Update Template
Operation description
When updating a template, please note:
- If you specify
TemplateBody
orTemplateURL
, the template version will be incremented by 1 after a successful update. For example, the version changes from v1 to v2. - If neither
TemplateBody
norTemplateURL
is specified, the template version remains unchanged. - A template can have up to 100 versions. If the version limit is reached, the template update will fail, and you need to recreate the template.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- For mandatory resource types, indicate with a prefix of * .
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ros:UpdateTemplate | update | *template acs:ros:{#regionId}:{#accountId}:template/{#templateId} |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
TemplateURL | string | No | The location of the file containing the template body. The URL must point to a template located on a web server (HTTP or HTTPS) or in an Alibaba Cloud OSS bucket (e.g., oss://ros/template/demo, oss://ros/template/demo?RegionId=cn-hangzhou), with a maximum size of 524,288 bytes. Note
If the OSS region is not specified, it defaults to the same as the RegionId parameter in the request.
You can only specify one of | oss://ros/template/demo |
TemplateName | string | No | The name of the template. | MyTemplate |
Description | string | No | The description of the template. The maximum length is 256 characters. | It is a demo. |
TemplateBody | string | No | The structure of the template body. The length should be between 1 and 524,288 bytes. If the content is long, it is recommended to use HTTP POST + Body Param to pass the parameter in the request body to avoid request failure due to an overly long URL. Note
You must and can only specify one of TemplateBody , TemplateURL , TemplateId , or TemplateScratchId .
| {"ROSTemplateFormatVersion":"2015-09-01"} |
TemplateId | string | Yes | The template ID. Supports both shared and private templates. | 5ecd1e10-b0e9-4389-a565-e4c15efc**** |
ValidationOptions | array | No | Validation options. By default, no options are enabled, and strict validation is performed. | |
string | No | Validation options. Values:
| BasicValidation | |
RotateStrategy | string | No | Template version rotation strategy. Values:
Note
| None |
IsDraft | boolean | No | Whether to update the Draft (draft) version. Values:
| false |
For details on common request parameters, see Common Parameters.
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "8C5D90E1-66B6-496C-9371-3807F8DA80A8",
"TemplateId": "5ecd1e10-b0e9-4389-a565-e4c15efc****",
"TemplateVersion": "v2"
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-08-08 | The response structure of the API has changed | View Change Details |
2024-08-01 | The request parameters of the API has changed | View Change Details |
2024-01-12 | The internal configuration of the API is changed, but the call is not affected | View Change Details |
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
404 | TemplateNotFound | The Tempalte ({ ID }) could not be found. | 模板不存在。 |
400 | InvalidSchema | {reason}. | 模板格式不正确。reason 为具体原因。 |
400 | InvalidTemplateAttribute | The Referenced Attribute ({resource} {name}) is incorrect. | 模板包含不正确的资源属性(输出)引用。resource 为资源名,name 为属性名。 |
400 | InvalidTemplatePropertyType | The specified value type of ({resource} {section}) is incorrect. | 模板资源定义中的字段类型不正确。resource 为资源名,section 为字段名。 |
400 | InvalidTemplateReference | The specified reference "{name}" (in {referencer}) is incorrect. | 模板包含不正确的引用。name 为引用名,referencer 为引用者。 |
400 | InvalidTemplateSection | The template section is invalid: {section}. | 模板包含无效的字段。section 为字段名。 |
400 | InvalidTemplateVersion | The template version is invalid: {reason}. | 模板版本不正确。reason 为具体原因。 |
400 | TemplateBeingProcessed | Template { ID } is being processed, retry later. | 模板正在处理中,稍后再试。ID 为模板 ID。 |