调用DetectStackResourceDrift接口对资源进行偏差检测。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | DetectStackResourceDrift |
要执行的操作,取值:DetectStackResourceDrift。 |
LogicalResourceId | String | 是 | ScalingRuleName |
资源名称。 |
RegionId | String | 是 | cn-hangzhou |
资源栈所属的地域ID。您可以调用DescribeRegions查看最新的阿里云地域列表。 |
StackId | String | 是 | 4a6c9851-3b0f-4f5f-b4ca-a14bf691**** |
资源栈ID。 |
ClientToken | String | 否 | 123e4567-e89b-12d3-a456-42665544**** |
保证请求的幂等性。 该值由客户端生成,并且必须是全局唯一的。 长度最大为64个字符,可包含英文字符、数字、短划线(-)和下划线(_)。 更多详情,请参见如何保证幂等性。 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
ActualProperties | String | {"ScalingRuleName": "test1"} |
实际的资源属性,以JSON格式表示。 |
DriftDetectionTime | String | 2020-02-27T07:47:47 |
资源偏差检测时间。 |
ExpectedProperties | String | {"ScalingRuleName": "test2"} |
模板中定义的资源属性,以JSON格式表示。 |
LogicalResourceId | String | ScalingRule |
资源逻辑ID,即模板中资源的名称。 |
PhysicalResourceId | String | asr-2ze4zzc3kf9yz1kd**** |
资源物理ID,即实际资源ID。 |
PropertyDifferences | Array |
资源属性偏差。 |
|
ActualValue | String | test1 |
资源属性的实际取值。 |
DifferenceType | String | NOT_EQUAL |
资源属性的偏差类型。取值:
|
ExpectedValue | String | test2 |
资源属性模板定义值。 |
PropertyPath | String | /ScalingRuleName |
资源属性的路径。 |
RequestId | String | B288A0BE-D927-4888-B0F7-B35EF84B6E6F |
请求ID。 |
ResourceDriftStatus | String | MODIFIED |
资源偏差状态。取值:
|
ResourceType | String | ALIYUN::ESS::ScalingRule |
资源类型。 |
StackId | String | 4a6c9851-3b0f-4f5f-b4ca-a14bf691**** |
资源栈ID。 |
示例
请求示例
http(s)://ros.aliyuncs.com/?Action=DetectStackResourceDrift
&LogicalResourceId=ScalingRuleName
&RegionId=cn-hangzhou
&StackId=4a6c9851-3b0f-4f5f-b4ca-a14bf691****
&<公共请求参数>
正常返回示例
XML
格式
<DetectStackResourceDriftResponse>
<ActualProperties>{"ScalingRuleName": "test1"}</ActualProperties>
<DriftDetectionTime>2020-02-27T07:47:47</DriftDetectionTime>
<ExpectedProperties>{"ScalingRuleName": "test2"}</ExpectedProperties>
<LogicalResourceId>ScalingRule</LogicalResourceId>
<PhysicalResourceId>asr-2ze4zzc3kf9yz1kd****</PhysicalResourceId>
<PropertyDifferences>
<ActualValue>test1</ActualValue>
<DifferenceType>NOT_EQUAL</DifferenceType>
<ExpectedValue>test2</ExpectedValue>
<PropertyPath>/ScalingRuleName</PropertyPath>
</PropertyDifferences>
<ResourceDriftStatus>MODIFIED</ResourceDriftStatus>
<ResourceType>ALIYUN::ESS::ScalingRule</ResourceType>
<StackId>4a6c9851-3b0f-4f5f-b4ca-a14bf691****</StackId>
</DetectStackResourceDriftResponse>
JSON
格式
{
"ActualProperties": "{\"ScalingRuleName\": \"test1\"}",
"DriftDetectionTime": "2020-02-27T07:47:47",
"ExpectedProperties": "{\"ScalingRuleName\": \"test2\"}",
"LogicalResourceId": "ScalingRule",
"PhysicalResourceId": "asr-2ze4zzc3kf9yz1kd****",
"PropertyDifferences": [
{
"ActualValue": "test1",
"DifferenceType": "NOT_EQUAL",
"ExpectedValue": "test2",
"PropertyPath": "/ScalingRuleName"
}
],
"ResourceDriftStatus": "MODIFIED",
"ResourceType": "ALIYUN::ESS::ScalingRule",
"StackId": "4a6c9851-3b0f-4f5f-b4ca-a14bf691****"
}
错误码
访问错误中心查看更多错误码。
HttpCode |
错误码 |
错误信息 |
描述 |
---|---|---|---|
400 |
ResourceDriftDetectionProcessing |
Drift detection of resource {name} is processing. |
已经在对资源进行偏差检测。name为资源名。 |
400 |
ResourceDriftDetectionFailure |
Fail to detect resource {name} drift: {reason} |
资源偏差检测失败。name为资源名,reason为原因。 |
404 |
StackNotFound |
The Stack ({name}) could not be found. |
资源栈不存在。name为资源栈名称或ID。 |
404 |
ResourceNotFound |
The Resource ({name}) could not be found in Stack {stack}. |
资源栈中不存某资源。name为资源名,stack为资源栈名称或ID。 |