更新时间:2024-04-28 GMT+08:00
分享

资产血缘(邀测)

功能介绍

资产血缘接口,该接口功能处于邀测阶段,后续将随功能公测将逐步开放。

调用方法

请参见如何调用API

URI

GET /v2/{project_id}/datamap/lineage/guid/{guid}

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目ID,获取方法请参见项目ID和账号ID

最小长度:32

最大长度:36

guid

String

资产guid,获取方法请参见数据资产guid

最小长度:32

最大长度:36

表2 Query参数

参数

是否必选

参数类型

描述

direction

String

血缘查询方向,默认值:BOTH。

枚举值:

  • IN(上游血缘)

  • OUT(下游血缘)

  • BOTH(上下游血缘)

relationship_types

Array

关联关系类型列表,血缘查询使用默认值空

relationship_type_categories

Array

关联关系类型类别,默认空。血缘查询使用DATA_FLOW

related_entity_types

Array

关联实体类型,指定上下游资产类型,血缘查询使用默认值空。

extend_process_data_flow

Boolean

是否扩展数据,血缘查询使用默认值false。

枚举值:

  • true扩展数据

  • false不扩展数据

include_parent_entity

Boolean

是否包含父类实体,默认false。

枚举值:

  • true包含父资产

  • false不包含父资产

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token,使用Token认证时必选。通过调用IAM服务的“获取用户Token”接口获取响应消息头中X-Subject-Token的值。

最小长度:1

最大长度:65536

instance

String

实例ID,获取方法请参见实例ID和工作空间ID

最小长度:32

最大长度:36

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

total

Number

查询命中总条数。

最小值:0

最大值:9223372036854775807

relationships

Array of Lineage objects

关系列表。

relationship_types

Object

关系类型。

entities

Array of Entity objects

资产信息。

entity_types

Object

实体类型。

表5 Lineage

参数

参数类型

描述

relation_type_name

String

关系类型。PARENT_CHILD,LOGICAL_PHYSICAL,PK_FK,DATA_FLOW,INSTANCE_OF,JOIN,IS_A,UP_DOWN,ASSOCIATION,WORK_FLOW。

direction

String

血缘流向。

枚举值:

  • IN上游血缘

  • OUT下游血缘

  • BOTH上下游血缘

ep1_id

String

节点一资产guid。

ep1_type_name

String

节点一资产类型。

ep2_id

String

节点二资产guid。

ep2_type_name

String

节点二资产类型。

end1

Entity object

节点一资产。

end2

Entity object

节点二资产。

propagate_tag

String

关系类型。

枚举值:

  • NONE 无关系

  • ONE_TO_TWO 一对多

  • TWO_TO_ONE 多对一

  • BOTH 所有的关系

guid

String

资产guid。

type_name

String

资产类型名称。

type_display_name

String

类型展示名称。

display_text

String

展示名称。

attributes

Object

资产属性。Map结构,key:属性名称,value:属性值

updated_attributes

Array of strings

修改属性列表。

project_id

String

项目id。

domain_id

String

主账号id。

instance_id

Array of strings

实例id。

workspace_id

Array of strings

空间id列表。

status

String

状态。

created_by

String

创建人。

updated_by

String

修改人。

create_time

String

创建时间。

update_time

String

修改时间。

表6 Entity

参数

参数类型

描述

version

Number

数据版本。

relationship_attributes

Object

关联关系属性,数据类型Map<String, Object>,key:关系类型:value:关联关系对象。

super_type_names

Array of strings

父类资产类型。

business_attributes

Object

业务属性,数据类型Map<String, Map<String, Object>>,key:业务关系类型,value:业务关系。

multi_attributes

Object

承担密级和标签的多值对象数据结构,数据结构Map<String, List<Map<String, Object>>>,key:综合关系类型,value:综合关系。

privilege_info

EntityPrivilegeInfo object

实体特权信息。

extended_attributes

Object

拓展属性,数据结构Map<String, Object>,key:拓展属性,value:拓展属性值。

guid

String

资产guid。

type_name

String

资产类型名称。

type_display_name

String

类型展示名称。

display_text

String

展示名称。

attributes

Object

资产属性,Map<String, Object>。key:属性,value:属性值。

updated_attributes

Array of strings

修改属性列表。

project_id

String

项目id。

domain_id

String

主账号id。

instance_id

Array of strings

实例化id。

