All Products
Search
Document Center

PolarDB:ModifyMaskingRules

Last Updated:Mar 21, 2025

Modifies or adds a data masking rule.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
polardb:ModifyMaskingRulesupdate
*DBCluster
acs:polardb:{#regionId}:{#accountId}:{#resource-type}/{#resource-id}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DBClusterIdstringYes

The ID of the cluster.

Note You can call the DescribeDBClusters operation to query the details of the clusters that belong to your Alibaba Cloud account, such as cluster IDs.
pc-*****************
RuleNamestringNo

The name of the data masking rule. You can specify only one rule name at a time.

Note
  • You can call the DescribeMaskingRules operation to query the details of all masking rules for a specified cluster, such as the names of the masking rules.

  • If the rule name does not exist in the cluster, the system automatically creates a masking rule based on the name and the value of RuleConfig.

testrule
RuleConfigstringNo

The parameter that is used to specify the masking rule that you want to modify and the value in the JSON format. All parameter values are of the string type. Example: {"auto": {"databases": ["db1"], "tables": ["tb1"], "columns": ["c1,c2"] }, "description": "This rule will be applied to the columns c1 and c2 in table t1", "enabled": true, "applies_to": ["user"]}. Where,

  • "auto": specifies that the dynamic masking algorithm is supported. This parameter is required.
  • "databases": Optional. The names of databases to which the masking rule is applied. Separate the names with commas (,). If you leave this parameter empty, the masking rule applies to all databases in the cluster.
  • "tables": Optional. The names of tables to which the masking rule is applied. Separate the names with commas (,). If you leave this parameter empty, the rule applies to all tables in the cluster.
  • "columns": Required. The names of fields to which the masking rule is applied. Separate the names with commas (,).
  • "description": Optional. The description of the masking rule. The description is up to 64 characters in length.
  • "enabled": Required. Specifies whether to enable the masking rule. Valid values: true (enable) and false (disable).
  • "applies_to": The names of database accounts to which the masking rule is applied. Separate the names with commas (,).
  • "exempted": The names of database accounts to which the masking rule is not applied. Separate the names with commas (,).
Note
  • If you specify RuleName, RuleConfig parameter is required.

  • You need to select either "applies_to" or "exempted".

{"auto": {"databases": ["db1"], "tables": ["tb1"], "columns": ["c1,c2"] }, "description": "This rule will be applied to the columns c1 and c2 in table t1", "enabled": true, "applies_to": ["user"]}
RuleNameListstringNo

The list of masking rule names. You can specify one or more masking rules at a time. Separate the masking rule names with commas (,).

Note You must specify either the RuleName or RuleNameList parameter.
testrule
EnablestringNo

Specifies whether to enable the specified masking rule. Valid values:

  • true
  • false
Note This parameter is valid only when the RuleNameList parameter is specfied.
true
RuleVersionstringNo

The version of the masking rule. Default value: v1. Valid values:

  • v1
  • v2
v2

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

99B355CE-526C-478B-B730-AD9D7C******
Messagestring

The message that is returned for the request.

Note If the request is successful, Successful is returned. If the request fails, an error message such as an error code is returned.
Message
Successboolean

Indicates whether the request is successful. Valid value:

  • true:
  • false
true

Examples

Sample success responses

JSONformat

{
  "RequestId": "99B355CE-526C-478B-B730-AD9D7C******",
  "Message": "Message",
  "Success": true
}

Error codes

HTTP status codeError codeError messageDescription
404InvalidDBClusterId.MalformedThe specified parameter DBClusterId is not valid.The specified DBClusterId parameter is invalid.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-01-02The Error code has changed. The request parameters of the API has changedView Change Details
2023-09-12The Error code has changedView Change Details