Queries the information of a stack.

This topic provides an example on how to query the information of the stack whose ID is c754d2a4-28f1-46df-b557-9586173a**** and that is deployed in the China (Hangzhou) region.

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 GetStack

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

StackId String Yes c754d2a4-28f1-46df-b557-9586173a****

The ID of the 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.

ClientToken String No 123e4567-e89b-12d3-a456-42665544****

The client token that is used to ensure the idempotence of the request. This value is generated by the client and is globally unique.

The token can be up to 64 characters in length, and can contain letters, digits, hyphens (-), and underscores (_).

For more information, see How to ensure idempotence.

OutputOption String No Disabled

Specifies whether to return the list of output parameters. Valid values:

  • Enabled: The list of output parameters is returned.
  • Disabled: The list of output parameters is not returned.
    Note Output parameters are time-consuming to calculate. If you do not require output parameters, we recommend that you set OutputOption to Disabled to improve the operation response speed.
ShowResourceProgress String No Disabled

Specifies whether to show the resource creation progress. Valid values:

  • Disabled: The resource creation progress is not shown.
  • EnabledIfCreateStack: The resource creation progress is shown only when you create a stack.
    Note When you create a stack, the state of the stack can be CREATE_IN_PROGRESS, CREATE_COMPLETE, CREATE_FAILED, CREATE_ROLLBACK_IN_PROGRESS, CREATE_ROLLBACK_COMPLETE, or CREATE_ROLLBACK_FAILED.

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

Response parameters

Parameter Type Example Description
Status String CREATE_COMPLETE

The state of the stack. Valid values:

  • CREATE_IN_PROGRESS: The stack is being created.
  • CREATE_FAILED: The stack could not be created.
  • CREATE_COMPLETE: The stack was created successfully.
  • UPDATE_IN_PROGRESS: The stack is being updated.
  • UPDATE_FAILED: The stack could not be updated.
  • UPDATE_COMPLETE: The stack was updated successfully.
  • DELETE_IN_PROGRESS: The stack is being deleted.
  • DELETE_FAILED: The stack could not be deleted.
  • CREATE_ROLLBACK_IN_PROGRESS: The stack creation operation is being rolled back.
  • CREATE_ROLLBACK_FAILED: The stack creation operation could not be rolled back.
  • CREATE_ROLLBACK_COMPLETE: The stack creation operation was rolled back successfully.
  • ROLLBACK_IN_PROGRESS: The stack is being rolled back.
  • ROLLBACK_FAILED: The stack could not be rolled back.
  • ROLLBACK_COMPLETE: The stack was rolled back successfully.
  • CHECK_IN_PROGRESS: The stack is being validated.
  • CHECK_FAILED: The stack could not be validated.
  • CHECK_COMPLETE: The stack was validated successfully.
  • REVIEW_IN_PROGRESS: The stack is being reviewed.
  • IMPORT_CREATE_IN_PROGRESS: The stack is being created through imported resources.
  • IMPORT_CREATE_FAILED: The stack could not be created through imported resources.
  • IMPORT_CREATE_COMPLETE: The stack was created successfully through imported resources.
  • IMPORT_CREATE_ROLLBACK_IN_PROGRESS: The operation of creating the stack through imported resources is being rolled back.
  • IMPORT_CREATE_ROLLBACK_FAILED: The operation of creating the stack through imported resources could not be rolled back.
  • IMPORT_CREATE_ROLLBACK_COMPLETE: The operation of creating the stack through imported resources was rolled back successfully.
  • IMPORT_UPDATE_IN_PROGRESS: The stack is being updated through imported resources.
  • IMPORT_UPDATE_FAILED: The stack could not be updated through imported resources.
  • IMPORT_UPDATE_COMPLETE: The stack was updated successfully through imported resources.
  • IMPORT_UPDATE_ROLLBACK_IN_PROGRESS: The operation of updating the stack through imported resources is being rolled back.
  • IMPORT_UPDATE_ROLLBACK_FAILED: The operation of updating the stack through imported resources could not be rolled back.
  • IMPORT_UPDATE_ROLLBACK_COMPLETE: The operation of updating the stack through imported resources was rolled back successfully.
Description String my stack description

