Updates an existing template.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
oos:UpdateTemplate |
update |
*template
|
|
|
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
No |
The region ID. |
cn-hangzhou |
| TemplateName |
string |
Yes |
The template name. The name can be up to 200 characters in length and can contain letters, digits, hyphens (-), and underscores (_). The name cannot start with ALIYUN, ACS, ALIBABA, or ALICLOUD. |
MyTemplate |
| Content |
string |
Yes |
The template content in JSON or YAML format, with a maximum size of 64 KB. |
{ "FormatVersion": "OOS-2019-06-01", "Description": { "en": "Bulky starts the ECS instances", "zh-cn": "Batch start ECS instances", "name-en": "Bulky Start Instances", "name-zh-cn": "Batch start instances" }, "Parameters": { "regionId": { "Type": "String", "Label": { "en": "RegionId", "zh-cn": "regionID" }, "AssociationProperty": "RegionId", "Default": "{{ ACS::RegionId }}" }, "targets": { "Type": "Json", "Label": { "en": "TargetInstance", "zh-cn": "目标instance" }, "AssociationProperty": "Targets", "AssociationPropertyMetadata": { "ResourceType": "ALIYUN::ECS::Instance", "RegionId": "regionId" } }, "rateControl": { "Label": { "en": "RateControl", "zh-cn": "任务执行的并发比率" }, "Type": "Json", "AssociationProperty": "RateControl", "Default": { "Mode": "Concurrency", "MaxErrors": 0, "Concurrency": 10 } }, "OOSAssumeRole": { "Label": { "en": "OOSAssumeRole", "zh-cn": "OOS扮演的RAM角色" }, "Type": "String", "Default": "OOSServiceRole" } }, "RamRole": "{{ OOSAssumeRole }}", "Tasks": [ { "Name": "getInstance", "Description": { "en": "Views the ECS instances", "zh-cn": "获取ECSinstance" }, "Action": "ACS::SelectTargets", "Properties": { "ResourceType": "ALIYUN::ECS::Instance", "RegionId": "{{ regionId }}", "Filters": [ "{{ targets }}" ] }, "Outputs": { "instanceIds": { "Type": "List", "ValueSelector": "Instances.Instance[].InstanceId" } } }, { "Name": "startInstance", "Action": "ACS::ECS::StartInstance", "Description": { "en": "Starts the ECS instances", "zh-cn": "启动instance" }, "Properties": { "regionId": "{{ regionId }}", "instanceId": "{{ ACS::TaskLoopItem }}" }, "Loop": { "RateControl": "{{ rateControl }}", "Items": "{{ getInstance.instanceIds }}" } } ], "Outputs": { "instanceIds": { "Type": "List", "Value": "{{ getInstance.instanceIds }}" } } } |
| Tags |
object |
No |
The tag keys and values. You can specify 1 to 20 key-value pairs. |
{"k1":"k2","k2":"v2"} |
| VersionName |
string |
No |
The template version name. |
v2 |
| ResourceGroupId |
string |
No |
The resource group ID. |
rg-acfmxsn4m4****** |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
2075899A-585D-4A41-A9B2-28DF4F534F |
| Template |
object |
The template metadata. |
|
| Hash |
string |
The SHA-256 hash of the template content. |
4bc7d7a21b3e003434b9c223f6e6d2578b5ebfeb5be28c1fcf8a8a1b11907bb4 |
| UpdatedDate |
string |
The time when the template was last updated. |
2019-05-16T10:26:14Z |
| UpdatedBy |
string |
The user who last updated the template. |
root(1309000) |
| Tags |
object |
The tag keys and values. You can specify 1 to 20 key-value pairs. |
{"k1":"k2","k2":"v2"} |
| TemplateName |
string |
The template name. |
MyTemplate |
| TemplateVersion |
string |
The template version. The version name consists of the letter v and a number starting from 1. |
v2 |
| TemplateFormat |
string |
The template format. The system automatically determines whether the format is JSON or YAML. |
JSON |
| Description |
string |
The template description. |
Describe instances of given status |
| ResourceGroupId |
string |
The resource group ID. |
rg-acfmxsn4m4****** |
| CreatedBy |
string |
The user who created the template. |
root(130920000) |
| CreatedDate |
string |
The time when the template was created. |
2019-05-16T10:26:14Z |
| TemplateId |
string |
The template ID. |
t-94753deed38 |
| HasTrigger |
boolean |
Indicates whether a trigger is configured for the template. |
true |
| ShareType |
string |
The sharing type of the template. User-created templates have a share type of Private. |
Private |
Examples
Success response
JSON format
{
"RequestId": "2075899A-585D-4A41-A9B2-28DF4F534F",
"Template": {
"Hash": "4bc7d7a21b3e003434b9c223f6e6d2578b5ebfeb5be28c1fcf8a8a1b11907bb4",
"UpdatedDate": "2019-05-16T10:26:14Z",
"UpdatedBy": "root(1309000)",
"Tags": {
"k1": "k2",
"k2": "v2"
},
"TemplateName": "MyTemplate",
"TemplateVersion": "v2",
"TemplateFormat": "JSON",
"Description": "Describe instances of given status",
"ResourceGroupId": "rg-acfmxsn4m4******",
"CreatedBy": "root(130920000)",
"CreatedDate": "2019-05-16T10:26:14Z",
"TemplateId": "t-94753deed38",
"HasTrigger": true,
"ShareType": "Private"
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.