Modifies the execution information of a Cloud Assistant scheduled task, including the command content, scheduled execution method, and adding ECS instances or managed instances to the task.
Operation description
- You can modify tasks with the following execution modes (see the
RepeatModevalue returned by DescribeInvocations):Period: periodic execution.
NextRebootOnly: automatically executes the command the next time the instance starts.
EveryReboot: automatically executes the command every time the instance starts.
- You can modify tasks in the following states (see the
InvocationStatusvalue returned by DescribeInvocations):Pending: The system is verifying or sending the command. If the command execution state on at least one instance is Pending, the overall execution state is Pending.
Running: The command is running on the instance. If the command execution state on at least one instance is Running, the overall execution state is Running.
Scheduled: The scheduled command has been sent and is waiting to run. If the command execution state on at least one instance is Scheduled, the overall execution state is Scheduled.
Stopping: The task is being stopped. If the command execution state on at least one instance is Stopping, the overall execution state is Stopping.
- Before modifying scheduled task execution information (including command content, custom parameters, and execution frequency), the Cloud Assistant Agent version on the ECS instances or managed instances that have already executed the task must be later than the following versions:
Linux: 2.2.3.541
Windows: 2.1.3.541
If the call result returns the
InvalidOperation.CloudAssistantVersionUnsupportederror code, update the Cloud Assistant Agent to the latest version.
When you execute a Cloud Assistant common command, you cannot modify the command content
CommandContent.When you modify the command content
CommandContent, and the task was created by calling InvokeCommand or RunCommand withKeepCommandset totrue, a new command is created for long-term retention, which counts toward your Cloud Assistant command quota. You can retain up to 500 to 50,000 Cloud Assistant commands in a region. You can also request a quota increase. For information about how to query and increase quotas, see Quota management.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:ModifyInvocationAttribute |
update |
*Invocation
Instance
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID. |
cn-hangzhou |
| InstanceId |
array |
No |
The instance ID of the ECS instance or managed instance to add to the task. |
|
|
string |
No |
The instance ID of the ECS instance or managed instance to add to the task. The total number of instances to add and instances that have already executed the task cannot exceed 100. |
i-bp1i7gg30r52z2em**** |
|
| InvokeId |
string |
Yes |
The command execution ID of the task to modify. |
t-hz0jdfwd9f**** |
| CommandContent |
string |
No |
The modified command content. The command content can be plaintext or Base64-encoded. Note the following items:
|
ZWNobyAxMjM= |
| EnableParameter |
boolean |
No |
Specifies whether the modified command contains custom parameters.
|
false |
| Parameters |
object |
No |
The key-value pairs of custom parameters to modify when the command contains custom parameters. The number of custom parameters ranges from 0 to 10. Note the following items:
Default value: empty, which indicates that no custom parameter key-value pairs are modified. |
{"name":"Jack", "accessKey":"LTAI*************"} |
| Frequency |
string |
No |
The modified scheduled execution frequency. This parameter takes effect only when
|
0 */20 * * * * |
| ContentEncoding |
string |
No |
The encoding method of the command content (
Default value: PlainText. If an invalid value is specified, it is treated as PlainText. |
PlainText |
| ClientToken |
string |
No |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but make sure that the token is unique among different requests. The ClientToken value can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence. |
123e4567-e89b-12d3-a456-426655440000 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** |
| CommandId |
string |
The command ID.
|
c-hz01272yr52**** |
Examples
Success response
JSON format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
"CommandId": "c-hz01272yr52****"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParameter.Frequency | The specified parameter Frequency is not valid. | The specified parameter Frequency is illegal. |
| 400 | InvalidParameters.KeyDuplicate | The key in the parameter Parameters cannot be duplicated. | Keys in parameter Parameters cannot be duplicated. |
| 400 | InvalidParameters.KeyNotMatch | The key in the parameter Parameters do not match those defined when creating the command. | The key in the parameter Parameters does not match the one defined when the command was created. |
| 400 | InvalidParameters.KeyMalformed | The key in the parameter Parameters is not valid. | A key in the Parameters parameter is invalid. |
| 400 | InvalidParameters.KeyEmpty | The key in the parameter Parameters cannot be empty. | The key in the parameter Parameters cannot be empty. |
| 400 | InvalidCommandContent.DecodeError | The specified parameter CommandContent can not be Base64 decoded. | Parameter CommandContent cannot be Base64 decoded. |
| 400 | InvalidClientToken.Malformed | The specified parameter clientToken is not valid. | The specified ClientToken parameter does not meet the format requirements. The parameter must contain only ASCII characters and cannot exceed 64 characters in length. |
| 500 | InternalError | An error occurred when you dispatched the request. | An error occurred while sending the request, please try again later. |
| 403 | InvalidInstanceId.OSTypeUnsupported | The OS type of the instance corresponding to the parameter InstanceId does not support the specified command type. | The operating system type of the instance specified by InstanceId does not support this operation. |
| 403 | InvalidOperation.RepeatModeUnsupported | The operation is not supported for current repeat mode of invocation. | The current command execution method does not support this operation. |
| 403 | InvalidOperation.InvokeAlreadyFinished | The operation is not supported for finished invocation. | The operation is not supported for completed tasks. |
| 403 | InvalidOperation.CloudAssistantVersionUnsupported | The operation is not supported for current CloudAssistant version of instance. | The Cloud Assistant version on the current instance does not support this operation. |
| 403 | InvalidOperation.ModifyPublicCommandUnsupported | Modification of the content of Public Command is not supported. | Modifying the contents of public commands is not supported. |
| 403 | InvalidCommandContent.LengthLimitExceeded | The length of the parameter CommandContent exceeds the limit of %s KB characters. | |
| 403 | Operation.Forbidden | The operation is not permitted. | The operation is not supported. |
| 403 | InvalidParameters.CountLimitExceeded | The count of the parameter Parameters exceeds the limit of 10. | The number of parameter Parameters exceeds the limit of 10. |
| 403 | InvalidParameters.KeyLengthLimitExceeded | The length of the key in the parameter Parameters exceeds the limit of 64 characters. | The length of a key in the Parameters parameter exceeds the limit of 64 characters. |
| 403 | InvalidInstanceId.CountLimitExceeded | The count of the parameter InstanceId exceeds the limit of %s. | |
| 403 | CommandLimitExceeded | The count of command in current region exceeds the limit of %s. | |
| 403 | InvalidParameters.ValueTypeUnsupported | The type of the value in the parameter Parameters is not supported. | The type of the value Parameters the parameter is not supported. |
| 403 | IdempotentParameterMismatch | The specified parameter has changed while using an already used clientToken. | The specified client token has already been used. |
| 403 | IdempotentProcessing | The previous idempotent request(s) is still processing. | A previous idempotent request is being processed. Try again later. |
| 404 | InvalidInvokeId.NotFound | The specified parameter InvokeId does not exist. | The specified command execution ID does not exist. |
| 404 | InvalidInstanceId.NotFound | The specified parameter InstanceId does not exist. | The specified instance ID does not exist. |
| 404 | InvalidRegionId.NotFound | The specified parameter RegionId does not exist. | The region information is invalid. |
| 404 | InvalidCommandId.NotFound | The specified CommandId does not exist. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.