更新时间:2025-06-10 GMT+08:00
分享

获取计算节点详情信息

功能介绍

功能描述:用户可以使用该接口获取单个可信计算节点详情信息。

调用方法

请参见如何调用API

URI

GET /v1/{project_id}/agents/{agent_id}

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目id,最大32位,字母和数字组成

agent_id

String

可信节点ID,获取方式:登录可信计算节点,单击基本信息,即可查看节点ID。

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户凭证

Content-Type

String

消息体的类型(格式)

响应参数

状态码:200

表3 响应Body参数

参数

参数类型

描述

agent_deploy

TicsAgentDeploy object

可信节点部署情况

agent_deploy_bcs

TicsAgentDeployBcs object

区块链相关信息

agent_deploy_detail

TicsAgentDeployDetail object

可信节点部署详情

agent_deploy_nat

TicsAgentNatCommonInfo object

可信节点网关公共信息

agent_deploy_node

TicsAgentNodeInfo object

可信节点信息表

表4 TicsAgentDeploy

参数

参数类型

描述

agent_id

String

可信节点Id

agent_name

String

可信节点名称

aom_flag

Boolean

是否开启aom监控

bcs_flag

Boolean

是否使用区块链存证

cce_version

String

可信节点使用cce集群的版本

create_time

DateTime

可信节点创建时间

creator_domain_id

String

可信节点创建者的租户Id

creator_id

String

可信节点创建者的Id

creator_name

String

可信节点创建者的名称

creator_project_id

String

创建可信节点所在项目Id

deploy_status

String

可信节点部署状态:ABNORMAL正常,RESTARTING重启中,RESTART_FAILED重启失败,ROLLBACKING回滚中,STARTING启动中,DEPLOYING创建中,DEPLOY_FAILED创建失败,DEPLOY_SUCCESS创建成功,RUNNING运行中,DELETING删除中,DELETE_FAILED删除失败,DELETE_SUCCESS删除成功,UPGRADING升级中,UPGRADE_FAILED升级失败,ROLLBACK回退中,ROLLBACK_FAILED回退失败,SUCCESS成功,FAILED失败,TO_START待开始,IN_PROGRESS进行中

deploy_type

String

可信节点部署类型,CCE.云容器集群,IEF.边缘容器

deployment_event_information

String

可信节点部署类型

high_avail

Boolean

可信节点是否高可用部署

image_id

String

可信节点部署使用的镜像Id

image_version

String

可信节点部署使用的镜像版本

league_id

String

可信节点所在空间的Id

league_name

String

可信节点所在空间的名称

league_region_name

String

可信节点所在空间的区域

league_version

String

可信节点所在空间的版本

nat_id

String

可信节点使用的网关的Id

storage_mount_type

String

可信节点使用的存储方式,HOST_PATH本地存储,OBS对象云存储,SFS_TURBO极速文件存储

表5 TicsAgentDeployBcs

参数

参数类型

描述

agent_id

String

可信节点Id

bcs_ip

String

区块链ip

block_chain_id

String

区块链Id

block_chain_name

String

区块链名称

channel_name

String

通道名称

org_name

String

组织名称

org_name_hash

String

组织名称的hash

表6 TicsAgentDeployDetail

参数

参数类型

描述

agent_access_address

String

可信节点访问地址

agent_id

String

可信节点Id

cce_cluster_id

String

可信节点所在cce集群的Id

cce_cluster_name

String

可信节点所在cce集群的名称

console_ip

String

可信节点所在ip

console_port

Integer

可信节点服务端口

host_path

String

主机挂载路径,本地挂载才会有值

namespace_name

String

命名空间名称

obs_pvc_name

String

可信节点CCE部署场景,对象文件存储PVC

persistence_id

String

持久化存储唯一标识

resource_spec_code

String

代理部署规格

web_port

Integer

可信节点访问端口

表7 TicsAgentNatCommonInfo

参数

参数类型

描述

nat_id

String

可信节点绑定的网关id

project_id

String

项目id

subnet_id

String

可信节点绑定的CCE集群所在子网id

vpc_id

String

可信节点绑定的CCE集群所在虚拟私有云id

表8 TicsAgentNodeInfo

参数

参数类型

描述

agent_id

String

可信节点Id

agent_vpcep_eps_id

String

无eip场景下,agent的eps id

ecs_server_id

String

弹性云服务器Id,IEF部署同node_id

league_server_ip_security_group_rule

String

入方向安全组规则ID

league_server_snat_ip

String

空间server组件的ip,为server的snatip,设置代理节点的入方向安全组规则

nat_eip

String

可信节点绑定的网关的ip,CCE部署时会返回该值

nat_eip_id

String

可信节点绑定的网关的ip的Id,CCE部署时会返回该值

node_az

String

