Creates or modifies a rule.

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 PutConfigRule

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

ConfigRuleName String Yes rds-cpu-min-count-limit-rd

The name of the rule.

RiskLevel Integer Yes 1

The risk level of the resources that are not compliant with the rule. Valid values:

  • 1: critical
  • 2: warning
  • 3: info
ScopeComplianceResourceTypes String Yes ["ACS::RDS::DBInstance"]

The types of the resources to be evaluated against the rule.

SourceDetailMessageType String Yes ConfigurationItemChangeNotification

The trigger type of the rule. Valid values:

  • ConfigurationItemChangeNotification: The rule is triggered upon configuration changes.
  • ScheduledNotification: The rule is triggered as scheduled.
SourceIdentifier String Yes rds-cpu-min-count-limit

The identifier of the rule.

  • For a managed rule, the value is the name of the managed rule.
  • For a custom rule, the value is the ARN of the custom rule.
SourceOwner String Yes ALIYUN

Specifies whether you or Alibaba Cloud owns and manages the rule. Valid values:

  • CUSTOM_FC: The rule is a custom rule and you own the rule.
  • ALIYUN: The rule is a managed rule and Alibaba Cloud owns the rule.
ConfigRuleId String No cr-2a914fcf617e00c9****

The ID of the rule.

Description String No The evaluation result is considered compliant if the number of CPU cores of each ApsaraDB for RDS instance under your account is greater than or equal to the threshold that you set.

The description of the rule.

InputParameters String No {"cpuCount": "2"}

The settings of the input parameters for the rule.

SourceMaximumExecutionFrequency String No Twelve_Hours

The frequency of the compliance evaluations. Valid values:

  • One_Hour
  • Three_Hours
  • Six_Hours
  • Twelve_Hours
  • TwentyFour_Hours
ScopeComplianceResourceId String No vpc-6weoy5flv41pj4wvr****

The ID of the resource to be evaluated.

  • If you do not set this parameter, the rule evaluates resources of all the types specified by ScopeComplianceResourceTypes.
  • If you specify a resource ID, the rule evaluates the resource identified by the ID.
ClientToken String No TF-dfc5********************3dc

The client token that is used to ensure the idempotence of the request. You can use the client to generate a token, but you must make sure that it is unique among different requests. The token cannot exceed 64 characters in length and can only contain ASCII characters.

MultiAccount Boolean No false

Specifies whether to create or modify the rule under the member accounts of the current master account. Valid values:

  • true: Create or modify the rule under all the member accounts in the resource directory of the current master account.
  • false: Create or modify the rule under the current master account. This is the default value.
Note If you are using Cloud Config for individuals, ignore this parameter.
MemberId Long No 1234567

The ID of the member account under which the rule is to be created or modified. This parameter is empty by default. This parameter is available only when MultiAccount is set to true.

  • When MemberId is left empty, the system creates or modifies the rule under the current master account and all its member accounts.
  • When MemberId is set to a specific value, the system creates or modifies the rule under the specified member account.
Note If you are using Cloud Config for individuals, ignore this parameter.

Response parameters

Parameter Type Example Description
ConfigRuleId String cr-76ac4fcfb57e00c9****

The ID of the rule.

RequestId String A7A0FFF8-0B44-40C6-8BBF-3A185EFDF3F7

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/? Action=PutConfigRule
&ConfigRuleName=rds-cpu-min-count-limit-rd
&RiskLevel=1
&ScopeComplianceResourceTypes=["ACS::RDS::DBInstance"]
&SourceDetailMessageType=ConfigurationItemChangeNotification
&SourceIdentifier=rds-cpu-min-count-limit
&SourceOwner=ALIYUN
&<Common request parameters>

Sample success responses

XML format

<PutConfigRuleResponse>
      <ConfigRuleId>cr-76ac4fcfb57e00c9****</ConfigRuleId>
      <RequestId>A7A0FFF8-0B44-40C6-8BBF-3A185EFDF3F7</RequestId>
</PutConfigRuleResponse>

JSON format

{
    "ConfigRuleId": "cr-76ac4fcfb57e00c9****",
    "RequestId": "A7A0FFF8-0B44-40C6-8BBF-3A185EFDF3F7"
}

Error codes

HTTP status code Error code Error message Description
400 ExceedMaxRuleCount The maximum number of rules is exceeded. The error message returned because the number of created rules has reached the upper limit.
503 ServiceUnavailable The request has failed due to a temporary failure of the server. The error message returned because the service is unavailable.
400 ConfigRuleNotExists The ConfigRule does not exist. The error message returned because the specified rule does not exist.
400 ConfigRuleExists The ConfigRule already exists. The error message returned because the specified rule already exists.
404 AccountNotExisted Your account does not exist. The error message returned because your account does not exist.

For a list of error codes, visit the API Error Center.