RunCommand
- Implements: IRunCommand
This class encapsulates and extends the ROS resource type ALIYUN::SWAS::RunCommand.
Initializers
import com.aliyun.ros.cdk.swas.RunCommand;
RunCommand.Builder.create(Construct scope, java.lang.String id, java.lang.Boolean enableResourcePropertyConstraint)
.commandContent(java.lang.String)
.commandContent(IResolvable)
.instanceId(java.lang.String)
.instanceId(IResolvable)
.name(java.lang.String)
.name(IResolvable)
.type(java.lang.String)
.type(IResolvable)
// .contentEncoding(java.lang.String)
// .contentEncoding(IResolvable)
// .enableParameter(java.lang.Boolean)
// .enableParameter(IResolvable)
// .parameters(IResolvable)
// .parameters(java.util.Map<java.lang.String, java.lang.Object>)
// .sync(java.lang.Boolean)
// .sync(IResolvable)
// .timeout(java.lang.Number)
// .timeout(IResolvable)
// .windowsPasswordName(java.lang.String)
// .windowsPasswordName(IResolvable)
// .workingDir(java.lang.String)
// .workingDir(IResolvable)
// .workingUser(java.lang.String)
// .workingUser(IResolvable)
.build();
| Name | Type | Description |
|---|---|---|
scope | com.aliyun.ros.cdk.core.Construct | No description. |
id | java.lang.String | No description. |
enableResourcePropertyConstraint | java.lang.Boolean | No description. |
commandContent | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property commandContent: The content of the command. |
instanceId | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property instanceId: The ID of the SWAS instance on which to run the command. |
name | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property name: The name of the command to run. |
type | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property type: The language type of the O&M script. |
contentEncoding | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property contentEncoding: The encoding mode of command content (CommandContent). |
enableParameter | java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable | Property enableParameter: Specifies whether the command contains custom parameters. |
parameters | com.aliyun.ros.cdk.core.IResolvable OR java.util.Map | Property parameters: The key-value pairs of custom parameters passed in when the command contains custom parameters. |
sync | java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable | Property sync: Whether to run the command synchronously. |
timeout | java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable | Property timeout: The timeout period for command execution. |
windowsPasswordName | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property windowsPasswordName: The name of the password to use to run the command on Windows instances. |
workingDir | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property workingDir: The execution path of the command. |
workingUser | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property workingUser: The user with which to run the command on the instance. |
scopeRequired
- Type: com.aliyun.ros.cdk.core.Construct
idRequired
- Type: java.lang.String
enableResourcePropertyConstraintOptional
- Type: java.lang.Boolean
commandContentRequired
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property commandContent: The content of the command.
Take note of the following items:
- If you set
EnableParameterto true, the custom parameter feature is enabled in the command content and you can configure custom parameters based on the following rules: - Define custom parameters in the {{}} format. Within
{{}}, the spaces and line feeds before and after the parameter names are ignored. - The number of custom parameters cannot be greater than 20.
- A custom parameter name can contain only letters, digits, underscores (_), and hyphens (-). The name is case-insensitive.
- Each custom parameter name cannot exceed 64 bytes in length.
instanceIdRequired
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property instanceId: The ID of the SWAS instance on which to run the command.
The instance must be in 'Running' status.
nameRequired
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property name: The name of the command to run.
typeRequired
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property type: The language type of the O&M script.
Valid values: RunShellScript: shell scripts for Linux instances RunBatScript: batch scripts for Windows instances RunPowerShellScript: PowerShell scripts for Windows instances
contentEncodingOptional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property contentEncoding: The encoding mode of command content (CommandContent).
Valid values (case insensitive): PlainText: The command content is not encoded, and transmitted in plaintext. Base64: base64-encoded. Default value: PlainText. If the specified value of this parameter is invalid, PlainText is used by default.
enableParameterOptional
- Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable
Property enableParameter: Specifies whether the command contains custom parameters.
Default value: false
parametersOptional
- Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.Map
Property parameters: The key-value pairs of custom parameters passed in when the command contains custom parameters.
Number of custom parameters: 0 to 20. The key cannot be an empty string. It can be up to 64 characters in length. The value can be an empty string. After the custom parameters and the original command content are Base64 encoded, the total size cannot exceed 16 KB. The set of custom parameter names must be a subset of the parameter set that is defined when you created the command. You can use an empty string to represent the parameters that are not passed in. Default value: null, indicating that this parameter is canceled and customer parameters are disabled.
syncOptional
- Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable
Property sync: Whether to run the command synchronously.
timeoutOptional
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
Property timeout: The timeout period for command execution.
Unit: seconds. Valid values: 10 to 86400. Default value: 60.
windowsPasswordNameOptional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property windowsPasswordName: The name of the password to use to run the command on Windows instances.
The name can be up to 255 characters in length. If you do not want to use the default System user to run the command on Windows instances, specify both WindowsPasswordName and WorkingUser. To mitigate the risk of password leaks, the password is stored in plaintext in Operation Orchestration Service (OOS) Parameter Store, and only the name of the password is passed in by using WindowsPasswordName.
workingDirOptional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property workingDir: The execution path of the command.
Custom paths are supported. Default execution paths vary based on the operating systems of the servers.
- For Linux servers, the default path is /root of the root user.
- For Windows servers, the default path is C:\Windows\system32.
workingUserOptional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property workingUser: The user with which to run the command on the instance.
Default value: 'root' for Linux instances, 'system' for Windows instances. You can specify other existing users to run the command to reduce security risks.
Methods
| Name | Description |
|---|---|
toString | Returns a string representation of this construct. |
synthesize | Allows this construct to emit artifacts into the cloud assembly during synthesis. |
addCondition | No description. |
addCount | No description. |
addDependency | No description. |
addResourceDesc | No description. |
applyRemovalPolicy | No description. |
fetchCondition | No description. |
fetchDependency | No description. |
fetchResourceDesc | No description. |
getAtt | No description. |
setMetadata | No description. |
toString
public java.lang.String toString()
Returns a string representation of this construct.
synthesize
public void synthesize(ISynthesisSession session)
Allows this construct to emit artifacts into the cloud assembly during synthesis.
This method is usually implemented by framework-level constructs such as Stack and Asset as they participate in synthesizing the cloud assembly.
- Type: com.aliyun.ros.cdk.core.ISynthesisSession
The synthesis session.
addCondition
public void addCondition(RosCondition condition)
- Type: com.aliyun.ros.cdk.core.RosCondition
addCount
public void addCount(java.lang.Number OR IResolvable count)
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
addDependency
public void addDependency(Resource resource)
- Type: com.aliyun.ros.cdk.core.Resource
addResourceDesc
public void addResourceDesc(java.lang.String desc)
- Type: java.lang.String
applyRemovalPolicy
public void applyRemovalPolicy(RemovalPolicy policy)
- Type: com.aliyun.ros.cdk.core.RemovalPolicy
fetchCondition
public RosCondition fetchCondition()
fetchDependency
public java.util.List<java.lang.String> fetchDependency()
fetchResourceDesc
public java.lang.String fetchResourceDesc()
getAtt
public IResolvable getAtt(java.lang.String name)
- Type: java.lang.String
setMetadata
public void setMetadata(java.lang.String key, java.lang.Object value)
- Type: java.lang.String
- Type: java.lang.Object
Static Functions
| Name | Description |
|---|---|
isConstruct | Return whether the given object is a Construct. |
isConstruct
import com.aliyun.ros.cdk.swas.RunCommand;
RunCommand.isConstruct(java.lang.Object x)
Return whether the given object is a Construct.
- Type: java.lang.Object
Properties
| Name | Type | Description |
|---|---|---|
node | com.aliyun.ros.cdk.core.ConstructNode | The construct tree node associated with this construct. |
env | com.aliyun.ros.cdk.core.IResourceEnvironment | The environment this resource belongs to. |
ref | java.lang.String | No description. |
stack | com.aliyun.ros.cdk.core.Stack | The stack in which this resource is defined. |
resource | com.aliyun.ros.cdk.core.RosResource | No description. |
attrInvokeId | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Attribute InvokeId: The ID of the command execution. |
attrInvokeResult | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Attribute InvokeResult: The result of the command execution. |
props | RunCommandProps | No description. |
nodeRequired
public ConstructNode getNode();
- Type: com.aliyun.ros.cdk.core.ConstructNode
The construct tree node associated with this construct.
envRequired
public IResourceEnvironment getEnv();
- Type: com.aliyun.ros.cdk.core.IResourceEnvironment
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
refRequired
public java.lang.String getRef();
- Type: java.lang.String
stackRequired
public Stack getStack();
- Type: com.aliyun.ros.cdk.core.Stack
The stack in which this resource is defined.
resourceOptional
public RosResource getResource();
- Type: com.aliyun.ros.cdk.core.RosResource
attrInvokeIdRequired
public java.lang.Object getAttrInvokeId();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Attribute InvokeId: The ID of the command execution.
attrInvokeResultRequired
public java.lang.Object getAttrInvokeResult();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Attribute InvokeResult: The result of the command execution.
propsRequired
public RunCommandProps getProps();
- Type: RunCommandProps