Modifies the parameters and content of a Cloud Assistant command.
Description
You can modify a command when it is run. After the command is modified, the new command content applies to subsequent executions.
You cannot modify the command type. For example, you cannot change a shell command (RunShellScript) to a batch command (RunBatScript).
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ModifyCommand |
The operation that you want to perform. Set the value to ModifyCommand. |
RegionId | String | Yes | cn-hangzhou |
The region ID of the command. You can call the DescribeRegions operation to query the most recent region list. |
CommandId | String | Yes | c-hz01272yr52**** |
The ID of the command. You can call the DescribeCommands operation to query all available command IDs. |
Name | String | No | test-CommandName |
The name of the command. The name supports all character sets and can be up to 128 characters in length. |
Description | String | No | This is description. |
The description of the command. The description supports all character sets and can be up to 512 characters in length. |
CommandContent | String | No | echo |
The content of the command. The command content can be plaintext or Base64-encoded. Take note of the following items:
|
WorkingDir | String | No | /home/ |
The working directory of the command on the ECS instance. |
Timeout | Long | No | 120 |
The maximum timeout period for command execution. Unit: seconds. When a command cannot run within the specified time range, the command times out. When a command execution times out, the Cloud Assistant client forcefully terminates the command process by canceling the process ID (PID) of the command. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 0DE9B41E-EF0D-40A0-BB43-37749C5BDA9C |
The ID of the request. |
Examples
Sample requests
https://ecs.aliyuncs.com/?Action=ModifyCommand
&CommandId=c-hz01272yr52****
&RegionId=cn-hangzhou
&Name=test-CommandName
&Description=This is description.
&CommandContent=c2VydmljZSB0b21jYXQgc3RhcnQ=
&WorkingDir=/home/
&Timeout=120
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<ModifyCommandResponse>
<RequestId>0DE9B41E-EF0D-40A0-BB43-37749C5BDA9C</RequestId>
</ModifyCommandResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "0DE9B41E-EF0D-40A0-BB43-37749C5BDA9C"
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | RegionId.ApiNotSupported | The api is not supported in this region. | The error message returned because the API operation cannot be called in the specified region. Check whether the RegionId parameter is valid. |
403 | CmdName.Readonly | The command name is readonly after publishing. | The error message returned because the command is published and cannot have its name changed. |
403 | CmdName.ExceedLimit | The length of the command name exceeds the upper limit. | The error message returned because the command name exceeds 128 characters in length. |
403 | CmdContent.ExceedLimit | The length of the command content exceeds the upper limit. | The error message returned because the length of the command content exceeds the upper limit. |
403 | CmdDesc.ExceedLimit | The length of the command description exceeds the upperlimit. | The error message returned because the command description exceeds 512 characters in length. |
403 | Operation.Forbidden | The operation is not permitted. | The error message returned because the operation is not supported. |
404 | InvalidCmdId.NotFound | The specified command ID does not exist. | The error message returned because the specified CommandId parameter is invalid. You can call the DescribeCommands operation to query all available command IDs. |
500 | InternalError.Dispatch | An error occurred when you dispatched the request. | The error message returned because an error occurred when the request was being sent. Try again later. |
For a list of error codes, visit the API Error Center.