All Products
Search
Document Center

Resource Orchestration Service:GetTemplate

Last Updated:Apr 10, 2024

Queries the details of a template based on stacks, stack groups, change sets, or any custom template information.

Operation description

In this example, the details of a template whose ID is 5ecd1e10-b0e9-4389-a565-e4c15efc**** is queried. The region ID of the template is cn-hangzhou.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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:
    • The required resource types are displayed in bold characters.
    • 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.
OperationAccess levelResource typeCondition keyAssociated operation
ros:GetTemplateREAD
  • stack
    acs:ros:{#regionId}:{#accountId}:stack/{#stackId}
  • template
    acs:ros:{#regionId}:{#accountId}:template/{#templateId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
StackIdstringNo

The ID of the stack.

Note You must specify one of the following parameters: StackId, ChangeSetId, StackGroupName, and TemplateId.
4a6c9851-3b0f-4f5f-b4ca-a14bf691****
RegionIdstringYes

The region ID of the stack or stack group that uses the template. You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
ChangeSetIdstringNo

The ID of the change set.

Note You must specify one of the following parameters: StackId, ChangeSetId, StackGroupName, and TemplateId.
1f6521a4-05af-4975-afe9-bc4b45ad****
TemplateIdstringNo

The ID of the template.

This parameter applies to shared and private templates. If the template is a shared template, the value of TemplateId is the same as the value of TemplateARN. You can use the template ID to query a shared template.

Note You must specify one of the following parameters: StackId, ChangeSetId, StackGroupName, and TemplateId.
5ecd1e10-b0e9-4389-a565-e4c15efc****
TemplateVersionstringNo

The version of the template. This parameter takes effect only if you specify TemplateId.
If the template is a shared template, you can specify this parameter only if VersionOption is set to AllVersions. For more information, see SetTemplatePermission .

Valid values: v1 to v100.

v1
TemplateStagestringNo

The stage of the template. This parameter takes effect only if you specify StackId, ChangeSetId, or StackGroupName.

Valid values:

  • Processed (default): returns the processed template.
  • Original: returns the original template.
Processed
IncludePermissionstringNo

Specifies whether to query the shared information about the template. Valid values:

  • Enabled
  • Disabled (default)
Note Only the template owner can query the shared information of a template.
Enabled
StackGroupNamestringNo

The name of the stack group.

Note You must specify one of the following parameters: StackId, ChangeSetId, StackGroupName, and TemplateId.
MyStackGroup
IncludeTagsstringNo

Specifies whether to query the information about tags. Valid values:

  • Enabled
  • Disabled (default)
Note This parameter takes effect only if you specify TemplateId.
Enabled

For more information about common request parameters, see Common parameters.

Response parameters

ParameterTypeDescriptionExample
object
TemplateARNstring

The Alibaba Cloud Resource Name (ARN) of the template. This parameter is returned only if you specify TemplateId.

acs:ros:*:151266687691****:template/a52f81be-496f-4e1c-a286-8852ab54****
Descriptionstring

The description of the template. This parameter is returned only if you specify TemplateId.

ROS template for create ECS instance.
RequestIdstring

The ID of the request.

B288A0BE-D927-4888-B0F7-B35EF84****
CreateTimestring

The time when the template was created. This parameter is returned only if you specify TemplateId.

Note
  • If you specify TemplateVersion, the creation time of the template whose version is specified by TemplateVersion is returned.
  • If you do not specify TemplateVersion, the creation time of the template whose version is the default version is returned.
  • 2020-11-18T08:49:26
    StackGroupNamestring

    The name of the stack group. This parameter is returned only if you specify StackGroupName.

    MyStackGroup
    TemplateVersionstring

    The version of the template. This parameter is returned only if you specify TemplateId.
    If TemplateVersion is not specified or does not take effect, the default version is used.

    If the template is a shared template, this parameter is returned only if you set VersionOption to AllVersions.

    v1
    TemplateBodystring

    The content of the template.

    {"ROSTemplateFormatVersion": "2015-09-01"}
    ChangeSetIdstring

    The ID of the change set. This parameter is returned only if you specify ChangeSetId.

    e85abe0c-6528-43fb-ae93-fdf8de22****
    OwnerIdstring

    The ID of the Alibaba Cloud account to which the template belongs. This parameter is returned only if you specify TemplateId.

    151266687691****
    UpdateTimestring

    The time when the template was last updated. This parameter is returned only if you specify TemplateId.

    Note
  • If you specify TemplateVersion, the last update time of the template whose version is specified by TemplateVersion is returned.
  • If you do not specify TemplateVersion, the last update time of the template whose version is the default version is returned.
  • 2020-12-07T06:11:48
    Permissionsobject []

    Details of the sharing status of the template. This parameter is returned only if you specify TemplateId and set IncludePermission to Enabled.

    Note
  • If TemplateVersion is not specified or does not take effect, the details of the sharing status of the template whose version is the default version is returned.
  • If TemplateVersion is specified and takes effect, the details of the sharing status of the template whose version is specified by TemplateVersion is returned.
  • VersionOptionstring

    The version option for the shared template. This parameter is returned only if you set ShareOption to ShareToAccounts.

    Valid values:

    • AllVersions: All template versions are shared.
    • Latest: Only the latest template version is shared. When the version of the template is updated, Resource Orchestration Service (ROS) updates the shared version to the latest version.
    • Current: Only the latest template version is shared. When the version of the template is updated, ROS does not update the shared version.
    • Specified: Only the specified template version is shared.
    AllVersions
    AccountIdstring

    The ID of the Alibaba Cloud account with which the template is shared.

    142437958638****
    ShareOptionstring

    The sharing option.

    The value ShareToAccounts indicates that the template is shared with one or more Alibaba Cloud accounts.

    ShareToAccounts
    TemplateVersionstring

    The version of the shared template. This parameter is returned only if you set ShareOption to ShareToAccounts and set VersionOption to Specified or Current.

    Valid values: v1 to v100.

    v1
    ShareSourcestring

    The service that is used for resource sharing. Valid values:

    • ROS: Resources are shared from ROS by using the ROS console or calling the ROS API.
    • ResourceDirectory: Resources are shared with accounts in a resource directory from Resource Management by using the resource sharing feature.
    Note
  • The number of accounts with which resources are shared from ROS is independent of the number of accounts with which resources are shared from the resource directory.
  • The shared resources from ROS cannot override or overwrite the shared resources from the resource directory.
  • The shared resources from the resource directory can overwrite the shared resources from ROS.
  • ROS
    TemplateNamestring

    The name of the template. This parameter is returned only if you specify TemplateId.

    Note
  • If you specify TemplateVersion, the name of the template whose version is specified by TemplateVersion is returned.
  • If you not specify TemplateVersion, the name of the template whose version is the default version is returned.
  • MyTemplate
    RegionIdstring

    The region ID of the stack or stack group that uses the template. This parameter is returned only if you specify StackId, ChangeSetId, or StackGroupName.

    cn-hangzhou
    TemplateIdstring

    The ID of the template. This parameter is returned only if you specify TemplateId.

    If the template is a shared template, the value of this parameter is the same as the value of TemplateARN.

    a52f81be-496f-4e1c-a286-8852ab54****
    StackIdstring

    The ID of the stack. This parameter is returned only if you specify StackId.

    4a6c9851-3b0f-4f5f-b4ca-a14bf691****
    ShareTypestring

    The sharing type of the template. This parameter is returned only if you specify TemplateId.

    Valid values:

    • Private: The template belongs to the template owner.
    • Shared: The template is shared by other users.
    Private
    ResourceGroupIdstring

    The ID of the resource group.

    rg-acfmxazb4ph6aiy****
    Interfacestring

    The description of the web UI in the ROS console.

    {}
    Tagsobject []

    The tags of the template.

    Keystring

    The tag key of the template.

    usage
    Valuestring

    The tag value of the template.

    test

    Examples

    Sample success responses

    JSONformat

    {
      "TemplateARN": "acs:ros:*:151266687691****:template/a52f81be-496f-4e1c-a286-8852ab54****",
      "Description": "ROS template for create ECS instance.",
      "RequestId": "B288A0BE-D927-4888-B0F7-B35EF84****",
      "CreateTime": "2020-11-18T08:49:26",
      "StackGroupName": "MyStackGroup",
      "TemplateVersion": "v1",
      "TemplateBody": "{\"ROSTemplateFormatVersion\": \"2015-09-01\"}",
      "ChangeSetId": "e85abe0c-6528-43fb-ae93-fdf8de22****",
      "OwnerId": "151266687691****",
      "UpdateTime": "2020-12-07T06:11:48",
      "Permissions": [
        {
          "VersionOption": "AllVersions",
          "AccountId": "142437958638****",
          "ShareOption": "ShareToAccounts",
          "TemplateVersion": "v1",
          "ShareSource": "ROS"
        }
      ],
      "TemplateName": "MyTemplate",
      "RegionId": "cn-hangzhou",
      "TemplateId": "a52f81be-496f-4e1c-a286-8852ab54****",
      "StackId": "4a6c9851-3b0f-4f5f-b4ca-a14bf691****\t",
      "ShareType": "Private",
      "ResourceGroupId": "rg-acfmxazb4ph6aiy****",
      "Interface": "{}",
      "Tags": [
        {
          "Key": "usage",
          "Value": "test"
        }
      ]
    }

    Error codes

    For a list of error codes, visit the Service error codes.

    Change history

    Change timeSummary of changesOperation
    2022-06-09The request parameters of the API has changed. The response structure of the API has changedsee changesets
    Change itemChange content
    Input ParametersThe request parameters of the API has changed.
      Added Input Parameters: IncludeTags
    Output ParametersThe response structure of the API has changed.