Querying an Instance
Function
This API is used to query the details about a specified instance.
Calling Method
For details, see Calling APIs.
URI
GET /v2/{project_id}/instances/{instance_id}
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Definition: Project ID. For details, see Obtaining a Project ID. Constraints: N/A Range: N/A Default Value: N/A |
instance_id |
Yes |
String |
Definition: Instance ID. You can call the API for querying all instances to obtain the instance ID. The instance ID is in the response body. Constraints: N/A Range: N/A Default Value: N/A |
Request Parameters
None
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
name |
String |
Definition: Instance name. Range: N/A |
engine |
String |
Definition: Engine. Range:
|
engine_version |
String |
Definition: Kafka version. Range:
|
description |
String |
Definition: Instance description. Range: N/A |
specification |
String |
Definition: Instance specification. Range: N/A |
storage_space |
Integer |
Definition: Message storage space, in GB. Range:
|
partition_num |
String |
Definition: Number of partitions in a Kafka instance. Range: N/A |
used_storage_space |
Integer |
Definition: Used message storage space, in GB. Range: N/A |
dns_enable |
Boolean |
Definition: Whether to enable domain name access to an instance. Range:
|
connect_address |
String |
Definition: Instance IP address. Range: N/A |
port |
Integer |
Definition: Instance port. Range: N/A |
status |
String |
Definition: Status of an instance. For details, see Instance Status. Range: N/A |
instance_id |
String |
Definition: Instance ID. Range: N/A |
resource_spec_code |
String |
Definition: Resource specification ID. Range:
|
charging_mode |
Integer |
Definition: Billing mode. Range:
and - 0 indicates yearly/monthly billing. |
vpc_id |
String |
Definition: VPC ID. Range: N/A |
vpc_name |
String |
Definition: VPC name. Range: N/A |
created_at |
String |
Definition: Time when creation is complete. The time is in the format of timestamp, that is, the offset milliseconds from 1970-01-01 00:00:00 UTC to the specified time. Range: N/A |
subnet_name |
String |
Definition: Subnet name. Range: N/A |
subnet_cidr |
String |
Definition: Subnet CIDR block. Range: N/A |
user_id |
String |
Definition: User ID. Range: N/A |
user_name |
String |
Definition: Username. Range: N/A |
access_user |
String |
Definition: Username for accessing an instance. Range: N/A |
order_id |
String |
Definition: Indicates an order ID. This parameter has a value only when the billing mode is yearly/monthly mode. Range: N/A |
maintain_begin |
String |
Definition: Time at which the maintenance window starts. The format is HH:mm:ss. Range: N/A |
maintain_end |
String |
Definition: Time at which the maintenance window ends. The format is HH:mm:ss. Range: N/A |
enable_publicip |
Boolean |
Definition: Indicates whether public access is enabled for an instance. Range:
|
management_connect_address |
String |
Definition: Indicates the connection address of the Kafka Manager of a Kafka instance. Range: N/A |
ssl_enable |
Boolean |
Definition: Whether security authentication is enabled. Range:
|
broker_ssl_enable |
Boolean |
Definition: Indicates whether to enable encrypted replica transmission among brokers. Range:
|
kafka_security_protocol |
String |
Definition: Security protocol used by Kafka. If port-protocols is returned in the instance details, kafka_security_protocol works as the security protocol for private and public network access, and cross-VPC access. Otherwise, kafka_security_protocol works as the security protocol only for cross-VPC access. For the security protocol for private and public network access, see port_protocols. Range:
|
sasl_enabled_mechanisms |
Array of strings |
Definition: Authentication mechanism used after SASL is enabled. |
ssl_two_way_enable |
Boolean |
Definition: Indicates whether to enable two-way authentication. Range:
|
cert_replaced |
Boolean |
Definition: Whether to enable certificate replacement. Range:
|
public_management_connect_address |
String |
Definition: Address for accessing Kafka Manager over public networks. Range: N/A |
enterprise_project_id |
String |
Definition: Enterprise project ID. Range: N/A |
is_logical_volume |
Boolean |
Definition: Distinguishes old instances from new instances during instance capacity expansion. Range:
|
extend_times |
Integer |
Definition: Indicates the number of disk expansion times. If it exceeds 20, the disk cannot be expanded. Range: N/A |
enable_auto_topic |
Boolean |
Definition: Whether to enable automatic topic creation. Range:
|
type |
String |
Definition: Instance type. Range:
|
product_id |
String |
Definition: Product ID. Range: N/A |
security_group_id |
String |
Definition: Security group ID. Range: N/A |
security_group_name |
String |
Definition: Security group name. Range: N/A |
subnet_id |
String |
Definition: Subnet ID. Range: N/A |
available_zones |
Array of strings |
Definition: Indicates the ID of the AZ to which the instance node belongs. The AZ ID is returned. |
available_zone_names |
Array of strings |
Definition: Indicates the AZ name to which the instance node belongs. The AZ name is returned. |
total_storage_space |
Integer |
Definition: Total message storage space, in GB. Range: N/A |
public_connect_address |
String |
Definition: Instance IP address for public access. This parameter is available only when public access is enabled for the instance. Range: N/A |
public_connect_domain_name |
String |
Definition: Instance domain name for public access. This parameter is available only when public access is enabled for the instance. Range: N/A |
storage_resource_id |
String |
Definition: Storage resource ID. Range: N/A |
storage_spec_code |
String |
Definition: I/O specification. Range: N/A |
service_type |
String |
Definition: Service type. Range: advanced |
storage_type |
String |
Definition: Storage type. Range: N/A |
retention_policy |
String |
Definition: Message retention policy. Range:
|
kafka_public_status |
String |
Definition: Whether Kafka public access is enabled. Range:
|
public_bandwidth |
Integer |
Definition: Public network access bandwidth. Range: N/A |
enable_log_collection |
Boolean |
Definition: Whether log collection is enabled. Range:
|
new_auth_cert |
Boolean |
Definition: Indicates whether to enable a new certificate. Range:
|
cross_vpc_info |
String |
Definition: Cross-VPC access information. Range: N/A |
ipv6_enable |
Boolean |
Definition: Whether IPv6 is enabled. Range:
|
ipv6_connect_addresses |
Array of strings |
Definition: IPv6 connection address. |
connector_enable |
Boolean |
Definition: Indicates whether dumping is enabled. Range:
|
connector_node_num |
Integer |
Definition: Number of connectors. Range: 2–16 |
connector_id |
String |
Definition: Dumping task ID. Range: N/A |
rest_enable |
Boolean |
Definition: Indicates whether the Kafka REST function is enabled. Range:
|
rest_connect_address |
String |
Definition: Indicates the Kafka REST connection address. Range: N/A |
public_boundwidth |
Integer |
Definition: Public network access bandwidth. To be deleted. Range: N/A |
message_query_inst_enable |
Boolean |
Definition: Indicates whether message query is enabled. Range:
|
vpc_client_plain |
Boolean |
Definition: Indicates whether intra-VPC plaintext access is enabled. Range:
|
support_features |
String |
Definition: Indicates the list of features supported by the Kafka instance. Range: N/A |
trace_enable |
Boolean |
Definition: Indicates whether message tracing is enabled. Range:
|
agent_enable |
Boolean |
Definition: Indicates whether the proxy is enabled. Range:
|
pod_connect_address |
String |
Definition: Indicates the connection address on the tenant side. Range: N/A |
disk_encrypted |
Boolean |
Definition: Whether disk encryption is enabled. Range:
|
disk_encrypted_key |
String |
Definition: Disk encryption key. If disk encryption is not enabled, this parameter is left blank. Range: N/A |
kafka_private_connect_address |
String |
Definition: Indicates the private connection address of a Kafka instance. Range: N/A |
kafka_private_connect_domain_name |
String |
Definition: Indicates the private domain name of a Kafka instance. Range: N/A |
ces_version |
String |
Definition: Cloud Eye version. Range: N/A |
public_access_enabled |
String |
Definition: Time when public access was enabled for an instance. Range:
|
node_num |
Integer |
Definition: Number of nodes. Range:
|
port_protocols |
PortProtocolsEntity object |
Definition: Connection modes and addresses supported by an instance. |
enable_acl |
Boolean |
Definition: Indicates whether access control is enabled. Range:
|
new_spec_billing_enable |
Boolean |
Definition: Whether billing based on new specifications is enabled. Range:
|
broker_num |
Integer |
Definition: Number of nodes. Range: N/A |
tags |
Array of TagEntity objects |
Definition: Tag list. |
dr_enable |
Boolean |
Definition: Whether DR is enabled. Range:
|
Parameter |
Type |
Description |
---|---|---|
private_plain_enable |
Boolean |
Definition: Whether private plaintext access is supported by an instance. Range:
|
private_plain_address |
String |
Definition: Connection addresses of Kafka private plaintext access. Range: N/A |
private_plain_domain_name |
String |
Definition: Private plaintext connection domain name. Range: N/A |
private_sasl_ssl_enable |
Boolean |
Definition: Whether the instance supports private SASL_SSL access. Range:
|
private_sasl_ssl_address |
String |
Definition: Connection addresses of the Kafka private SASL_SSL access mode. Range: N/A |
private_sasl_ssl_domain_name |
String |
Definition: Private SASL_SSL connection domain name. Range: N/A |
private_sasl_plaintext_enable |
Boolean |
Definition: Whether the instance supports private SASL_PLAINTEXT access. Range:
|
private_sasl_plaintext_address |
String |
Definition: Connection addresses of the Kafka private SASL_PLAINTEXT access mode. Range: N/A |
private_sasl_plaintext_domain_name |
String |
Definition: Private SASL_PLAINTEXT connection domain name. Range: N/A |
public_plain_enable |
Boolean |
Definition: Whether the instance supports public plaintext access. Range:
|
public_plain_address |
String |
Definition: Connection addresses of Kafka public plaintext access. Range: N/A |
public_plain_domain_name |
String |
Definition: Public plaintext connection domain name. Range: N/A |
public_sasl_ssl_enable |
Boolean |
Definition: Whether the instance supports public SASL_SSL access. Range:
|
public_sasl_ssl_address |
String |
Definition: Connection addresses of the Kafka public SASL_SSL access mode. Range: N/A |
public_sasl_ssl_domain_name |
String |
Definition: Public SASL_SSL connection domain name. Range: N/A |
public_sasl_plaintext_enable |
Boolean |
Definition: Whether the instance supports public SASL_PLAINTEXT access. Range:
|
public_sasl_plaintext_address |
String |
Definition: Connection addresses of the Kafka public SASL_PLAINTEXT access mode. Range: N/A |
public_sasl_plaintext_domain_name |
String |
Definition: Public SASL_PLAINTEXT connection domain name. Range: N/A |
Parameter |
Type |
Description |
---|---|---|
key |
String |
Definition: Tag key. Constraints:
Range: N/A Default Value: N/A |
value |
String |
Definition: Tag value. Constraints:
Range: N/A Default Value: N/A |
Example Requests
Querying an instance
GET https://{endpoint}/v2/{project_id}/instances/{instance_id}
Example Responses
Status code: 200
Specified instance queried.
{ "name" : "kafka-2085975099", "engine" : "kafka", "port" : 9092, "status" : "RUNNING", "type" : "cluster", "specification" : "100MB", "engine_version" : "1.1.0", "connect_address" : "192.168.0.100,192.168.0.61,192.168.0.72", "instance_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "resource_spec_code" : "dms.instance.kafka.cluster.c3.mini", "charging_mode" : 1, "vpc_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "vpc_name" : "dms-test", "created_at" : "1585618587087", "product_id" : "00300-30308-0--0", "security_group_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "security_group_name" : "Sys-default", "subnet_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "available_zones" : [ "38b0f7a602344246bcb0da47b5d548e7" ], "available_zone_names" : [ "AZ1" ], "user_id" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "user_name" : "paas_dms", "maintain_begin" : "02:00:00", "maintain_end" : "06:00:00", "enable_log_collection" : false, "new_auth_cert" : false, "storage_space" : 492, "total_storage_space" : 600, "used_storage_space" : 25, "partition_num" : "300", "enable_publicip" : false, "ssl_enable" : false, "broker_ssl_enable" : false, "cert_replaced" : false, "management_connect_address" : "https://192.168.0.100:9999", "cross_vpc_info" : "{\"192.168.0.61\":{\"advertised_ip\":\"192.168.0.61\",\"port\":9011,\"port_id\":\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"},\"192.168.0.72\":{\"advertised_ip\":\"192.168.0.72\",\"port\":9011,\"port_id\":\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"},\"192.168.0.100\":{\"advertised_ip\":\"192.168.0.100\",\"port\":9011,\"port_id\":\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"}}", "storage_resource_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "storage_spec_code" : "dms.physical.storage.ultra", "service_type" : "advanced", "storage_type" : "hec", "enterprise_project_id" : "0", "is_logical_volume" : true, "extend_times" : 0, "retention_policy" : "produce_reject", "ipv6_enable" : false, "ipv6_connect_addresses" : [ ], "connector_enable" : false, "connector_node_num" : 0, "connector_id" : "", "rest_enable" : false, "rest_connect_address" : "", "kafka_public_status" : "closed", "public_bandwidth" : 0, "message_query_inst_enable" : true, "vpc_client_plain" : false, "support_features" : "kafka.new.pod.port,feature.physerver.kafka.topic.modify,feature.physerver.kafka.topic.accesspolicy,message_trace_enable,features.pod.token.access,feature.physerver.kafka.pulbic.dynamic,roma_app_enable,features.log.collection,auto_topic_switch,feature.physerver.kafka.user.manager", "trace_enable" : false, "agent_enable" : false, "pod_connect_address" : "100.86.75.15:9080,100.86.142.77:9080,100.86.250.167:9080", "disk_encrypted" : false, "kafka_private_connect_address" : "192.168.0.61:9092,192.168.0.100:9092,192.168.0.72:9092", "enable_auto_topic" : false, "new_spec_billing_enable" : false, "ces_version" : "linux", "port_protocols" : "{\"private_plain_enable\": true,\"private_plain_address\": \"192.xxx.xxx.xxx:9092,192.xxx.xxx.xxx:9092,192.xxx.xxx.xxx:9092\",\"private_sasl_ssl_enable\": true,\"private_sasl_ssl_address\": \"192.xxx.xxx.xxx:9093,192.xxx.xxx.xxx:9093,192.xxx.xxx.xxx:9093\",\"private_sasl_plaintext_enable\": false,\"private_sasl_plaintext_address\": \"\",\"public_plain_enable\": true,\"public_plain_address\": \"100.xxx.xxx.xxx:9094,100.xxx.xxx.xxx:9094,100.xxx.xxx.xxx:9094\",\"public_sasl_ssl_enable\": true,\"public_sasl_ssl_address\": \"100.xxx.xxx.xxx:9095,100.xxx.xxx.xxx:9095,100.xxx.xxx.xxx:9095\",\"public_sasl_plaintext_enable\": false,\"public_sasl_plaintext_address\": \"\"}" }
SDK Sample Code
The SDK sample code is as follows.
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.kafka.v2.region.KafkaRegion; import com.huaweicloud.sdk.kafka.v2.*; import com.huaweicloud.sdk.kafka.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); KafkaClient client = KafkaClient.newBuilder() .withCredential(auth) .withRegion(KafkaRegion.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()); } } } |
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 huaweicloudsdkkafka.v2.region.kafka_region import KafkaRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkkafka.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 = KafkaClient.new_builder() \ .with_credentials(credentials) \ .with_region(KafkaRegion.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) |
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" kafka "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/kafka/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/kafka/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/kafka/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 := kafka.NewKafkaClient( kafka.KafkaClientBuilder(). 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) } } |
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
Status Code |
Description |
---|---|
200 |
Specified instance queried. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot