You can call this operation to update an existing template.
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateTemplate | The operation that you want to perform. Set this parameter to UpdateTemplate. |
TemplateName | String | Yes | MyTemplate | The name of the template. The template name can be up to 200 characters in length. The name can contain letters, digits, hyphens (-), and underscores (_). It cannot start with ALIYUN, ACS, ALIBABA, or ALICLOUD. |
Content | String | Yes | {“FormatVersion”: “OOS-2019-06-01”, “Description”: “Describe instances of given status”, “Parameters”: {“Status”: {“Type”: “String”, “Description”: “(Required) The status of the Ecs instance.”}}, “Tasks”: [{“Properties”: {“Parameters”: {“Status”: “{{ Status }}”}, “API”: “DescribeInstances”, “Service”: “Ecs”}, “Name”: “foo”, “Action”: “ACS::ExecuteApi”}]} | The content of the template. The content must be in JSON or YAML format. Length constraint: Maximum length of 64 KB. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 14A07460-EBE7-47CA-9757-12CC4761D47A | The ID of the request. |
Template | The metadata of the template. | ||
└ CreatedBy | String | root(130920000) | The creator of the template. |
└ CreatedDate | String | 2019-05-16T10:26:14Z | The time when the template is created. |
└ UpdatedBy | String | root(1309000) | The user who updates the template. |
└ UpdatedDate | String | 2019-05-16T10:26:14Z | The time when the template is updated. |
└ Description | String | Describe instances of given status | The description of the template. |
└ Hash | String | 4bc7d7a21b3e003434b9c223f6e6d2578b5ebfeb5be28c1fcf8a8a1b11907bb4 | The SHA256 hash of the template content. |
└ ShareType | String | Private | The sharing type of the template. The sharing type of templates created by users is set to Private. |
└ TemplateFormat | String | JSON | The format of the template. The format can be JSON or YAML. The system automatically identifies the format. |
└ TemplateName | String | MyTemplate | The name of the template. |
└ TemplateId | String | t-94753deed38 | The ID of the template. |
└ TemplateVersion | String | v2 | The version of the template. The format is the letter v and a number. The number starts from 1. |
Examples
Sample request
https://oos.cn-hangzhou.aliyuncs.com/?Action=UpdateTemplate
&TemplateName=MyTemplate
&Content=%7B%22FormatVersion%22%3A+%22OOS-2019-06-01%22%2C+%22Description%22%3A+%22Descirbe+instances+of+given+status%22%2C+%22Parameters%22%3A+%7B%22Status%22%3A+%7B%22Type%22%3A+%22String%22%2C+%22Description%22%3A+%22%28Required%29+The+status+of+the+Ecs+instance.%22%7D%7D%2C+%22Tasks%22%3A+%5B%7B%22Properties%22%3A+%7B%22Parameters%22%3A+%7B%22Status%22%3A+%22%7B%7B+Status+%7D%7D%22%7D%2C+%22API%22%3A+%22DescribeInstances%22%2C+%22Service%22%3A+%22ECS%22%7D%2C+%22Name%22%3A+%22describeInstances%22%2C+%22Action%22%3A+%22ACS%3A%3AExecuteAPI%22%7D%5D%7D
&<Common request parameters>
Sample success response JSON
format
{
"RequestId": "2075899A-585D-4A41-A9B2-28DF4F534F",
"Template": {
"CreatedBy": "root(13090000)",
"CreatedDate": "2019-05-27T08:46:33Z",
"UpdatedBy": "root(13090000)",
"UpdatedDate": "2019-05-27T08:46:33Z",
"Description": "Descirbe instances of given status",
"Hash": "4bc7d7a21b3e003434b9c223f6e6d2578b5ebfeb5be28c1fcf8a8a1b11907bb4",
"ShareType": "Private",
"TemplateFormat": "JSON",
"TemplateName": "MyTemplate",
"TemplateId": "t-94753de38",
"TemplateVersion": "v2"
}
}
Error codes
Error code | HTTP status code | Error message | Description |
---|---|---|---|
InvalidVersion | 400 | Specified parameter Version is not valid. | The error message returned because the specified version is invalid. Specify a valid version in the URL and try again. |
InvalidAction.NotFound | 400 | Specified api is not found, please check your url and method. | The error message returned because the specified operation does not exist. Enter the correct Action in the URL. |
Throttling.User | 400 | Request was denied due to user flow control. | The error message returned because too many requests have been sent over a short period of time. Try again later. |
User.NoPermission | 401 | User has no permission to do the action: ({api_name}) | The error message returned because the user does not have the permission to call this operation. Check whether the current user has the permission to call the OOS API in the RAM console. |
InvalidStsToken | 400 | Invalid STS token to do the action: ({api_name}) | The error message returned because the specified STS token is invalid. |
ExpiredStsToken | 400 | Expired STS token to do the action: ({api_name}) | The error message returned because the specified STS token has expired. |
QuotaExceed | 403 | The Quota ({key}) exceeded ({value}). | The error message returned because an upper limit is reached, such as the maximum number of templates and running executions. |
InvalidAccountType | 400 | The account type ({account_type}) was not supported. | The error message returned because the specified account type is not supported. |
TemplateValidationError | 400 | {reason} | The error message returned because the template failed the validation due to violations of data type, value range, or other constraints. |
EntityNotExists.Template | 404 | The specified template {name} does not exist. | The error message returned because the specified template does not exist. |
TemplateUpdateFailed | 403 | The template {name} update failed due to concurrence. Please try again. | The error message returned because of concurrent updates to the template. Try again later. |