DsgDesensPlanAddOrUpdate
Creates or updates a data masking rule.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dataworks:DsgDesensPlanAddOrUpdate |
list |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| DesensRules |
array<object> |
Yes |
The collection of data masking rules to create or update. |
|
|
array<object> |
No |
The data masking rule information. |
||
| Id |
integer |
No |
The ID of the data masking rule. You can call the DsgDesensPlanQueryList operation to query the ID. |
123 |
| DataType |
string |
No |
The sensitive field type. Call the DsgQueryDefaultTemplates operation to query the available types for the current tenant, obtain the value from If the required type is not returned, verify the classification and grading template and sensitive fields of the current tenant. To configure or import a template, go to Data Security Guard > Rule Configuration > Data Classification and Grading in the DataWorks console. To add a sensitive field to an existing template, call the QueryDefaultTemplate operation to view the default template, and then call the AddRecognizeRule operation. After the configuration is complete, query the available masking types again. |
phone |
| RuleName |
string |
Yes |
The name of the data masking rule. |
phone_hash |
| Status |
integer |
No |
The effective status of the data masking rule. Valid values:
|
1 |
| SceneIds |
array |
Yes |
The secondary data masking scenarios. |
|
|
integer |
No |
The ID of the secondary data masking scenario. The secondary data masking scenario specified here must not have a data masking rule configured for the sensitive field type specified by the DataType parameter. You can call the DsgSceneQuerySceneListByName operation to query the ID of the data masking scenario. |
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 data masking plan. |
|
| DesensPlanType |
string |
Yes |
The masking method configured in the data masking rule. Valid values:
|
hash |
| ExtParam |
object |
No |
The parameters of the data masking rule. |
|
|
any |
No |
The parameter settings of the data masking rule. Add different parameters based on the data masking rule you want to configure. For more information, see the following examples. |
{ "algo": "MD5", "salt":6 } |
|
| emptyNotDesens |
boolean |
No |
Specifies whether to keep null values unmasked. A value of true indicates that null values are not masked. A value of false indicates that null values are processed according to the rule. |
|
| columns |
array<object> |
No |
The list of columns associated with the data masking rule. |
|
|
object |
No |
|||
| dbType |
string |
Yes |
The type of the data source. |
ODPS.ODPS |
| project |
string |
Yes |
The name of the workspace. |
test_dev |
| table |
string |
Yes |
The name of the table. |
test_table_dev |
| column |
string |
Yes |
The name of the column. |
test_col_dev |
ExtParam is a dynamic parameter and varies based on the data masking rule. The following examples are for reference:
Hashing:
{
"algo": "MD5",
"salt": 6
}
Pseudonymization:
{
"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 more information about the supported masking methods and related rules, call the DsgQueryDefaultTemplates operation.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
OpenApiResultModel |
||
| Success |
boolean |
Indicates whether the call was successful. Valid values:
|
true |
| ErrorCode |
string |
The error code. |
1029030003 |
| ErrorMessage |
string |
The error message. |
param error |
| HttpStatusCode |
integer |
The HTTP status code. |
400 |
| Data |
boolean |
The execution result of the creation or update operation. |
true |
| RequestId |
string |
The ID of the request. You can use the ID 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. | The parameter is invalid. |
| 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.