You can call this operation to query the drift information of resources in a specified stack.

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 ListStackResourceDrifts

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

RegionId String Yes cn-hangzhou

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

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

The ID of the stack.

MaxResults Long No 50

The maximum number of results to be returned with a single call when the NextToken parameter is used for the query.

Valid values: 1 to 100.

Default value: 50.

ResourceDriftStatus.N RepeatList No MODIFIED

The drift status of the resource. Valid values:

  • DELETED: The actual configuration of the resource differs from its expected template configuration because the resource has been deleted.
  • MODIFIED: The actual configuration of the resource differs from its expected template configuration.
  • NOT_CHECKED: ROS has not checked whether the actual configuration of the resource differs from its expected template configuration.
  • IN_SYNC: The actual configuration of the resource matches its expected template configuration.
NextToken String No AAAAAdDWBF2****w==

The query token. Set this parameter to the NextToken value returned in the last API call.

Response parameters

Parameter Type Example Description
NextToken String AAAAAdDWBF2****w==

The query token value returned in this call.

RequestId String B288A0BE-D927-4888-B0F7-B35EF84B6E6F

The ID of the request.

ResourceDrifts Array

An array of resource drifts.

ActualProperties String {"ScalingRuleName": "test1"}

The actual resource properties in JSON format.

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

The time when the resource drift detection operation was initiated.

ExpectedProperties String {"ScalingRuleName": "test2"}

The resource properties as defined in the template, in JSON format.

LogicalResourceId String ScalingRule

The logical ID of the resource as defined in the template.

PhysicalResourceId String asr-2ze4zzc3kf9yz1kd****

The physical ID of the resource.

PropertyDifferences Array

The property differences of the resource.

ActualValue String test1

The actual value of the resource property.

DifferenceType String NOT_EQUAL

The drift type of the resource property. Valid values:

  • ADD: The value has been added to a resource property whose data type was Array or List.
  • REMOVE: The property has been deleted from the current resource configuration.
  • NOT_EQUAL: The current property value differs from the expected value defined in the stack template.
ExpectedValue String test2

The expected value of the resource property as defined in the template.

PropertyPath String /ScalingRuleName

The path of the resource property.

ResourceDriftStatus String MODIFIED

The drift status of the resource. Valid values:

  • DELETED: The actual configuration of the resource differs from its expected template configuration because the resource had been deleted.
  • MODIFIED: The actual configuration of the resource differs from its expected template configuration.
  • NOT_CHECKED: ROS has not checked whether the actual configuration of the resource differs from its expected template configuration.
  • IN_SYNC: The actual configuration of the resource matches its expected template configuration.
ResourceType String ALIYUN::ESS::ScalingRule

The type of the resource.

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

The ID of the stack.

Examples

Sample requests

http(s)://ros.aliyuncs.com/? Action=ListStackResourceDrifts
&RegionId=cn-hangzhou
&StackId=4a6c9851-3b0f-4f5f-b4ca-a14bf691****
&<Common request parameters>

Sample success responses

XML format

<ListStackResourceDriftsResponse>
      <NextToken>AAAAAdDWBF2****w==</NextToken>
      <ResourceDrifts>
            <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>
      </ResourceDrifts>
      <RequestId>8625BB3E-2950-4F3E-A713-5458DB5CD874</RequestId>
</ListStackResourceDriftsResponse>

JSON format

{
    "NextToken": "AAAAAdDWBF2****w==",
    "ResourceDrifts": [
        {
            "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****"
        }
    ],
    "RequestId": "8625BB3E-2950-4F3E-A713-5458DB5CD874"
}

Error codes

For more information about error codes, visit API Error Center.

HttpCode

Error code

Error message

Description

400

StackDriftDetectionExpired

The stack drift detection of next token is expired, a new stack drift detection ({ID}) has already completed, please query from the very beginning again.

The error message returned because a new drift detection has been completed. Perform another query. ID indicates the drift detection ID.

400

StackDriftDetectionNotAvailable

There is no complete drift detection for stack ({ID}).

The error message returned because no drift detection has been completed on the stack. ID indicates the stack ID.

404

StackNotFound

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

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