The description of the stack.

Parameters Array of Parameter

The parameters of the stack.

ParameterKey String InstanceType

The key of parameter N.

ParameterValue String ecs.cm4.6xlarge

The value of parameter N.

RequestId String B288A0BE-D927-4888-B0F7-B35EF84B6E6F

The ID of the request.

StatusReason String Stack CREATE completed successfully

The reason why the stack is in its current state.

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

The ID of the parent stack.

CreateTime String 2020-10-14T01:55:01

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.

DeletionProtection String Disabled

Specifies whether to enable deletion protection on the stack. Default value: Disabled. Valid values:

  • Enabled: Deletion protection is enabled on the stack.
  • Disabled: Deletion protection is disabled on the stack. You can release the stack by using the Resource Orchestration Service (ROS) console or calling the DeleteStack operation.
Note The deletion protection property of a nested stack is the same as that of its root stack.
RootStackId String 4a6c9851-3b0f-4f5f-b4ca-a14bf692****

The ID of the root stack. This parameter is returned if the specified stack is a nested stack.

TemplateDescription String Create an ECS instance

The description of the template.

StackType String ROS

The type of the stack. Valid values:

  • ROS: The stack was created based on an ROS template.
  • Terraform: The stack was created based on a Terraform template.
RamRoleName String test-role

The name of the RAM role. ROS assumes the RAM role to create the stack and uses the credential of the role to call the APIs of Alibaba Cloud services.

ROS assumes the RAM role to perform operations on the stack. If you have permissions to perform operations on the stack but you do not have permissions to use the RAM role, ROS still uses the RAM role. Follow the principle of least privilege when granting permissions to the role.

If you do not specify this parameter, ROS uses the existing role that is associated with the stack. If no roles are available for ROS to assume, ROS uses a temporary credential that is generated from the credentials of your account.

The name of the RAM role can be up to 64 bytes in length.

UpdateTime String 2020-11-14T01:55:01

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

Outputs Array of Object [{"Description": "Instance ID","OutputKey": "InstanceId","OutputValue": "i-a****"}]

The list of output parameters of the stack.

Note This parameter is returned when OutputOption is set to Enabled.
DriftDetectionTime String 2021-02-27T07:47:47

The time when the most recent successful drift detection operation was initiated.

RegionId String cn-hangzhou

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

StackDriftStatus String IN_SYNC

The drift status of the stack in the last successful drift detection. Valid values:

  • DRIFTED: The stack has drifted.
  • NOT_CHECKED: No drift detection is completed on the stack.
  • IN_SYNC: The stack is being synchronized.
NotificationURLs Array of String ["http://127.XX.XX.1:8080/x", "http://127.0.XX.XX:8080/y"]

The callback URLs for receiving stack events.

DisableRollback Boolean false

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

  • true: Rollback is disabled on stack creation failure.
  • false: Rollback is enabled on stack creation failure.
StackName String MyStack

The name of the stack.

The name can be up to 255 characters in length, and can contain digits, letters, hyphens (-), and underscores (_). It must start with a digit or letter.

Tags Array of Tag

The tags of the stack.

Key String usage

The key of tag N of the stack.

Value String test

The value of tag N of the stack.

TimeoutInMinutes Integer 10

The timeout period that is specified for the stack creation request. Unit: minutes.

StackId String c754d2a4-28f1-46df-b557-9586173a****

The ID of the stack.

ResourceGroupId String rg-acfmxazb4ph6aiy****

The ID of the resource group.

ResourceProgress Object

The resource creation process.

TotalResourceCount Integer 2

The total number of resources.

SuccessResourceCount Integer 1

The number of resources that were processed.

FailedResourceCount Integer 0

The number of resources that failed to be processed.

InProgressResourceCount Integer 1

The number of resources that are being processed.

PendingResourceCount Integer 0

The number of resources to be processed.

InProgressResourceDetails Array of InProgressResourceDetail

The progress details of resources that are being processed.

ResourceName String WaitCondition

The name of the resource.

ResourceType String ALIYUN::ROS::WaitCondition

The type of the resource.

ProgressValue Float 5

The current progress value of the resource.

ProgressTargetValue Float 10

The desired progress value of the resource.

Log Object

