Call the DsgDesensPlanAddOrUpdate API to create or edit a data desensitization rule.
Try it now
Test
RAM authorization
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| DesensRules |
array<object> |
Yes |
The collection of data masking rules to add or update. |
|
|
array<object> |
No |
The configuration of a data masking rule. |
||
| Id |
integer |
No |
The data masking rule ID. You can call the DsgDesensPlanQueryList operation to obtain it. |
123 |
| DataType |
string |
No |
The sensitive data type. |
phone |
| RuleName |
string |
Yes |
The name of the data masking rule. |
phone_hash |
| Status |
integer |
No |
The status of the data masking rule. Valid values:
|
1 |
| SceneIds |
array |
Yes |
The secondary data masking scenes. |
|
|
integer |
No |
The ID of a secondary data masking scene. This scene cannot have an existing data masking rule for the sensitive data type specified by the DataType parameter. To find the scene ID, call the DsgSceneQuerySceneListByName operation. |
123 |
|
| Owner |
string |
Yes |
The owner of the data masking rule. |
test_user |
| CheckWatermark |
boolean |
No |
Specifies whether to add a watermark. Valid values:
|
true |
| DesensPlan |
object |
Yes |
The configuration of the data masking method. |
|
| DesensPlanType |
string |
Yes |
The data masking method. Valid values:
|
hash |
| ExtParam |
object |
No |
The parameters for the data masking method. |
|
|
any |
No |
The parameters for the selected data masking method. The required parameters depend on the value of the DesensPlanType parameter. See the request examples for details. |
{ "algo": "MD5", "salt":6 } |
|
| emptyNotDesens |
boolean |
No |
||
| columns |
array<object> |
No |
The associated columns for masking. |
|
|
object |
No |
|||
| dbType |
string |
Yes |
The data source type. |
ODPS.ODPS |
| project |
string |
Yes |
The name of the DataWorks workspace. |
test_dev |
| table |
string |
Yes |
The table name. |
test_table_dev |
| column |
string |
Yes |
The column name. |
test_col_dev |
ExtParam is a dynamic parameter. Its configuration depends on the desensitization rule. See the following configuration examples:
Hash:
{
"algo": "MD5",
"salt": 6
}
Pseudonymization:
{
"charset": "Aa",
"salt": 6
}
Masking:
{
"before": 3,
"after": 4
}
Custom mask:
{
"separatorList": [
{
"desens": true,
"left": 3
},
{
"desens": false,
"left": 6
},
{
"desens": true,
"left": -99
}
]
}
Sample character replacement:
{
"library": "test_library",
"position": 3
}
Fixed 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 details on supported desensitization methods and their rules, see the DsgQueryDefaultTemplates API.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
OpenApiResultModel |
||
| Success |
boolean |
Indicates whether the request was successful. A value of |
true |
| ErrorCode |
string |
The error code. |
1029030003 |
| ErrorMessage |
string |
The error message. |
param error |
| HttpStatusCode |
integer |
The HTTP status code. |
400 |
| Data |
boolean |
Indicates whether the add or update operation was successful. |
true |
| RequestId |
string |
The request ID. You can use the ID to trace 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. | |
| 400 | DESENSPLAN.DATATYPE.ERROR | Sensitive type already has a desensitization rule. | Desensitization rules have been configured for sensitive types. |
| 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 desensitization rule ID does not exist. |
| 400 | DESENSPLAN.PAGESIZE.ERROR | Page size is too large, maximum of 100. | Page size limit, up to 100 |
| 400 | DESENSPLAN.PARAM.ERROR | Desensitization rule parameter error. | The desensitization rule parameter is incorrect. |
| 400 | DESENSPLAN.SCENECODE.ERROR | Scene code does not exist. | Scene code does not exist |
| 400 | DESENSPLAN.SCENEID.ERROR | Scene ID does not exist. | Scene ID does not exist. |
| 400 | DESENSPLAN.SCENEIDLEVEL.ERROR | The scene is not a secondary scene. | The scene is not a secondary scene. |
| 400 | DESENSPLAN.SIZE.ERROR | The number of desens plan exceeds the limit. | The number of desensitization rules exceeded the limit. |
| 500 | UNKNOWN.ERROR | unknown error. | Unknown error. |
| 403 | PERMISSION.DENIED.ERROR | Permission denied | Insufficient permissions. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.