Updated on 2023-08-14 GMT+08:00

Listing Stacks

Function

This API is used to query a stack list.

URI

GET /v2/stacks?project_id={project_id}

Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Project to which the stack belongs. This parameter is mandatory for common user queries. The value must be 1 to 64 characters long.

labels

No

Label of the stack to be queried. The format is "key1=value1,key2=value2". The label names and values must meet the requirements of the labels field in Table 1.

dsl_version

No

DSL version of the template. The stack of the corresponding version can be queried. Only huaweicloud _tosca_version_1_0 is supported. By default, this parameter is left blank.

template_id

No

Template ID. The stack that uses the specified template ID can be queried. This parameter cannot coexist with template_name.

template_name

No

Template name. The stack that uses the specified template name can be queried. This parameter cannot coexist with template_id.

template_version

No

Template version. The stack that uses the specified template version is queried. You need to specify template_name at the same time.

include_periodic_res

No

Stacks billed in the yearly/monthly mode are queried.

include_stack

No

  • true: Solution stacks are queried.
  • false: Common stacks are queried.
  • If this parameter is left blank, all stacks are queried.

name

No

The stack that uses the specified name is queried.

status

No

Stack status.

  • Running: Running.
  • Stopped: All resources are stopped.
  • Abnormal: The stack is abnormal.
  • Pending: Initializing.
  • Processing: Processing.
  • PartialStopped: Some resources are stopped.
  • Unknow: Unknown.

Request

N/A

