Queries the compliance evaluation results based on rules in a compliance package.

In this topic, the cp-541e626622af0087**** compliance package is used as an example. The return result shows a total of one rule against which specific resources are evaluated as compliant.

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 GetConfigRuleComplianceByPack

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

CompliancePackId String Yes cp-541e626622af0087****

The ID of the compliance package.

For more information about how to obtain the ID of a compliance package, see ListCompliancePacks.

For information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
RequestId String 6EC7AED1-172F-42AE-9C12-295BC2ADB751

The ID of the request.

ConfigRuleComplianceResult Object

The information about the compliance evaluation results returned.

CompliancePackId String cp-541e626622af0087****

The ID of the compliance package.

NonCompliantCount Integer 0

The number of rules against which specific resources are evaluated as non-compliant.

ConfigRuleCompliances Array of ConfigRuleCompliances

The rule enabled in the compliance package and the compliance evaluation result returned by the rule.

ComplianceType String COMPLIANT

The compliance evaluation result. Valid values:

  • COMPLIANT: The relevant resources are evaluated as compliant.
  • NON_COMPLIANT: The relevant resources are evaluated as non-compliant.
  • NOT_APPLICABLE: The rule does not apply to your resources.
  • INSUFFICIENT_DATA: No resource data is available.
ConfigRuleName String eip-bandwidth-limit

The name of the rule enabled in the compliance package.

ConfigRuleId String cr-fdc8626622af00f9****

The ID of the rule enabled in the compliance package.

TotalCount Integer 1

The total number of rules enabled in the compliance package.

Examples

Sample requests

http(s)://[Endpoint]/?Action=GetConfigRuleComplianceByPack
&CompliancePackId=cp-541e626622af0087****
&<Common request parameters>

Sample success responses

XML format

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

<GetConfigRuleComplianceByPackResponse>
	<RequestId>C6B0C0A8-3245-48F1-AEAB-BC1A446E99D0</RequestId>
	<ConfigRuleComplianceResult>
		<CompliancePackId>cp-541e626622af0087****</CompliancePackId>
		<ConfigRuleCompliances>
			<ConfigRuleId>cr-fdc8626622af00f9****</ConfigRuleId>
			<ComplianceType>COMPLIANT</ComplianceType>
			<ConfigRuleName>eip-bandwidth-limit</ConfigRuleName>
		</ConfigRuleCompliances>
		<TotalCount>1</TotalCount>
		<NonCompliantCount>0</NonCompliantCount>
	</ConfigRuleComplianceResult>
</GetConfigRuleComplianceByPackResponse>

JSON format

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

{
  "RequestId" : "C6B0C0A8-3245-48F1-AEAB-BC1A446E99D0",
  "ConfigRuleComplianceResult" : {
    "CompliancePackId" : "cp-541e626622af0087****",
    "ConfigRuleCompliances" : [ {
      "ConfigRuleId" : "cr-fdc8626622af00f9****",
      "ComplianceType" : "COMPLIANT",
      "ConfigRuleName" : "eip-bandwidth-limit"
    } ],
    "TotalCount" : 1,
    "NonCompliantCount" : 0
  }
}

Error codes

HTTP status code Error code Error message Description
400 Invalid.CompliancePackId.Value The specified CompliancePackId does not exist. The error message returned because the specified compliance package ID does not exist.
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.