Adds one or more rules in an account group to a compliance package.

The sample request in this topic shows you how to add the cr-6cc4626622af00e7**** rule in the ca-75b4626622af00c3**** account group to the cp-5bb1626622af00bd**** compliance package.

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 AttachAggregateConfigRuleToCompliancePack

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

ConfigRuleIds String Yes cr-a124626622af00e7****

The ID of the rule to be added to the compliance package. Separate multiple rule IDs with commas (,).

For more information about how to obtain the ID of a rule, see ListAggregateConfigRules.

CompliancePackId String Yes cp-0453626622af0020****

The ID of the compliance package to which you want to add the rule.

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

AggregatorId String Yes ca-75b4626622af00c3****

The ID of the account group.

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

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
RequestId String DE72B7B5-D0EA-15E6-A359-EDECBB9BDFA3

The ID of the request.

OperateRuleResult Object

The results of the operations to add one or more rules.

OperateRuleItemList Array of OperateRuleItem

The result of the operation to add the rule.

ErrorCode String ConfigRuleNotExists

The error code.

  • This parameter is empty if the rule is added to the compliance package.
  • An error code is returned if the rule fails to be added to the compliance package. For more information about error codes, visit the API Error Center.
Success Boolean true

Indicates whether the operation is successful. Valid values:

  • true: The operation is successful.
  • false: The operation fails.
ConfigRuleId String cr-a124626622af00e7****

The ID of the rule that is added to the compliance package.

Examples

Sample requests

http(s)://[Endpoint]/?Action=AttachAggregateConfigRuleToCompliancePack
&ConfigRuleIds=cr-a124626622af00e7****
&CompliancePackId=cp-0453626622af0020****
&AggregatorId=ca-75b4626622af00c3****
&<Common request parameters>

Sample success responses

XML format

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

<AttachAggregateConfigRuleToCompliancePackResponse>
    <RequestId>DE72B7B5-D0EA-15E6-A359-EDECBB9BDFA3</RequestId>
    <OperateRuleResult>
        <OperateRuleItemList>
            <ErrorCode/>
            <Success>true</Success>
            <ConfigRuleId>cr-a124626622af00e7****</ConfigRuleId>
        </OperateRuleItemList>
    </OperateRuleResult>
</AttachAggregateConfigRuleToCompliancePackResponse>

JSON format

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

{
  "RequestId" : "DE72B7B5-D0EA-15E6-A359-EDECBB9BDFA3",
  "OperateRuleResult" : {
    "OperateRuleItemList" : [ {
      "ErrorCode" : "",
      "Success" : true,
      "ConfigRuleId" : "cr-a124626622af00e7****"
    } ]
  }
}

Error codes

HTTP status code Error code Error message Description
400 NoPermission You are not authorized to perform this operation. The error message returned because you are not authorized to perform the specified operation.
400 Invalid.ConfigRuleIds.SizeExceed The maximum number of ConfigRuleIds cannot exceed 20. The error message returned because the number of specified rule IDs exceeds 20.
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.