更新时间:2022-02-22 GMT+08:00

查询堆栈列表

功能介绍

用于查询堆栈列表。

URI

GET /v2/stacks?project_id={project_id}

表1 参数说明

参数

是否必选

描述

project_id

堆栈所属项目,在普通用户查询时必选。长度[1,64]。

labels

指定查询堆栈的标签。格式为key1=value1,key2=value2,标签名与值需要满足表1中的labels字段的要求。

dsl_version

模板语法版本,将查询到相应版本的堆栈。只支持cloud_tosca_version_1_0,默认为空。

template_id

将查询到使用指定模板ID的堆栈,不可与template_name同时使用。

template_name

将查询到使用指定模板名称的堆栈,不可与template_id同时使用。

template_version

将查询到使用指定模板版本的堆栈,需要同时指定template_name。

include_stack

  • true:查询解决方案堆栈
  • false:查询通用堆栈
  • 空:查询所有堆栈

name

查询指定名称的堆栈

status

堆栈状态:

  • Running:运行中
  • Stopped:全部资源停止
  • Abnormal:异常
  • Pending:初始化
  • Processing:处理中
  • PartialStopped:部分资源停止
  • Unknow:未知状态

请求消息

N/A。

响应消息

  • 响应参数

    响应参数是一个堆栈结构列表或返回消息结构。

    • 查询成功时返回堆栈结构列表。
    • 查询失败时返回错误消息结构。

    其中,堆栈结构如表2所示, 错误消息结构如表5所示。

    表2 响应参数

    参数

    参数类型

    描述

    [数组元素]

    Array of objects

    每个元素表示堆栈详细信息,详情请参见表2

  • 成功响应示例

    此处只写出单一堆栈结构,url返回为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.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
        }
    }
  • 错误响应示例
    {
        "message": "Internal error.please check the error log and handle it.",
        "code": "02000051",
        "extend": ""
    }

状态码

  • 正常
    表3 状态码

    状态码

    描述

    200

    查询堆栈列表成功

  • 异常
    表4 状态码

    状态码

    描述

    500

    服务器遇到了一个未曾预料的状况,导致无法完成对请求的处理。