All Products
Search
Document Center

CloudOps Orchestration Service:ListTemplates

Last Updated:Oct 14, 2024

Queries templates. Multiple methods are supported to filter templates.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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
oos:ListTemplatesget
  • Template
    acs:oos:{#regionId}:{#accountId}:template/*
  • Template
    acs:oos:{#regionId}:{#accountId}:template/{#templateName}
  • oos:tag
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringNo

The ID of the region in which you want to query templates.

cn-hangzhou
TemplateNamestringNo

The name of the template. All templates whose names contain the specified template name are to be returned.

MyTemplate
TemplateFormatstringNo

The format of the template. Valid values:

  • JSON
  • YAML
YAML
ShareTypestringNo

The share type of the template. Valid values:

  • Public
  • Private
Private
CreatedBystringNo

The creator of the template.

  • To query the template provided by Alibaba Cloud, set this parameter to ACS.
  • To query the template created by a user, set this parameter to the ID of the template or the name of the user who creates the template.
ACS
CreatedDateBeforestringNo

Specifies to query the template that is created at or before the specified time.

The value must be in the YYYY-MM-DDThh:mm::ssZ format.

2019-05-16T10:26:14Z
CreatedDateAfterstringNo

Specifies to query the template that is created at or later than the specified time.

The value must be in the YYYY-MM-DDThh:mm:ssZ format.

2019-05-16T10:26:14Z
TagsobjectNo

The tag keys and values. The number of key-value pairs ranges from 1 to 20.

{"k1":"k2","k2":"v2"}
CategorystringNo

The type of the template. Valid values include TimerTrigger, EventTrigger, AlarmTrigger, and Other.

TimerTrigger
MaxResultsintegerNo

The number of entries per page. Valid values: 10 to 100. Default value: 50.

50
NextTokenstringNo

The token that is used to retrieve the next page of results.

xxx
SortFieldstringNo

The field that is used to sort the templates to be queried. Valid values:

  • TotalExecutionCount (default): The system sorts the returned templates based on the total number of times that the templates are used.
  • Popularity: The system sorts the returned templates based on the popularity of the templates.
  • TemplateName: The system sorts the returned templates based on the names of the templates.
  • CreatedDate: The system sorts the returned templates based on the points in time when the templates are created.
  • UpdatedDate: The system sorts the returned templates based on the points in time when the templates are updated.
Popularity
SortOrderstringNo

The order in which you want to sort the results. Valid values:

  • Ascending: ascending order.
  • Descending: descending order. This is the default value.
Descending
HasTriggerbooleanNo

Specifies whether to query the template that is configured with a trigger.

true
TemplateTypestringNo

The type of the template. Valid values:

  • Automation: the template for automated tasks.
  • State: the template for configuration inventories.
  • Package: the template for software packages.
private
ResourceGroupIdstringNo

The ID of the resource group.

rg-acfmxsn4m4******
IsFavoritebooleanNo

Specifies whether the template is added to favorites.

true
IsExamplebooleanNo

Specifies whether the template is an example template

false

Response parameters

ParameterTypeDescriptionExample
object
NextTokenstring

The token that is used to retrieve the next page of results.

xxx
RequestIdstring

The ID of the request.

BEF54BA-17B6-449F-A219-49ACB157E3
MaxResultsinteger

The number of entries returned on each page.

50
Templatesarray<object>

The template metadata.

Templateobject
Hashstring

The SHA256 value of the template content.

4bc7d7a21b3e003434b9c223f6e6d2578b5ebfeb5be28c1fcf8a8a1b11907bb4
UpdatedDatestring

The time when the template was last updated.

2019-05-16T10:26:14Z
UpdatedBystring

The user who last updated the template.

root(13092000)
TemplateTypestring

The template type.

private
Tagsobject

The tag keys and values. The number of key-value pairs ranges from 1 to 20.

{"k1":"v1","k2":"v2"}
TemplateNamestring

The template name.

MyTemplate
TemplateVersionstring

The template version. The version contains the letter v and a number. The number starts from 1.

v1
TemplateFormatstring

The template format. The system automatically determines whether the format of the template is JSON or YAML.

JSON
Popularityinteger

The popularity of the public template. Valid values: 1-10. A greater value indicates higher popularity. If ShareType is set to Private, the value of this parameter is -1.

Note This parameter is valid only if ShareType is set to Public.
8
TotalExecutionCountinteger

The number of times for which the private template is executed. If ShareType is set to Public, the value of this parameter is -1.

Note This parameter is valid only if ShareType is set to Private.
5
Descriptionstring

The template description.

Describe instances of given status
ResourceGroupIdstring

The ID of the resource group.

rg-acfmxsn4m4******
CreatedBystring

The user who created the template.

root(1309200)
CreatedDatestring

The creation time of the template.

2019-05-16T10:26:14Z
Categorystring

The template type.

TimerTrigger
HasTriggerboolean

Indicates whether the template was configured with a trigger.

true
TemplateIdstring

The template ID.

t-94753deed38
ShareTypestring

The share type of the template. The share type of a template created by a user is Private. Valid values:

  • Public
  • Private
Public
IsFavoriteboolean

Indicates whether the template is added to favorites.

true
Publisherstring

The user who published the template.

aliyun
Constraintsstring

The template constraints.

{ "InstanceTypeFamilies": ["ecs.g8y", "ecs.c8y"], "ImageTypes": ["system"], "OSPlatforms": ["CentOS", "Ubuntu"], "OSVersions": ["CentOS7.9 64bit"] }

Examples

Sample success responses

JSONformat

{
  "NextToken": "xxx",
  "RequestId": "BEF54BA-17B6-449F-A219-49ACB157E3",
  "MaxResults": 50,
  "Templates": [
    {
      "Hash": "4bc7d7a21b3e003434b9c223f6e6d2578b5ebfeb5be28c1fcf8a8a1b11907bb4",
      "UpdatedDate": "2019-05-16T10:26:14Z",
      "UpdatedBy": "root(13092000)",
      "TemplateType": "private",
      "Tags": {
        "k1": "v1",
        "k2": "v2"
      },
      "TemplateName": "MyTemplate",
      "TemplateVersion": "v1",
      "TemplateFormat": "JSON",
      "Popularity": 8,
      "TotalExecutionCount": 5,
      "Description": "Describe instances of given status",
      "ResourceGroupId": "rg-acfmxsn4m4******",
      "CreatedBy": "root(1309200)",
      "CreatedDate": "2019-05-16T10:26:14Z",
      "Category": "TimerTrigger",
      "HasTrigger": true,
      "TemplateId": "t-94753deed38",
      "ShareType": "Public",
      "IsFavorite": true,
      "Publisher": "aliyun",
      "Constraints": "{\n  \"InstanceTypeFamilies\": [\"ecs.g8y\", \"ecs.c8y\"],\n  \"ImageTypes\": [\"system\"],\n  \"OSPlatforms\": [\"CentOS\", \"Ubuntu\"],\n  \"OSVersions\": [\"CentOS7.9 64bit\"]\n}"
    }
  ]
}

Error codes

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

Change history

Change timeSummary of changesOperation
2024-07-11The request parameters of the API has changedView Change Details
2023-12-08The request parameters of the API has changed. The response structure of the API has changedView Change Details