RunCommand
- Implements: IRunCommand
This class encapsulates and extends the ROS resource type ALIYUN::SWAS::RunCommand.
Initializers
import ros_cdk_swas
ros_cdk_swas.RunCommand(
scope: Construct,
id: str,
command_content: typing.Union[str, IResolvable],
instance_id: typing.Union[str, IResolvable],
name: typing.Union[str, IResolvable],
type: typing.Union[str, IResolvable],
content_encoding: typing.Union[str, IResolvable] = None,
enable_parameter: typing.Union[bool, IResolvable] = None,
parameters: typing.Union[IResolvable, typing.Mapping[typing.Any]] = None,
sync: typing.Union[bool, IResolvable] = None,
timeout: typing.Union[typing.Union[int, float], IResolvable] = None,
windows_password_name: typing.Union[str, IResolvable] = None,
working_dir: typing.Union[str, IResolvable] = None,
working_user: typing.Union[str, IResolvable] = None,
enable_resource_property_constraint: bool = None
)
| Name | Type | Description |
|---|---|---|
scope | ros_cdk_core.Construct | No description. |
id | str | No description. |
command_content | typing.Union[str, ros_cdk_core.IResolvable] | Property commandContent: The content of the command. |
instance_id | typing.Union[str, ros_cdk_core.IResolvable] | Property instanceId: The ID of the SWAS instance on which to run the command. |
name | typing.Union[str, ros_cdk_core.IResolvable] | Property name: The name of the command to run. |
type | typing.Union[str, ros_cdk_core.IResolvable] | Property type: The language type of the O&M script. |
content_encoding | typing.Union[str, ros_cdk_core.IResolvable] | Property contentEncoding: The encoding mode of command content (CommandContent). |
enable_parameter | typing.Union[bool, ros_cdk_core.IResolvable] | Property enableParameter: Specifies whether the command contains custom parameters. |
parameters | typing.Union[ros_cdk_core.IResolvable, typing.Mapping[typing.Any]] | Property parameters: The key-value pairs of custom parameters passed in when the command contains custom parameters. |
sync | typing.Union[bool, ros_cdk_core.IResolvable] | Property sync: Whether to run the command synchronously. |
timeout | typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] | Property timeout: The timeout period for command execution. |
windows_password_name | typing.Union[str, ros_cdk_core.IResolvable] | Property windowsPasswordName: The name of the password to use to run the command on Windows instances. |
working_dir | typing.Union[str, ros_cdk_core.IResolvable] | Property workingDir: The execution path of the command. |
working_user | typing.Union[str, ros_cdk_core.IResolvable] | Property workingUser: The user with which to run the command on the instance. |
enable_resource_property_constraint | bool | No description. |
scopeRequired
- Type: ros_cdk_core.Construct
idRequired
- Type: str
command_contentRequired
- Type: typing.Union[str, 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.
instance_idRequired
- Type: typing.Union[str, 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: typing.Union[str, ros_cdk_core.IResolvable]
Property name: The name of the command to run.
typeRequired
- Type: typing.Union[str, 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
content_encodingOptional
- Type: typing.Union[str, 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.
enable_parameterOptional
- Type: typing.Union[bool, ros_cdk_core.IResolvable]
Property enableParameter: Specifies whether the command contains custom parameters.
Default value: false
parametersOptional
- Type: typing.Union[ros_cdk_core.IResolvable, typing.Mapping[typing.Any]]
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: typing.Union[bool, ros_cdk_core.IResolvable]
Property sync: Whether to run the command synchronously.
timeoutOptional
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
Property timeout: The timeout period for command execution.
Unit: seconds. Valid values: 10 to 86400. Default value: 60.
windows_password_nameOptional
- Type: typing.Union[str, 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.
working_dirOptional
- Type: typing.Union[str, 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.
working_userOptional
- Type: typing.Union[str, 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.
enable_resource_property_constraintOptional
- Type: bool
Methods
| Name | Description |
|---|---|
to_string | Returns a string representation of this construct. |
synthesize | Allows this construct to emit artifacts into the cloud assembly during synthesis. |
add_condition | No description. |
add_count | No description. |
add_dependency | No description. |
add_resource_desc | No description. |
apply_removal_policy | No description. |
fetch_condition | No description. |
fetch_dependency | No description. |
fetch_resource_desc | No description. |
get_att | No description. |
set_metadata | No description. |
to_string
def to_string() -> str
Returns a string representation of this construct.
synthesize
def synthesize(
session: ISynthesisSession
) -> None
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: ros_cdk_core.ISynthesisSession
The synthesis session.
add_condition
def add_condition(
condition: RosCondition
) -> None
- Type: ros_cdk_core.RosCondition
add_count
def add_count(
count: typing.Union[typing.Union[int, float], IResolvable]
) -> None
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
add_dependency
def add_dependency(
resource: Resource
) -> None
- Type: ros_cdk_core.Resource
add_resource_desc
def add_resource_desc(
desc: str
) -> None
- Type: str
apply_removal_policy
def apply_removal_policy(
policy: RemovalPolicy
) -> None
- Type: ros_cdk_core.RemovalPolicy
fetch_condition
def fetch_condition() -> RosCondition
fetch_dependency
def fetch_dependency() -> typing.List[str]
fetch_resource_desc
def fetch_resource_desc() -> str
get_att
def get_att(
name: str
) -> IResolvable
- Type: str
set_metadata
def set_metadata(
key: str,
value: typing.Any
) -> None
- Type: str
- Type: typing.Any
Static Functions
| Name | Description |
|---|---|
is_construct | Return whether the given object is a Construct. |
is_construct
import ros_cdk_swas
ros_cdk_swas.RunCommand.is_construct(
x: typing.Any
)
Return whether the given object is a Construct.
- Type: typing.Any
Properties
| Name | Type | Description |
|---|---|---|
node | ros_cdk_core.ConstructNode | The construct tree node associated with this construct. |
env | ros_cdk_core.IResourceEnvironment | The environment this resource belongs to. |
ref | str | No description. |
stack | ros_cdk_core.Stack | The stack in which this resource is defined. |
resource | ros_cdk_core.RosResource | No description. |
attr_invoke_id | typing.Union[str, ros_cdk_core.IResolvable] | Attribute InvokeId: The ID of the command execution. |
attr_invoke_result | typing.Union[str, ros_cdk_core.IResolvable] | Attribute InvokeResult: The result of the command execution. |
props | RunCommandProps | No description. |
nodeRequired
node: ConstructNode
- Type: ros_cdk_core.ConstructNode
The construct tree node associated with this construct.
envRequired
env: IResourceEnvironment
- Type: 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
ref: str
- Type: str
stackRequired
stack: Stack
- Type: ros_cdk_core.Stack
The stack in which this resource is defined.
resourceOptional
resource: RosResource
- Type: ros_cdk_core.RosResource
attr_invoke_idRequired
attr_invoke_id: typing.Union[str, IResolvable]
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Attribute InvokeId: The ID of the command execution.
attr_invoke_resultRequired
attr_invoke_result: typing.Union[str, IResolvable]
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Attribute InvokeResult: The result of the command execution.
propsRequired
props: RunCommandProps
- Type: RunCommandProps