Response message.

  • Response Parameters

    A response parameter is a stack structure list or response structure.

    • The stack structure list is returned when the query is successful.
    • The failure response structure is returned when the query fails.

    For the stack structure, see Table 2. For the failure response structure, see Table 5.

    Table 2 Response Parameters

    Parameter

    Data Type

    Description

    [Array element]

    Array of objects

    Each element indicates the stack details. For details, see Table 2.

  • Success response example

    Only a single stack structure is provided here. The returned URL is JSONArray([{"name": "stack1", ...}, {"name": "stack2", ...}]).

    {
        "force": false,
        "guid": "6c2dc1bc-66cc-11e7-8a31-0255ac101c16",
        "namespace": "csc-system",
        "project_id": "3de3c020647e447fb9c9dbe1f0fc8b85",
        "cluster_name": "cluster01",
        "cluster_id": "d019ddfa-61e2-11e7-80ba-0255ac100705",
        "domain_id": "c952eaaa5bdc43668d31aff2bb74a72d",
        "name": "b-lss-f98q0",
        "description": "",
        "status": "Running",
        "template_id": "6307541e-11e9-8d57-0682-0a0ab82e8450",
        "previous_template_id": "",
        "template_name": "paasconsole",
        "healthy": true,
        "healthy_message": "",
        "inputs_json": "{\"app_path\":\"/\",\"container_port\":18081,\"custom_tag_key0\":\"netype\",\"custom_tag_val0\":\"com.huawei.itpaas.platformservice.ncss\",\"extend_info\":\"{}\",\"image_name\":\"10.101.248.47:20202/aos-team/cam-default/dw_broker_lss_suse11sp3:v600r001c11\",\"pod_name\":\"b-lss-f98q0\",\"role_name\":\"manage\",\"secret_name\":\"default-ingress-ssl\",\"service_guid\":\"beef926a-e170-0419-c220-16d90bce9951\",\"sso_info\":\"{\\\"iam_external_domain\\\":\\\"10.101.248.93\\\",\\\"iam_external_addr\\\":\\\"10.101.248.93\\\",\\\"iam_internal_ip\\\":\\\"iam.kube-system.svc.cluster.local\\\",\\\"iam_port\\\":\\\"31943\\\"}\",\"volume_container_path\":\"/home/agentlib/uniagentconf\",\"volume_host_path\":\"/home/agentlib/uniagentconf\"}",
        "previous_inputs_json": "",
        "create_at": "2017-07-12T06:36:23Z",
        "update_at": "2017-07-12T06:36:39Z",
        "labels": "",
        "object": {
            "metadata": {
                "name": "b-lss-f98q0",
                "namespace": "3de3c020647e447fb9c9dbe1f0fc8b85",
                "selfLink": "/apis/paas/v1alpha1/namespaces/3de3c020647e447fb9c9dbe1f0fc8b85/stacks/b-lss-f98q0",
                "uid": "6c2dc1bc-66cc-11e7-8a31-0255ac101c16",
                "resourceVersion": "1442425",
                "creationTimestamp": "2017-07-12T06:36:23Z",
                "labels": {
                    "stackname": "b-lss-f98q0"
                },
                "annotations": {
                    "cluster-id": "d019ddfa-61e2-11e7-80ba-0255ac100705",
                    "namespace": "csc-system",
                    "paas-iam.alpha.kubernetes.io/domain-id": "c952eaaa5bdc43668d31aff2bb74a72d",
                    "stack.kubernetes.io/revision": "1"
                }
            },
            "spec": {
                "selector": {
                    "matchLabels": {
                        "stackname": "b-lss-f98q0"
                    }
                },
                "template": {
                    "type": "Aos",
                    "data": "******"
                }
            },
            "status": {
                "phase": "CreateSucceeded",
                "elementStatuses": {
                    "paas-console-app": {
                        "runtimeProperties": {
                            "CfeCluster": "{\"clusterID\":\"d019ddfa-61e2-11e7-80ba-0255ac100705\",\"namespace\":\"csc-system\"}",
                            "ConfigMap": "{\"selfLink\":\"/api/v1/namespaces/csc-system/configmaps/b-lss-f98q0\",\"name\":\"b-lss-f98q0\",\"id\":\"7248cfe7-66cc-11e7-9a88-286ed489ceaa\"}",
                            "Deployment": "{\"selfLink\":\"/apis/extensions/v1beta1/namespaces/csc-system/deployments/b-lss-f98q0\",\"name\":\"b-lss-f98q0\",\"id\":\"7253bff2-66cc-11e7-9a88-286ed489ceaa\"}",
                            "Ingress": "{\"selfLink\":\"/apis/extensions/v1beta1/namespaces/csc-system/ingresses/b-lss-f98q0\",\"annotations\":{\"ingress.beta.kubernetes.io/role\":\"manage\",\"ingress.beta.kubernetes.io/type\":\"external\",\"ingress.kubernetes.io/external-address\":\"10.101.204.188:30283\",\"ingress.kubernetes.io/external-ssl-address\":\"10.101.204.188:30282\"},\"rules\":[{\"host\":\"b-lss-f98q0-csc-system.10.101.204.188.xip.io\",\"http\":{\"paths\":[{\"path\":\"/\",\"backend\":{\"serviceName\":\"b-lss-f98q0\",\"servicePort\":32158}}]}}]}",
                            "Service": "{\"selfLink\":\"/api/v1/namespaces/csc-system/services/b-lss-f98q0\",\"type\":\"NodePort\",\"ports\":[{\"name\":\"\",\"protocol\":\"TCP\",\"port\":18081,\"targetPort\":18081,\"nodePort\":32158}],\"selector\":{\"app\":\"b-lss-f98q0\",\"stack-name\":\"b-lss-f98q0\"},\"clusterIP\":\"10.247.248.87\",\"ExternalName\":\"\",\"sessionAffinity\":\"None\"}"
                        }
                    }
                },
                "lastExecutionStatus": {
                    "actionName": "create",
                    "progress": 100,
                    "objectStatus": {
                        "phase": "Succeeded",
                        "updateAt": "2017-07-12T06:36:37Z"
                    },
                    "subObjectStatuses": {
                        "host-dir": {
                            "phase": "Succeeded",
                            "updateAt": "2017-07-12T06:36:23Z"
                        },
                        "paas-console": {
                            "phase": "Succeeded",
                            "updateAt": "2017-07-12T06:36:23Z"
                        },
                        "paas-console-app": {
                            "phase": "Succeeded",
                            "updateAt": "2017-07-12T06:36:36Z"
                        }
                    }
                }
            }
        },
        "health": {
            "message": "",
            "healthy": true
        }
    }
  • Error response example
    {
        "message": "Internal error.please check the error log and handle it.",
        "code": "02000051",
        "extend": ""
    }

Status Codes

  • Normal
    Table 3 Status code

    Status Code

    Description

    200

    Querying the stack list is successful.

  • Abnormal
    Table 4 Status code

    Status Code

    Description

    500

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