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

资产详情(邀测)

功能介绍

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

调用方法

请参见如何调用API

URI

GET /v1/{project_id}/datamap/entities/guid/{guid}

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

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

最小长度:32

最大长度:36

guid

String

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

最小长度:32

最大长度:36

表2 Query参数

参数

是否必选

参数类型

描述

ignore_relationships

Boolean

是否忽略关联资产,取值范围:true(忽略关联资产)、false(不忽略关联资产) 缺省值: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参数

参数

参数类型

描述

entity

Entity object

资产信息。

referred_entities

Object

关联资产信息,结构体Map<String, Entity>。key:资产guid,value:资产信息。

表5 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

修改时间。

表6 EntityPrivilegeInfo

参数

参数类型

描述

privileges

Array of strings

特权列表。

inherit_privileges

Array of strings

继承特权列表。

状态码: 400

表7 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

状态码: 401

表8 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

状态码: 403

表9 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

状态码: 404

表10 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

状态码: 500

表11 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

请求示例

响应示例

状态码: 200

OK。

{
  "entity" : {
    "guid" : "a14d047e-3d67-4f71-90f0-53b6759a7fa5",
    "attributes" : {
      "owner" : "username",
      "is_favorite" : 0,
      "qualifiedName" : "dws@a96be22c-77f3-46ea-96ab-c8913052ec7d",
      "favorites_count" : 0,
      "description" : "This temp entity was generated from DLF lineage service",
      "clusterId" : "",
      "click_through" : 10,
      "baseType" : "Source",
      "path" : "",
      "catalogId" : "",
      "workspaceVsId" : { },
      "createTime" : "2022-12-09T01:59:42.319+00:00",
      "port" : 8000,
      "sourceType" : "dws",
      "name" : "dws_4autotest1_nomodify",
      "host" : "",
      "id" : "f9338475eb8c4cbda61b85c05908a432",
      "projectId" : ""
    },
    "status" : "ACTIVE",
    "version" : 0,
    "type_name" : "dataasset.Source",
    "type_display_name" : "数据源",
    "project_id" : 123456,
    "domain_id" : 123456,
    "instance_id" : [ "123456" ],
    "workspace_id" : [ "123456" ],
    "updated_by" : "username",
    "create_time" : "2023-05-17T06:32:00.511+00:00",
    "update_time" : "2023-05-17T06:32:00.511+00:00",
    "super_type_names" : [ "base.Asset", "base.Infrastructure" ],
    "business_attributes" : {
      "businessName" : {
        "confidence" : 1.0,
        "name" : "dws0505",
        "confirmed" : true
      }
    },
    "multi_attributes" : {
      "tags" : [ {
        "confidence" : 1.0,
        "name" : "个人数据误删",
        "confirmed" : false
      } ]
    },
    "privilege_info" : {
      "privileges" : [ ],
      "inherit_privileges" : [ ]
    },
    "extended_attributes" : { },
    "display_text" : "dws0505"
  },
  "referred_entities" : 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 ShowDataDetailSolution {

    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();
        ShowDataDetailRequest request = new ShowDataDetailRequest();
        request.withGuid("{guid}");
        try {
            ShowDataDetailResponse response = client.showDataDetail(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 = ShowDataDetailRequest()
        request.guid = "{guid}"
        response = client.show_data_detail(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.ShowDataDetailRequest{}
	request.Guid = "{guid}"
	response, err := client.ShowDataDetail(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。

分享:

    相关文档

    相关产品