修改云助手定时任务的执行信息,包括命令内容、定时执行方式、添加ECS实例或托管实例到任务。
接口说明
- 支持修改以下执行方式的任务(参见 DescribeInvocations 返回的
RepeatMode值):Period:周期执行。
NextRebootOnly:当实例下一次启动时,自动执行命令。
EveryReboot:实例每一次启动都将自动执行命令。
- 支持修改以下状态的任务(参见 DescribeInvocations 返回的
InvocationStatus值):Pending:系统正在校验或发送命令。存在至少一台实例的命令执行状态为 Pending,则总执行状态为 Pending。
Running:命令正在实例上运行。存在至少一台实例的命令执行状态为 Running,则总执行状态为 Running。
Scheduled:定时执行的命令已发送,等待运行。存在至少一台实例的命令执行状态为 Scheduled,则总执行状态为 Scheduled。
Stopping:正在停止任务。存在至少一台实例的命令执行状态为 Stopping,则总执行状态为 Stopping。
- 修改定时任务执行信息(包括命令内容、自定义参数、执行频率)前,已执行的 ECS 实例或托管实例的云助手 Agent 版本需要高于以下对应的版本。
Linux:2.2.3.541
Windows:2.1.3.541
如果调用结果返回
InvalidOperation.CloudAssistantVersionUnsupported错误码,请将云助手 Agent 更新至最新版本。
当您执行一个云助手公共命令时,无法修改命令内容
CommandContent。当您修改了命令内容
CommandContent,且调用 InvokeCommand 或调用 RunCommand 时设置KeepCommand为true创建任务,将会新增一条命令并长期保留,并占用云助手命令配额;在一个地域下,您最多可以保有 500~50,000 条云助手命令。您也可以申请提升配额,关于如何查询及提升配额,请参见配额管理。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
ecs:ModifyInvocationAttribute |
update |
*Invocation
Instance
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| RegionId |
string |
是 |
地域 ID。 |
cn-hangzhou |
| InstanceId |
array |
否 |
待加入任务的 ECS 实例 ID 或托管实例 ID。 |
|
|
string |
否 |
待加入任务的 ECS 实例 ID 或托管实例 ID。待加入的实例数量与已执行的实例数量总和不得超过 100。 |
i-bp1i7gg30r52z2em**** |
|
| RegionId |
string |
是 |
地域 ID。 |
cn-hangzhou |
| InvokeId |
string |
是 |
待修改任务的命令执行 ID。 |
t-hz0jdfwd9f**** |
| CommandContent |
string |
否 |
待修改后的命令内容。命令内容可以是明文内容或 Base64 编码后的内容。您需要注意:
|
ZWNobyAxMjM= |
| EnableParameter |
boolean |
否 |
修改命令中是否包含自定义参数。
|
false |
| Parameters |
object |
否 |
命令中包含自定义参数时,修改执行命令时传入的自定义参数的键值对。 自定义参数的个数范围为 0~10,且您需要注意:
默认值为空,表示不涉及自定义参数键值对的修改。 |
{"name":"Jack", "accessKey":"LTAI*************"} |
| Frequency |
string |
否 |
待修改的定时执行频率。仅当
|
0 */20 * * * * |
| ContentEncoding |
string |
否 |
命令内容(
默认值:PlainText,填写错误时会当作 PlainText 处理。 |
PlainText |
| ClientToken |
string |
否 |
保证请求幂等性。从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken 只支持 ASCII 字符,且不能超过 64 个字符。更多信息,请参见如何保证幂等性。 |
123e4567-e89b-12d3-a456-426655440000 |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| RequestId |
string |
请求 ID。 |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** |
| CommandId |
string |
命令 ID。
|
c-hz01272yr52**** |
示例
正常返回示例
JSON格式
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
"CommandId": "c-hz01272yr52****"
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InvalidParameter.Frequency | The specified parameter Frequency is not valid. | 指定的参数Frequency不合法。 |
| 400 | InvalidParameters.KeyDuplicate | The key in the parameter Parameters cannot be duplicated. | 参数Parameters中的键不能重复。 |
| 400 | InvalidParameters.KeyNotMatch | The key in the parameter Parameters do not match those defined when creating the command. | 参数Parameters中的键与创建命令时定义的不匹配。 |
| 400 | InvalidParameters.KeyMalformed | The key in the parameter Parameters is not valid. | 参数Parameters中的键不合法。 |
| 400 | InvalidParameters.KeyEmpty | The key in the parameter Parameters cannot be empty. | 参数Parameters中的键不能为空。 |
| 400 | InvalidCommandContent.DecodeError | The specified parameter CommandContent can not be Base64 decoded. | 参数CommandContent无法通过Base64解码。 |
| 400 | InvalidClientToken.Malformed | The specified parameter clientToken is not valid. | 指定的幂等参数不合法。 |
| 500 | InternalError | An error occurred when you dispatched the request. | 发送请求时发生错误,请稍后重试。 |
| 403 | InvalidInstanceId.OSTypeUnsupported | The OS type of the instance corresponding to the parameter InstanceId does not support the specified command type. | 参数InstanceId对应实例的操作系统类型不支持指定的命令类型。 |
| 403 | InvalidOperation.RepeatModeUnsupported | The operation is not supported for current repeat mode of invocation. | 当前命令执行的方式不支持该操作。 |
| 403 | InvalidOperation.InvokeAlreadyFinished | The operation is not supported for finished invocation. | 已执行完成的任务不支持该操作。 |
| 403 | InvalidOperation.CloudAssistantVersionUnsupported | The operation is not supported for current CloudAssistant version of instance. | 当前实例的云助手版本不支持该操作。 |
| 403 | InvalidOperation.ModifyPublicCommandUnsupported | Modification of the content of Public Command 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. | 该操作是不被允许的。 |
| 403 | InvalidParameters.CountLimitExceeded | The count of the parameter Parameters exceeds the limit of 10. | 参数Parameters的数量超过了10的限制。 |
| 403 | InvalidParameters.KeyLengthLimitExceeded | The length of the key in the parameter Parameters exceeds the limit of 64 characters. | 参数Parameters中键的长度超过了64个字符的限制。 |
| 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. | 不支持参数Parameters中值的类型。 |
| 403 | IdempotentParameterMismatch | The specified parameter has changed while using an already used clientToken. | 指定的客户令牌已经被使用。 |
| 403 | IdempotentProcessing | The previous idempotent request(s) is still processing. | 先前的幂等请求仍在处理中,请稍后重试。 |
| 404 | InvalidInvokeId.NotFound | The specified parameter InvokeId does not exist. | 指定的命令执行ID不存在。 |
| 404 | InvalidInstanceId.NotFound | The specified parameter InstanceId does not exist. | 指定的实例ID不存在。 |
| 404 | InvalidRegionId.NotFound | The specified parameter RegionId does not exist. | 指定的地域ID不存在。 |
| 404 | InvalidCommandId.NotFound | The specified CommandId does not exist. |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。