All Products
Search
Document Center

:AddRecognizeRule

最終更新日:May 06, 2024

Adds a sensitive field that is defined based on the category and sensitivity level of data in Data Security Guard.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action String Yes AddRecognizeRule

The operation that you want to perform. Set the value to AddRecognizeRule.

TenantId String No 10241024

The tenant ID. To obtain the tenant ID, perform the following steps: Log on to the DataWorks console. Find your workspace and go to the DataStudio page. On the DataStudio page, click the logon username in the upper-right corner and click User Info in the Menu section.

AccountName String No dsg-uat

The Alibaba Cloud account that is used to create a sensitive data identification rule. Enter the username of the Alibaba Cloud account.

SensitiveName String No Name

The name of the custom sensitive field. Enter a string that is less than 128 characters in length.

TemplateId String No e1970541-6cf5-4d23-b101-d5b66f6e1024

The template ID. You can call the QueryDefaultTemplate operation to obtain the template ID.

NodeId String No 0ce67949-0810-400f-a24a-cc5ffafe1024

The ID of the data category. You can call the QuerySensClassification operation to query the ID of all data categories. Then, you can select a data category to create a sensitive field. Enter the ID of the selected data category.

NodeParent String No Customer/Individual/Personal Natural Information/Personal Profile

The information about the parent data category of the current data category. You can call the QuerySensClassification operation to obtain the ID of a data category.

Level String No 1

The sensitivity level of the sensitive field. You can select one from all sensitivity levels that are defined in a template as the sensitivity level of the sensitive field, such as level 1 to level 10.

LevelName String No Confidential

The name of the sensitivity level. You can call the QueryDefaultTemplate operation to obtain the name of the sensitivity level in the related template.

SensitiveDescription String No A sensitive field that identifies names

The description of the sensitive field. Enter a string that is less than 128 characters in length.

OperationType Integer No 0

The type of the arithmetic operation. Valid values:

  • 0: OR
  • 1: AND
RecognizeRulesType String No 1

The type of the sensitive data identification rule. Valid values:

  • 1: regular expression
  • 2: built-in rule
  • 3: sample library
  • 4: self-generated data identification model
RecognizeRules String No {"contentRule":{"_clazz":"com.alipay.dsgclient.sdk.dsg.fastscan.engine.cond.GenderCond"},"_clazz":"com.alipay.dsg.dal.model.RuleContent"}

The content of the sensitive data identification rule. You can call the QuerySensNodeInfo operation to query the value of the current parameter for a built-in sensitive field.

ContentScan String No {"_clazz":"com.alipay.dsgclient.sdk.dsg.fastscan.engine.cond.NationalityCond"}

Identifies content. You can call the QuerySensNodeInfo operation to query the value of the current parameter for a built-in sensitive field.

HitThreshold Integer No 50

The hit ratio threshold. If more than 60%, which is a sample hit ratio threshold, of all sample data records hit the Name Entity Recognition (NER) model, the sensitive field is hit. The value can be an integer from 0 to 100.

ColScan String No default.qujian.*

Scans fields. The system identifies only fields that are assigned with values.

  • The value must be in the ${Project name}.${Table name}.${Field name} or ${Project name}.${Schema name}.${Table name}.${Field name} format.
  • Wildcards are supported. For example, the asterisk (*) in default.table.column1* can be used to match any content following default.table.column1, such as default.table.column10.
ColExclude String No default.qujian.*6

Excludes fields. The system does not identify fields that are assigned with values.

  • The value must be in the ${Project name}.${Table name}.${Field name} or ${Project name}.${Schema name}.${Table name}.${Field name} format.
  • Wildcards are supported. For example, the asterisk (*) in default.table.column1* can be used to match any content following default.table.column1, such as default.table.column10.
CommentScan String No test

Scans content. The value is the text of each field comment in your data asset. Fuzzy match is supported.

Status Integer No 0

The status of the sensitive field. Valid values:

  • 0: draft
  • 1: effective

Response parameters

Parameter

Type

Example

Description

Success Boolean true

Indicates whether the request was successful.

  • true
  • false
ErrorCode String 9990030003

The error code.

ErrorMessage String A required parameter is not specified.

The error message.

HttpStatusCode Integer 200

The HTTP status code.

Data Any { "HttpStatusCode": 200, "Success": true }

The returned result in the JSON format.

RequestId String 10000001

The request ID.

Examples

Sample requests

http(s)://[Endpoint]/?Action=AddRecognizeRule
&TenantId=10241024
&AccountName=dsg-uat
&SensitiveName=Name
&TemplateId=e1970541-6cf5-4d23-b101-d5b66f6e1024
&NodeId=0ce67949-0810-400f-a24a-cc5ffafe1024
&NodeParent=Customer/Individual/Personal Natural Information/Personal Profile
&Level=1
&LevelName=Confidential
&SensitiveDescription=A sensitive field that identifies names
&OperationType=0
&RecognizeRulesType=1
&RecognizeRules={"contentRule":{"_clazz":"com.alipay.dsgclient.sdk.dsg.fastscan.engine.cond.GenderCond"},"_clazz":"com.alipay.dsg.dal.model.RuleContent"}
&ContentScan={"_clazz":"com.alipay.dsgclient.sdk.dsg.fastscan.engine.cond.NationalityCond"}
&HitThreshold=50
&ColScan=default.qujian.*
&ColExclude=default.qujian.*6
&CommentScan=test
&Status=0
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<AddRecognizeRuleResponse>
    <Success>true</Success>
    <ErrorCode>9990030003</ErrorCode>
    <ErrorMessage>A required parameter is not specified.</ErrorMessage>
    <HttpStatusCode>200</HttpStatusCode>
    <Data>{   "HttpStatusCode": 200,   "Success": true }</Data>
    <RequestId>10000001</RequestId>
</AddRecognizeRuleResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Success" : true,
  "ErrorCode" : "9990030003",
  "ErrorMessage": "A required parameter is not specified.",
  "HttpStatusCode" : 200,
  "Data" : "{   \"HttpStatusCode\": 200,   \"Success\": true }",
  "RequestId" : "10000001"
}

Error codes

HttpCode

Error code

Error message

Description

400 BADPARAMETERS Parameters are missing or in the wrong format. A required parameter is not specified.

For a list of error codes, see Service error codes.