Queries the compliance evaluation result of resources based on a rule.
Operation Description
This topic provides an example on how to query the compliance evaluation result of resources based on a rule whose ID is cr-cac56457e0d900d3****
. The returned result indicates that the i-hp3e4kvhzqn2s11t****
resource is evaluated as NON_COMPLIANT
by using the rule. The resource is an Elastic Compute Service (ECS) instance.
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Association operation |
---|---|---|---|---|
config:ListConfigRuleEvaluationResults | List |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ComplianceType | string | No | The compliance evaluation result of resources. Valid values:
| NON_COMPLIANT |
NextToken | string | No | The token that is used to initiate the next request. If the response to the current request is truncated, this token is used to initiate another request and obtain the remaining entries.`` | IWBjqMYSy0is7zSMGu16**** |
MaxResults | integer | No | The maximum number of entries to return in a request. Valid values: 1 to 100. | 10 |
ConfigRuleId | string | No | The ID of the rule. For more information about how to obtain the ID of a rule, see ListConfigRules. | cr-cac56457e0d900d3**** |
CompliancePackId | string | No | The ID of the compliance package. For more information about how to obtain the ID of a compliance package, see ListCompliancePacks. | cp-f1e3326622af00cb**** |
Regions | string | No | The ID of the region where the resources that you want to evaluate reside. Separate multiple region IDs with commas (,). | cn-shanghai |
ResourceTypes | string | No | The type of the resources that you want to evaluate. Separate multiple resource types with commas (,). | ACS::ECS::Instane |
ResourceGroupIds | string | No | The ID of the resource group to which the resources that you want to evaluate belong. Separate multiple resource group IDs with commas (,). | rg-aek2indxn3g**** |
For more information about common request parameters, see Common parameters.
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "2A4A33BD-8186-4D60-91B9-42174EED75B5",
"EvaluationResults": {
"NextToken": "IWBjqMYSy0is7zSMGu16****",
"MaxResults": 10,
"EvaluationResultList": [
{
"RiskLevel": 1,
"ComplianceType": "NON_COMPLIANT",
"ResultRecordedTimestamp": 1622802307150,
"Annotation": "{\\\"configuration\\\":\\\"\\\",\\\"desiredValue\\\":\\\"\\\",\\\"operator\\\":\\\"IsNotStringEmpty\\\",\\\"property\\\":\\\"$.KeyPairName\\\",\\\"reason\\\":\\\"No property contains.\\\"}",
"ConfigRuleInvokedTimestamp": 1622802307081,
"InvokingEventMessageType": "ConfigurationItemChangeNotification",
"EvaluationResultIdentifier": {
"OrderingTimestamp": 1622802307081,
"EvaluationResultQualifier": {
"ResourceOwnerId": 0,
"ConfigRuleArn": "acs:config::120886317861****:rule/cr-cac56457e0d900d3****",
"ResourceType": "ACS::ECS::Instance",
"ConfigRuleName": "",
"ResourceId": "i-hp3e4kvhzqn2s11t****",
"ConfigRuleId": "cr-cac56457e0d900d3****",
"ResourceName": "iZuf6j91r34rnwawoox****",
"RegionId": "cn-hangzhou",
"CompliancePackId": "cp-bcc33457e0d900d5****",
"IgnoreDate": "2022-06-01"
}
},
"RemediationEnabled": true
}
]
}
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | NoPermission | You are not authorized to perform this operation. | You are not authorized to perform this operation. |
404 | CloudConfigServiceRoleNotExisted | The CloudConfigServiceRole does not exist. | The CloudConfig service role does not exist. |
404 | AccountNotExisted | Your account does not exist. | The specified account does not exist. |
503 | ServiceUnavailable | The request has failed due to a temporary failure of the server. | The request has failed due to a temporary failure of the server. |
For a list of error codes, visit the Service error codes.