Queries the resource in a stack.
In this topic, a resource named WebServer
in a stack whose ID is 4a6c9851-3b0f-4f5f-b4ca-a14bf691****
is queried. The stack is deployed in the China (Hangzhou) region.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | GetStackResource |
The operation that you want to perform. Set the value to GetStackResource. |
StackId | String | Yes | 4a6c9851-3b0f-4f5f-b4ca-a14bf691**** |
The ID of the stack. |
ClientToken | String | No | 123e4567-e89b-12d3-a456-42665544**** |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that it is unique among different requests. The token can be up to 64 characters in length, and can contain letters, digits, hyphens (-), and underscores (_). For more information, see Ensure idempotence. |
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. |
ShowResourceAttributes | Boolean | No | true |
Specifies whether to query the resource properties. Valid values:
|
LogicalResourceId | String | Yes | WebServer |
The logical ID of the resource defined in the template. |
ResourceAttributes.N | String | No | InstanceId |
The name of resource property N that you want to query. Note Maximum value of N: 20.
|
For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Status | String | CREATE_COMPLETE |
The status of the resource. Valid values:
|
Description | String | no description |
The description of the resource. |
RequestId | String | B288A0BE-D927-4888-B0F7-B35EF84B6E6 |
The ID of the request. |
StatusReason | String | state changed |
The reason why the resource is in its current state. |
PhysicalResourceId | String | d04af923-e6b7-4272-aeaa-47ec9777**** |
The physical ID of the resource. |
CreateTime | String | 2019-08-01T06:01:23 |
The time when the resource was created. The time follows the ISO 8601 standard in the YYYY-MM-DDThh:mm:ss format. The time is displayed in UTC. |
Metadata | Map |
The metadata. |
|
ResourceType | String | ALIYUN::ROS::WaitConditionHandle |
The resource type. |
ResourceAttributes | Array of Object | [{"ResourceAttributeKey": "CurlCli","ResourceAttributeValue": "curl -i -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'x-acs-region-id: cn-beijing' http://192.168.XX.XX/waitcondition?stackname=test-describe-resource\\&stackid=efdf5c10-96a5-4fd7-ab89-68e7baa2****\\&resource=WaitConditionHandle\\&expire=156468****\\&signature=991d910a901a89db6580d74233119960c004****"}] |
The list of the resource properties. |
LogicalResourceId | String | WebServer |
The logical ID of the resource defined in the template. |
ResourceDriftStatus | String | IN_SYNC |
The status of the resource in the last successful drift detection. Valid values:
|
UpdateTime | String | 2019-08-01T06:01:29 |
The time when the resource 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 | 2020-02-27T07:47:47 |
The time when the last successful drift detection was performed on the stack. |
StackName | String | test-describe-resource |
The name of the stack. 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. |
StackId | String | efdf5c10-96a5-4fd7-ab89-68e7baa2**** |
The ID of the stack. |
Examples
Sample requests
http(s)://ros.aliyuncs.com/?Action=GetStackResource
&RegionId=cn-hangzhou
&StackId=4a6c9851-3b0f-4f5f-b4ca-a14bf691****
&LogicalResourceId=WebServer
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<GetStackResourceResponse>
<CreateTime>2019-08-01T06:01:23</CreateTime>
<Description></Description>
<LogicalResourceId>WaitConditionHandle</LogicalResourceId>
<Metadata />
<PhysicalResourceId></PhysicalResourceId>
<RequestId>B288A0BE-D927-4888-B0F7-B35EF84B6E6F</RequestId>
<ResourceAttributes>
<ResourceAttributeKey>CurlCli</ResourceAttributeKey>
<ResourceAttributeValue>curl -i -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'x-acs-region-id: cn-beijing' http://192.168.XX.XX/waitcondition?stackname=test-describe-resource\&stackid=efdf5c10-96a5-4fd7-ab89-68e7baa2****\&resource=WaitConditionHandle\&expire=156468****\&signature=991d910a901a89db6580d74233119960c004****</ResourceAttributeValue>
</ResourceAttributes>
<ResourceAttributes>
<ResourceAttributeKey>WindowsCurlCli</ResourceAttributeKey>
<ResourceAttributeValue>curl -i -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "x-acs-region-id: cn-beijing" "http://192.168.XX.XX/waitcondition?stackname=test-describe-resource&stackid=efdf5c10-96a5-4fd7-ab89-68e7baa2****&resource=WaitConditionHandle&expire=156468****&signature=991d910a901a89db6580d74233119960c004****"</ResourceAttributeValue>
</ResourceAttributes>
<ResourceAttributes>
<ResourceAttributeKey>PowerShellCurlCli</ResourceAttributeKey>
<ResourceAttributeValue>curl -Uri "http://192.168.XX.XX/waitcondition?stackname=test-describe-resource&stackid=efdf5c10-96a5-4fd7-ab89-68e7baa2****&resource=WaitConditionHandle&expire=156468****&signature=991d910a901a89db6580d74233119960c004****" -Method Post -Headers @{"Content-Type"="application/json"; "Accept"="application/json"; "x-acs-region-id"="cn-beijing"}</ResourceAttributeValue>
</ResourceAttributes>
<ResourceType>ALIYUN::ROS::WaitConditionHandle</ResourceType>
<StackId>efdf5c10-96a5-4fd7-ab89-68e7baa2****</StackId>
<StackName>test-describe-resource</StackName>
<Status>UPDATE_COMPLETE</Status>
<StatusReason>state changed</StatusReason>
<UpdateTime>2019-08-01T06:01:29</UpdateTime>
<DriftDetectionTime>2020-02-27T07:47:47</DriftDetectionTime>
<ResourceDriftStatus>IN_SYNC</ResourceDriftStatus>
</GetStackResourceResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"CreateTime" : "2019-08-01T06:01:23",
"Description" : "",
"LogicalResourceId" : "WaitConditionHandle",
"Metadata" : { },
"PhysicalResourceId" : "",
"RequestId" : "B288A0BE-D927-4888-B0F7-B35EF84B6E6F",
"ResourceAttributes" : [ {
"ResourceAttributeKey" : "CurlCli",
"ResourceAttributeValue" : "curl -i -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'x-acs-region-id: cn-beijing' http://192.168.XX.XX/waitcondition?stackname=test-describe-resource\\&stackid=efdf5c10-96a5-4fd7-ab89-68e7baa2****\\&resource=WaitConditionHandle\\&expire=156468****\\&signature=991d910a901a89db6580d74233119960c004****"
}, {
"ResourceAttributeKey" : "WindowsCurlCli",
"ResourceAttributeValue" : "curl -i -X POST -H \"Content-Type: application/json\" -H \"Accept: application/json\" -H \"x-acs-region-id: cn-beijing\" \"http://192.168.XX.XX/waitcondition?stackname=test-describe-resource&stackid=efdf5c10-96a5-4fd7-ab89-68e7baa2****&resource=WaitConditionHandle&expire=156468****&signature=991d910a901a89db6580d74233119960c004****\""
}, {
"ResourceAttributeKey" : "PowerShellCurlCli",
"ResourceAttributeValue" : "curl -Uri \"http://192.168.XX.XX/waitcondition?stackname=test-describe-resource&stackid=efdf5c10-96a5-4fd7-ab89-68e7baa2****&resource=WaitConditionHandle&expire=156468****&signature=991d910a901a89db6580d74233119960c004****\" -Method Post -Headers @{\"Content-Type\"=\"application/json\"; \"Accept\"=\"application/json\"; \"x-acs-region-id\"=\"cn-beijing\"}"
} ],
"ResourceType" : "ALIYUN::ROS::WaitConditionHandle",
"StackId" : "efdf5c10-96a5-4fd7-ab89-68e7baa2****",
"StackName" : "test-describe-resource",
"Status" : "UPDATE_COMPLETE",
"StatusReason" : "state changed",
"UpdateTime" : "2019-08-01T06:01:29",
"DriftDetectionTime" : "2020-02-27T07:47:47",
"ResourceDriftStatus" : "IN_SYNC"
}
Error codes
For a list of error codes, visit the API Error Center.
Http status code |
Error code |
Error message |
Description |
---|---|---|---|
404 |
ResourceNotFound |
The Resource ({name}) could not be found in Stack {stack}. |
The error message returned because the specified resource does not exist in the stack. name indicates the resource name. stack indicates the stack name or ID. |
404 |
StackNotFound |
The Stack ({name}) could not be found. |
The error message returned because the stack does not exist. name indicates the name or ID of the stack. |