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

查询指定实例

功能介绍

查询指定实例的详细信息。

调用方法

请参见如何调用API

URI

GET /v2/{project_id}/instances/{instance_id}

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目ID,获取方式请参见获取项目ID

instance_id

String

实例ID。

请求参数

响应参数

状态码: 200

表2 响应Body参数

参数

参数类型

描述

access_user

String

认证用户名,只能由英文字母、数字、中划线组成,长度为4~64的字符。

broker_num

Integer

代理个数。

name

String

实例名称。

engine

String

消息引擎。

engine_version

String

消息引擎版本。

specification

String

实例规格。

  • RabbitMQ实例单机返回vm规格。

  • RabbitMQ实例集群返回vm规格和节点数。

storage_space

Integer

消息存储空间,单位:GB。

used_storage_space

Integer

已使用的消息存储空间,单位:GB。

connect_address

String

实例连接IP地址。

port

Integer

实例连接端口。

status

String

实例的状态。

description

String

实例描述。

instance_id

String

实例ID。

resource_spec_code

String

资源规格标识。

  • dms.instance.rabbitmq.single.c3.2u4g:RabbitMQ单机,vm规格2u4g

  • dms.instance.rabbitmq.single.c3.4u8g:RabbitMQ单机,vm规格4u8g

  • dms.instance.rabbitmq.single.c3.8u16g:RabbitMQ单机,vm规格8u16g

  • dms.instance.rabbitmq.single.c3.16u32g:RabbitMQ单机,vm规格16u32g

  • dms.instance.rabbitmq.cluster.c3.4u8g.3:RabbitMQ集群,vm规格4u8g,3个节点

  • dms.instance.rabbitmq.cluster.c3.4u8g.5:RabbitMQ集群,vm规格4u8g,5个节点

  • dms.instance.rabbitmq.cluster.c3.4u8g.7:RabbitMQ集群,vm规格4u8g,7个节点

  • dms.instance.rabbitmq.cluster.c3.8u16g.3:RabbitMQ集群,vm规格8u16g,3个节点

  • dms.instance.rabbitmq.cluster.c3.8u16g.5:RabbitMQ集群,vm规格8u16g,5个节点

  • dms.instance.rabbitmq.cluster.c3.8u16g.7:RabbitMQ集群,vm规格8u16g,7个节点

  • dms.instance.rabbitmq.cluster.c3.16u32g.3:RabbitMQ集群,vm规格16u32g,3个节点

  • dms.instance.rabbitmq.cluster.c3.16u32g.5:RabbitMQ集群,vm规格16u32g,5个节点

  • dms.instance.rabbitmq.cluster.c3.16u32g.7:RabbitMQ集群,vm规格16u32g,7个节点

charging_mode

Integer

付费模式,1表示按需计费,0表示包年/包月计费。

vpc_id

String

VPC ID。

vpc_name

String

VPC的名称。

created_at

String

完成创建时间。格式为时间戳,指从格林威治时间 1970年01月01日00时00分00秒起至指定时间的偏差总毫秒数。

user_id

String

用户ID。

user_name

String

用户名。

order_id

String

订单ID,只有在包周期计费时才会有order_id值,其他计费方式order_id值为空。

maintain_begin

String

维护时间窗开始时间,格式为HH:mm:ss。

maintain_end

String

维护时间窗结束时间,格式为HH:mm:ss。

enable_publicip

Boolean

RabbitMQ实例是否开启公网访问功能。

  • true:开启

  • false:未开启

publicip_address

String

RabbitMQ实例绑定的弹性IP地址。

如果未开启公网访问功能,该字段值为null。

publicip_id

String

RabbitMQ实例绑定的弹性IP地址的ID。

如果未开启公网访问功能,该字段值为null。

management_connect_address

String

RabbitMQ实例的管理地址。

ssl_enable

Boolean

是否开启安全认证。

  • true:开启

  • false:未开启

enterprise_project_id

String

企业项目ID。

is_logical_volume

Boolean

实例扩容时用于区分老实例与新实例。

  • true:新创建的实例,允许磁盘动态扩容不需要重启。

  • false:老实例

extend_times

Integer

实例扩容磁盘次数,如果超过20次则无法扩容磁盘。

type

String

实例类型:集群,cluster。

product_id

String

产品标识。

security_group_id

String

安全组ID。

security_group_name

String

租户安全组名称。

subnet_id

String

子网ID。

available_zones

