RunCommandOfLifespanProps
Properties for defining a RunCommandOfLifespan.
See https://www.alibabacloud.com/help/ros/developer-reference/aliyun-ecs-runcommandoflifespan
Initializer
import com.aliyun.ros.cdk.ecs.RunCommandOfLifespanProps;
RunCommandOfLifespanProps.builder()
.instanceIds(IResolvable)
.instanceIds(java.util.List<java.lang.String)
.instanceIds(IResolvable>)
.type(java.lang.String)
.type(IResolvable)
// .commandContent(java.lang.String)
// .commandContent(IResolvable)
// .commandContentOnDeletion(java.lang.String)
// .commandContentOnDeletion(IResolvable)
// .containerId(java.lang.String)
// .containerId(IResolvable)
// .containerName(java.lang.String)
// .containerName(IResolvable)
// .contentEncoding(java.lang.String)
// .contentEncoding(IResolvable)
// .description(java.lang.String)
// .description(IResolvable)
// .enableParameter(java.lang.Boolean)
// .enableParameter(IResolvable)
// .launcher(java.lang.String)
// .launcher(IResolvable)
// .name(java.lang.String)
// .name(IResolvable)
// .parameters(IResolvable)
// .parameters(java.util.Map<java.lang.String, java.lang.Object>)
// .resourceGroupId(java.lang.String)
// .resourceGroupId(IResolvable)
// .sync(java.lang.Boolean)
// .sync(IResolvable)
// .tags(java.util.List<TagsProperty>)
// .timeout(java.lang.Number)
// .timeout(IResolvable)
// .username(java.lang.String)
// .username(IResolvable)
// .windowsPasswordName(java.lang.String)
// .windowsPasswordName(IResolvable)
// .workingDir(java.lang.String)
// .workingDir(IResolvable)
.build();
Properties
| Name | Type | Description |
|---|---|---|
instanceIds | com.aliyun.ros.cdk.core.IResolvable OR java.util.List | Property instanceIds: The instance id list. |
type | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property type: The language type of the O&M script. |
commandContent | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property commandContent: When this resource is created, this content will be executed. |
commandContentOnDeletion | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property commandContentOnDeletion: When this resource is deleted, this content will be executed. |
containerId | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property containerId: The ID of the container. |
containerName | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property containerName: The name of the container. |
contentEncoding | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property contentEncoding: The encoding mode of script content (CommandContent). |
description | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property description: The description of the script, which supports all character sets. |
enableParameter | java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable | Property enableParameter: Specifies whether the script contains custom parameters. |
launcher | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property launcher: A bootloader for script execution. |
name | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property name: The name of the script, which supports all character sets. |
parameters | com.aliyun.ros.cdk.core.IResolvable OR java.util.Map | Property parameters: The key-value pairs of custom parameters passed in when the script contains custom parameters. |
resourceGroupId | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property resourceGroupId: The ID of the resource group to which to assign the command executions. |
sync | java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable | Property sync: Whether to invoke synchronously. |
tags | java.util.List<TagsProperty> | Property tags: Tags to attach to run_command. |
timeout | java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable | Property timeout: The timeout period for script execution. |
username | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property username: The username to use to run the command on instances. |
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 running directory of the script in the ECS instance. |
instanceIdsRequired
public java.lang.Object getInstanceIds();
- Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.List
Property instanceIds: The instance id list.
Instances status must be running.
typeRequired
public java.lang.Object getType();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property type: The language type of the O&M script.
Valid values: RunBatScript: batch scripts for Windows instances RunPowerShellScript: PowerShell scripts for Windows instances RunShellScript: shell scripts for Linux instances
commandContentOptional
public java.lang.Object getCommandContent();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property commandContent: When this resource is created, this content will be executed.
When this parameter changes, the new content will be executed. Either CommandContent or CommandContentOnDeletion must be specified. The plaintext content or the Base64-encoded content of the script. The Base64-encoded script content cannot exceed 16 KB. You can enable the custom parameter function by setting EnableParameter=true in the script content: Define custom parameters in the {{}} format. Within {{}}, the spaces and line breaks before and after the name of the parameter are ignored. The number of custom parameters cannot exceed 20. A custom parameter name can contain only letters, digits, underscores (_), and hyphens (-). It is case insensitive. Each custom parameter key cannot exceed 64 bytes.
commandContentOnDeletionOptional
public java.lang.Object getCommandContentOnDeletion();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property commandContentOnDeletion: When this resource is deleted, this content will be executed.
Either CommandContent or CommandContentOnDeletion must be specified. The plaintext content or the Base64-encoded content of the script. The Base64-encoded script content cannot exceed 16 KB. You can enable the custom parameter function by setting EnableParameter=true in the script content: Define custom parameters in the {{}} format. Within {{}}, the spaces and line breaks before and after the name of the parameter are ignored. The number of custom parameters cannot exceed 20. A custom parameter name can contain only letters, digits, underscores (_), and hyphens (-). It is case insensitive. Each custom parameter key cannot exceed 64 bytes.
containerIdOptional
public java.lang.Object getContainerId();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property containerId: The ID of the container.
Only 64-bit hexadecimal strings are supported. You can use container IDs that are prefixed with docker://, containerd://, or cri-o:// to specify container runtimes. Take note of the following items:
- If you specify this parameter, Cloud Assistant runs scripts in the specified container of the instance.
- If you specify this parameter, make sure that the version of Cloud Assistant Agent installed on Linux instances is 2.2.3.344 or later.- If you specify this parameter, Username that is specified in a request to call this operation and WorkingDir that is specified in a request to call the CreateCommand operation do not take effect. You can run the command only in the default working directory of the container by using the default user of the container.
- If you specify this parameter, only shell scripts can be run in Linux containers. You cannot add a command in the format similar to #!/usr/bin/python at the beginning of a script to specify a script interpreter.
containerNameOptional
public java.lang.Object getContainerName();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property containerName: The name of the container.
Take note of the following items:
- If you specify this parameter, Cloud Assistant runs scripts in the specified container of the instance.
- If you specify this parameter, make sure that the version of Cloud Assistant Agent installed on Linux instances is 2.2.3.344 or later.
- If you specify this parameter, Username that is specified in a request to call this operation and WorkingDir that is specified in a request to call the CreateCommand operation do not take effect. You can run the command only in the default working directory of the container by using the default user of the container.
- If you specify this parameter, only shell scripts can be run in Linux containers. You cannot add a command in the format similar to #!/usr/bin/python at the beginning of a script to specify a script interpreter.
contentEncodingOptional
public java.lang.Object getContentEncoding();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property contentEncoding: The encoding mode of script content (CommandContent).
Valid values (case insensitive): PlainText: The script 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.
descriptionOptional
public java.lang.Object getDescription();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property description: The description of the script, which supports all character sets.
It can be up to 512 characters in length.
enableParameterOptional
public java.lang.Object getEnableParameter();
- Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable
Property enableParameter: Specifies whether the script contains custom parameters.
Default value: false
launcherOptional
public java.lang.Object getLauncher();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property launcher: A bootloader for script execution.
The length cannot exceed 1 KB.
nameOptional
public java.lang.Object getName();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property name: The name of the script, which supports all character sets.
It can be up to 128 characters in length.
parametersOptional
public java.lang.Object getParameters();
- Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.Map
Property parameters: The key-value pairs of custom parameters passed in when the script contains custom parameters.
Number of custom parameters: 0 to 10. 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 script 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 script. 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.
resourceGroupIdOptional
public java.lang.Object getResourceGroupId();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property resourceGroupId: The ID of the resource group to which to assign the command executions.
The instances specified by InstanceIds must belong to the specified resource group.
syncOptional
public java.lang.Object getSync();
- Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable
Property sync: Whether to invoke synchronously.
tagsOptional
public java.util.List<TagsProperty> getTags();
- Type: java.util.List<TagsProperty>
Property tags: Tags to attach to run_command.
Max support 20 tags to add during create run_command. Each tag with two properties Key and Value, and Key is required.
timeoutOptional
public java.lang.Object getTimeout();
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
Property timeout: The timeout period for script execution.
Unit: seconds. A timeout error occurs when a script cannot be run because the process slows down, a specific module or the Cloud Assistant client does not exist. When the script times out, the script process is forcibly terminated. Default value: 60.
usernameOptional
public java.lang.Object getUsername();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property username: The username to use to run the command on instances.
The username can be up to 255 characters in length.
- For Linux instances, the root username is used by default.
- For Windows instances, the System username is used by default. You can also specify other usernames that already exist in the instances to run the command. For security purposes, we recommend that you run Cloud Assistant commands as a regular user.
windowsPasswordNameOptional
public java.lang.Object getWindowsPasswordName();
- 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 Username. 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
public java.lang.Object getWorkingDir();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property workingDir: The running directory of the script in the ECS instance.
Default value: Linux instances: under the home directory of the administrator (root user): /root. Windows instances: under the directory where the process of the Cloud Assistant client is located, such as C:\ProgramData\aliyun\assist$(version).