Retrieves a template, including its content.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
oos:GetTemplate |
get |
*template
|
|
None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
No |
The region ID. |
cn-hangzhou |
| TemplateName |
string |
Yes |
The name of the template. The name can be up to 200 characters in length and can contain letters, digits, hyphens (-), and underscores (_). |
MyTemplate |
| TemplateVersion |
string |
No |
The version of the template. Format: "v" + a number. Value range: v1-v200. |
v1 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Content |
string |
The content of the template. |
"FormatVersion: OOS-2019-06-01\nDescription:\n en: Creates an ECS image\n zh-cn: 创建一个ECS镜像\n name-en: Create Image\n name-zh-cn: 创建镜像\n categories:\n - image_manage\n - application_manage\nParameters:\n regionId:\n Type: String\n Label:\n en: RegionId\n zh-cn: 地域ID\n AssociationProperty: RegionId\n Default: '{{ ACS::RegionId }}'\n instanceId:\n Label:\n en: InstanceId\n zh-cn: ECS实例ID\n Type: String\n AssociationProperty: ALIYUN::ECS::Instance::InstanceId\n AssociationPropertyMetadata:\n RegionId: regionId\n imageName:\n Label:\n en: ImageName\n zh-cn: 新镜像的名称\n Type: String\n Description:\n en: Note:
注意:
|
| RequestId |
string |
The request ID. |
5BBE2663-A18E-5261-9BBB-F4832F5294D9 |
| Template |
object |
The metadata of the template. |
|
| Hash |
string |
The SHA-256 hash of the template content. |
40fb5e3e08ef6c8a499ff7cd8441194f518028ad08338a84cb70c023a64576f1 |
| UpdatedDate |
string |
The time when the template was updated. |
2022-04-26T08:37:07Z |
| UpdatedBy |
string |
The user who updated the template. |
ACS |
| TemplateType |
string |
The type of the template. |
Automation |
| Tags |
object |
The tags. You can specify 1 to 20 key-value pairs. |
{"k1":"k2","k2":"v2"} |
| TemplateName |
string |
The name of the template. |
ACS-ECS-CreateImage |
| TemplateVersion |
string |
The template version. The format is v followed by a number that starts from 1. |
v15 |
| TemplateFormat |
string |
The template format. This is a system field. The value can be JSON or YAML. |
YAML |
| Description |
string |
The description of the template. |
"{\"en\": \"Creates an ECS image\", \"zh-cn\": \"创建一个ECS镜像\", \"name-en\": \"Create Image\", \"name-zh-cn\": \"创建镜像\", \"categories\": [\"image_manage\", \"application_manage\"]}" |
| ResourceGroupId |
string |
The ID of the resource group. |
rg-acfmxsn4m4****** |
| CreatedBy |
string |
The user who created the template. |
ACS |
| CreatedDate |
string |
The time when the template was created. |
2019-05-16T10:26:14Z |
| VersionName |
string |
The name of the version. |
version15 |
| TemplateId |
string |
The ID of the template. |
t-4bdb1745c171401883a2 |
| HasTrigger |
boolean |
Indicates whether the template has a trigger. |
false |
| ShareType |
string |
The share type of the template. The share type of a user-created template is Private. |
Public |
| SharedAccounts |
string |
Examples
Success response
JSON format
{
"Content": "\"FormatVersion: OOS-2019-06-01\\nDescription:\\n en: Creates an ECS image\\n zh-cn: 创建一个ECS镜像\\n name-en: Create Image\\n name-zh-cn: 创建镜像\\n categories:\\n - image_manage\\n - application_manage\\nParameters:\\n regionId:\\n Type: String\\n Label:\\n en: RegionId\\n zh-cn: 地域ID\\n AssociationProperty: RegionId\\n Default: '{{ ACS::RegionId }}'\\n instanceId:\\n Label:\\n en: InstanceId\\n zh-cn: ECS实例ID\\n Type: String\\n AssociationProperty: ALIYUN::ECS::Instance::InstanceId\\n AssociationPropertyMetadata:\\n RegionId: regionId\\n imageName:\\n Label:\\n en: ImageName\\n zh-cn: 新镜像的名称\\n Type: String\\n Description:\\n en:
Note:
Length is 2~128 English or Chinese characters
must start with big or small letters or Chinese, not http:// and https://.
Can contain numbers, colons (:), underscores (_), or dashes (-). \\n zh-cn:
注意:
长度为2~128个英文或中文字符
必须以大小字母或中文开头,不能以http://和https://开头。
可以包含数字、半角冒号(:)、下划线(_)或者短划线(-)。 \\n tags:\\n Label:\\n en: Tags\\n zh-cn: 镜像标签\\n Type: Json\\n AssociationProperty: Tags\\n AssociationPropertyMetadata:\\n ShowSystem: false\\n Default: []\\n OOSAssumeRole:\\n Label:\\n en: OOSAssumeRole\\n zh-cn: OOS扮演的RAM角色\\n Type: String\\n Default: OOSServiceRole\\nRamRole: '{{ OOSAssumeRole }}'\\nTasks:\\n- Name: createImage\\n Action: ACS::ECS::CreateImage\\n Description:\\n en: Create new image with the specified image name and instance ID\\n zh-cn: 通过指定实例ID和镜像名称创建新的镜像\\n Properties:\\n regionId: '{{ regionId }}'\\n imageName: '{{ imageName }}__on_{{ ACS::ExecutionId }}_at_{{ Acs::CurrentDate }}'\\n instanceId: '{{ instanceId }}'\\n tags: '{{tags}}'\\n Outputs:\\n imageId:\\n ValueSelector: imageId\\n Type: String\\nOutputs:\\n imageId:\\n Type: String\\n Value: '{{ createImage.imageId }}'\\nMetadata:\\n ALIYUN::OOS::Interface:\\n ParameterGroups:\\n - Parameters:\\n - regionId\\n - instanceId\\n Label:\\n default:\\n zh-cn: 选择实例\\n en: Select Ecs Instances\\n - Parameters:\\n - imageName\\n - tags\\n Label:\\n default:\\n zh-cn: 镜像设置\\n en: Image Configure\\n - Parameters:\\n - OOSAssumeRole\\n Label:\\n default:\\n zh-cn: 高级选项\\n en: Control Options\"",
"RequestId": "5BBE2663-A18E-5261-9BBB-F4832F5294D9",
"Template": {
"Hash": "40fb5e3e08ef6c8a499ff7cd8441194f518028ad08338a84cb70c023a64576f1",
"UpdatedDate": "2022-04-26T08:37:07Z",
"UpdatedBy": "ACS",
"TemplateType": "Automation",
"Tags": {
"k1": "k2",
"k2": "v2"
},
"TemplateName": "ACS-ECS-CreateImage",
"TemplateVersion": "v15",
"TemplateFormat": "YAML",
"Description": "\"{\\\"en\\\": \\\"Creates an ECS image\\\", \\\"zh-cn\\\": \\\"创建一个ECS镜像\\\", \\\"name-en\\\": \\\"Create Image\\\", \\\"name-zh-cn\\\": \\\"创建镜像\\\", \\\"categories\\\": [\\\"image_manage\\\", \\\"application_manage\\\"]}\"",
"ResourceGroupId": "rg-acfmxsn4m4******",
"CreatedBy": "ACS",
"CreatedDate": "2019-05-16T10:26:14Z",
"VersionName": "version15",
"TemplateId": "t-4bdb1745c171401883a2",
"HasTrigger": false,
"ShareType": "Public",
"SharedAccounts": ""
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.