Array of strings

实例节点所在的可用区,返回“可用区ID”。

total_storage_space

Integer

总共消息存储空间,单位:GB。

storage_resource_id

String

存储资源ID。

storage_spec_code

String

IO规格。

ipv6_enable

Boolean

是否开启ipv6。

ipv6_connect_addresses

Array of strings

IPv6的连接地址。

tags

Array of TagEntity objects

标签列表。

表3 TagEntity

参数

参数类型

描述

key

String

标签键。

  • 不能为空。

  • 对于同一个实例,Key值唯一。

  • 长度为1~128个字符(中文也可以输入128个字符)。

  • 由任意语种字母、数字、空格和字符组成,字符仅支持_ . : = + - @

  • 首尾字符不能为空格。

value

String

标签值。

  • 长度为0~255个字符(中文也可以输入255个字符)。

  • 由任意语种字母、数字、空格和字符组成,字符仅支持_ . : = + - @

  • 首尾字符不能为空格。

请求示例

查询指定实例的详细信息。

GET https://{endpoint}/v2/{project_id}/instances/{instance_id}

响应示例

状态码: 200

查询指定实例成功。

{
  "name" : "api-explorer",
  "engine" : "rabbitmq",
  "port" : 5672,
  "status" : "RUNNING",
  "type" : "single",
  "specification" : "2vCPUs 4GB",
  "engine_version" : "3.8.35",
  "connect_address" : "192.168.0.74",
  "instance_id" : "de873040-d661-4770-aa96-9329c71d7c8a",
  "resource_spec_code" : "dms.instance.rabbitmq.single.c3.2u4g",
  "charging_mode" : 1,
  "vpc_id" : "40a6501e-85ca-4449-a0db-b8bc7f0cec28",
  "vpc_name" : "vpc-a400",
  "created_at" : "1590047080687",
  "product_id" : "00300-30109-0--0",
  "security_group_id" : "bfd68e26-f8ef-4a91-a373-0a8f5c198601",
  "security_group_name" : "Sys-default",
  "subnet_id" : "a7f9a564-30dd-4059-8124-364ca6554578",
  "available_zones" : [ "9f1c5806706d4c1fb0eb72f0a9b18c77" ],
  "user_id" : "3df5acbc24a54fadb62a043c9000a307",
  "user_name" : "paas_dms_01",
  "maintain_begin" : "22:00:00",
  "maintain_end" : "02:00:00",
  "storage_space" : 88,
  "total_storage_space" : 100,
  "used_storage_space" : 4,
  "enable_publicip" : false,
  "ssl_enable" : false,
  "management_connect_address" : "http://192.168.0.74:15672",
  "storage_resource_id" : "52be287d-1d6a-4d30-937e-185b3f176fc4",
  "storage_spec_code" : "dms.physical.storage.normal",
  "enterprise_project_id" : "0",
  "tags" : [ {
    "key" : "key1",
    "value" : "value1"
  }, {
    "key" : "key2",
    "value" : "value2"
  } ],
  "is_logical_volume" : true,
  "extend_times" : 0,
  "ipv6_enable" : false,
  "ipv6_connect_addresses" : [ ],
  "broker_num" : 1,
  "access_user" : "root_01"
}

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
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.rabbitmq.v2.region.RabbitMQRegion;
import com.huaweicloud.sdk.rabbitmq.v2.*;
import com.huaweicloud.sdk.rabbitmq.v2.model.*;


public class ShowInstanceSolution {

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

        ICredential auth = new BasicCredentials()
                .withAk(ak)
                .withSk(sk);

        RabbitMQClient client = RabbitMQClient.newBuilder()
                .withCredential(auth)
                .withRegion(RabbitMQRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowInstanceRequest request = new ShowInstanceRequest();
        try {
            ShowInstanceResponse response = client.showInstance(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
# coding: utf-8

from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkrabbitmq.v2.region.rabbitmq_region import RabbitMQRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkrabbitmq.v2 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")

    credentials = BasicCredentials(ak, sk) \

    client = RabbitMQClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(RabbitMQRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ShowInstanceRequest()
        response = client.show_instance(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
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    rabbitmq "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rabbitmq/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rabbitmq/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rabbitmq/v2/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")

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        Build()

    client := rabbitmq.NewRabbitMQClient(
        rabbitmq.RabbitMQClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

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

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

状态码

状态码

描述

200

查询指定实例成功。

错误码

请参见错误码