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

Querying a Stack Element List

Function

This API is used to query a stack element list.

URI

GET /v2/stacks/{stack_id}/elements

Table 1 Parameter description

Parameter

Mandatory

Description

stack_id

Yes

Stack ID, which supports a maximum of 64 characters

element_type

No

Stack element type, such as Application, SoftwareComponent, Service, AppGroup, Port, Cluster, or Volume. Other types can also be the types defined in the template. The value supports a maximum of 64 characters.

Request

N/A

Response

  • Response parameters

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

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

    Table 5 shows the structure of a failure response.

    Table 2 Response parameters

    Parameter

    Type

    Description

    [Array element]

    Array of objects

    Each element in the array indicates the details about an element in the stack. For details, see Table 3.

    Table 3 Stack element details

    Parameter

    Type

    Description

    id

    String

    Element name

    description

    String

    Element description

    properties

    Object

    Element attribute, which corresponds to the template content

    runtime_properties

    Object

    Element runtime attribute

    relationships

    Object

    Relationships between elements. For details, see Table 4.

    stack_id

    String

    Stack guid to which the element belongs

    type

    String

    Element type

    create_at

    String

    Element creation time

    update_at

    String

    Element update time

    type_hierarchy

    String

    Stack element type

    action_status

    Object

    Status of a stack element. For details, see Table 5.

    Table 4 Stack Nodes Relationship structure

    Parameter

    Type

    Description

    name

    String

    Relationship name

    type

    String

    Relationship type

    target_id

    String

    Name of the target node of a relationship

    type_hierarchy

    Array of strings

    Inherited structure of the relationship

    properties

    Object

    Attribute of a relationship. The attribute contains a key whose name is connection_type and the type is string, and indicates the connection type of the relationship.

    Table 5 Data structure of the action_status field

    Parameter

    Type

    Description

    subActionName

    String

    Name of an element suboperation.

    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.

    createAt

    String

    UTC timestamp of the information creation in the RFC3339 format.

    updateAt

    String

    UTC timestamp of the information update in the RFC3339 format.

  • Example response
    [
        {
            "id": "subnet",
            "stack_id": "a067769b-c1bb-11ea-8a77-0255ac1003d8",
            "relationships": [
                {
                    "name": "vpcId",
                    "type": "Cloud.Relationships.ContainedIn",
                    "type_hierarchy": [
                        "Cloud.Relationships.Root",
                        "Cloud.Relationships.DependsOn",
                        "Cloud.Relationships.ContainedIn"
                    ],
                    "properties": {},
                    "target_id": "vpc"
                }
            ],
            "type_hierarchy": [
                "Cloud.Node.Root",
                "Cloud.VPC.Subnet"
            ],
            "properties": {
                "cidr": "192.168.1.0/24",
                "dhcpEnable": true,
                "gateway": "192.168.1.1",
                "name": "dfsdf",
                "vpcId": {
                    "get_attribute": [
                        "vpc",
                        "refID"
                    ]
                }
            },
            "type": "Cloud.VPC.Subnet",
            "runtime_properties": {
                "neutron_network_id": "940bb729-260c-44fe-ab40-e98367865530",
                "neutron_subnet_id": "dc893222-ab37-4358-b162-3316c97c4958",
                "refID": "940bb729-260c-44fe-ab40-e98367865530",
                "refName": "dfsdf",
                "vpcId": "f78881f0-2944-44d4-9325-966f5f30369e"
            },
            "action_status": {
                "subActionName": "create",
                "phase": "Succeeded",
                "updateAt": "2020-07-09T08:10:26.830795Z",
                "createAt": "2020-07-09T08:10:22.270746Z"
            },
            "create_at": "2020-07-09T08:10:18Z",
            "update_at": "2020-07-09T08:10:18Z"
        },
        {
            "id": "vpc",
            "stack_id": "a067769b-c1bb-11ea-8a77-0255ac1003d8",
            "relationships": [],
            "type_hierarchy": [
                "Cloud.Node.Root",
                "Cloud.VPC.VPC"
            ],
            "properties": {
                "cidr": "192.168.0.0/16",
                "name": "sdfs"
            },
            "type": "Cloud.VPC.VPC",
            "runtime_properties": {
                "refID": "f78881f0-2944-44d4-9325-966f5f30369e",
                "refName": "sdfs"
            },
            "action_status": {
                "subActionName": "create",
                "phase": "Succeeded",
                "updateAt": "2020-07-09T08:10:22.270648Z",
                "createAt": "2020-07-09T08:10:18.278579Z"
            },
            "create_at": "2020-07-09T08:10:18Z",
            "update_at": "2020-07-09T08:10:18Z"
        }
    ]

Status Code

  • Normal
    Table 6 Status code

    Status Code

    Description

    200

    Querying the stack element list is successful.

  • Abnormal
    Table 7 Status code

    Status Code

    Description

    404

    The requested stack does not exist.

    500

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