查询指定实例
功能介绍
查询指定实例的详细信息。
调用方法
请参见如何调用API。
URI
GET /v2/{project_id}/instances/{instance_id}
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
参数解释: 项目ID,获取方式请参见获取项目ID。 约束限制: 不涉及。 取值范围: 不涉及。 默认取值: 不涉及。 |
instance_id |
是 |
String |
参数解释: 实例ID。获取方法如下:登录RocketMQ控制台,在RocketMQ实例详情页面查找实例ID。 约束限制: 不涉及。 取值范围: 不涉及。 默认取值: 不涉及。 |
请求参数
无
响应参数
状态码:200
参数 |
参数类型 |
描述 |
---|---|---|
name |
String |
参数解释: 实例名称。 取值范围: 不涉及。 |
engine |
String |
参数解释: 消息引擎。 取值范围: 不涉及。 |
status |
String |
参数解释: 状态。 取值范围: 不涉及。 |
description |
String |
参数解释: 消息描述。 取值范围: 不涉及。 |
type |
String |
参数解释: 实例类型。 取值范围:
|
specification |
String |
参数解释: 实例规格。 取值范围: 不涉及。 |
engine_version |
String |
参数解释: 实例版本。 取值范围: 不涉及。 |
instance_id |
String |
参数解释: 实例ID。 取值范围: 不涉及。 |
charging_mode |
Integer |
参数解释: 付费模式。 取值范围: 1表示按需计费,0表示包年/包月计费。 |
vpc_id |
String |
参数解释: 私有云ID。 取值范围: 不涉及。 |
vpc_name |
String |
参数解释: 私有云名称。 取值范围: 不涉及。 |
created_at |
String |
参数解释: 完成创建时间。 格式为时间戳,指从格林威治时间1970年01月01日00时00分00秒起至指定时间的偏差总毫秒数。 取值范围: 不涉及。 |
product_id |
String |
参数解释: 产品标识。 取值范围: 不涉及。 |
security_group_id |
String |
参数解释: 安全组ID。 取值范围: 不涉及。 |
security_group_name |
String |
参数解释: 安全组名称。 取值范围: 不涉及。 |
subnet_id |
String |
参数解释: 子网ID。 取值范围: 不涉及。 |
subnet_name |
String |
参数解释: 子网名称。 取值范围: 不涉及。 |
subnet_cidr |
String |
参数解释: 子网路由(仅RocketMQ 5.x版本会显示此字段)。 取值范围: 不涉及。 |
available_zones |
Array of strings |
参数解释: 可用区ID列表。 取值范围: 不涉及。 |
available_zone_names |
Array of strings |
参数解释: 可用区名称列表。 |
user_id |
String |
参数解释: 用户ID。 取值范围: 不涉及。 |
user_name |
String |
参数解释: 用户名。 取值范围: 不涉及。 |
maintain_begin |
String |
参数解释: 维护时间窗开始时间,格式为HH:mm:ss。 取值范围: 不涉及。 |
maintain_end |
String |
参数解释: 维护时间窗结束时间,格式为HH:mm:ss。 取值范围: 不涉及。 |
enable_log_collection |
Boolean |
参数解释: 是否开启消息收集功能。 取值范围:
|
storage_space |
Integer |
参数解释: 存储空间,单位:GB。 取值范围: 不涉及。 |
used_storage_space |
Integer |
参数解释: 已用消息存储空间,单位:GB。 取值范围: 不涉及。 |
enable_publicip |
Boolean |
参数解释: 是否开启公网。 取值范围:
|
publicip_id |
String |
参数解释: 实例绑定的弹性IP地址的ID。 以英文逗号隔开多个弹性IP地址的ID。 如果开启了公网访问功能(即enable_publicip为true),该字段为必选。 取值范围: 不涉及。 |
publicip_address |
String |
参数解释: 公网IP地址。 取值范围: 不涉及。 |
ssl_enable |
Boolean |
参数解释: 是否开启SSL。 取值范围:
|
cross_vpc_info |
String |
参数解释: 跨VPC访问信息。 取值范围: 不涉及。 |
storage_resource_id |
String |
参数解释: 存储资源ID。 取值范围: 不涉及。 |
storage_spec_code |
String |
参数解释: 存储规格代码。 取值范围: 不涉及。 |
service_type |
String |
参数解释: 服务类型。 取值范围: 不涉及。 |
storage_type |
String |
参数解释: 存储类型。 取值范围: 不涉及。 |
extend_times |
Long |
参数解释: 扩展时间。 取值范围: 不涉及。 |
ipv6_enable |
Boolean |
参数解释: 是否开启IPv6。 取值范围:
|
support_features |
String |
参数解释: 实例支持的特性功能。 取值范围: 不涉及。 |
disk_encrypted |
Boolean |
参数解释: 是否开启磁盘加密。 取值范围:
|
ces_version |
String |
参数解释: 云监控版本。 取值范围: 不涉及。 |
node_num |
Integer |
参数解释: 节点数。 取值范围: 不涉及。 |
new_spec_billing_enable |
Boolean |
参数解释: 是否启用新规格计费。 取值范围:
|
enable_acl |
Boolean |
参数解释: 是否开启访问控制列表。 取值范围:
|
broker_num |
Integer |
参数解释: Broker节点数(仅RocketMQ 4.8.0版本会显示此字段)。 取值范围: 不涉及。 |
dns_enable |
Boolean |
参数解释: 实例是否开启域名访问功能。 取值范围:
|
namesrv_address |
String |
参数解释: 元数据地址。 取值范围: 不涉及。 |
namesrv_domain_name |
String |
参数解释: 元数据域名。 取值范围: 不涉及。 |
broker_address |
String |
参数解释: 业务数据地址。 取值范围: 不涉及。 |
public_namesrv_address |
String |
参数解释: 公网元数据地址。 取值范围: 不涉及。 |
public_namesrv_domain_name |
String |
参数解释: 公网元数据域名。 取值范围: 不涉及。 |
public_broker_address |
String |
参数解释: 公网业务数据地址。 取值范围: 不涉及。 |
grpc_address |
String |
参数解释: grpc连接地址(仅RocketMQ 5.x版本会显示此字段)。 取值范围: 不涉及。 |
grpc_domain_name |
String |
参数解释: grpc连接域名(仅RocketMQ 5.x版本会显示此字段)。 取值范围: 不涉及。 |
public_grpc_address |
String |
参数解释: 公网grpc连接地址(仅RocketMQ 5.x版本会显示此字段)。 取值范围: 不涉及。 |
public_grpc_domain_name |
String |
参数解释: 公网grpc连接域名(仅RocketMQ 5.x版本会显示此字段)。 取值范围: 不涉及。 |
enterprise_project_id |
String |
参数解释: 企业项目ID。 取值范围: 不涉及。 |
tags |
Array of TagEntity objects |
参数解释: 标签列表。 取值范围: 不涉及。 |
total_storage_space |
Integer |
参数解释: 总存储空间。 取值范围: 不涉及。 |
resource_spec_code |
String |
参数解释: 资源规格。 取值范围: 不涉及。 |
produce_portion |
Integer |
参数解释: 生产TPS占比。 取值范围: 不涉及。 |
consume_portion |
Integer |
参数解释: 消费TPS占比。 取值范围: 不涉及。 |
dr_enable |
Boolean |
参数解释: 是否为容灾实例。 取值范围: 不涉及。 |
config_ssl_need_restart_process |
Boolean |
参数解释: 配置ssl是否需要重启。 取值范围: 不涉及。 |
tls_mode |
String |
参数解释: 实例使用的安全协议。 取值范围: 不涉及。 |
请求示例
查询指定实例的详细信息。
GET https://{endpoint}/v2/{project_id}/instances/{instance_id}
响应示例
状态码:200
查询实例成功。
{ "name" : "reliability-test", "engine" : "reliability", "status" : "RUNNING", "description" : "", "type" : "single.basic", "specification" : "rocketmq.b1.large.1, 500 tps", "engine_version" : "5.x", "instance_id" : "68fdc9a8-805e-439d-8dd9-25adc1c58bf6", "resource_spec_code" : "", "charging_mode" : 1, "vpc_id" : "3db8490c-4d6d-4d8f-8d3f-047b0de4c5cf", "vpc_name" : "vpc-1101840", "created_at" : "1636699753874", "product_id" : "rocketmq.b1.large.1", "security_group_id" : "23c5977f-ff33-4b95-a73e-08d8a0bc4e6c", "security_group_name" : "security_group_test", "subnet_id" : "0a0f1fcb-f019-458d-b9e5-301867394d50", "subnet_name" : "subnet-test", "subnet_cidr" : "192.168.64.0/18", "available_zones" : [ "9f1c5806706d4c1fb0eb72f0a9b18c77" ], "available_zone_names" : [ "AZ3" ], "user_id" : "0b01fbb53600d4671fa8c00673c71260", "user_name" : "user_test", "maintain_begin" : "02:00:00", "maintain_end" : "06:00:00", "enable_log_collection" : false, "storage_space" : 558, "total_storage_space" : 600, "used_storage_space" : 28, "enable_publicip" : true, "publicip_id" : "83924171-7014-48f0-a6b2-c714e7a090dd", "publicip_address" : "***", "ssl_enable" : false, "cross_vpc_info" : "{\"192.168.93.114\":{\"advertised_ip\":\"192.168.93.114\",\"broker_port\":\"10100\",\"port_id\":\"b3de3981-1f73-4e6f-b35a-78833b783364\",\"namesrv_port\":\"8300\"}}", "storage_resource_id" : "164bdaef-2e67-4fd5-be8b-a18f91d455a2", "storage_spec_code" : "dms.physical.storage.ultra.v2", "service_type" : "advanced", "storage_type" : "hec", "enterprise_project_id" : "0", "extend_times" : 0, "ipv6_enable" : false, "support_features" : "kafka.crossvpc.domain.enable,auto.create.topics.enable,rabbitmq.plugin.management,support.permissive.mode,auto_topic_switch,feature.physerver.kafka.user.manager,kafka.ssl.2way.modify.enable,kafka.new.pod.port,message_trace_enable,features.pod.token.access,log.enable,features.log.collection,max.connections,rabbitmq.manage.support,replica_port_standalone,feature.physerver.kafka.topic.accesspolicy,enable.kafka.quota.monitor,rocketmq.acl,roma_app_enable,support.kafka.producer.ip,enable.new.authinfo,enable.kafka.quota,rabbitmq_run_log_enable,max.ssl.connections,route,message_trace_v2_enable,kafka.config.dynamic.modify.enable,feature.physerver.kafka.topic.modify,enable.topic.quota,kafka.ssl.cert.modify.enable,roma.user.manage.no.support,auto.create.groups.enable,feature.physerver.kafka.pulbic.dynamic,kafka.config.static.modify.enable", "disk_encrypted" : false, "ces_version" : "linux,v1,v2,v3,v4", "new_spec_billing_enable" : true, "enable_acl" : false, "namesrv_address" : "192.168.93.114:8100", "broker_address" : "192.168.64.0/18:10100", "public_namesrv_address" : "100.85.116.211:8200", "public_broker_address" : "100.85.116.211:10101", "grpc_address" : "192.168.93.114:8080", "public_grpc_address" : "100.85.116.211:8081" }
SDK代码示例
SDK代码示例如下。
Java
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.rocketmq.v2.region.RocketMQRegion; import com.huaweicloud.sdk.rocketmq.v2.*; import com.huaweicloud.sdk.rocketmq.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"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); RocketMQClient client = RocketMQClient.newBuilder() .withCredential(auth) .withRegion(RocketMQRegion.valueOf("<YOUR REGION>")) .build(); ShowInstanceRequest request = new ShowInstanceRequest(); request.withInstanceId("{instance_id}"); 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()); } } } |
Python
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 huaweicloudsdkrocketmq.v2.region.rocketmq_region import RocketMQRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkrocketmq.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 = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = RocketMQClient.new_builder() \ .with_credentials(credentials) \ .with_region(RocketMQRegion.value_of("<YOUR REGION>")) \ .build() try: request = ShowInstanceRequest() request.instance_id = "{instance_id}" 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) |
Go
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" rocketmq "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rocketmq/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rocketmq/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/rocketmq/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") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := rocketmq.NewRocketMQClient( rocketmq.RocketMQClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ShowInstanceRequest{} request.InstanceId = "{instance_id}" response, err := client.ShowInstance(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
更多
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
状态码 |
描述 |
---|---|
200 |
查询实例成功。 |
错误码
请参见错误码。