ModifyMaskingRules

更新时间:
复制 MD 格式

Modifies or creates data masking rules.

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 supports 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 the details of all clusters in your account, including cluster IDs.

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

RuleName

string

No

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 data masking rules in the target cluster, including rule names.

  • If a rule with the specified name does not exist, the system creates a new one based on the provided RuleConfig.

testrule

RuleConfig

string

No

A JSON string that specifies the rule configuration. 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 JSON string includes the following fields:

  • "auto": Required. The object that contains the configuration for the dynamic data masking algorithm.

  • "databases": Optional. The databases to which the rule applies. Separate multiple database names with a comma (,). If this parameter is omitted, the rule applies to all databases in the cluster.

  • "tables": Optional. The tables to which the rule applies. Separate multiple table names with a comma (,). If this parameter is omitted, the rule applies to all tables in the cluster.

  • "columns": Required. The columns to which the rule applies. Separate multiple column names with a comma (,).

  • "description": Optional. The rule description, up to 64 characters in length.

  • "enabled": Required. Specifies whether the data masking rule is enabled. Valid values: true (enabled) and false (disabled).

  • "applies_to": The database accounts to which the rule applies. Separate multiple account names with a comma (,).

  • "exempted": The database accounts that are exempt from the rule. Separate multiple account names with a comma (,).

Note
  • If you specify the RuleName parameter, you must also specify the RuleConfig parameter.

  • 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

A comma-separated list of data masking rule names.

Note

You must specify either the RuleName or RuleNameList parameter.

testrule

Enable

string

No

Enables or disables the specified data masking rules. Valid values:

  • true: enables the specified rules.

  • false: disables the specified rules.

Note

This parameter applies 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

The type of rule to modify. Valid values:

v1: Modifies a data masking rule. v2: Modifies an encryption rule.

v1

MaskingAlgo

string

No

The masking algorithm. Specify one or more algorithms and their parameters. Format: [{ "name": "algorithm_name", "params": {"key": "value"} }]

[{ "name": "aes-128-gcm" }]

DefaultAlgo

string

No

The default algorithm.

Note

You must specify either MaskingAlgo or DefaultAIgo.

aes-128-gcm

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

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

Message

string

The response message.

Note

If the request is successful, Successful is returned. If the request fails, an error message is returned.

Message

Success

boolean

Indicates whether the request was successful. Valid values:

  • true

  • false

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.