workspace_id

Array of strings

空间id列表。

status

String

状态。

created_by

String

创建人。

updated_by

String

修改人。

create_time

String

创建时间。

update_time

String

修改时间。

表7 EntityPrivilegeInfo

参数

参数类型

描述

privileges

Array of strings

特权列表。

inherit_privileges

Array of strings

继承特权列表。

状态码: 400

表8 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

状态码: 401

表9 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

状态码: 403

表10 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

状态码: 404

表11 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

状态码: 500

表12 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

请求示例

响应示例

状态码: 200

OK。

{
  "total" : 1,
  "relationships" : [ {
    "guid" : "62c8a705-abeb-4d25-b974-854a6b97343c",
    "status" : "ACTIVE",
    "direction" : "IN",
    "type_name" : "dataasset.tables_schema",
    "type_display_name" : "数据表:模式",
    "project_id" : "0833a5737480d53b2f25c010dc1a7b88",
    "instance_id" : [ "dd97167b873d4a79b2aad54d4370a3bc" ],
    "workspace_id" : [ "ae559f076ac14061921b6c6c331576c4", "8f91082a19474825b2fee2147e9b464c", "1b59d3c777ad4d619b89eeac4f3cce87" ],
    "created_by" : "username",
    "updated_by" : "username",
    "create_time" : "2024-01-03T09:11:42.871+00:00",
    "update_time" : "2024-01-04T11:52:36.454+00:00",
    "relation_type_name" : "PARENT_CHILD",
    "ep1_id" : "0c0f000e-d7b2-4aab-956c-cdc8b07083c6",
    "ep2_id" : "6a1510a9-f40c-477f-ae3a-638e592b6504",
    "ep1_type_name" : "dws.Table",
    "ep2_type_name" : "dws.Schema",
    "propagate_tag" : "NONE"
  }, {
    "guid" : "64d40028-10b9-41ed-811e-9c32689983eb",
    "status" : "ACTIVE",
    "direction" : "IN",
    "type_name" : "dataasset.tables_database",
    "type_display_name" : "数据表:数据库",
    "project_id" : "0833a5737480d53b2f25c010dc1a7b88",
    "instance_id" : [ "dd97167b873d4a79b2aad54d4370a3bc" ],
    "workspace_id" : [ "ae559f076ac14061921b6c6c331576c4", "8f91082a19474825b2fee2147e9b464c", "1b59d3c777ad4d619b89eeac4f3cce87" ],
    "created_by" : "username",
    "updated_by" : "username",
    "create_time" : "2024-01-03T09:11:42.872+00:00",
    "update_time" : "2024-01-04T11:52:36.454+00:00",
    "relation_type_name" : "PARENT_CHILD",
    "ep1_id" : "0c0f000e-d7b2-4aab-956c-cdc8b07083c6",
    "ep2_id" : "e10623fb-dbfc-4f43-bccc-33c68fb4c774",
    "ep1_type_name" : "dws.Table",
    "ep2_type_name" : "dws.Database",
    "propagate_tag" : "NONE"
  }, {
    "guid" : "cfdd16e6-3827-4572-8b16-d200bb5fcc79",
    "attributes" : {
      "__index" : 1,
      "__key" : null
    },
    "status" : "ACTIVE",
    "direction" : "OUT",
    "type_name" : "process.node_job",
    "type_display_name" : "作业:节点",
    "project_id" : "0833a5737480d53b2f25c010dc1a7b88",
    "instance_id" : [ "dd97167b873d4a79b2aad54d4370a3bc" ],
    "workspace_id" : [ "1b59d3c777ad4d619b89eeac4f3cce87" ],
    "created_by" : "username",
    "updated_by" : "username",
    "create_time" : "2024-01-03T10:17:24.696+00:00",
    "update_time" : "2024-01-03T10:17:24.696+00:00",
    "relation_type_name" : "PARENT_CHILD",
    "ep1_id" : "71e0b8d8-abc8-4cf0-94ba-e8e0e04c9b5a",
    "ep2_id" : "806e2242-a579-4340-aed0-7c8f35ec52fa",
    "ep1_type_name" : "dlf.Job",
    "ep2_type_name" : "dlf.dws_sql",
    "propagate_tag" : "NONE"
  }, {
    "guid" : "8ab58411-db50-477f-b0e8-3faacefb3216",
    "attributes" : {
      "__index" : 0,
      "__key" : null
    },
    "status" : "ACTIVE",
    "direction" : "OUT",
    "type_name" : "base.process_dataset_outputs",
    "type_display_name" : "输出",
    "project_id" : "0833a5737480d53b2f25c010dc1a7b88",
    "instance_id" : [ "dd97167b873d4a79b2aad54d4370a3bc" ],
    "workspace_id" : [ "1b59d3c777ad4d619b89eeac4f3cce87" ],
    "created_by" : "username",
    "updated_by" : "username",
    "create_time" : "2024-01-03T10:17:34.823+00:00",
    "update_time" : "2024-01-03T10:17:34.823+00:00",
    "relation_type_name" : "DATA_FLOW",
    "ep1_id" : "806e2242-a579-4340-aed0-7c8f35ec52fa",
    "ep2_id" : "0c0f000e-d7b2-4aab-956c-cdc8b07083c6",
    "ep1_type_name" : "dlf.dws_sql",
    "ep2_type_name" : "dws.Table",
    "propagate_tag" : "NONE"
  } ],
  "relationship_types" : null,
  "entities" : [ {
    "guid" : "71e0b8d8-abc8-4cf0-94ba-e8e0e04c9b5a",
    "attributes" : {
      "owner" : "username",
      "path" : "",
      "catalogId" : "catalog@cn-north-7",
      "scheduleType" : "REAL_TIME",
      "createTime" : "2024-01-03T10:17:17.924+00:00",
      "qualifiedName" : "19424819@dlf_job.0833a5737480d53b2f25c010dc1a7b88-workspace-1b59d3c777ad4d619b89eeac4f3cce87",
      "name" : "job_6757",
      "description" : "BATCH",
      "id" : 19424819,
      "priority" : 0,
      "cronExp" : "",
      "baseType" : "Job"
    },
    "status" : "ACTIVE",
    "version" : 5,
    "type_name" : "dlf.Job",
    "type_display_name" : "作业",
    "project_id" : "0833a5737480d53b2f25c010dc1a7b88",
    "domain_id" : "0833a5736980d53b0f22c0102ffcbfc0",
    "instance_id" : [ "dd97167b873d4a79b2aad54d4370a3bc" ],
    "workspace_id" : [ "1b59d3c777ad4d619b89eeac4f3cce87" ],
    "created_by" : "username",
    "updated_by" : "username",
    "create_time" : "2024-01-03T10:12:07.391+00:00",
    "update_time" : "2024-01-03T10:17:24.696+00:00",
    "super_type_names" : [ "base.Process", "base.Asset", "process.Job" ],
    "business_attributes" : {
      "businessName" : {
        "confidence" : 1,
        "name" : "job_6757",
        "confirmed" : true
      }
    },
    "multi_attributes" : {
      "tags" : [ ]
    },
    "extended_attributes" : { },
    "display_text" : "job_6757"
  }, {
    "guid" : "0c0f000e-d7b2-4aab-956c-cdc8b07083c6",
    "attributes" : {
      "sourceId" : "dws@94a1ad37-1bde-4919-8e93-712577a9c3b2",
      "description" : "",
      "ddlCreateTime" : 1691478978133,
      "dataConnectionId" : [ "3653cce08ed7433bad507a30d86f2f2c" ],
      "totalFrequency" : 0,
      "baseType" : "Table",
      "tableType" : "BASE TABLE",
      "partitionCount" : 0,
      "path" : "/wk/public",
      "hasRules" : false,
      "catalogId" : "catalog@cn-north-7",
      "writeFrequency" : 0,
      "schemaQName" : "wk.public@dws.94a1ad37-1bde-4919-8e93-712577a9c3b2",
      "isPartition" : false,
      "tableSize" : 0,
      "releaseStatus" : "",
      "alias" : "",
      "hasTriggers" : false,
      "dataUpdateTime" : 0,
      "publishStatus" : "",
      "owner" : "dbadmin",
      "orientation" : "ROW",
      "lastAccessTime" : 0,
      "qualifiedName" : "wk.public.wk_02@dws.94a1ad37-1bde-4919-8e93-712577a9c3b2",
      "qualityScoreOverall" : 0,
      "readFrequency" : 0,
      "partitionType" : "",
      "sourceType" : "dws",
      "rowCounts" : 0,
      "name" : "wk_02",
      "databaseQName" : "wk@dws.94a1ad37-1bde-4919-8e93-712577a9c3b2",
      "location" : "",
      "comment" : "",
      "partitionKeyCount" : 0,
      "sourceName" : "dws_nossl_4autotest_nomodify",
      "hasIndexes" : false,
      "ddlUpdateTime" : 1691478978133
    },
    "status" : "ACTIVE",
    "version" : 2,
    "type_name" : "dws.Table",
    "type_display_name" : "数据表",
    "project_id" : "0833a5737480d53b2f25c010dc1a7b88",
    "domain_id" : "0833a5736980d53b0f22c0102ffcbfc0",
    "instance_id" : [ "dd97167b873d4a79b2aad54d4370a3bc" ],
    "workspace_id" : [ "ae559f076ac14061921b6c6c331576c4", "1b59d3c777ad4d619b89eeac4f3cce87" ],
    "created_by" : "username",
    "updated_by" : "username",
    "create_time" : "2024-01-03T09:11:42.871+00:00",
    "update_time" : "2024-01-04T11:52:36.454+00:00",
    "super_type_names" : [ "base.DataAsset", "dataasset.Table", "base.DataSet", "base.Asset" ],
    "business_attributes" : {
      "businessName" : {
        "confidence" : 1,
        "name" : "wk_02",
        "confirmed" : true
      }
    },
    "multi_attributes" : {
      "classifications" : [ ],
      "tags" : [ ]
    },
    "extended_attributes" : { },
    "display_text" : "wk_02"
  }, {
    "guid" : "6a1510a9-f40c-477f-ae3a-638e592b6504",
    "attributes" : {
      "sourceId" : "dws@94a1ad37-1bde-4919-8e93-712577a9c3b2",
      "owner" : "Ruby",
      "path" : "/wk",
      "catalogId" : "catalog@cn-north-7",
      "sourceType" : "dws",
      "qualifiedName" : "wk.public@dws.94a1ad37-1bde-4919-8e93-712577a9c3b2",
      "name" : "public",
      "databaseQName" : "wk@dws.94a1ad37-1bde-4919-8e93-712577a9c3b2",
      "description" : "gs_roach_stop_backup",
      "sourceName" : "dws_nossl_4autotest_nomodify",
      "dataConnectionId" : [ "3653cce08ed7433bad507a30d86f2f2c" ],
      "baseType" : "Schema"
    },
    "status" : "ACTIVE",
    "version" : 3,
    "type_name" : "dws.Schema",
    "type_display_name" : "模式",
    "project_id" : "0833a5737480d53b2f25c010dc1a7b88",
    "domain_id" : "0833a5736980d53b0f22c0102ffcbfc0",
    "instance_id" : [ "dd97167b873d4a79b2aad54d4370a3bc" ],
    "workspace_id" : [ "8f91082a19474825b2fee2147e9b464c", "ae559f076ac14061921b6c6c331576c4", "1b59d3c777ad4d619b89eeac4f3cce87" ],
    "created_by" : "username",
    "updated_by" : "username",
    "create_time" : "2024-01-02T08:43:44.775+00:00",
    "update_time" : "2024-01-04T11:52:26.054+00:00",
    "super_type_names" : [ "base.DataAsset", "dataasset.Schema", "base.Asset" ],
    "business_attributes" : {
      "businessName" : {
        "confidence" : 1,
        "name" : "public",
        "confirmed" : true
      }
    },
    "multi_attributes" : {
      "tags" : [ ]
    },
    "extended_attributes" : { },
    "display_text" : "public"
  }, {
    "guid" : "e10623fb-dbfc-4f43-bccc-33c68fb4c774",
    "attributes" : {
      "sourceId" : "dws@94a1ad37-1bde-4919-8e93-712577a9c3b2",
      "owner" : "dbadmin",
      "qualifiedName" : "wk@dws.94a1ad37-1bde-4919-8e93-712577a9c3b2",
      "description" : "",
      "encoding" : "SQL_ASCII",
      "dataConnectionId" : [ "3653cce08ed7433bad507a30d86f2f2c" ],
      "baseType" : "Database",
      "path" : "/",
      "catalogId" : "catalog@cn-north-7",
      "sourceType" : "dws",
      "isTemplate" : false,
      "name" : "wk",
      "comment" : "",
      "sourceName" : "dws_nossl_4autotest_nomodify"
    },
    "status" : "ACTIVE",
    "version" : 3,
    "type_name" : "dws.Database",
    "type_display_name" : "数据库",
    "project_id" : "0833a5737480d53b2f25c010dc1a7b88",
    "domain_id" : "0833a5736980d53b0f22c0102ffcbfc0",
    "instance_id" : [ "dd97167b873d4a79b2aad54d4370a3bc" ],
    "workspace_id" : [ "8f91082a19474825b2fee2147e9b464c", "ae559f076ac14061921b6c6c331576c4", "1b59d3c777ad4d619b89eeac4f3cce87" ],
    "created_by" : "username",
    "updated_by" : "username",
    "create_time" : "2024-01-02T08:43:44.726+00:00",
    "update_time" : "2024-01-04T11:52:25.995+00:00",
    "super_type_names" : [ "base.DataAsset", "base.Asset", "dataasset.Database" ],
    "business_attributes" : {
      "businessName" : {
        "confidence" : 1,
        "name" : "wk",
        "confirmed" : true
      }
    },
    "multi_attributes" : {
      "tags" : [ ]
    },
    "extended_attributes" : { },
    "display_text" : "wk"
  }, {
    "guid" : "806e2242-a579-4340-aed0-7c8f35ec52fa",
    "attributes" : {
      "owner" : "username",
      "scriptPath" : "8abfdb5a8cce4a43018cced3039200c2",
      "statementOrScript" : "SCRIPT",
      "qualifiedName" : "19424819.e2b86e34-3223-4332-ac24-c61f9af72e22@dlf_job.0833a5737480d53b2f25c010dc1a7b88-workspace              -1b59d3c777ad4d619b89eeac4f3cce87",
      "failRetry" : false,
      "description" : "BATCH",
      "pollingTime" : 20,
      "nodeType" : "dws_sql_node",
      "timeout" : 360,
      "baseType" : "Node",
      "args" : null,
      "failPolicy" : "EXIT",
      "path" : null,
      "database" : "wk",
      "catalogId" : "catalog@cn-north-7",
      "maxRetryTime" : null,
      "name" : "xxxx",
      "statement" : "-- DWS sql -- ******************************************************************** ---- author: username-- create time: 2024/01/03 18:16:15 GMT+08:00-- ******************************************************************** --INSERT INTO wk_02 SELECT * FROM wk_01;",
      "retryInterval" : null,
      "connection" : "a0b248d34ab84631872f46d46a44f0b2",
      "dirtyDataPath" : null
    },
    "status" : "ACTIVE",
    "version" : 1,
    "type_name" : "dlf.dws_sql",
    "type_display_name" : "节点",
    "project_id" : "0833a5737480d53b2f25c010dc1a7b88",
    "domain_id" : "0833a5736980d53b0f22c0102ffcbfc0",
    "instance_id" : [ "dd97167b873d4a79b2aad54d4370a3bc" ],
    "workspace_id" : [ "1b59d3c777ad4d619b89eeac4f3cce87" ],
    "created_by" : "username",
    "updated_by" : "username",
    "create_time" : "2024-01-03T10:17:24.696+00:00",
    "update_time" : "2024-01-03T10:17:24.696+00:00",
    "super_type_names" : [ "base.Process", "dlf.Node", "base.Asset", "process.Node" ],
    "business_attributes" : {
      "businessName" : {
        "confidence" : 1,
        "name" : "xxxx",
        "confirmed" : true
      }
    },
    "multi_attributes" : {
      "tags" : [ ]
    },
    "extended_attributes" : { },
    "display_text" : "xxxx"
  } ],
  "entity_types" : null
}

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 ShowDatamapLineageSolution {

    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();
        ShowDatamapLineageRequest request = new ShowDatamapLineageRequest();
        request.withGuid("{guid}");
        try {
            ShowDatamapLineageResponse response = client.showDatamapLineage(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
# coding: utf-8

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 = __import__('os').getenv("CLOUD_SDK_AK")
    sk = __import__('os').getenv("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 = ShowDatamapLineageRequest()
        request.guid = "{guid}"
        response = client.show_datamap_lineage(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.ShowDatamapLineageRequest{}
	request.Guid = "{guid}"
	response, err := client.ShowDatamapLineage(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

OK。

400

BadRequest。

401

Unauthorized。

403

Forbidden。

404

Not Found。

500

InternalServerError。

分享:

    相关文档

    相关产品