All Products
Search
Document Center

PolarDB:ModifyMaskingRules

Last Updated:Aug 06, 2025

Modifies the configuration of existing data masking rules or adds new one.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that support authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

polardb:ModifyMaskingRules

update

*DBCluster

acs:polardb:{#regionId}:{#accountId}:{#resource-type}/{#resource-id}

None

None

Request parameters

Parameter

Type

Required

Description

Example

DBClusterId

string

Yes

The cluster ID.

Note

You can call the DescribeDBClusters operation to query detailed information about all clusters under your account, including cluster IDs.

pc-*****************

RuleName

string

No

The name of the data masking rule. Specify only one rule name at a time.

Note
  • You can call the DescribeMaskingRules operation to view details about all data masking rules for the target cluster, including rule names.

  • If the specified rule name does not exist in the current cluster, the system automatically creates a new one based on the name and the RuleConfig value.

testrule

RuleConfig

string

No

The JSON string of configuration parameters and their values for the data masking rule to be modified. All parameter values are of the string type, for 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"]}. The parameters include the following:

  • "auto": Required. Indicates support for dynamic data masking algorithms.

  • "databases": Optional. The names of databases to which the current rule applies. You can specify multiple database names separated by commas (,). If this parameter is left empty, the rule applies to all databases in the current cluster.

  • "tables": Optional. The names of tables to which the current rule applies. You can specify multiple table names separated by commas (,). If this parameter is left empty, the rule applies to all tables in the current cluster.

  • "columns": Required. The names of fields to which the current rule applies. You can specify multiple field names separated by commas (,).

  • "description": Optional. The description of the data masking rule. The description cannot exceed 64 characters.

  • "enabled": Required. Enables or disables the target data masking rule. Valid values: true (enable) or false (disable).

  • "applies_to": The names of database accounts to which the current rule applies. You can specify multiple database account names separated by commas (,).

  • "exempted": The names of database accounts to which the current rule does not apply. You can specify multiple database account names separated by commas (,).

Note
  • If you specify the RuleName parameter, the RuleConfig parameter is required.

  • You must specify 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"]}

RuleNameList

string

No

The list of data masking rule names. You can specify one or more rule names separated by commas (,).

Note

You must specify either the RuleName parameter or the RuleNameList parameter.

testrule

Enable

string

No

Specifies whether to enable or disable the target data masking rule. Valid values:

  • true: enables the rule.

  • false: disables the rule.

Note

This parameter takes effect only when the RuleNameList parameter is specified.

true

RuleVersion

string

No

The version of the data masking rule. Valid values:

  • v1 (default)

  • v2

v2

InterfaceVersion

string

No

Modifies the masking encryption rule. Valid values:

v1: Modifies the data masking rule. v2: Modifies the encryption rule.

v1

MaskingAlgo

string

No

DefaultAlgo

string

No

Response parameters

Parameter

Type

Description

Example

object

RequestId

string

The request ID.

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

Message

string

The returned message of the request.

Note

When the request is successful, this parameter returns "Successful". When the request fails, this parameter returns exception information such as error codes.

Message

Success

boolean

The result of the request. Valid values:

  • true: The request was successful.

  • false: The request failed.

true

Examples

Success response

JSON format

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

Error codes

HTTP status code

Error code

Error message

Description

404

InvalidDBClusterId.Malformed

The specified parameter DBClusterId is not valid.

The specified DBClusterId parameter is invalid.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.