Adding identification rules
Function
Create a recognition rule.
Calling Method
For details, see Calling APIs.
URI
POST /v1/{project_id}/security/data-classification/rule
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID. For details about how to obtain the project ID, see Project ID and Account ID. |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| workspace | Yes | String | Workspace ID. For details about how to obtain the workspace ID, see Instance ID and Workspace ID. |
| X-Auth-Token | Yes | String | IAM token, which is obtained by calling the IAM API for obtaining a user token (value of X-Subject-Token in the response header). This parameter is mandatory for token authentication. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| rule_type | Yes | String | Rule type. The options are CUSTOM and BUILTIN. |
| secrecy_level_id | Yes | String | Security level ID. |
| name | Yes | String | Indicates the rule name. When rule_type is set to CUSTOM, the rule name can be customized. When rule_type is set to BUILTIN, the rule name must be the same as that in the built-in template. |
| method | No | String | Rule method, which can be REGULAR, NONE, DEFAULT, or COMBINE. |
| content_expression | No | String | Content expression. This parameter is required only when rule_type is set to CUSTOM and method is set to REGULAR. |
| column_expression | No | String | Column expression. This parameter is required only when rule_type is set to CUSTOM and method is set to REGULAR. |
| commit_expression | No | String | Remarks expression. This parameter is required only when rule_type is set to CUSTOM and method is set to REGULAR. |
| builtin_rule_id | No | String | Built-in rule ID. This parameter is required only when rule_type is set to BUILTIN. |
| description | No | String | Rule description. |
| category_id | No | String | Category ID. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| uuid | String | Rule ID. |
| rule_type | String | Rule type. The options are CUSTOM and BUILTIN. |
| secrecy_level | String | Security level name. |
| secrecy_level_num | Long | Confidentiality level. |
| name | String | Indicates the rule name. |
| guid | String | guid. |
| enable | Boolean | Indicates whether the rule is enabled. |
| method | String | Rule method. The value can be REGULAR, NONE, DEFAULT, or COMBINE. |
| content_expression | String | Content expression. |
| column_expression | String | Column expression. |
| commit_expression | String | Remarks expression. |
| combine_expression | String | Condition expression |
| project_id | String | Project ID. |
| description | String | Specifies the assignment description. |
| created_by | String | Policy creator. |
| created_at | Long | Time when a policy is created. |
| updated_by | String | Person who updates the policy. |
| updated_at | Long | Time when a policy is updated. |
| builtin_rule_id | String | ID of a built-in rule. |
| category_id | String | Category ID. |
| instance_id | String | Instance ID. |
| match_type | String | Match type. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_msg | String | Error message. |
Example Requests
-
/v1/0833a5737480d53b2f25c010dc1a7b88/security/data-classification/rule { "rule_type" : "CUSTOM", "secrecy_level_id" : "8a9480ad7e992660017e9a381244000d", "category_id" : "0cce38e7c28547828905ae9e4f10a4bf", "name" : "Special_Administrative_Region_test", "method" : "REGULAR", "description" : "testModifyDes", "content_expression" : "testExpression" } -
/v1/0833a5737480d53b2f25c010dc1a7b88/security/data-classification/rule { "builtin_rule_id" : "a5adcca681f011e9a870765a9db3b202", "rule_type" : "BUILTIN", "secrecy_level_id" : "8a9480ad7e992660017e9a381244000d", "category_id" : "0cce38e7c28547828905ae9e4f10a4bf", "name" : "Bank_Account", "description" : "testCreateBuiltInRule" }
Example Responses
Status code: 200
ok
{
"builtin_rule_id" : null,
"category_id" : "0cce38e7c28547828905ae9e4f10a4bf",
"column_expression" : null,
"commit_expression" : null,
"content_expression" : ".*",
"created_at" : 1698633124002,
"created_by" : "chenxiaoyu",
"description" : "",
"enable" : true,
"guid" : null,
"instance_id" : "dd97167b873d4a79b2aad54d4370a3bc",
"match_type" : null,
"method" : "REGULAR",
"name" : "matchRules",
"project_id" : "0833a5737480d53b2f25c010dc1a7b88",
"rule_type" : "CUSTOM",
"secrecy_level" : "asd",
"secrecy_level_num" : 1,
"updated_at" : 1698633124002,
"updated_by" : "chenxiaoyu",
"uuid" : "8a94800e8b753a35018b7e6be6950023"
} Status Codes
| Status Code | Description |
|---|---|
| 200 | ok |
| 400 | Bad Request |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.