Listing All Instances
Function
This API is used to query the instances of an account by the specified conditions.
Calling Method
For details, see Calling APIs.
URI
GET /v2/{project_id}/instances
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 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
engine |
Yes |
String |
Parameter description: Message engine type. The value is rabbitmq. Constraints: N/A Value range: N/A Default value: N/A |
name |
No |
String |
Parameter description: Instance name. To obtain it, log in to the RabbitMQ console and find the instance name on the RabbitMQ instance details page. Constraints: N/A Value range: N/A Default value: N/A |
instance_id |
No |
String |
Parameter description: Instance ID. To obtain it, log in to the RabbitMQ console and find the instance ID on the RabbitMQ instance details page. Constraints: N/A Value range: N/A Default value: N/A |
status |
No |
String |
Parameter description: Instance status. For details, see Instance Status. Constraints: N/A Value range: N/A Default value: N/A |
include_failure |
No |
String |
Parameter description: Indicates whether to return the number of instances that fail to be created. Constraints: N/A Value range:
Default value: N/A |
exact_match_name |
No |
String |
Parameter description: Whether to search for the instance that precisely matches a specified instance name. Constraints: N/A Value range:
Default value: false |
enterprise_project_id |
No |
String |
Parameter description: Enterprise project ID. Constraints: N/A Value range: N/A Default value: N/A |
offset |
No |
String |
Parameter description: Offset, which is the position where the query starts. Constraints: N/A Value range: ≥ 0 Default value: N/A |
limit |
No |
String |
Parameter description: Maximum number of instances that can be returned in a query. Constraints: N/A Value range: 1–50 Default value: 10 |
Request Parameters
None
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
instances |
Array of ShowInstanceResp objects |
Parameter description: Instance list. |
instance_num |
Integer |
Parameter description: Number of instances. Value range: N/A |
Parameter |
Type |
Description |
---|---|---|
access_user |
String |
Parameter description: Authentication username. Value range: N/A |
broker_num |
Integer |
Parameter description: Number of brokers. Value range:
|
name |
String |
Parameter description: Instance name. Value range: N/A |
engine |
String |
Parameter description: Message engine. Value range: N/A |
engine_version |
String |
Parameter description: Version of the message engine. Value range: N/A |
specification |
String |
Parameter description: Instance flavor. Value range:
|
storage_space |
Integer |
Parameter description: Message storage space, in GB. Value range: N/A |
used_storage_space |
Integer |
Parameter description: Used message storage space, in GB. Value range: N/A |
dns_enable |
Boolean |
Parameter description: Whether to enable domain name access to an instance. Value range:
|
connect_address |
String |
Parameter description: Instance IP address for private access. Value range: N/A |
connect_domain_name |
String |
Parameter description: Instance domain name for private access. Value range: N/A |
public_connect_address |
String |
Parameter description: Instance IP address for public access. Value range: N/A |
public_connect_domain_name |
String |
Parameter description: Instance domain name for public access. Value range: N/A |
port |
Integer |
Parameter description: Instance port. Value range: N/A |
status |
String |
Parameter description: Instance status. Value range: For details, see Instance Status. |
description |
String |
Parameter description: Instance description. Value range: N/A |
instance_id |
String |
Parameter description: Instance ID. Value range: N/A |
resource_spec_code |
String |
Parameter description: Resource specification ID. Value range:
|
charging_mode |
Integer |
Parameter description: Billing mode. Value range:
|
vpc_id |
String |
Parameter description: VPC ID. Value range: N/A |
vpc_name |
String |
Parameter description: VPC name. Value range: N/A |
created_at |
String |
Parameter description: Time when the 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. Value range: N/A |
user_id |
String |
Parameter description: User ID. Value range: N/A |
user_name |
String |
Parameter description: Username. Value range: N/A |
order_id |
String |
Parameter description: Indicates an order ID. This parameter has a value only when the billing mode is yearly/monthly mode. Value range: N/A |
maintain_begin |
String |
Parameter description: Time at which the maintenance window starts. The format is HH:mm:ss. Value range: N/A |
maintain_end |
String |
Parameter description: Time at which the maintenance window ends. The format is HH:mm:ss. Value range: N/A |
enable_publicip |
Boolean |
Parameter description: Indicates whether to enable public access for a RabbitMQ instance. Value range:
|
publicip_address |
String |
Parameter description: Indicates the EIP bound to a RabbitMQ instance. The value of this parameter is null if public access is disabled. Value range:
|
publicip_id |
String |
Parameter description: Indicates the ID of the EIP bound to a RabbitMQ instance. The value of this parameter is null if public access is disabled. Value range: N/A |
management_connect_address |
String |
Parameter description: Management address of a RabbitMQ instance. Value range: N/A |
management_connect_domain_name |
String |
Parameter description: Management domain name of a RabbitMQ instance. Value range: N/A |
public_management_connect_address |
String |
Parameter description: Public management address of a RabbitMQ instance. Value range: N/A |
public_management_connect_domain_name |
String |
Parameter description: Public management domain name of a RabbitMQ instance. Value range: N/A |
ssl_enable |
Boolean |
Parameter description: Whether security authentication is enabled. Value range:
|
enterprise_project_id |
String |
Parameter description: Enterprise project ID. Value range: N/A |
is_logical_volume |
Boolean |
Parameter description: Distinguishes old instances from new instances during instance capacity expansion. Value range:
|
extend_times |
Integer |
Parameter description: Indicates the number of disk expansion times. If it exceeds 20, the disk cannot be expanded. Value range: N/A |
type |
String |
Parameter description: Instance type. Value range:
|
product_id |
String |
Parameter description: Product ID. Value range: N/A |
security_group_id |
String |
Parameter description: Security group ID. Value range: N/A |
security_group_name |
String |
Parameter description: Name of the tenant security group. Value range: N/A |
subnet_id |
String |
Parameter description: Subnet ID. Value range: N/A |
available_zones |
Array of strings |
Parameter description: ID of the AZ where an instance node is located. |
available_zone_names |
Array of strings |
Parameter description: Name of the AZ where an instance node is located. |
total_storage_space |
Integer |
Parameter description: Total message storage space, in GB. Value range: N/A |
storage_resource_id |
String |
Parameter description: Storage resource ID. Value range: N/A |
storage_spec_code |
String |
Parameter description: I/O specification. Value range: N/A |
ipv6_enable |
Boolean |
Parameter description: Whether IPv6 is enabled. Value range:
|
ipv6_connect_addresses |
Array of strings |
Parameter description: IPv6 connection address. |
tags |
Array of TagEntity objects |
Parameter description: Tag list. |
Example Requests
Listing all instances
GET https://{endpoint}/v2/{project_id}/instances
Example Responses
Status code: 200
All instances are listed successfully.
{
"instances" : [ {
"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" ],
"available_zone_names" : [ "AZ1" ],
"user_id" : "3df5acbc24a54fadb62a043c9000a307",
"user_name" : "********",
"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" : [ ]
} ],
"instance_num" : 1
}
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 |
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 ListInstancesDetailsSolution {
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);
RabbitMQClient client = RabbitMQClient.newBuilder()
.withCredential(auth)
.withRegion(RabbitMQRegion.valueOf("<YOUR REGION>"))
.build();
ListInstancesDetailsRequest request = new ListInstancesDetailsRequest();
try {
ListInstancesDetailsResponse response = client.listInstancesDetails(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 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 = os.environ["CLOUD_SDK_AK"]
sk = os.environ["CLOUD_SDK_SK"]
projectId = "{project_id}"
credentials = BasicCredentials(ak, sk, projectId)
client = RabbitMQClient.new_builder() \
.with_credentials(credentials) \
.with_region(RabbitMQRegion.value_of("<YOUR REGION>")) \
.build()
try:
request = ListInstancesDetailsRequest()
response = client.list_instances_details(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"
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")
projectId := "{project_id}"
auth := basic.NewCredentialsBuilder().
WithAk(ak).
WithSk(sk).
WithProjectId(projectId).
Build()
client := rabbitmq.NewRabbitMQClient(
rabbitmq.RabbitMQClientBuilder().
WithRegion(region.ValueOf("<YOUR REGION>")).
WithCredential(auth).
Build())
request := &model.ListInstancesDetailsRequest{}
response, err := client.ListInstancesDetails(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.
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.rabbitmq.v2.region.RabbitMQRegion;
import com.huaweicloud.sdk.rabbitmq.v2.*;
import com.huaweicloud.sdk.rabbitmq.v2.model.*;
public class ListInstancesDetailsSolution {
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);
RabbitMQClient client = RabbitMQClient.newBuilder()
.withCredential(auth)
.withRegion(RabbitMQRegion.valueOf("<YOUR REGION>"))
.build();
ListInstancesDetailsRequest request = new ListInstancesDetailsRequest();
try {
ListInstancesDetailsResponse response = client.listInstancesDetails(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 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 = os.environ["CLOUD_SDK_AK"]
sk = os.environ["CLOUD_SDK_SK"]
projectId = "{project_id}"
credentials = BasicCredentials(ak, sk, projectId)
client = RabbitMQClient.new_builder() \
.with_credentials(credentials) \
.with_region(RabbitMQRegion.value_of("<YOUR REGION>")) \
.build()
try:
request = ListInstancesDetailsRequest()
response = client.list_instances_details(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"
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")
projectId := "{project_id}"
auth := basic.NewCredentialsBuilder().
WithAk(ak).
WithSk(sk).
WithProjectId(projectId).
Build()
client := rabbitmq.NewRabbitMQClient(
rabbitmq.RabbitMQClientBuilder().
WithRegion(region.ValueOf("<YOUR REGION>")).
WithCredential(auth).
Build())
request := &model.ListInstancesDetailsRequest{}
response, err := client.ListInstancesDetails(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 |
All instances are listed successfully. |
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