弹性云服务器所在可用区,CCE部署时会返回该值

node_id

String

可信节点部署的虚机id,CCE部署情况返回CCE节点ID。

node_ip

String

弹性云服务器的私网ip

node_name

String

弹性云服务器的名称

server_to_agent_vpcep_epi_id

String

无eip场景下,server访问agent的epi id

server_to_agent_vpcep_epi_ip

String

无eip场景下,server访问agent的ip

snat_rule_id

String

节点绑定的snat id

状态码:500

表9 响应Body参数

参数

参数类型

描述

error_code

String

错误码

error_msg

String

错误信息

请求示例

获取计算节点详情信息

GET /v1/{project_id}/agents/{agent_id}

响应示例

状态码:200

获取计算节点详情信息成功

{
  "agent_deploy" : {
    "agent_id" : "22a38e92ef7e4284b666b2a14bc29462",
    "agent_name" : "agent_7819",
    "league_region_name" : "xx-xxx",
    "league_id" : "ef73b252a0ad4b5db21a12c40a413b2f",
    "league_name" : "test",
    "league_version" : "1.15.1",
    "image_id" : "115",
    "image_version" : "1.15.1",
    "creator_project_id" : "098593b07680d2a32f62c004a482da10",
    "creator_name" : "user01",
    "creator_id" : "098593b08f00d2a34f64c004408b64bc",
    "creator_domain_id" : "098593b06a80d2a30f5fc004c28f6da0",
    "create_time" : "2022-10-08T08:54:26.000+00:00",
    "storage_mount_type" : "OBS",
    "deploy_type" : "CCE",
    "deploy_status" : "RUNNING",
    "deployment_event_information" : "Closing agent container",
    "bcs_flag" : false,
    "cce_version" : "v1.19.10",
    "aom_flag" : true,
    "nat_id" : "baedab5b-d120-43a6-b965-5b3d7e2deae5",
    "high_avail" : false
  },
  "agent_deploy_detail" : {
    "agent_id" : "22a38e92ef7e4284b666b2a14bc29462",
    "namespace_name" : "default",
    "resource_spec_code" : "agent.middle",
    "cce_cluster_id" : "233ac994-46e7-11ed-9162-0255ac100b09",
    "cce_cluster_name" : "tics-agent-22a38e92ef7e4284b666b2a14bc29462",
    "console_ip" : "x.x.x.x",
    "web_port" : 30964,
    "console_port" : 30912,
    "obs_pvc_name" : "cce-obs-22a38e92ef7e4284b666b2a14bc29462",
    "persistence_id" : "pvc-747d6aa1-22cc-4993-a32e-1c6c64f38bdb"
  },
  "agent_deploy_bcs" : null,
  "agent_deploy_node" : {
    "ecs_server_id" : "5461246e-29fc-4016-b422-4b0db86a89a6",
    "node_id" : "8e204053-46e8-11ed-9162-0255ac100b09",
    "agent_id" : "22a38e92ef7e4284b666b2a14bc29462",
    "node_ip" : "x.x.x.x",
    "node_name" : "node-22a38e92ef7e4284b666b2a14bc29462-0",
    "node_az" : "xx-xxx",
    "nat_eip" : "x.x.x.x",
    "nat_eip_id" : "1966fa41-229e-4595-a725-e99266ce9587"
  },
  "agent_deploy_nat" : {
    "nat_id" : "baedab5b-d120-43a6-b965-5b3d7e2deae5",
    "project_id" : "098593b07680d2a32f62c004a482da10",
    "vpc_id" : "670ad039-5188-4c18-9ca2-a6b29bd18d67",
    "subnet_id" : "9cc4bdd1-ad35-4d0f-849c-71d305121f61"
  }
}

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.tics.v1.region.TicsRegion;
import com.huaweicloud.sdk.tics.v1.*;
import com.huaweicloud.sdk.tics.v1.model.*;


public class ShowAgentDetailSolution {

    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);

        TicsClient client = TicsClient.newBuilder()
                .withCredential(auth)
                .withRegion(TicsRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowAgentDetailRequest request = new ShowAgentDetailRequest();
        request.withAgentId("{agent_id}");
        try {
            ShowAgentDetailResponse response = client.showAgentDetail(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 huaweicloudsdktics.v1.region.tics_region import TicsRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdktics.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 = TicsClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(TicsRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ShowAgentDetailRequest()
        request.agent_id = "{agent_id}"
        response = client.show_agent_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"
    tics "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/tics/v1"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/tics/v1/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/tics/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 := tics.NewTicsClient(
        tics.TicsClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ShowAgentDetailRequest{}
	request.AgentId = "{agent_id}"
	response, err := client.ShowAgentDetail(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

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

状态码

状态码

描述

200

获取计算节点详情信息成功

500

获取计算节点详情信息失败

相关文档