Updated on 2023-11-15 GMT+08:00

Listing Templates

Function

This API is used to query a template list based on the parameters provided.

URI

GET /v2/templates

Table 1 Parameter description

Parameter

Mandatory

Description

name

No

Template name. This parameter is applicable to scenarios where the template ID is queried based on the template name.

offset

No

Start offset. The default value is 0.

limit

No

Total number of queries. This parameter can be set only when offset is set.

dsl_version

No

DSL version of the template.

check_used

No

Template usage condition. If this parameter is left blank, false is used by default.

include_stack

No

If this parameter is set to true, solution templates are queried. If this parameter is set to false, common templates are queried. If this parameter is left blank, all templates are queried.

Request

N/A

Response message.

  • Response Parameters

    For details about response parameters when the request fails, see Table 5.

    Table 2 Response Parameters

    Parameter

    Type

    Description

    [Array element]

    Array of objects

    Array elements are template details. For details, see Table 3.

    Table 3 Template details

    Parameter

    Type

    Description

    id

    String

    Template ID.

    name

    String

    Template name.

    version

    String

    Template version.

    vendor

    String

    Template vendor.

    description

    String

    Template description.

    project_id

    String

    ID of the project to which the template belongs.

    template_url

    String

    URL where the template package is stored.

    converge_url

    String

    URL of the template conversion package, which is used for template preview.

    create_at

    String

    Template creation time.

    update_at

    String

    Template update time.

    scope

    String

    Template application scope.

    • project: available in the project (Currently, templates of this scope cannot be created.)
    • domain: available within an account
    • public: available globally, namely, available between accounts

    domain

    String

    Name of the account to which the template belongs.

    main_file_name

    String

    Name of the main file. If this parameter is left blank, the default value blueprint.yaml is used.

    need_clutser

    Boolean

    Check whether a Cloud Container Engine (CCE) cluster is required. Currently, all AOS applications must be deployed on CCE clusters.

    dsl_version

    String

    DSL version of the template.

    is_used

    Boolean

    Check whether the template is in use (that is, check whether there are any stack created using this template). If the value of this parameter is true, the template is in use.

    This parameter is returned when check_used is true.

    is_new_template

    Boolean

    Whether it is a new template.

    include_stack

    Boolean

    Whether the template contains stack elements (AOS.Stack).

    Table 4 Response headers

    Parameter

    Type

    Description

    Content-Range

    String

    Pagination information. The value of items includes the start number, end number, and total number. The value depends on the number of user templates.

    For example, items 0-24/66.

  • Example Response
    [
        {
            "id": "f9f5839d-73e2-f22b-f20b-fb11bc1abb66",
            "name": "test-z",
            "version": "v1",
            "vendor": "aos-team",
            "description": "",
            "project_id": "",
            "template_url": "https://swr-api-server.manage.svc.cluster.local:20202/swr/v2/domains/aos-team/namespaces/aos-teame002/repositories/stack_templates/packages/test-z/versions/v1/file_paths/test-staless-container.tar.gz",
            "converge_url": "https://swr-api-server.manage.svc.cluster.local:20202/swr/v2/domains/aos-team/namespaces/aos-teame002/repositories/stack_templates/packages/test-z/versions/v1/file_paths/test-z-v1-converge.tar.gz",
            "create_at": "2018-12-16T01:15:39Z",
            "update_at": "2018-12-16T01:15:41Z",
            "scope": "domain",
            "domain": "aos-team",
            "main_file_name": "blueprint.yaml",
            "need_cluster": true,
            "dsl_version": "huaweicloud_tosca_version_",
            "is_used": true,
            "is_new_template": false,
            "include_stack": false
        },
        {
            "id": "fd3f1e6d-cc93-c3c3-d015-f69c3ff3bc63",
            "name": "test-z",
            "version": "v2",
            "vendor": "aos-team",
            "description": "",
            "project_id": "",
            "template_url": "https://swr-api-server.manage.svc.cluster.local:20202/swr/v2/domains/aos-team/namespaces/aos-teame002/repositories/stack_templates/packages/test-z/versions/v2/file_paths/blueprint.zip",
            "converge_url": "https://swr-api-server.manage.svc.cluster.local:20202/swr/v2/domains/aos-team/namespaces/aos-teame002/repositories/stack_templates/packages/test-z/versions/v2/file_paths/test-z-v2-converge.tar.gz",
            "create_at": "2018-12-16T04:09:24Z",
            "update_at": "2018-12-16T04:09:26Z",
            "scope": "domain",
            "domain": "aos-team",
            "main_file_name": "blueprint.yaml",
            "need_cluster": true,
            "dsl_version": "huaweicloud_tosca_version_",
            "is_used": true,
            "is_new_template": false,
            "include_stack": false
        }
    ]

Status Code

  • Normal
    Table 5 Status Code

    Status Code

    Description

    200

    The template list query succeeds.

  • Abnormal
    Table 6 Status Code

    Status Code

    Description

    500

    The server fails to process the request due to an unexpected condition.