调用GetStackResource接口查询某个资源栈的资源。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
Action String GetStackResource

要执行的操作,取值:GetStackResource。

LogicalResourceId String WebServer

资源逻辑ID,即模板中资源的名称。

RegionId String cn-hangzhou

资源栈所属的地域ID。您可以调用DescribeRegions查看最新的阿里云地域列表。

StackId String 4a6c9851-3b0f-4f5f-b4ca-a14bf691****

资源栈ID。

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

保证请求的幂等性。该值由客户端生成,并且必须是全局唯一的。

长度不超过64个字符,可包含英文字母、数字、短划线(-)和下划线(_)。

更多详情,请参见如何保证幂等性

ShowResourceAttributes Boolean true

是否查询资源属性。

返回数据

名称 类型 示例值 描述
Status String CREATE_COMPLETE

资源状态。取值:

  • CREATE_COMPLETE
  • CREATE_FAILED
  • CREATE_IN_PROGRESS
  • UPDATE_IN_PROGRESS
  • UPDATE_FAILED
  • UPDATE_COMPLETE
  • DELETE_IN_PROGRESS
  • DELETE_FAILED
  • CHECK_IN_PROGRESS
  • CHECK_FAILED
  • CHECK_COMPLETE
  • IMPORT_IN_PROGRESS
  • IMPORT_FAILED
  • IMPORT_COMPLETE
Description String no description

资源描述。

LogicalResourceId String WebServer

资源逻辑ID,即模板中资源的名称。

StackId String efdf5c10-96a5-4fd7-ab89-68e7baa2****

资源栈ID。

StackName String test-describe-resource

资源栈名称。

长度不超过255个字符,必须以数字或英文字母开头,可包含数字、英文字母、短划线(-)和下划线(_)。

StatusReason String state changed

资源状态原因。

PhysicalResourceId String d04af923-e6b7-4272-aeaa-47ec9777****

资源物理ID,即实际资源ID。

ResourceType String ALIYUN::ROS::WaitConditionHandle

资源类型。

CreateTime String 2019-08-01T06:01:23

创建时间。

按照ISO8601标准表示,需使用UTC时间,格式:YYYY-MM-DDThh:mm:ss。

Metadata Map {"key": "value"}

元数据。

UpdateTime String 2019-08-01T06:01:29

更新时间。

按照ISO8601标准表示,需使用UTC时间,格式:YYYY-MM-DDThh:mm:ss。

ResourceAttributes List [ { "ResourceAttributeValue":"curl -Uri \"http://100.100.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\"}", "ResourceAttributeKey":"PowerShellCurlCli" } ]

资源属性列表。

RequestId String B288A0BE-D927-4888-B0F7-B35EF84B6E6

请求ID。

DriftDetectionTime String 2020-02-27T07:47:47

资源栈最近一次成功的偏差检测中资源检测的时间。

ResourceDriftStatus String IN_SYNC

资源栈最近一次成功的偏差检测中的资源的偏差状态。取值:

  • DELETED:资源与预期的模板配置不同,因为资源已被删除。
  • MODIFIED:资源与预期的模板配置不同。
  • NOT_CHECKED:ROS没有检测资源是否与预期的模板配置不同。
  • IN_SYNC:资源的当前配置与其预期的模板配置相匹配。

示例

请求示例

http(s)://ros.aliyuncs.com/?Action=GetStackResource
&RegionId=cn-hangzhou
&StackId=4a6c9851-3b0f-4f5f-b4ca-a14bf691****
&LogicalResourceId=WebServer
&<公共请求参数>

正常返回示例

XML 格式

<GetStackResourceResponse>
		  <CreateTime>2019-08-01T06:01:23</CreateTime>
		  <Description></Description>
		  <LogicalResourceId>WaitConditionHandle</LogicalResourceId>
		  <Metadata></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://100.100.XX.XX/waitcondition?stackname=test-describe-resource\&amp;stackid=efdf5c10-96a5-4fd7-ab89-68e7baa2****\&amp;resource=WaitConditionHandle\&amp;expire=156468****\&amp;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://100.100.XX.XX/waitcondition?stackname=test-describe-resource&amp;stackid=efdf5c10-96a5-4fd7-ab89-68e7baa2****&amp;resource=WaitConditionHandle&amp;expire=156468****&amp;signature=991d910a901a89db6580d74233119960c004****"</ResourceAttributeValue>
		  </ResourceAttributes>
		  <ResourceAttributes>
			    <ResourceAttributeKey>PowerShellCurlCli</ResourceAttributeKey>
			    <ResourceAttributeValue>curl -Uri "http://100.100.XX.XX/waitcondition?stackname=test-describe-resource&amp;stackid=efdf5c10-96a5-4fd7-ab89-68e7baa2****&amp;resource=WaitConditionHandle&amp;expire=156468****&amp;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 格式

{
    "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://100.100.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://100.100.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://100.100.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。