调用GetStackResource接口查询某个资源栈的资源。
本文将提供一个示例,为您查询杭州地域资源栈ID为4a6c9851-3b0f-4f5f-b4ca-a14bf691****的资源栈中名为WebServer的资源详情。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
| 名称 | 类型 | 是否必选 | 示例值 | 描述 |
|---|---|---|---|---|
| Action | String | 是 | GetStackResource |
要执行的操作,取值:GetStackResource。 |
| StackId | String | 是 | 4a6c9851-3b0f-4f5f-b4ca-a14bf691**** |
资源栈ID。 |
| ClientToken | String | 否 | 123e4567-e89b-12d3-a456-42665544**** |
保证请求的幂等性。该值由客户端生成,并且必须是全局唯一的。 长度不超过64个字符,可包含英文字母、数字、短划线(-)和下划线(_)。 更多信息,请参见如何保证幂等性。 |
| RegionId | String | 是 | cn-hangzhou |
资源栈所属的地域ID。您可以通过调用DescribeRegions接口查看最新的阿里云地域列表。 |
| ShowResourceAttributes | Boolean | 否 | true |
是否查询资源属性。取值:
|
| LogicalResourceId | String | 是 | WebServer |
资源逻辑ID,即模板中资源的名称。 |
| ResourceAttributes.N | String | 否 | InstanceId |
指定要查询的资源输出属性名称。 说明 N最大值为20。
|
关于公共请求参数的详情,请参见公共参数。
返回数据
| 名称 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| Status | String | CREATE_COMPLETE |
资源状态。取值:
|
| Description | String | no description |
资源描述。 |
| RequestId | String | B288A0BE-D927-4888-B0F7-B35EF84B6E6 |
请求ID。 |
| StatusReason | String | state changed |
资源状态原因。 |
| PhysicalResourceId | String | d04af923-e6b7-4272-aeaa-47ec9777**** |
资源物理ID,即实际资源ID。 |
| CreateTime | String | 2019-08-01T06:01:23 |
创建时间。 按照ISO8601标准表示,需使用UTC时间,格式:YYYY-MM-DDThh:mm:ss。 |
| Metadata | Map |
元数据。 |
|
| ResourceType | String | ALIYUN::ROS::WaitConditionHandle |
资源类型。 |
| 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****"}] |
资源属性列表。 |
| LogicalResourceId | String | WebServer |
资源逻辑ID,即模板中资源的名称。 |
| ResourceDriftStatus | String | IN_SYNC |
资源栈最近一次成功的偏差检测中的资源的偏差状态。取值:
|
| UpdateTime | String | 2019-08-01T06:01:29 |
更新时间。 按照ISO8601标准表示,需使用UTC时间,格式:YYYY-MM-DDThh:mm:ss。 |
| DriftDetectionTime | String | 2020-02-27T07:47:47 |
资源栈最近一次成功的偏差检测中资源检测的时间。 |
| StackName | String | test-describe-resource |
资源栈名称。 长度不超过255个字符,必须以数字或英文字母开头,可包含数字、英文字母、短划线(-)和下划线(_)。 |
| StackId | String | efdf5c10-96a5-4fd7-ab89-68e7baa2**** |
资源栈ID。 |
示例
请求示例
http(s)://ros.aliyuncs.com/?Action=GetStackResource
&RegionId=cn-hangzhou
&StackId=4a6c9851-3b0f-4f5f-b4ca-a14bf691****
&LogicalResourceId=WebServer
&<公共请求参数>
正常返回示例
XML格式
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格式
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"
}
错误码
访问错误中心查看更多错误码。
|
HttpCode |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
|
404 |
ResourceNotFound |
The Resource ({name}) could not be found in Stack {stack}. |
资源栈中不存某资源。name为资源名,stack为资源栈名称或ID。 |
|
404 |
StackNotFound |
The Stack ({name}) could not be found. |
资源栈不存在。name为资源栈名称或ID。 |