Queries the compliance timeline of a resource.

The sample request in this topic shows you how to query the compliance timeline of the new-bucket resource that resides in the cn-hangzhou region. The resource is an Object Storage Service (OSS) bucket. The return result shows the following two timestamps on the compliance timeline: 1625200295276 and 1625200228510. The first timestamp indicates 12:31:35 on July 2, 2021 (UTC+8) and the second timestamp indicates 12:30:28 on July 2, 2021 (UTC+8).

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 GetResourceComplianceTimeline

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

ResourceType String Yes ACS::OSS::Bucket

The type of the resource.

For more information about how to obtain the type of a resource, see ListDiscoveredResources.

ResourceId String Yes new-bucket

The ID of the resource.

For more information about how to obtain the ID of a resource, see ListDiscoveredResources.

StartTime Long No 1623211156000

The timestamp that specifies the beginning of the time range to query. By default, Cloud Config retrieves the compliance evaluations in the last 30 days for the specified resource. Unit: milliseconds.

EndTime Long No 1625821156000

The timestamp that specifies the end of the time range to query. The default value is the time when the GetResourceComplianceTimeline operation is called. Unit: milliseconds.

MaxResults Integer No 10

The maximum number of entries to return for a single request. Valid values: 1 to 100.

Region String Yes cn-hangzhou

The ID of the region where the resource resides.

NextToken String No IWBjqMYSy0is7zSMGu16****

The token that is used to initiate the next request. If the response of the current request is truncated, this token is used to initiate another request and obtain the remaining entries.

For information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
RequestId String 8D53A78F-1EB8-4264-A554-72F07E34FAE6

The ID of the request.

ResourceComplianceTimeline Object

The information about the compliance timeline.

NextToken String 5OVS5J4I1/UKTkHV5oNs****

The token that is used to initiate the next request.

MaxResults Integer 10

The maximum number of entries that can be returned for a single request.

ComplianceList Array of ComplianceList

The compliance evaluation records on the compliance timeline.

