查询指定资源的合规检测历史。合规检测历史是资源的一组合规评估记录,包括合规检测历史上的点和合规检测历史的内容。
接口说明
在配置审计中,每个资源都有属于自己的合规检测历史。当规则被触发评估资源时,产生合规评估记录,持续的合规评估形成了资源的合规检测历史。规则触发方式包括:配置变更、周期执行和手动执行。
本文将提供一个示例,查询地域cn-hangzhou中资源new-bucket(存储空间)的合规检测历史。返回结果显示,资源的合规检测历史为1625200295276(北京时间:2021-07-02 12:31:35)和1625200228510(北京时间:2021-07-02 12:30:28)。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
 调试
        
            调试
        
    
授权信息
| 操作 | 访问级别 | 资源类型 | 条件关键字 | 关联操作 | 
| config:GetResourceComplianceTimeline | list | *全部资源 
 | 无 | 无 | 
请求参数
| 名称 | 类型 | 必填 | 描述 | 示例值 | 
| ResourceType | string | 是 | 资源类型。 关于如何获取类型,请参见 ListDiscoveredResources 。 | ACS::OSS::Bucket | 
| ResourceId | string | 是 | 资源 ID。 关于如何获取资源 ID,请参见 ListDiscoveredResources 。 | new-bucket | 
| StartTime | integer | 否 | 开始时间戳。默认查询发起调用前 30 天的时间。单位:毫秒。 | 1623211156000 | 
| EndTime | integer | 否 | 结束时间戳。默认查询发起调用时的时间。单位:毫秒。 | 1625821156000 | 
| MaxResults | integer | 否 | 单次请求返回结果的最大条数。取值范围:1~100。 | 10 | 
| Region | string | 是 | 地域 ID。 | cn-hangzhou | 
| NextToken | string | 否 | 当请求的返回结果被截断时,您可以使用 | IWBjqMYSy0is7zSMGu16**** | 
关于公共请求参数的详情,请参见公共参数。
返回参数
| 名称 | 类型 | 描述 | 示例值 | 
| object | |||
| RequestId | string | 请求 ID。 | 8D53A78F-1EB8-4264-A554-72F07E34FAE6 | 
| ResourceComplianceTimeline | object | 资源合规检测历史。 | |
| NextToken | string | 查询下一页使用的 Token。 | 5OVS5J4I1/UKTkHV5oNs**** | 
| MaxResults | integer | 单次请求返回结果的最大条数。 | 10 | 
| ComplianceList | array<object> | 资源合规检测历史列表。 | |
| object | |||
| Tags | string | 资源标签。 | {\"\"hc\"\":[\"\"value2\"\"]} | 
| AccountId | string | 资源归属的阿里云账号 ID。 | 100931896542**** | 
| AvailabilityZone | string | 资源可用区。 | cn-hangzhou-f | 
| ResourceType | string | 资源类型。 | ACS::OSS::Bucket | 
| ResourceCreateTime | integer | 创建资源的时间戳。单位:毫秒。 | 1624961112000 | 
| Region | string | 地域 ID。 | cn-hangzhou | 
| Configuration | string | 资源关联的规则列表和规则合规详情。 | {\"Compliance\":{\"complianceType\":\"COMPLIANT\",\"count\":1},\"ConfigRuleList\":[{\"accountId\":100931896542****,\"configRuleId\":\"cr-9524626622af003d****\",\"configRuleArn\":\"acs:config::100931896542****:rule/cr-9524626622af003d****\",\"configRuleName\":\"OSS存储空间ACL禁止公共读写\",\"complianceType\":\"COMPLIANT\",\"riskLevel\":1,\"annotation\":\"\",\"invokingEventMessageType\":\"ScheduledNotification\"}]} | 
| CaptureTime | integer | 记录资源合规评估的时间戳。单位:毫秒。 | 1625200295276 | 
| ConfigurationDiff | string | 触发本次评估的资源变更细节。 | {\"OSS存储空间ACL禁止公共读写\":[{\"accountId\":100931896542****,\"configRuleId\":\"cr-965f626622af003d****\",\"configRuleArn\":\"acs:config::100931896542****:rule/cr-965f626622af003d****\",\"configRuleName\":\"OSS存储空间ACL禁止公共读写\",\"complianceType\":\"COMPLIANT\",\"riskLevel\":1,\"annotation\":\"\",\"invokingEventMessageType\":\"ScheduledNotification\"},{}]} | 
| ResourceId | string | 资源 ID。 | new-bucket | 
| ResourceName | string | 资源名称。 | new-bucket | 
| ResourceStatus | string | 资源状态。资源状态取决于各云服务对其的定义,该参数可能为空。例如: 
 | null | 
示例
正常返回示例
JSON格式
{
  "RequestId": "8D53A78F-1EB8-4264-A554-72F07E34FAE6",
  "ResourceComplianceTimeline": {
    "NextToken": "5OVS5J4I1/UKTkHV5oNs****",
    "MaxResults": 10,
    "ComplianceList": [
      {
        "Tags": "{\\\"\\\"hc\\\"\\\":[\\\"\\\"value2\\\"\\\"]}",
        "AccountId": "100931896542****",
        "AvailabilityZone": "cn-hangzhou-f",
        "ResourceType": "ACS::OSS::Bucket",
        "ResourceCreateTime": 1624961112000,
        "Region": "cn-hangzhou",
        "Configuration": "{\\\"Compliance\\\":{\\\"complianceType\\\":\\\"COMPLIANT\\\",\\\"count\\\":1},\\\"ConfigRuleList\\\":[{\\\"accountId\\\":100931896542****,\\\"configRuleId\\\":\\\"cr-9524626622af003d****\\\",\\\"configRuleArn\\\":\\\"acs:config::100931896542****:rule/cr-9524626622af003d****\\\",\\\"configRuleName\\\":\\\"OSS存储空间ACL禁止公共读写\\\",\\\"complianceType\\\":\\\"COMPLIANT\\\",\\\"riskLevel\\\":1,\\\"annotation\\\":\\\"\\\",\\\"invokingEventMessageType\\\":\\\"ScheduledNotification\\\"}]}",
        "CaptureTime": 1625200295276,
        "ConfigurationDiff": "{\\\"OSS存储空间ACL禁止公共读写\\\":[{\\\"accountId\\\":100931896542****,\\\"configRuleId\\\":\\\"cr-965f626622af003d****\\\",\\\"configRuleArn\\\":\\\"acs:config::100931896542****:rule/cr-965f626622af003d****\\\",\\\"configRuleName\\\":\\\"OSS存储空间ACL禁止公共读写\\\",\\\"complianceType\\\":\\\"COMPLIANT\\\",\\\"riskLevel\\\":1,\\\"annotation\\\":\\\"\\\",\\\"invokingEventMessageType\\\":\\\"ScheduledNotification\\\"},{}]}",
        "ResourceId": "new-bucket",
        "ResourceName": "new-bucket",
        "ResourceStatus": "null"
      }
    ]
  }
}错误码
| HTTP status code | 错误码 | 错误信息 | 描述 | 
|---|---|---|---|
| 400 | NoPermission | You are not authorized to perform this operation. | 您无权执行此操作。 | 
| 404 | AccountNotExisted | Your account does not exist. | |
| 503 | ServiceUnavailable | The request has failed due to a temporary failure of the server. | 服务不可用。 | 
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。