Queries the list of stacks.

Description

This topic provides an example on how to query the list of stacks. In this example, the stacks that are deployed in the China (Hangzhou) region are queried.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListStacks

The operation that you want to perform. Set the value to ListStacks.

PageSize Long No 10

The number of entries to return on each page.

Maximum value: 50.

Default value: 10.

ParentStackId String No 4a6c9851-3b0f-4f5f-b4ca-a14bf691****

The ID of the parent stack.

RegionId String Yes cn-hangzhou

The region ID of the stack. You can call the DescribeRegions operation to query the most recent region list.

PageNumber Long No 1

The number of the page to return.

Pages start from page 1.

Default value: 1.

ShowNestedStack Boolean No true

Specifies whether to return nested stacks. Default value: false. Valid values:

  • true
  • false
    Note If the ParentStackId parameter is specified, you must set the ShowNestedStack parameter to true.
StackId String No 4a6c9851-3b0f-4f5f-b4ca-a14bf691****

The ID of the stack. If you want to query the basic information about the stack, you can use this parameter and do not need to call the GetStack operation.

Status.N String No CREATE_COMPLETE

The state N of the stack. Valid values:

  • CREATE_IN_PROGRESS: The stack is being created.
  • CREATE_FAILED: The stack fails to be created.
  • CREATE_COMPLETE: The stack is created.
  • UPDATE_IN_PROGRESS: The stack is being updated.
  • UPDATE_FAILED: The stack fails to be updated.
  • UPDATE_COMPLETE: The stack is updated.
  • DELETE_IN_PROGRESS: The stack is being deleted.
  • DELETE_FAILED: The stack fails to be deleted.
  • CREATE_ROLLBACK_IN_PROGRESS: The resources are being rolled back after the stack fails to be created.
  • CREATE_ROLLBACK_FAILED: The resources fail to be rolled back after the stack fails to be created.
  • CREATE_ROLLBACK_COMPLETE: The resources are rolled back after the stack fails to be created.
  • ROLLBACK_IN_PROGRESS: The resources of the stack are being rolled back.
  • ROLLBACK_FAILED: The resources of the stack fail to be rolled back.
  • ROLLBACK_COMPLETE: The resources of the stack are rolled back.
  • CHECK_IN_PROGRESS: The stack is being validated.
  • CHECK_FAILED: The stack fails to be validated.
  • CHECK_COMPLETE: The stack is validated.
  • REVIEW_IN_PROGRESS: The stack is being reviewed.
  • IMPORT_CREATE_IN_PROGRESS: The stack is being created by using imported resources.
  • IMPORT_CREATE_FAILED: The stack fails to be created by using imported resources.
  • IMPORT_CREATE_COMPLETE: The stack is created by using imported resources.
  • IMPORT_CREATE_ROLLBACK_IN_PROGRESS: The resources are being rolled back after the stack fails to be created by using imported resources.
  • IMPORT_CREATE_ROLLBACK_FAILED: The resources fail to be rolled back after the stack fails to be created by using imported resources.
  • IMPORT_CREATE_ROLLBACK_COMPLETE: The resources are rolled back after the stack fails to be created by using imported resources.
  • IMPORT_UPDATE_IN_PROGRESS: The stack is being updated by using imported resources.
  • IMPORT_UPDATE_FAILED: The stack fails to be updated by using imported resources.
  • IMPORT_UPDATE_COMPLETE: The stack is updated by using imported resources.
  • IMPORT_UPDATE_ROLLBACK_IN_PROGRESS: The resources are being rolled back after the stack fails to be updated by using imported resources.
  • IMPORT_UPDATE_ROLLBACK_FAILED: The resources fail to be rolled back after the stack fails to be updated by using imported resources.
  • IMPORT_UPDATE_ROLLBACK_COMPLETE: The resources are rolled back after the stack fails to be updated by using imported resources.
StackName.N String No MyStack

The name of stack N.