Tags String {\"\"hc\"\":[\"\"value2\"\"]}

The tags of the resource.

AccountId String 100931896542****

The ID of the Alibaba Cloud account to which the resource belongs.

AvailabilityZone String cn-hangzhou-f

The zone where the resource resides.

ResourceType String ACS::OSS::Bucket

The type of the resource.

ResourceCreateTime Long 1624961112000

The timestamp when the resource was created. Unit: milliseconds.

Region String cn-hangzhou

The ID of the region where the resource resides.

Configuration String {\"Compliance\":{\"complianceType\":\"COMPLIANT\",\"count\":1},\"ConfigRuleList\":[{\"accounId \":100931896542****,\"configRuleId\":\"cr-9524626622af003d****\",\"configRuleArn\":\"acs:config::100931896542****:rule/cr-9524626622af003d****\",\"configRuleName\":\"oss-bucket-public-write-prohibited\",\"complianceType\":\"COMPLIANT\",\"riskLevel\":1,\"annotation\":\"\",\"invokingEventMessageType\":\"ScheduledNotification\"}]}

The information about the rules that evaluated the resource and the compliance evaluation result.

CaptureTime Long 1625200295276

The timestamp when the compliance evaluation was recorded. Unit: milliseconds.

ConfigurationDiff String {\"oss-bucket-public-write-prohibited\":[{\"accountId\":100931896542****,\"configRuleId\":\"cr-965f626622af003d****\",\"configRuleArn\":\"acs:config::100931896542****:rule/cr-965f626622af003d****\",\"configRuleName\":\"oss-bucket-public-write-prohibited\",\"complianceType\":\"COMPLIANT\",\"riskLevel\":1,\"annotation\":\"\",\"invokingEventMessageType\":\"ScheduledNotification\"},{}]}

The details of the configuration change that triggered the compliance evaluation.

ResourceId String new-bucket

The ID of the resource.

ResourceName String new-bucket

The name of the resource.

ResourceStatus String Running

The status of the resource. The parameter value varies with the resource type and may be left empty. Examples:

  • If the ResourceType parameter is set to ACS::ECS::Instance, the resource is an Elastic Compute Service (ECS) instance that has a specific state. In this case, valid values of this parameter include Running and Stopped.
  • If the ResourceType parameter is set to ACS::OSS::Bucket, the resource is an Object Storage Service (OSS) bucket that does not have a specific state. In this case, this parameter is left empty.

Examples

Sample requests

http(s)://[Endpoint]/?Action=GetResourceComplianceTimeline
&ResourceType=ACS::OSS::Bucket
&ResourceId=new-bucket
&Region=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<GetResourceComplianceTimelineResponse>
    <RequestId>8D53A78F-1EB8-4264-A554-72F07E34FAE6</RequestId>
    <ResourceComplianceTimeline>
        <NextToken>5OVS5J4I1/UKTkHV5oNs****</NextToken>
        <ComplianceList>
            <AccountId>100931896542****</AccountId>
            <CaptureTime>1625200295276</CaptureTime>
            <ConfigurationDiff>{\"oss-bucket-public-write-prohibited\":[{\"accountId\":100931896542****,\"configRuleId\":\"cr-965f626622af003d****\",\"configRuleArn\":\"acs:config::100931896542****:rule/cr-965f626622af003d****\",\"configRuleName\":\"oss-bucket-public-write-prohibited\",\"complianceType\":\"COMPLIANT\",\"riskLevel\":1,\"annotation\":\"\",\"invokingEventMessageType\":\"ScheduledNotification\"},{}]}</ConfigurationDiff>
            <Configuration>{\"Compliance\":{\"complianceType\":\"COMPLIANT\",\"count\":1},\"ConfigRuleList\":[{\"accountId\":100931896542****,\"configRuleId\":\"cr-9524626622af003d****\",\"configRuleArn\":\"acs:config::100931896542****:rule/cr-9524626622af003d****\",\"configRuleName\":\"oss-bucket-public-write-prohibited\",\"complianceType\":\"COMPLIANT\",\"riskLevel\":1,\"annotation\":\"\",\"invokingEventMessageType\":\"ScheduledNotification\"}]}</Configuration>
            <ResourceId>new-bucket</ResourceId>
            <ResourceName>new-bucket</ResourceName>
            <AvailabilityZone>cn-hangzhou-f</AvailabilityZone>
            <Region>cn-hangzhou</Region>
            <ResourceType>ACS::OSS::Bucket</ResourceType>
            <ResourceCreateTime>1624961112000</ResourceCreateTime>
            <Tags>{\"\"hc\"\":[\"\"value2\"\"]}</Tags>
        </ComplianceList>
        <ComplianceList>
            <AccountId>100931896542****</AccountId>
            <CaptureTime>1625200228510</CaptureTime>
            <ConfigurationDiff>{\"oss-bucket-public-write-prohibited\":[{},{\"annotation\":\"\",\"complianceType\":\"COMPLIANT\",\"configRuleArn\":\"acs:config::100931896542****:rule/cr-965f626622af003d****\",\"configRuleId\":\"cr-965f626622af003d****\",\"configRuleName\":\"oss-bucket-public-write-prohibited\",\"invokingEventMessageType\":\"ScheduledNotification\",\"riskLevel\":1}]}</ConfigurationDiff>
            <Configuration>{\"Compliance\":{\"complianceType\":\"COMPLIANT\",\"count\":2},\"ConfigRuleList\":[{\"annotation\":\"\",\"complianceType\":\"COMPLIANT\",\"configRuleArn\":\"acs:config::100931896542****:rule/cr-9524626622af003d****\",\"configRuleId\":\"cr-9524626622af003d****\",\"configRuleName\":\"oss-bucket-public-write-prohibited\",\"invokingEventMessageType\":\"ScheduledNotification\",\"riskLevel\":1},{\"annotation\":\"\",\"complianceType\":\"COMPLIANT\",\"configRuleArn\":\"acs:config::100931896542****:rule/cr-965f626622af003d****\",\"configRuleId\":\"cr-965f626622af003d****\",\"configRuleName\":\"oss-bucket-public-write-prohibited\",\"invokingEventMessageType\":\"ScheduledNotification\",\"riskLevel\":1}]}</Configuration>
            <ResourceId>new-bucket</ResourceId>
            <ResourceName>new-bucket</ResourceName>
            <AvailabilityZone>cn-hangzhou-f</AvailabilityZone>
            <Region>cn-hangzhou</Region>
            <ResourceType>ACS::OSS::Bucket</ResourceType>
            <ResourceCreateTime>1624961112000</ResourceCreateTime>
            <Tags>{\"\"hc\"\":[\"\"value2\"\"]}</Tags>
        </ComplianceList>
        <MaxResults>10</MaxResults>
    </ResourceComplianceTimeline>
</GetResourceComplianceTimelineResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "8D53A78F-1EB8-4264-A554-72F07E34FAE6",
  "ResourceComplianceTimeline" : {
    "NextToken" : "5OVS5J4I1/UKTkHV5oNs****",
    "ComplianceList" : [ {
      "AccountId" : "100931896542****",
      "CaptureTime" : 1625200295276,
      "ConfigurationDiff" : "{\"oss-bucket-public-write-prohibited\":[{\"accountId\":100931896542****,\"configRuleId\":\"cr-965f626622af003d****\",\"configRuleArn\":\"acs:config::100931896542****:rule/cr-965f626622af003d****\",\"configRuleName\":\"oss-bucket-public-write-prohibited\",\"complianceType\":\"COMPLIANT\",\"riskLevel\":1,\"annotation\":\"\",\"invokingEventMessageType\":\"ScheduledNotification\"},{}]}",
      "Configuration" : "{\"Compliance\":{\"complianceType\":\"COMPLIANT\",\"count\":1},\"ConfigRuleList\":[{\"accountId\":100931896542****,\"configRuleId\":\"cr-9524626622af003d****\",\"configRuleArn\":\"acs:config::100931896542****:rule/cr-9524626622af003d****\",\"configRuleName\":\"oss-bucket-public-write-prohibited\",\"complianceType\":\"COMPLIANT\",\"riskLevel\":1,\"annotation\":\"\",\"invokingEventMessageType\":\"ScheduledNotification\"}]}",
      "ResourceId" : "new-bucket",
      "ResourceName" : "new-bucket",
      "AvailabilityZone" : "cn-hangzhou-f",
      "Region" : "cn-hangzhou",
      "ResourceType" : "ACS::OSS::Bucket",
      "ResourceCreateTime" : 1624961112000,
      "Tags" : "{\"\"hc\"\":[\"\"value2\"\"]}"
    }, {
      "AccountId" : "100931896542****",
      "CaptureTime" : 1625200228510,
      "ConfigurationDiff" : "{\"oss-bucket-public-write-prohibited\":[{},{\"annotation\":\"\",\"complianceType\":\"COMPLIANT\",\"configRuleArn\":\"acs:config::100931896542****:rule/cr-965f626622af003d****\",\"configRuleId\":\"cr-965f626622af003d****\",\"configRuleName\":\"oss-bucket-public-write-prohibited\",\"invokingEventMessageType\":\"ScheduledNotification\",\"riskLevel\":1}]}",
      "Configuration" : "{\"Compliance\":{\"complianceType\":\"COMPLIANT\",\"count\":2},\"ConfigRuleList\":[{\"annotation\":\"\",\"complianceType\":\"COMPLIANT\",\"configRuleArn\":\"acs:config::100931896542****:rule/cr-9524626622af003d****\",\"configRuleId\":\"cr-9524626622af003d****\",\"configRuleName\":\"oss-bucket-public-write-prohibited\",\"invokingEventMessageType\":\"ScheduledNotification\",\"riskLevel\":1},{\"annotation\":\"\",\"complianceType\":\"COMPLIANT\",\"configRuleArn\":\"acs:config::100931896542****:rule/cr-965f626622af003d****\",\"configRuleId\":\"cr-965f626622af003d****\",\"configRuleName\":\"oss-bucket-public-write-prohibited\",\"invokingEventMessageType\":\"ScheduledNotification\",\"riskLevel\":1}]}",
      "ResourceId" : "new-bucket",
      "ResourceName" : "new-bucket",
      "AvailabilityZone" : "cn-hangzhou-f",
      "Region" : "cn-hangzhou",
      "ResourceType" : "ACS::OSS::Bucket",
      "ResourceCreateTime" : 1624961112000,
      "Tags" : "{\"\"hc\"\":[\"\"value2\"\"]}"
    } ],
    "MaxResults" : 10
  }
}

Error codes

HTTP status code Error code Error message Description
400 NoPermission You are not authorized to perform this operation. The error message returned because you are not authorized to perform the specified operation.
404 AccountNotExisted Your account does not exist. The error message returned because your account does not exist.
503 ServiceUnavailable The request has failed due to a temporary failure of the server. The error message returned because the service is unavailable.

For a list of error codes, visit the API Error Center.