Queries the compliance evaluation results of resources monitored by a compliance package in an account group.

The sample request in this topic shows you how to query the compliance evaluation results of resources monitored by the cp-fdc8626622af00f9**** compliance package in the ca-f632626622af0079****account group. The return result shows that the total number of monitored resources is 10 and the number of non-compliant resources is 7.

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 GetAggregateResourceComplianceByPack

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

CompliancePackId String Yes cp-fdc8626622af00f9****

The ID of the compliance package.

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

AggregatorId String Yes ca-f632626622af0079****

The ID of the account group.

For more information about how to obtain the ID of an account group, see ListAggregators.

For information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
ResourceComplianceResult Object

The compliance evaluation results of resources monitored by the compliance package.

CompliancePackId String cp-fdc8626622af00f9****

The ID of the compliance package.

NonCompliantCount Integer 7

The number of non-compliant resources.

TotalCount Integer 10

The total number of monitored resources.

RequestId String 6EC7AED1-172F-42AE-9C12-295BC2ADB751

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=GetAggregateResourceComplianceByPack
&CompliancePackId=cp-fdc8626622af00f9****
&AggregatorId=ca-f632626622af0079****
&Common request parameters

Sample success responses

XML format

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

<GetAggregateResourceComplianceByPackResponse>
    <ResourceComplianceResult>
        <CompliancePackId>cp-fdc8626622af00f9****</CompliancePackId>
        <NonCompliantCount>7</NonCompliantCount>
        <TotalCount>10</TotalCount>
    </ResourceComplianceResult>
    <RequestId>6EC7AED1-172F-42AE-9C12-295BC2ADB751</RequestId>
</GetAggregateResourceComplianceByPackResponse>

JSON format

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

{
  "ResourceComplianceResult" : {
    "CompliancePackId" : "cp-fdc8626622af00f9****",
    "NonCompliantCount" : 7,
    "TotalCount" : 10
  },
  "RequestId" : "6EC7AED1-172F-42AE-9C12-295BC2ADB751"
}

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.
400 Invalid.AggregatorId.Value The specified AggregatorId is invalid. The error message returned because the specified account group ID does not exist or you are not authorized to use the account group.
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.