Creates or edits a data masking rule.
Try it now
Test
RAM authorization
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| DesensRules |
array |
Yes |
The collection of masking rules to create or edit. |
|
|
array |
No |
The masking rule information. |
||
| Id |
integer |
No |
The masking rule ID. You can call the DsgDesensPlanQueryList operation to query the ID. |
123 |
| DataType |
string |
No |
The sensitive column type. |
phone |
| RuleName |
string |
Yes |
The name of the masking rule. |
phone_hash |
| Status |
integer |
No |
The status of the masking rule. Valid values:
|
1 |
| SceneIds |
array |
Yes |
The level-2 masking scenes. |
|
|
integer |
No |
The ID of the level-2 masking scene. The specified scene must not already have a masking rule configured for the sensitive column type specified by DataType. You can call the DsgSceneQuerySceneListByName operation to query the masking scene ID. |
123 |
|
| Owner |
string |
Yes |
The owner of the masking rule. |
test_user |
| CheckWatermark |
boolean |
No |
Whether to add a watermark. Valid values:
|
true |
| DesensPlan |
object |
Yes |
The masking rule. |
|
| DesensPlanType |
string |
Yes |
The masking method configured in the masking rule. Valid values:
|
hash |
| ExtParam |
object |
No |
The masking rule parameters. |
|
|
any |
No |
The masking rule parameter configurations. Required parameters vary by masking rule. For more information, see the examples below. |
{ "algo": "MD5", "salt":6 } |
|
| emptyNotDesens |
boolean |
No |
||
| columns |
array |
No |
The list of columns associated with the masking rule. |
|
|
object |
No |
|||
| dbType |
string |
Yes |
The data source type. |
ODPS.ODPS |
| project |
string |
Yes |
The name of the project. |
test_dev |
| table |
string |
Yes |
The table name. |
test_table_dev |
| column |
string |
Yes |
The column name. |
test_col_dev |
ExtParam varies by masking rule. Examples:
Hash:
{
"algo": "MD5",
"salt": 6
}
Pseudonym:
{
"charset": "Aa",
"salt": 6
}
Masking:
{
"before": 3,
"after": 4
}
Custom masking:
{
"separatorList": [
{
"desens": true,
"left": 3
},
{
"desens": false,
"left": 6
},
{
"desens": true,
"left": -99
}
]
}
Sample value character replacement:
{
"library": "test_library",
"position": 3
}
Fixed value character replacement:
{
"replace": "repData",
"position": 3
}
Random character replacement:
{
"replace": "repData"
}
Custom character replacement:
{
"separatorList": [
{
"desensParam": {
"replace": "repData"
},
"left": 3
},
{
"desensParam": {
"library": "test_library"
},
"left": 6
},
{
"desensParam": {
},
"left": 99
}
]
}
Interval transformation:
{
"intervalselects": [
{
"desens": "1",
"interval": [
"1",
"100"
]
}
]
}
Rounding:
{
"point":3
}
Nullification:
{}
For supported masking methods and rules, call the DsgQueryDefaultTemplates operation.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
OpenApiResultModel |
||
| Success |
boolean |
Whether the request was successful. Valid values: true: The call was successful. false: The call failed. |
true |
| ErrorCode |
string |
The error code. |
1029030003 |
| ErrorMessage |
string |
The error message. |
param error |
| HttpStatusCode |
integer |
The HTTP status code. |
400 |
| Data |
boolean |
Whether the create or edit operation succeeded. |
true |
| RequestId |
string |
The request ID. You can use it to locate logs and troubleshoot issues. |
102400001 |
Examples
Success response
JSON format
{
"Success": true,
"ErrorCode": "1029030003",
"ErrorMessage": "param error",
"HttpStatusCode": 400,
"Data": true,
"RequestId": "102400001"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | PARAMS.ERROR | param error. | Parameter error. |
| 400 | DESENSPLAN.DATATYPE.ERROR | Sensitive type already has a desensitization rule. | The sensitive type already has a masking rule configured. |
| 400 | DESENSPLAN.DATATYPENOTEXIST.ERROR | Sensitive type not exist. | The sensitive type does not exist. |
| 400 | DESENSPLAN.ID.ERROR | Desensitization rule ID does not exist. | The masking rule ID does not exist. |
| 400 | DESENSPLAN.PAGESIZE.ERROR | Page size is too large, maximum of 100. | The page size exceeds the limit. The maximum value is 100. |
| 400 | DESENSPLAN.PARAM.ERROR | Desensitization rule parameter error. | The masking rule parameter is invalid. |
| 400 | DESENSPLAN.SCENECODE.ERROR | Scene code does not exist. | The scene code does not exist. |
| 400 | DESENSPLAN.SCENEID.ERROR | Scene ID does not exist. | The scene ID does not exist. |
| 400 | DESENSPLAN.SCENEIDLEVEL.ERROR | The scene is not a secondary scene. | The scene is not a level-2 scene. |
| 400 | DESENSPLAN.SIZE.ERROR | The number of desens plan exceeds the limit. | The number of masking rules exceeds the limit. |
| 500 | UNKNOWN.ERROR | unknown error. | An unknown error occurred. |
| 403 | PERMISSION.DENIED.ERROR | Permission denied | You do not have the required permissions. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.