查询某个脱敏策略的详细信息
功能介绍
查询某个脱敏策略的详细信息。
调用方法
请参见如何调用API。
URI
GET /v1/{project_id}/security/masking/dynamic/policies/{id}
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
项目ID,获取方法请参见项目ID和账号ID。 |
id |
是 |
String |
动态脱敏策略id。 |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
workspace |
是 |
String |
工作空间ID,获取方法请参见实例ID和工作空间ID。 |
X-Auth-Token |
是 |
String |
IAM Token,通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)使用Token认证时必选。 |
响应参数
状态码: 200
参数 |
参数类型 |
描述 |
---|---|---|
id |
String |
策略id。 |
name |
String |
策略名称。英文和汉字开头, 支持英文、汉字、数字、下划线, 2-64字符。 |
datasource_type |
String |
数据源类型
|
cluster_id |
String |
集群id。请于集群管理页面查看集群ID信息。当数据源类型为DLI时,该参数需要填写为DLI。 |
cluster_name |
String |
集群名称。请于集群管理页面查看集群名称信息。当数据源类型为DLI时,该参数需要填写为DLI。 |
database_name |
String |
数据库名称。获取方法请参见获取数据源中的表。 |
table_id |
String |
数据表id,获取方法请参见获取数据源中的表。 |
table_name |
String |
数据表名称, 获取方法请参见获取数据源中的表。 |
user_groups |
String |
用户组列表,用户组名称逗号分隔(非必填项,但用户、用户组必须二选其一进行配置)。例如:"userGroup1,userGroup2"。 |
users |
String |
用户列表,用户名称逗号分隔(非必填项,但用户、用户组必须二选其一进行配置),例如:"user1,user2"。 |
conn_name |
String |
数据连接名称,获取方法请参见查询数据连接列表。 |
conn_id |
String |
数据连接id,获取方法请参见查询数据连接列表。 |
sync_status |
String |
同步状态:
|
sync_msg |
String |
策略同步信息。 |
sync_log |
String |
同步运行日志, 格式为 字段同步信息+换行符。 |
create_time |
Long |
策略创建时间。 |
create_user |
String |
策略创建者。 |
update_time |
Long |
策略更新时间。 |
update_user |
String |
策略更新者。 |
schema_name |
String |
DWS数据源的模式名称。 |
policy_list |
Array of DynamicMaskingPolicy objects |
动态数据脱敏策略列表。 |
参数 |
参数类型 |
描述 |
---|---|---|
id |
String |
字段脱敏策略id。 |
policy_set_id |
String |
动态脱敏策略id。 |
column_name |
String |
数据表中的字段名称。 |
column_type |
String |
数据表中字段的数据类型。 |
algorithm_type |
String |
动态脱敏规则参数介绍,具体请参考用户指南手册中的“动态脱敏规则介绍”章节。 HIVE数据源动态脱敏算法
DWS数据源动态脱敏算法
DLI数据源动态脱敏算法
|
sync_status |
String |
同步状态:
|
algorithm_detail |
String |
动态脱敏策略算法详情。 |
algorithm_detail_dto |
AlgorithmDetailDTO object |
动态脱敏策略算法详情 |
参数 |
参数类型 |
描述 |
---|---|---|
start |
Integer |
开始位数,该值需要大于0且小于end值。 |
end |
Integer |
结束位数,该值需要大于或等于start值。 |
int_target |
Integer |
数值类型。 |
string_target |
String |
字符串类型。可输入参数为"*"或者"#"。 |
状态码: 400
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码。 |
error_msg |
String |
错误描述。 |
请求示例
无
响应示例
状态码: 200
动态数据脱敏策略
{ "cluster_id" : "dc425074-26b3-479c-9e2f-b103c0cdd90f", "cluster_name" : "mrs_3x_xxxx_do_not_del", "conn_id" : "ae55cb5c44be4119b8958a3ba5d9a71f", "conn_name" : "hive_xxxx_0520", "create_time" : 1716195990000, "create_user" : "ei_dayu_xxxx_01", "database_name" : "bigdatatest", "datasource_type" : "HIVE", "id" : "7ea6b287dfd34b81c5eb627de2fd3401", "name" : "xxxx", "policy_list" : [ { "algorithm_detail" : null, "algorithm_detail_dto" : null, "algorithm_type" : "MASK_HASH", "associated_id" : null, "associated_policy_name" : null, "column_name" : "rr", "column_type" : "string", "id" : "3ced68b49ce558507af65207d880e51f", "policy_set_id" : "7ea6b287dfd34b81c5eb627de2fd3401", "sync_msg" : null, "sync_status" : "NOT_SYNC", "sync_time" : null } ], "schema_id" : null, "schema_name" : null, "sync_log" : "", "sync_msg" : null, "sync_status" : "NOT_SYNC", "table_id" : "NativeTable-ae55cb5c44be4119b8958a3ba5d9a71f-bigdatatest-chuan", "table_name" : "xxxx", "update_time" : 1716195990000, "update_user" : "ei_dayu_xxxx_01", "user_groups" : "xxxx", "users" : "" }
SDK代码示例
SDK代码示例如下。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.dataartsstudio.v1.region.DataArtsStudioRegion; import com.huaweicloud.sdk.dataartsstudio.v1.*; import com.huaweicloud.sdk.dataartsstudio.v1.model.*; public class ShowSecurityDynamicMaskingPolicySolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); DataArtsStudioClient client = DataArtsStudioClient.newBuilder() .withCredential(auth) .withRegion(DataArtsStudioRegion.valueOf("<YOUR REGION>")) .build(); ShowSecurityDynamicMaskingPolicyRequest request = new ShowSecurityDynamicMaskingPolicyRequest(); request.withId("{id}"); try { ShowSecurityDynamicMaskingPolicyResponse response = client.showSecurityDynamicMaskingPolicy(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkdataartsstudio.v1.region.dataartsstudio_region import DataArtsStudioRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkdataartsstudio.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = DataArtsStudioClient.new_builder() \ .with_credentials(credentials) \ .with_region(DataArtsStudioRegion.value_of("<YOUR REGION>")) \ .build() try: request = ShowSecurityDynamicMaskingPolicyRequest() request.id = "{id}" response = client.show_security_dynamic_masking_policy(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" dataartsstudio "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := dataartsstudio.NewDataArtsStudioClient( dataartsstudio.DataArtsStudioClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ShowSecurityDynamicMaskingPolicyRequest{} request.Id = "{id}" response, err := client.ShowSecurityDynamicMaskingPolicy(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
状态码 |
描述 |
---|---|
200 |
动态数据脱敏策略 |
400 |
Bad Request |