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

获取技术资产统计信息

功能介绍

获取技术资产统计信息。

调用方法

请参见如何调用API

URI

GET /v3/{project_id}/asset/statistic/assets/technical-assets

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

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

表2 Query参数

参数

是否必选

参数类型

描述

tag

String

标签名,指定标签名称可以获取此标签对应技术资产的统计信息。

offset

Integer

分页参数,查询偏移量,默认查询所有。

limit

Integer

分页参数,每页数量,默认查询所有。

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

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

workspace

String

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

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

count

Integer

数据连接总数。

datasource_statistics

Array of DataSource objects

数据连接统计信息。

表5 DataSource

参数

参数类型

描述

datasource_name

String

数据连接名称。

datasource_type

String

数据连接类型。

datasource_guid

String

数据连接guid。

datasource_qualified_name

String

数据连接唯一标识名称。

obs_folder_count

Integer

obs目录数。

obs_file_count

Integer

obs文件数。

css_index_count

Integer

css索引数。

css_index_field_count

Integer

css 索引字段数目。

namespace_count

Integer

命名空间数。

ges_vertex_count

Integer

ges点的总数。

ges_edge_count

Integer

ges边的总数。

database_count

Integer

数据库总数。

stream_count

Integer

通道总数。

table_count

Integer

表总数。

data_size

Integer

数据大小。

databases

Array of Database objects

数据库统计信息。

folders

Array of ObsFolder objects

顶层目录统计信息。

css_indices

Array of CssIndex objects

css索引统计信息。

namespaces

Array of Namespace objects

命名空间统计信息。

dis_streams

Array of DisStream objects

通道统计信息。

表6 Database

参数

参数类型

描述

database_name

String

数据库名称。

database_guid

String

数据库guid。

database_qualified_name

String

数据库的唯一标识名称。

table_count

Integer

数据库中表数目。

data_size

Integer

数据量大小。

表7 ObsFolder

参数

参数类型

描述

folder_name

String

目录名称。

folder_guid

String

目录的guid。

folder_qualified_name

String

目录的唯一标识名称。

object_count

Integer

对象总数。

data_size

Integer

数据量。

表8 CssIndex

参数

参数类型

描述

index_name

String

索引名称。

index_guid

String

索引的guid。

index_qualified_name

String

索引的唯一标识名称。

index_doc_count

Integer

索引中文档总数。

index_data_size

Integer

索引数据量大小。

表9 Namespace

参数

参数类型

描述

namespace_name

String

命名空间的名称。

namespace_guid

String

命名空间的guid。

namespace_qualified_name

String

命名空间的唯一标识名称。

table_count

Integer

命名空间下的表总数。

表10 DisStream

参数

参数类型

描述

stream_name

String

通道名称。

stream_guid

String

通道GUID。

stream_qualified_name

String

通道的唯一标识名称。

partition_count

Integer

分区数。

app_count

Integer

dis的app数目。

task_count

Integer

转储任务数。

状态码: 400

表11 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

状态码: 401

表12 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

状态码: 403

表13 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

状态码: 404

表14 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

请求示例

响应示例

状态码: 200

Technical assets statistic。

{
  "count" : 1,
  "datasource_statistics" : [ {
    "datasource_name" : "dli",
    "datasource_type" : "dli",
    "datasource_guid" : "0fff4057-c206-4dc3-a4ac-73ffc332bc9a",
    "datasource_qualified_name" : "dli@0833a5737480d53b2f25c010dc1a7b88-workspace-61aa10df45e54431a1901cb3527adab8",
    "obs_folder_count" : 0,
    "obs_file_count" : 0,
    "css_index_count" : 0,
    "css_index_field_count" : 0,
    "namespace_count" : 0,
    "ges_vertex_count" : 0,
    "ges_edge_count" : 0,
    "database_count" : 1,
    "stream_count" : 0,
    "table_count" : 1,
    "data_size" : 5478,
    "databases" : [ {
      "data_size" : 5478,
      "database_guid" : "e2b12c35-48ee-441f-a357-e338a85f5d00",
      "database_name" : "cbu_training",
      "database_qualified_name" : "cbu_training@dli.0833a5737480d53b2f25c010dc1a7b88-workspace-61aa10df45e54431a1901cb3527adab8",
      "table_count" : 1
    } ],
    "folders" : null,
    "css_indices" : null,
    "namespaces" : null,
    "dis_streams" : 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
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 ShowTechnicalAssetsStatisticSolution {

    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();
        ShowTechnicalAssetsStatisticRequest request = new ShowTechnicalAssetsStatisticRequest();
        try {
            ShowTechnicalAssetsStatisticResponse response = client.showTechnicalAssetsStatistic(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

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 = ShowTechnicalAssetsStatisticRequest()
        response = client.show_technical_assets_statistic(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
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.ShowTechnicalAssetsStatisticRequest{}
	response, err := client.ShowTechnicalAssetsStatistic(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

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

状态码

状态码

描述

200

Technical assets statistic。

400

BadRequest。

401

Unauthorized。

403

Forbidden。

404

Not Found。

相关文档