Queries the list of stack groups.

This topic provides an example on how to query the list of stack groups. In this example, the stack groups that are in the active state and 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 ListStackGroups

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

RegionId String Yes cn-hangzhou

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

Status String No ACTIVE

The state of the stack group. If you do not specify this parameter, the stack groups in all states in the specified region are queried.

Valid values:

  • ACTIVE
  • DELETED
PageSize Long No 10

The number of entries to return on each page.

  • Valid values: 1 to 50.
  • Default value: 10.
PageNumber Long No 1

The number of the page to return.

  • Pages start from page 1.
  • Default value: 1.
ResourceGroupId String No rg-acfmzawhxxcj****

The ID of the resource group. If you do not specify this parameter, the stack groups in all the resource groups are queried.

Note If you want to obtain the resource group ID, go to the Resource Group page in the Resource Management console. For more information, see View basic information about a resource group.
Tags.N.Key String Yes usage

The key of tag N that is added to the stack group.

Note The Tags parameter is optional. If you specify the Tags parameter, you must specify the Tags.N.Key parameter.
Tags.N.Value String No test

The value of tag N that is added to the stack group.

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

Response parameters

Parameter Type Example Description
StackGroups Array of StackGroup

The list of stack groups.

StackGroupId String fd0ddef9-9540-4b42-a464-94f77835****

The ID of the stack group.

Status String ACTIVE

The state of the stack group.

Valid values:

  • ACTIVE
  • DELETED
DriftDetectionTime String 2020-02-27T07:47:47

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

Description String My Stack Group

The description of the stack group.

StackGroupDriftStatus String IN_SYNC

The state of the stack group on which the last successful drift detection was performed.

Valid values:

  • DRIFTED: The stack group has drifted.
  • NOT_CHECKED: No drift detection is performed on the stack group.
  • IN_SYNC: No drifts are detected on the stack group.
StackGroupName String MyStackGroup

The name of the stack group.

Tags Array of Tags

The tags that are added to the stack group.

Key String usage1

The key of the tag that is added to the stack group.

Value String test1

The value of the tag that is added to the stack group.

ResourceGroupId String rg-acfmzawhxxcj****

The ID of the resource group.

PermissionModel String SELF_MANAGED

The permission model.

Valid values:

  • SELF_MANAGED: self-managed permission model
  • SERVICE_MANAGED: service-managed permission model
Note For more information about the permission models of stack groups, see Overview.
AutoDeployment Object

The information about automatic deployment settings.

Enabled Boolean true

Indicates whether automatic deployment is enabled.

Valid values:

  • true: Automatic deployment is enabled. If you add a member to the folder to which the stack group belongs after you enable automatic deployment, ROS automatically adds the stacks in the stack group to the specified region of the member. If you delete the member from the folder, ROS automatically deletes the stacks in the stack group from the specified region of the member.
  • false: Automatic deployment is disabled. After you disable automatic deployment, the stacks remain unchanged when you change the member in the folder.
RetainStacksOnAccountRemoval Boolean true

Indicates whether the stacks within a member are retained when you delete the member from the folder.

Valid values:

  • true
  • false
Note This parameter is returned only if the Enabled parameter is set to true.
TotalCount Integer 1

The total number of stack groups.

RequestId String 14A07460-EBE7-47CA-9757-12CC4761D47A

The ID of the request.

PageSize Integer 10

The number of entries returned per page.

PageNumber Integer 1

The page number of the returned page.

Examples

Sample requests

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

Sample success responses

XML format

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

<ListStackGroupsResponse>
    <StackGroups>
        <StackGroupId>fd0ddef9-9540-4b42-a464-94f77835****</StackGroupId>
        <Status>ACTIVE</Status>
        <DriftDetectionTime>2020-02-27T07:47:47</DriftDetectionTime>
        <Description>My Stack Group</Description>
        <StackGroupDriftStatus>IN_SYNC</StackGroupDriftStatus>
        <StackGroupName>MyStackGroup</StackGroupName>
        <Tags>
            <Key>usage1</Key>
            <Value>test1</Value>
        </Tags>
        <ResourceGroupId>rg-acfmzawhxxcj****</ResourceGroupId>
        <PermissionModel>SELF_MANAGED</PermissionModel>
        <AutoDeployment>
            <Enabled>true</Enabled>
            <RetainStacksOnAccountRemoval>true</RetainStacksOnAccountRemoval>
        </AutoDeployment>
    </StackGroups>
    <TotalCount>1</TotalCount>
    <RequestId>14A07460-EBE7-47CA-9757-12CC4761D47A</RequestId>
    <PageSize>10</PageSize>
    <PageNumber>1</PageNumber>
</ListStackGroupsResponse>

JSON format

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

{
  "StackGroups" : {
    "StackGroupId" : "fd0ddef9-9540-4b42-a464-94f77835****",
    "Status" : "ACTIVE",
    "DriftDetectionTime" : "2020-02-27T07:47:47",
    "Description" : "My Stack Group",
    "StackGroupDriftStatus" : "IN_SYNC",
    "StackGroupName" : "MyStackGroup",
    "Tags" : {
      "Key" : "usage1",
      "Value" : "test1"
    },
    "ResourceGroupId" : "rg-acfmzawhxxcj****",
    "PermissionModel" : "SELF_MANAGED",
    "AutoDeployment" : {
      "Enabled" : true,
      "RetainStacksOnAccountRemoval" : true
    }
  },
  "TotalCount" : 1,
  "RequestId" : "14A07460-EBE7-47CA-9757-12CC4761D47A",
  "PageSize" : 10,
  "PageNumber" : 1
}

Error codes

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

Error code

Error message

HTTP status code

Description

InvalidParameter

The specified parameter {name} is invalid, {reason}.

400

The error message returned because the specified parameter is invalid. name indicates the parameter name. reason indicates the cause of the error.