Modifies a rule.

The sample request in this topic shows you how to change the risk level specified for the cr-a260626622af0005**** rule to 3, which indicates low risk level.

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 UpdateConfigRule

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

ConfigRuleId String Yes cr-a260626622af0005****

The ID of the rule.

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

Description String No If the resource has all the specified tags, the configuration is considered compliant. You can define up to six groups of tags.

The description of the rule.

InputParameters Map No null

The input parameters of the rule.

MaximumExecutionFrequency String No One_Hour

The intervals at which the rule is triggered. Valid values:

  • One_Hour: 1 hour.
  • Three_Hours: 3 hours.
  • Six_Hours: 6 hours.
  • Twelve_Hours: 12 hours.
  • TwentyFour_Hours: 24 hours. This is the default value.
Note This parameter is required if the ConfigRuleTriggerTypes parameter is set to ScheduledNotification.
ResourceTypesScope Array of String No ACS::ECS::Instance

The type of the resource to be evaluated by the rule. Separate multiple resource types with commas (,).

RiskLevel Integer No 3

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

  • 1: high risk level
  • 2: medium risk level
  • 3: low risk level
ClientToken String No 1594295238-f9361358-5843-4294-8d30-b5183fac****

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

RegionIdsScope String No cn-hangzhou

The ID of the region to which the rule applies. Separate multiple region IDs with commas (,).

Note This parameter applies only to a managed rule.
ExcludeResourceIdsScope String No lb-t4nbowvtbkss7t326****

The ID of the resource to be excluded from the compliance evaluations performed by the rule. Separate multiple resource IDs with commas (,).

Note This parameter applies only to a managed rule.
ConfigRuleTriggerTypes String No ConfigurationItemChangeNotification

The trigger type of the rule. Valid values:

  • ConfigurationItemChangeNotification: The rule is triggered by configuration changes.
  • ScheduledNotification: The rule is periodically triggered.
Note This parameter applies only to a custom rule.
ResourceGroupIdsScope String No rg-aekzc7r7rhx****

The ID of the resource group to which the rule applies. Separate multiple resource group IDs with commas (,).

Note This parameter applies only to a managed rule.
TagKeyScope String No ECS

The tag key used to filter resources. The rule applies only to the resources with the specified tag key.

Note This parameter applies only to a managed rule. You must set the TagKeyScope and TagValueScope parameters at the same time.
TagValueScope String No test

The tag value used to filter resources. The rule applies only to the resources with the specified tag value.

Note This parameter applies only to a managed rule. You must set the TagKeyScope and TagValueScope parameters at the same time.
ConfigRuleName String No required-tags

The name of the rule.

For more information about how to query the name of a rule, see ListAggregateConfigRules.

TagKeyLogicScope String No AND

The logical relationship among the tag keys if you specify multiple tag keys by using the TagKeyScope parameter. For example, if you set the TagKeyScope parameter to ECS,OSS and set the TagKeyLogicScope parameter to AND, the rule applies to resources with both the ECS and OSS tag keys. Valid values:

  • AND: the logical relationship of AND
  • OR: the logical relationship of OR

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

Response parameters

Parameter Type Example Description
ConfigRuleId String cr-a260626622af0005****

The ID of the rule.

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

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=UpdateConfigRule
&ConfigRuleId=cr-a260626622af0005****
&RiskLevel=3
&<Common request parameters>

Sample success responses

XML format

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

<UpdateConfigRuleResponse>
    <ConfigRuleId>cr-a260626622af0005****</ConfigRuleId>
    <RequestId>6EC7AED1-172F-42AE-9C12-295BC2ADB751</RequestId>
</UpdateConfigRuleResponse>

JSON format

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

{
  "ConfigRuleId" : "cr-a260626622af0005****",
  "RequestId" : "6EC7AED1-172F-42AE-9C12-295BC2ADB751"
}

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 existing rules reaches the upper limit.
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 name already exists.
404 AccountNotExisted Your account does not exist. The error message returned because the specified 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.