Removes one or more rules from a compliance package.

Prerequisites

One or more rules are added to a compliance package.

Usage notes

The sample request in this topic shows you how to remove the cr-6cc4626622af00e7**** rule from 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 DetachConfigRuleToCompliancePack

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

ConfigRuleIds String Yes cr-6cc4626622af00e7****

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

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

CompliancePackId String Yes cp-5bb1626622af00bd****

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

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

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

Response parameters

Parameter Type Example Description
RequestId String 1AC7AED1-172F-42AE-9C12-295BC2ADB12A

The ID of the request.

OperateRuleResult Object

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

OperateRuleItemList Array of OperateRuleItem

The result of the operation to remove the rule.

ErrorCode String ConfigRuleNotExists

The error code.

  • This parameter is empty if the rule is removed from the compliance package.
  • An error code is returned if the rule fails to be removed from 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-6cc4626622af00e7****

The ID of the rule that is removed from the compliance package.

Examples

Sample requests

http(s)://[Endpoint]/?Action=DetachConfigRuleToCompliancePack
&ConfigRuleIds=cr-6cc4626622af00e7****
&CompliancePackId=cp-5bb1626622af00bd****
&<Common request parameters>

Sample success responses

XML format

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

<DetachConfigRuleToCompliancePackResponse>
    <RequestId>1AC7AED1-172F-42AE-9C12-295BC2ADB12A</RequestId>
    <OperateRuleResult>
        <OperateRuleItemList>
            <ErrorCode/>
            <Success>true</Success>
            <ConfigRuleId>cr-6cc4626622af00e7****</ConfigRuleId>
        </OperateRuleItemList>
    </OperateRuleResult>
</DetachConfigRuleToCompliancePackResponse>

JSON format

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

{
  "RequestId" : "1AC7AED1-172F-42AE-9C12-295BC2ADB12A",
  "OperateRuleResult" : {
    "OperateRuleItemList" : [ {
      "ErrorCode" : "",
      "Success" : true,
      "ConfigRuleId" : "cr-6cc4626622af00e7****"
    } ]
  }
}

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.