Queries the compliance evaluation results of a resource by using the specific rule.
In this topic, the cr-d369626622af008e****
rule is used as an example. The return result shows that a total of 10 resources
are evaluated by the rule and five
of them are evaluated as compliant.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | GetResourceComplianceByConfigRule |
The operation that you want to perform. Set the value to GetResourceComplianceByConfigRule. |
ComplianceType | String | No | COMPLIANT |
The compliance evaluation results to be returned. Valid values:
|
ConfigRuleId | String | Yes | cr-d369626622af008e**** |
The ID of the rule. For more information about how to obtain the ID of a rule, see ListConfigRules. |
For information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
ComplianceResult | Object |
The compliance evaluation results returned. |
|
TotalCount | Long | 10 |
The total number of evaluated resources. |
Compliances | Array of Compliances |
The information about the compliance evaluation. |
|
ComplianceType | String | COMPLIANT |
The compliance evaluation result. Valid values:
|
Count | Integer | 5 |
The number of resources that have the compliance evaluation result. For example, if
the value of the |
RequestId | String | 23306AB1-34E0-468F-BD7B-68D8AEAB753d |
The ID of the request. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=GetResourceComplianceByConfigRule
&ConfigRuleId=cr-d369626622af008e****
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<GetResourceComplianceByConfigRuleResponse>
<ComplianceResult>
<TotalCount>10</TotalCount>
<Compliances>
<ComplianceType>COMPLIANT</ComplianceType>
<Count>5</Count>
</Compliances>
</ComplianceResult>
<RequestId>23306AB1-34E0-468F-BD7B-68D8AEAB753d</RequestId>
</GetResourceComplianceByConfigRuleResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"ComplianceResult" : {
"TotalCount" : 10,
"Compliances" : [ {
"ComplianceType" : "COMPLIANT",
"Count" : 5
} ]
},
"RequestId" : "23306AB1-34E0-468F-BD7B-68D8AEAB753d"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
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.