修改雲端助手排程任務的執行資訊,包括命令內容、定時執行方式、新增 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**** |
|
| 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. | 指定的參數 ClientToken 格式不符合規範要求,該參數應該只包括 ASCII 字元,且長度不應該超過 64 個字元。 |
| 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. | 地域資訊錯誤。 |
| 404 | InvalidCommandId.NotFound | The specified CommandId does not exist. |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。