修改雲助手定時任務的執行資訊,包括命令內容、定時執行方式、添加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 |
否 |
待修改後的命令內容。命令內容可以是明文內容或 Base 64 編碼後的內容。您需要注意:
|
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. |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。