The name can be up to 255 characters in length, and can contain digits, letters, hyphens (-), and underscores (_). The name must start with a digit or letter. You can use the wildcard character (∗) for fuzzy search.

Valid values of N: 1 to 5.

Tag.N.Key String No usage

The key of tag N of the stack.

Valid values of N: 1 to 20.

Tag.N.Value String No test

The value of tag N of the stack.

Valid values of N: 1 to 20.

ResourceGroupId String No rg-acfmxazb4ph6aiy****

The ID of the resource group.

For more information about resource groups, see the "Resource Group" section of the What is Resource Management? topic.

StackIds.N String No 4a6c9851-3b0f-4f5f-b4ca-a14bf691****

The ID of stack N.

You can specify one or more IDs to query one or more stacks at the same time.

Valid values of N: 1 to 10.

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
TotalCount Integer 2

The total number of stacks.

PageSize Integer 10

The number of entries returned per page.

Maximum value: 50.

Default value: 10.

RequestId String FBAC80B4-9C27-529D-BC9C-4155FA5CD7A7

The ID of the request.

PageNumber Integer 1

The page number of the returned page.

Stacks Array of Stack

The list of stacks.

Status String CREATE_COMPLETE

The state of the stack.

UpdateTime String 2022-03-10T07:44:36

The time when the stack was updated. The time follows the ISO 8601 standard in the YYYY-MM-DDThh:mm:ss format. The time is displayed in UTC.

DriftDetectionTime String 2022-03-10T06:46:36

The time when the last successful drift detection was performed on the stack.

StatusReason String Stack CREATE completed successfully

The reason why the stack is in its current state.

CreateTime String 2022-03-10T06:44:36

The time when the stack was created. The time follows the ISO 8601 standard in the YYYY-MM-DDThh:mm:ss format. The time is displayed in UTC.

DisableRollback Boolean false

Indicates whether rollback is disabled when the stack fails to be created. Default value: false. Valid values:

  • true
  • false
Tags Array of Tag

The tags of the stack.

Key String acs:rm:rgId

The tag key of the stack.

Value String rg-aek2frunvw7****

The tag value of the stack.

StackName String MyStack

The name of the stack.

TimeoutInMinutes Integer 60

The timeout period that is allowed to create the stack. Unit: minutes.

RegionId String cn-hangzhou

The region ID of the stack. You can call the DescribeRegions operation to query the most recent region list.

ParentStackId String 4a6c9851-3b0f-4f5f-b4ca-a14bf692****

The ID of the parent stack.

StackId String 67805444-a605-45ee-a57f-83908ff6****

The ID of the stack.

StackDriftStatus String IN_SYNC

The state of the stack on which the last successful drift detection was performed. Valid values:

  • DRIFTED: Drift detection is being performed on the stack.
  • NOT_CHECKED: No successful drift detection is performed on the stack.
  • IN_SYNC: The stack is being synchronized.
StackType String ROS

The type of the stack. Valid values:

  • ROS: ROS stack. The stack is created by using a Resource Orchestration Service (ROS) template.
  • Terraform: Terraform stack. The stack is created by using a Terraform template.
ResourceGroupId String rg-aek2frunvw7****

The ID of the resource group.

ServiceManaged Boolean false

Indicates whether the stack is a managed stack. Valid values:

  • true
  • false
ServiceName String ACVS

The name of the service to which the managed stack belongs.

OperationInfo Object

The supplementary information that is returned when an operation fails to be performed on the stack.

Note This parameter is returned if an operation fails to be performed on the stack. The system returns at least one sub-property. Example: An error occurred when the API operation of another Alibaba Cloud service was called.
Code String DependencyViolation

The error code.

Message String There is still instance(s) in the specified security group.

The error message.

RequestId String 071D6166-3F6B-5C7B-A1F0-0113FBB643A8

The ID of the request that is initiated to call the API operation of another Alibaba Cloud service.

Action String DeleteSecurityGroup

The name of the API operation that belongs to another Alibaba Cloud service.

ResourceType String ALIYUN::ECS::SecurityGroup

