Updated on 2022-02-22 GMT+08:00

Querying a Stack

Function

This API is used to query a stack.

URI

GET /v2/stacks/{stack_id}

Table 1 Parameter description

Parameter

Mandatory

Description

stack_id

Yes

Stack ID, which has a length of 1 to 64 characters

Request

N/A

Response

  • Response parameters

    A response parameter is a stack structure or response structure.

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

    The returned stack structure is shown in Table 2, and the returned failure response structure is shown in Table 5.

    Table 2 Response parameters

    Parameter

    Type

    Description

    cluster_id

    String

    ID of the cluster where the stack is located.

    cluster_name

    String

    Name of the cluster where the stack is located.

    create_at

    String

    Stack creation time.

    description

    String

    Stack description.

    domain_id

    String

    Account to which the stack belongs.

    dsl_version

    String

    Version of the template syntax used by the stack.

    force

    Boolean

    Label for stack forcible tailoring.

    guid

    String

    Stack ID.

    health

    Object

    Health check results of a stack. This parameter is not returned when the stack is being created. For details, see Table 3.

    inputs_json

    String

    Input parameters of the template used by a stack. Each key-value pair in this parameter corresponds to the key and value in the inputs. If a key is not specified, the default value is used. If no default value is specified, an error is reported.

    labels

    Map<String,String>

    Stack label.

    name

    String

    Stack name.

    namespace

    String

    Namespace to which the stack belongs.

    object

    Object

    Stack running data. This parameter is not returned when the stack is being created. For details, see Table 4.

    project_id

    String

    ID of the project to which the stack belongs.

    status

    String

    Stack status.

    template_id

    String

    Template ID.

    template_version

    String

    Version of the template used by the stack.

    update_at

    String

    Stack update time.

    Table 3 Data structure of the health field

    Parameter

    Type

    Description

    healthy

    Boolean

    Health status

    message

    String

    Description of the health status

    Table 4 Data structure of the object field

    Parameter

    Type

    Description

    apiVersion

    String

    API version. The value is paas/v1alpha1.

    kind

    String

    Type. The value is Stack.

    metadata

    Object

    Metadata of a stack. For details, see Table 5.

    spec

    Object

    Stack specifications. For details, see Table 6.

    status

    Object

    Stack execution status. For details, see Table 9.

    Table 5 Data structure of the object.metadata field

    Parameter

    Type

    Description

    annotations

    Object

    Special attributes of a stack. Currently, there are three fields.

    • paas-iam.alpha.kubernetes.io/domain-id: consistent with the top-level domain_id field
    • namespace: consistent with the top-level namespace field
    • cluster-id: consistent with the top-level cluster_id field

    labels

    Map<String,String>

    Stack label.

    name

    String

    Stack name, which is passed as action_id when lifecycle operation is executed.

    namespace

    String

    Stack project ID, which is the same as the top-level project_id field.

    resourceVersion

    String

    Resource version.

    selfLink

    String

    API address for accessing the resource.

    uid

    String

    Stack resource ID, which is the same as the top-level guid field.

    Table 6 Data structure of the object.spec field

    Parameter

    Type

    Description

    selector

    Object

    This parameter contains a JSONObject field named matchLabels. A key-value pair is included. The key is stackname, and the value is the name field at the top level. For details, see Table 7.

    template

    Object

    AOS template attributes. For details, see Table 8.

    Table 7 Data structure of the object.spec.selector field

    Parameter

    Type

    Description

    matchLabels

    Map<String,String>

    Label information

    Table 8 Data structure of the object.spec.template field

    Parameter

    Type

    Description

    reference

    Object

    Reference information

    type

    String

    The value is Aos, indicating an AOS template.

    Table 9 Data structure of the object.status field

    Parameter

    Type

    Description

    elementStatuses

    Map<String,Object>

    Execution status and attributes of each stack element. For details, see Table 11.

    healthyStatus

    object

    Cache of the last stack health check status. For details, see Table 12.

    lastExecutionStatus

    object

    Latest execution status. For details, see Table 16.

    phase

    String

    Stack execution status. The status can be succeeded, executing, suspended, canceled, canceling, forcibly canceling, suspending, retrying, or running. For details, see Table 10.

    Table 10 phase parameter description

    phase Parameter Value

    Description

    Running

    Running.

    Pending

    Initializing.

    Terminating

    Deleting.

    CreateFailed

    Creation failed.

    DeleteSucceeded

    Deletion successful.

    DarklaunchSucceeded

    Dark launch successful.

    UpgradeFailed

    Update failed.

    DarklaunchFailed

    Dark launch failed.

    RollbackFailed

    Failed to restore the stack.

    DeleteFailed

    Deletion failed.

    UpdateFailed

    Updating failed.

    ForceCancelled

    Forcibly canceled.

    CreateSucceeded

    Creation successful.

    RollbackSucceeded

    Stack restored successfully.

    UpgradeSucceeded

    Upgrade successfully.

    UpdateSucceeded

    Updating successfully.

    ReconfigFailed

    Failed to edit.

    ReconfigSucceeded

    Editing successful.

    Creating

    Creating.

    Deleting

    Deleting.

    Upgrading

    Upgrading.

    Darklaunching

    Performing dark launch.

    Rollbacking

    Restoring the stack.

    Updating

    Updating.

    Reconfiging

    Editing.

    CreatePaused

    Creation paused.

    DeletePaused

    Deletion paused.

    UpgradePaused

    Upgrade paused.

    DarkLaunchPaused

    Dark launch paused.

    RollbackPaused

    Stack recovery paused.

    UpdatePaused

    Updating paused.

    ReconfigPaused

    Editing paused.

    CreateCancelling

    Canceling creation.

    DeleteCancelling

    Canceling deletion.

    UpgradeCancelling

    Canceling upgrade.

    DarklaunchCancelling

    Canceling dark launch.

    RollbackCancelling

    Canceling stack recovery.

    UpdateCancelling

    Canceling update.

    ReconfigCancelling

    Canceling editing.

    CreateCancelled

    Canceling creation.

    DeleteCancelled

    Canceling deletion.

    UpgradeCancelled

    Canceling upgrade.

    RollbackCancelled

    Stack recovery canceled.

    ReconfigCancelled

    Editing canceled.

    CancelFailed

    Cancellation failed.

    Table 11 Data structure of the object.status.elementStatuses field

    Parameter

    Type

    Description

    runtimeProperties

    Object

    Information in runtimeProperties

    Table 12 Data structure of the object.status.healthyStatus field

    Parameter

    Type

    Description

    elements

    Map<String,Object>

    Health check results of each element. For details, see Table 13.

    elementsReference

    Object

    Element reference information. For details, see Table 15.

    healthyCheckTimestamp

    String

    Timestamp of the health check in the RFC3339 format.

    status

    String

    Status of an element after the health check, for example, Running.

    Table 13 Data structure of the object.status.healthyStatus.elements field

    Parameter

    Type

    Description

    message

    String

    Health check results of elements.

    runtimes

    Object

    Each key-value indicates a feature of the health check result. For details, see Table 14.

    status

    String

    Status of an element after the health check.

    Table 14 Data structure of the object.status.healthyStatus.elements.runtimes field

    Parameter

    Type

    Description

    fatigue

    Integer

    Element status

    instanceCount

    Integer

    Number of instances

    timestamp

    String

    Timestamp

    Table 15 Data structure of the object.status.healthyStatus.elementsReference field

    Parameter

    Type

    Description

    APIVersion

    String

    API version of an element

    FieldPath

    String

    Field path of an element

    Kind

    String

    Element type

    Name

    String

    Element name

    Namespace

    String

    Namespace of an element

    ResourceVersion

    String

    Resource version of an element

    UID

    String

    Element UID

    Table 16 Data structure of the object.status.lastExecutionStatus field

    Parameter

    Type

    Description

    actionName

    String

    Operation name.

    objectStatus

    Object

    Overall execution progress of the operation. For details, see Table 17.

    progress

    Integer

    Execution progress.

    subObjectStatuses

    Map<String,Object>

    Each key-value pair indicates the execution progress of the node corresponding to the key. For details, see Table 18.

    Table 17 Data structure of the object.status.lastExecutionStatus.objectStatus field

    Parameter

    Type

    Description

    message

    String

    Detailed error information.

    phase

    String

    Execution status of an operation step.

    updateAt

    String

    UTC timestamp of the information update in the RFC3339 format.

    Table 18 Data structure of the object.status.lastExecutionStatus.subObjectStatuses field

    Parameter

    Type

    Description

    createAt

    String

    UTC timestamp of the information creation in the RFC3339 format.

    message

    String

    Detailed error information.

    phase

    String

    Execution status of an operation step.

    reason

    String

    Brief error description in the CamelCase format.

    subActionName

    String

    Name of an element suboperation.

    updateAt

    String

    UTC timestamp of the information update in the RFC3339 format.

  • Example response
    {
        "force": true,
        "guid": "e167e354-c4d7-11ea-972c-0255ac1003cf",
        "namespace": "default",
        "project_id": "d383836f2d134980beb6a8cc5fced7ed",
        "cluster_name": "",
        "cluster_id": "",
        "domain_id": "4e9f3643e4cc44aeb8b7473e06ab309b",
        "name": "aoss4iit-b9152f94",
        "description": "",
        "status": "Running",
        "template_id": "779531a0-8949-b015-53a5-62764f56134b",
        "template_name": "no-delete-vpc-period",
        "inputs_json": "{\"Cloud.DomainId\":\"4e9f3643e4cc44aeb8b7473e06ab309b\",\"Cloud.NoValue\":\"\",\"Cloud.PeriodNum\":1,\"Cloud.PeriodType\":\"month\",\"Cloud.ProjectId\":\"d383836f2d134980beb6a8cc5fced7ed\",\"Cloud.Region\":\"ae-ad-1\",\"Cloud.StackName\":\"aoss4iit-b9152f94\",\"Cloud.UserId\":\"f24e2f88f137420a9cfe8464e5f0a1ff\"}",
        "create_at": "2020-07-08T08:18:57Z",
        "update_at": "2020-07-13T07:10:06Z",
        "labels": "{\"creator\":\"vpc1\"}",
        "dsl_version": "cloud_tosca_version_1_0",
        "object": {
            "kind": "Stack",
            "apiVersion": "paas/v1alpha1",
            "metadata": {
                "name": "aoss4iit-b9152f94",
                "namespace": "d383836f2d134980beb6a8cc5fced7ed",
                "selfLink": "/apis/paas/v1alpha1/namespaces/d3838sadweea4980beb6a8cc5fced7ed/stacks/aoss4iit-b9152f94",
                "uid": "e167e354-c4d7-11ea-972c-0255ac1003cf",
                "resourceVersion": "274630605",
                "labels": {
                    "stackname": "aoss4iit-b9152f94"
                },
                "annotations": {
                    "cluster-id": "",
                    "namespace": "default",
                    "paas-iam.alpha.kubernetes.io/domain-id": "4e9f3643e4cc44asswb7473e06ab309b",
                }
            },
            "spec": {
                "selector": {
                    "matchLabels": {
                        "stackname": "aoss4iit-b9152f94"
                    }
                },
                "template": {
                    "type": "Aos",
                    "reference": {
                        "namespace": "d383836f2d134980beb6a8cc5fced7ed",
                        "name": "aoss4iit-b9152f94-713114f1-1430-89fe-5112-992a1830d457",
                        "uid": "aoss4iit-b9152f94-713114f1-1430-89fe-5112-992a1830d457"
                    }
                }
            },
            "status": {
                "phase": "CreateSucceeded",
                "elementStatuses": {
                    "vpcvp4ud": {
                        "runtimeProperties": {
                            "refID": "42531670-5561-4722-bdca-1007aa25710f",
                            "refName": "vpcvp4ud-72b2dee4"
                        }
                    }
                },
                "lastExecutionStatus": {
                    "actionName": "create",
                    "progress": 100,
                    "objectStatus": {
                        "phase": "Succeeded",
                        "updateAt": "2020-07-13T07:10:11.789231Z"
                    },
                    "subObjectStatuses": {
                        "vpcvp4ud": {
                            "subActionName": "create",
                            "phase": "Succeeded",
                            "updateAt": "2020-07-13T07:10:10.820633Z",
                            "createAt": "2020-07-13T07:10:06.787787Z"
                        }
                    }
                },
                "healthyStatus": {
                    "healthyCheckTimestamp": "2020-07-14T09:40:42+08:00",
                    "status": "Running",
                    "elements": {
                        "vpcvp4ud": {
                            "status": "healthy",
                            "runtimes": {
                                "fatigue": "1",
                                "instanceCount": "1",
                                "timestamp": "2020-07-14T09:40:42+08:00"
                            }
                        }
                    },
                    "elementsReference": {
                        "Kind": "",
                        "Namespace": "d383836f2d134980beb6a8cc5fced7ed",
                        "Name": "aoss4iit-b9152f94-health-e545b9a7-565d-0284-c498-7e2d801ae968",
                        "UID": "01427996-c4d8-11ea-972c-0255ac1003cf",
                        "APIVersion": "",
                        "ResourceVersion": "",
                        "FieldPath": ""
                    }
                }
            }
        },
        "health": {
            "message": "",
            "healthy": true
        }
    }

Status Code

  • Normal
    Table 19 Status Code

    Status Code

    Description

    200

    Querying the stack is successful.

  • Abnormal
    Table 20 Status Code

    Status Code

    Description

    404

    The requested resource cannot be found.

    500

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