Querying the Logical Cluster List
Function
This API is used to query the logical cluster list.
Call Method
For details, see Calling APIs.
URI
GET /v2/{project_id}/clusters/{cluster_id}/logical-clusters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain the ID, see Obtaining Project ID. |
cluster_id |
Yes |
String |
Cluster ID. For details about how to obtain the ID, see Obtaining the Cluster ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
offset |
No |
Integer |
Offset for the pagination query |
limit |
No |
Integer |
Number of records displayed on each page of the pagination query |
Request Parameters
None
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
logical_clusters |
Array of LogicalClusterInfo objects |
Logical cluster list |
count |
Integer |
Total number of logical clusters |
add_enable |
Boolean |
Specifies whether a logical cluster can be added. If other O&M operations are performed in the cluster, the value is false. In this case, the logical cluster cannot be added. true indicates that a logical cluster can be added. |
Parameter |
Type |
Description |
---|---|---|
logical_cluster_id |
String |
ID of the logical cluster |
logical_cluster_name |
String |
Name of a logical cluster |
cluster_rings |
Array of ClusterRing objects |
Host information of the logical cluster |
status |
String |
Status of the logical cluster The status is as follows:
|
first_logical_cluster |
Boolean |
Whether the cluster is the first logical cluster. The first created or converted logical cluster cannot be deleted because it contains some system views. |
action_info |
ActionInfo object |
Operation information about the logical cluster |
edit_enable |
Boolean |
Whether editing is allowed. |
restart_enable |
Boolean |
Whether restart is allowed. |
delete_enable |
Boolean |
Whether deletion is allowed. |
add_to_elastic |
Boolean |
Whether autoscaling is allowed. |
mode |
String |
Logical cluster mode |
waiting_for_killing |
Integer |
Waiting to be destroyed. |
cluster_type |
String |
Cluster type |
Parameter |
Type |
Description |
---|---|---|
ring_hosts |
Array of RingHost objects |
Cluster host information |
Parameter |
Type |
Description |
---|---|---|
host_name |
String |
Host name |
back_ip |
String |
Backend IP address |
cpu_cores |
Integer |
Number of host CPUs |
memory |
Double |
Host memory |
disk_size |
Double |
Disk size of the host |
Parameter |
Type |
Description |
---|---|---|
action_name |
String |
Operation name. Currently, the following operations are allowed:
|
progress |
Integer |
Operation progress. The default value is 10. |
completed |
Boolean |
Whether an operation is complete. |
start_time |
String |
Start time of an operation |
end_time |
String |
End time of an operation |
result |
String |
Operation result. The value can be success or failed. The default value is an empty string. |
logs |
String |
Operation logs |
Example Request
GET https://{Endpoint}/v2/9b06d044ea4f49f1a58b2bed2b0084bd/clusters/9b7ff56b-47b3-4d00-a1fd-4c023d34404b/logical-clusters
Example Response
Status code: 200
The cluster list is queried successfully.
{ "logical_clusters" : [ { "logical_cluster_id" : "fa9d69a0-3814-4fb9-98df-d9f4f5ef53ca", "logical_cluster_name" : "elastic_group", "cluster_rings" : [ { "ring_hosts" : [ { "host_name" : "host-172-16-20-246", "back_ip" : "172.16.73.90", "cpu_cores" : 8, "memory" : 32.0, "disk_size" : 800.0 }, { "host_name" : "host-172-16-4-26", "back_ip" : "172.16.123.5", "cpu_cores" : 8, "memory" : 32.0, "disk_size" : 800.0 }, { "host_name" : "host-172-16-43-90", "back_ip" : "172.16.92.175", "cpu_cores" : 8, "memory" : 32.0, "disk_size" : 800.0 } ] } ], "status" : "Normal", "first_logical_cluster" : false, "action_info" : { "progress" : 100, "completed" : true, "result" : "success", "logs" : null, "action_name" : "Grow", "start_time" : "2023-06-05 01:58:43", "end_time" : "2023-06-05 02:11:50" }, "edit_enable" : true, "restart_enable" : true, "delete_enable" : false, "add_to_elastic" : true, "mode" : null, "cluster_type" : null } ], "count" : 1, "add_enable" : true }
SDK Sample Code
The 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.dws.v2.region.DwsRegion; import com.huaweicloud.sdk.dws.v2.*; import com.huaweicloud.sdk.dws.v2.model.*; public class ListLogicalClustersSolution { 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); DwsClient client = DwsClient.newBuilder() .withCredential(auth) .withRegion(DwsRegion.valueOf("<YOUR REGION>")) .build(); ListLogicalClustersRequest request = new ListLogicalClustersRequest(); request.withOffset(<offset>); request.withLimit(<limit>); try { ListLogicalClustersResponse response = client.listLogicalClusters(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 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkdws.v2.region.dws_region import DwsRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkdws.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.getenv("CLOUD_SDK_AK") sk = os.getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = DwsClient.new_builder() \ .with_credentials(credentials) \ .with_region(DwsRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListLogicalClustersRequest() request.offset = <offset> request.limit = <limit> response = client.list_logical_clusters(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 39 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" dws "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dws/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dws/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dws/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 := dws.NewDwsClient( dws.DwsClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ListLogicalClustersRequest{} offsetRequest:= int32(<offset>) request.Offset = &offsetRequest limitRequest:= int32(<limit>) request.Limit = &limitRequest response, err := client.ListLogicalClusters(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
For more SDK sample codes of programming languages, visit API Explorer and click the Sample Code tab. Example codes can be automatically generated.
Status Code
Status Code |
Description |
---|---|
200 |
The cluster list is queried successfully. |
400 |
Request error. |
401 |
Authentication failed. |
403 |
You do not have required permissions. |
404 |
No resources found. |
500 |
Internal server error. |
503 |
Service unavailable. |
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