Queries the list of stacks.

Description

This topic describes 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 ID of the region to which the stack belongs. 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 you specify the ParentStackId parameter, you must set the ShowNestedStack parameter to true.
StackId String No 4a6c9851-3b0f-4f5f-b4ca-a14bf691****

The ID of the stack. You can specify this parameter to query only the stack ID. If you need to query the detailed information about the stack, call the GetStack operation.

ResourceGroupId String No rg-acfmxazb4ph6aiy****

The ID of the resource group.

For more information about resource groups, see Resource groups.

Status.N String No CREATE_COMPLETE

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 stack is being rolled back.
  • ROLLBACK_FAILED: The stack fails to be rolled back.
  • ROLLBACK_COMPLETE: The stack is 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 importing resources.
  • IMPORT_CREATE_FAILED: The stack fails to be created by importing resources.
  • IMPORT_CREATE_COMPLETE: The stack is created by importing resources.
  • IMPORT_CREATE_ROLLBACK_IN_PROGRESS: The resources are being rolled back after the stack fails to be created by importing resources.
  • IMPORT_CREATE_ROLLBACK_FAILED: The resources fail to be rolled back after the stack fails to be created by importing resources.
  • IMPORT_CREATE_ROLLBACK_COMPLETE: The resources are rolled back after the stack fails to be created by importing resources.
  • IMPORT_UPDATE_IN_PROGRESS: The stack is being updated by importing resources.
  • IMPORT_UPDATE_FAILED: The stack fails to be updated by importing resources.
  • IMPORT_UPDATE_COMPLETE: The stack is updated by importing resources.
  • IMPORT_UPDATE_ROLLBACK_IN_PROGRESS: The resources are being rolled back after the stack fails to be updated by importing resources.
  • IMPORT_UPDATE_ROLLBACK_FAILED: The resources fail to be rolled back after the stack fails to be updated by importing resources.
  • IMPORT_UPDATE_ROLLBACK_COMPLETE: The resources are rolled back after the stack fails to be updated by importing 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.

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

The ID of stack N.

You can specify one or more IDs to query the detailed information about 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 status 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 a specific 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: Rollback is disabled when the stack fails to be created.
  • false: Rollback is enabled when the stack fails to be created.
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 within which the stack can be created. Unit: minutes.

RegionId String cn-hangzhou

The ID of the region to which the stack belongs. 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 status 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 stack type. Valid values:

  • ROS: The stack is created based on a Resource Orchestration Service (ROS) template.
  • Terraform: The stack is created based on 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.

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>
        <StackType>ROS</StackType>
        <ResourceGroupId>rg-aek2frunvw7****</ResourceGroupId>
        <ServiceManaged>false</ServiceManaged>
        <StatusReason>Stack CREATE completed successfully</StatusReason>
        <CreateTime>2022-03-10T06:44:36</CreateTime>
        <RegionId>cn-hangzhou</RegionId>
        <DisableRollback>false</DisableRollback>
        <StackName>MyStack</StackName>
        <Tags>
            <Value>rg-aek2frunvw7****</Value>
            <Key>acs:rm:rgId</Key>
        </Tags>
        <TimeoutInMinutes>60</TimeoutInMinutes>
        <StackId>67805444-a605-45ee-a57f-83908ff6****</StackId>
    </Stacks>
    <Stacks>
        <Status>CREATE_COMPLETE</Status>
        <StackType>ROS</StackType>
        <ResourceGroupId>rg-acfmzawhxxc****</ResourceGroupId>
        <ServiceManaged>false</ServiceManaged>
        <StatusReason>Stack CREATE completed successfully</StatusReason>
        <CreateTime>2020-10-22T05:53:32</CreateTime>
        <RegionId>cn-hangzhou</RegionId>
        <DisableRollback>false</DisableRollback>
        <StackName>MyStack2</StackName>
        <TimeoutInMinutes>60</TimeoutInMinutes>
        <StackId>1ae37e7b-cdf0-4709-b53d-292260a0****</StackId>
    </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",
    "StackType" : "ROS",
    "ResourceGroupId" : "rg-aek2frunvw7****",
    "ServiceManaged" : false,
    "StatusReason" : "Stack CREATE completed successfully",
    "CreateTime" : "2022-03-10T06:44:36",
    "RegionId" : "cn-hangzhou",
    "DisableRollback" : false,
    "StackName" : "MyStack",
    "Tags" : [ {
      "Value" : "rg-aek2frunvw7****",
      "Key" : "acs:rm:rgId"
    } ],
    "TimeoutInMinutes" : 60,
    "StackId" : "67805444-a605-45ee-a57f-83908ff6****"
  }, {
    "Status" : "CREATE_COMPLETE",
    "StackType" : "ROS",
    "ResourceGroupId" : "rg-acfmzawhxxc****",
    "ServiceManaged" : false,
    "StatusReason" : "Stack CREATE completed successfully",
    "CreateTime" : "2020-10-22T05:53:32",
    "RegionId" : "cn-hangzhou",
    "DisableRollback" : false,
    "StackName" : "MyStack2",
    "Tags" : [ ],
    "TimeoutInMinutes" : 60,
    "StackId" : "1ae37e7b-cdf0-4709-b53d-292260a0****"
  } ]
}

Error codes

For a list of error codes, visit the API Error Center.