The logs of the stack.

TerraformLogs Array of TerraformLog

The logs of the Terraform stack. This parameter is returned only when the stack is a Terraform stack.

Note This parameter is not returned for a running stack. This parameter contains the logs of the last creation, re-creation, update, or deletion operation on the stack.
Command String apply

The name of the Terraform command. Valid values:

  • apply
  • plan
  • destroy
  • version

For more information about the Terraform commands, see Basic CLI Features.

Stream String stdout

The output stream. Valid values:

  • stdout: the standard output stream.
  • stderr: the standard error stream.
Content String Apply complete! Resources: 42 added, 0 changed, 0 destroyed.

The content of the output stream.

TemplateId String a52f81be-496f-4e1c-a286-8852ab54****

The ID of the template. This parameter is returned only when the template currently used by the stack is a custom template or a shared template.

If the template is a shared template, the value of this parameter is the same as that of the TemplateARN parameter.

TemplateVersion String v1

The version of the template. This parameter is returned only when the template currently used by the stack is a custom template or a shared template.

If the stack is a shared template, this parameter is returned only when the VersionOption parameter is set to AllVersions.

Valid values: v1 to v100.

TemplateScratchId String ts-7f7a704cf71c49a6****

The ID of the scenario. This parameter is returned only when the template currently used by the stack is from a scenario.

TemplateURL String oss://ros/template/demo

The URL of the file that contains the template body. This parameter is returned only when the template currently used by the stack is from a URL, including the URL of an HTTP or HTTPS web server or an Alibaba Cloud Object Storage Service (OSS) bucket.

Examples

Sample requests

http(s)://ros.aliyuncs.com/?Action=GetStack
&StackId=c754d2a4-28f1-46df-b557-9586173a****
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

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

<GetStackResponse>
    <Status>CREATE_COMPLETE</Status>
    <Description>my stack description</Description>
    <Parameters>
        <ParameterKey>InstanceType</ParameterKey>
        <ParameterValue>ecs.cm4.6xlarge</ParameterValue>
    </Parameters>
    <RequestId>B288A0BE-D927-4888-B0F7-B35EF84B6E6F</RequestId>
    <StatusReason>Stack CREATE completed successfully</StatusReason>
    <CreateTime>2020-10-14T01:55:01</CreateTime>
    <DeletionProtection>Disabled</DeletionProtection>
    <TemplateDescription>Create an ECS instance</TemplateDescription>
    <StackType>ROS</StackType>
    <RegionId>cn-hangzhou</RegionId>
    <DisableRollback>false</DisableRollback>
    <StackName>MyStack</StackName>
    <Tags>
        <Key>usage</Key>
        <Value>test</Value>
    </Tags>
    <TimeoutInMinutes>10</TimeoutInMinutes>
    <StackId>c754d2a4-28f1-46df-b557-9586173a****</StackId>
    <ResourceGroupId>rg-acfmxazb4ph6aiy****</ResourceGroupId>
</GetStackResponse>

JSON format

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

{
  "Status" : "CREATE_COMPLETE",
  "Description" : "my stack description",
  "Parameters" : [ {
    "ParameterKey" : "InstanceType",
    "ParameterValue" : "ecs.cm4.6xlarge"
  } ],
  "RequestId" : "B288A0BE-D927-4888-B0F7-B35EF84B6E6F",
  "StatusReason" : "Stack CREATE completed successfully",
  "CreateTime" : "2020-10-14T01:55:01",
  "DeletionProtection" : "Disabled",
  "TemplateDescription" : "Create an ECS instance",
  "StackType" : "ROS",
  "RegionId" : "cn-hangzhou",
  "DisableRollback" : false,
  "StackName" : "MyStack",
  "Tags" : [ {
    "Key" : "usage",
    "Value" : "test"
  } ],
  "TimeoutInMinutes" : 10,
  "StackId" : "c754d2a4-28f1-46df-b557-9586173a****",
  "ResourceGroupId" : "rg-acfmxazb4ph6aiy****"
}

Error codes

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

HttpCode

Error codes

Error message

Description

404

StackNotFound

The Stack ({name}) could not be found.

The error message returned because the specified stack does not exist. name indicates the stack name or ID.