All Products
Search
Document Center

Container Service for Kubernetes:DescribeTemplates

Last Updated:Dec 09, 2024

An orchestration template defines and describes a group of Kubernetes resources. It declaratively describes the configuration of an application or how an application runs. You can call the DescribeTemplates API operation to query orchestration templates and their detailed information, including access permissions, YAML content, and labels.

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
cs:DescribeTemplatesget
*All Resources
*
    none
none

Request syntax

GET /templates HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
template_typestringNo

The type of template. This parameter can be set to a custom value.

  • If the parameter is set to kubernetes, the template is displayed on the Templates page in the console.
  • If you set the parameter to compose, the template is not displayed on the Templates page in the console.

Default value: kubernetes.

kubernetes
page_numlongNo

The page number.

Default value: 1.

1
page_sizelongNo

The number of entries per page.

Default value: 10.

10

Response parameters

ParameterTypeDescriptionExample
object

The response body.

templatesarray<object>

The list of returned templates.

templateobject
aclstring

The access control policy of the template. Valid values:

  • private: The template is private.
  • public: The template is public.
  • shared: The template can be shared.

Default value: private.

private
idstring

The ID of the template.

874ec485-e7e6-4373-8a3b-47bde8ae789f
namestring

The name of the template.

webserver
descriptionstring

The description of the template.

a web server
tagsstring

The label of the template. By default, the value is the name of the template.

kubernetes
templatestring

The template content in the YAML format.

apiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment-basic\n labels:\n app: nginx\nspec:\n replicas: 2\n selector:\n matchLabels:\n app: nginx\n template:\n metadata:\n labels:\n app: nginx\n spec:\n containers:\n - name: nginx\n image: busybox:latest\n ports:\n - containerPort: 80
template_typestring

The type of template. This parameter can be set to a custom value.

  • If the parameter is set to kubernetes, the template is displayed on the Templates page in the console.
  • If the parameter is set to compose, the template is displayed on the Container Service - Swarm page in the console. However, Container Service for Swarm is deprecated.
kubernetes
createdstring

The time when the template was created.

2020-06-10T16:30:16+08:00
updatedstring

The time when the template was updated.

2020-06-10T16:30:16+08:00
template_with_hist_idstring

The ID of the parent template. The value of template_with_hist_id is the same for each template version. This allows you to manage different template versions.

ad81d115-7c8b-47e7-a222-9c28d7f6e588
page_infoobject

The pagination information.

page_numberlong

The page number.

20
page_sizelong

The number of entries per page.

3
total_countlong

The total number of entries returned.

50

Examples

Sample success responses

JSONformat

{
  "templates": [
    {
      "acl": "private",
      "id": "874ec485-e7e6-4373-8a3b-47bde8ae789f",
      "name": "webserver",
      "description": "a web server",
      "tags": "kubernetes",
      "template": "apiVersion: apps/v1\\nkind: Deployment\\nmetadata:\\n  name: nginx-deployment-basic\\n  labels:\\n    app: nginx\\nspec:\\n  replicas: 2\\n  selector:\\n    matchLabels:\\n      app: nginx\\n  template:\\n    metadata:\\n      labels:\\n        app: nginx\\n    spec:\\n      containers:\\n      - name: nginx\\n        image: busybox:latest\\n        ports:\\n        - containerPort: 80",
      "template_type": "kubernetes",
      "created": "2020-06-10T16:30:16+08:00",
      "updated": "2020-06-10T16:30:16+08:00",
      "template_with_hist_id": "ad81d115-7c8b-47e7-a222-9c28d7f6e588"
    }
  ],
  "page_info": {
    "page_number": 20,
    "page_size": 3,
    "total_count": 50
  }
}

Error codes

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

Change history

Change timeSummary of changesOperation
No change history