The type of the resource on which an operation fails to be performed.

LogicalResourceId String EcsSecurityGroup

The logical ID of the resource on which an operation fails to be performed.

Examples

Sample requests

http(s)://ros.aliyuncs.com/?Action=ListStacks
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ListStacksResponse>
    <TotalCount>2</TotalCount>
    <PageSize>10</PageSize>
    <RequestId>FBAC80B4-9C27-529D-BC9C-4155FA5CD7A7</RequestId>
    <PageNumber>1</PageNumber>
    <Stacks>
        <Status>CREATE_COMPLETE</Status>
        <UpdateTime>2022-03-10T07:44:36</UpdateTime>
        <DriftDetectionTime>2022-03-10T06:46:36</DriftDetectionTime>
        <StatusReason>Stack CREATE completed successfully</StatusReason>
        <CreateTime>2022-03-10T06:44:36</CreateTime>
        <DisableRollback>false</DisableRollback>
        <Tags>
            <Key>acs:rm:rgId</Key>
            <Value>rg-aek2frunvw7****</Value>
        </Tags>
        <StackName>MyStack</StackName>
        <TimeoutInMinutes>60</TimeoutInMinutes>
        <RegionId>cn-hangzhou</RegionId>
        <ParentStackId>4a6c9851-3b0f-4f5f-b4ca-a14bf692****</ParentStackId>
        <StackId>67805444-a605-45ee-a57f-83908ff6****</StackId>
        <StackDriftStatus>IN_SYNC</StackDriftStatus>
        <StackType>ROS</StackType>
        <ResourceGroupId>rg-aek2frunvw7****</ResourceGroupId>
        <ServiceManaged>false</ServiceManaged>
        <ServiceName>ACVS</ServiceName>
        <OperationInfo>
            <Code>DependencyViolation</Code>
            <Message>There is still instance(s) in the specified security group.</Message>
            <RequestId>071D6166-3F6B-5C7B-A1F0-0113FBB643A8</RequestId>
            <Action>DeleteSecurityGroup</Action>
            <ResourceType>ALIYUN::ECS::SecurityGroup</ResourceType>
            <LogicalResourceId>EcsSecurityGroup</LogicalResourceId>
        </OperationInfo>
    </Stacks>
</ListStacksResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "TotalCount" : 2,
  "PageSize" : 10,
  "RequestId" : "FBAC80B4-9C27-529D-BC9C-4155FA5CD7A7",
  "PageNumber" : 1,
  "Stacks" : {
    "Status" : "CREATE_COMPLETE",
    "UpdateTime" : "2022-03-10T07:44:36",
    "DriftDetectionTime" : "2022-03-10T06:46:36",
    "StatusReason" : "Stack CREATE completed successfully",
    "CreateTime" : "2022-03-10T06:44:36",
    "DisableRollback" : false,
    "Tags" : {
      "Key" : "acs:rm:rgId",
      "Value" : "rg-aek2frunvw7****"
    },
    "StackName" : "MyStack",
    "TimeoutInMinutes" : 60,
    "RegionId" : "cn-hangzhou",
    "ParentStackId" : "4a6c9851-3b0f-4f5f-b4ca-a14bf692****",
    "StackId" : "67805444-a605-45ee-a57f-83908ff6****",
    "StackDriftStatus" : "IN_SYNC",
    "StackType" : "ROS",
    "ResourceGroupId" : "rg-aek2frunvw7****",
    "ServiceManaged" : false,
    "ServiceName" : "ACVS",
    "OperationInfo" : {
      "Code" : "DependencyViolation",
      "Message" : "There is still instance(s) in the specified security group.",
      "RequestId" : "071D6166-3F6B-5C7B-A1F0-0113FBB643A8",
      "Action" : "DeleteSecurityGroup",
      "ResourceType" : "ALIYUN::ECS::SecurityGroup",
      "LogicalResourceId" : "EcsSecurityGroup"
    }
  }
}

Error codes

For a list of error codes, see Service error codes.