Querying the Cluster List
Function
This API is used to query the cluster list and cluster status, including cluster nodes, Kibana public network access information, public network IP address, and IPv4 address and port number for private network access. After a cluster is created, check the cluster information and update the cluster in a timely manner.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
css:cluster:list
List
cluster *
-
css:cluster:getInstances
-
URI
GET /v1.0/{project_id}/clusters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. For details about how to obtain the project ID and name, see Obtaining the Project ID and Name. Constraints N/A Range Project ID of an account. The value contains 32 characters, consisting of lowercase letters and digits. Default Value N/A |
Request Parameters
None
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| totalSize | Integer | Definition: Number of clusters. If datastoreType is specified, the number of clusters of the specified type is displayed. Otherwise, the number of all clusters is displayed. Value range: N/A |
| clusters | Array of ClusterList objects | Definition: Cluster object list. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| datastore | ClusterListDatastore object | Definition: Cluster data search engine type. Value range: N/A |
| snapshotPolicy | SnapshotPolicyResp object | Definition: Information about an automatic snapshot creation policy. Value range: N/A |
| instances | Array of ClusterListInstances objects | Definition: Cluster node list. Value range: N/A |
| publicKibanaResp | publicKibanaRespBody object | Definition: Public network access information for Kibana/Dashboards, including the IP address, whitelist, and bandwidth. Value range: N/A |
| elbWhiteList | elbWhiteListResp object | Definition: Public network access control information. Value range: N/A |
| updated | String | Definition: Time when the cluster was last modified. Value range: The format is CCYY-MM-DDThh:mm:ss (ISO 8601). |
| name | String | Definition: Cluster name. Value range: N/A |
| publicIp | String | Definition: Public IP address information. Value range: N/A |
| created | String | Definition: Cluster creation time. The returned cluster list is sorted by creation time in descending order. The latest cluster is displayed at the top. Value range: The format is CCYY-MM-DDThh:mm:ss (ISO 8601). |
| id | String | Definition: Cluster ID. Value range: N/A. |
| status | String | Definition: Cluster status. Value range: |
| endpoint | String | Definition The internal IPv4 address and port used for cluster access, for example, 10.10.20.2:9100. Range N/A |
| vpcId | String | Definition: VPC ID. Value range: N/A |
| subnetId | String | Definition: Current subnet of a cluster. The subnet is used for adding nodes, including scaling, adding dedicated master/client nodes, and enabling VPC Endpoint. IP addresses will be allocated to newly added nodes from the new subnet. Value range: N/A |
| securityGroupId | String | Definition: Security group ID. Value range: N/A |
| bandwidthSize | Integer | Definition Public network bandwidth, in Mbit/s. Range N/A |
| httpsEnable | Boolean | Definition: Whether HTTPS access is enabled. Value range: |
| authorityEnable | Boolean | Definition: Whether to enable security mode-based authentication for the cluster. Value range: |
| diskEncrypted | Boolean | Definition Whether to enable disk encryption. This is a restricted function and requires a service ticket to enable. Range |
| backupAvailable | Boolean | Definition Whether to enable cluster snapshots. Range |
| actionProgress | Object | Definition: Cluster behavior progress, which shows the progress of cluster creation and scaling in percentage. CREATING indicates the progress of creation. Value range: N/A |
| actions | Array of strings | Definition Cluster status. The value can be REBOOTING (the cluster is being restarted), GROWING (the cluster is being scaled out), RESTORING (the cluster is being restored), SNAPSHOTTING (a snapshot is being created), BIND_FAILURE (failed to bind the cluster to a public network), SHRINKING (the cluster is being scaled in), REPLACE_NODE (a node is being replaced), AZ_MIGRATION (AZ is being migrated), RESIZING_FLAVOR (the flavor is being modified), MODE_CHANGING (the security mode is being changed), SG_CHANGING (the security group is being changed), UPGRADING (the version is being upgraded), RESETING_PASSWORD (the password is being reset), or CONFIGURED (the configuration is updated and is waiting for a restart). |
| enterpriseProjectId | String | Definition: ID of the enterprise project that a cluster belongs. If the user of the cluster has not enabled the enterprise project, the setting of this parameter is not returned. Value range: N/A |
| tags | Array of ClusterListTags objects | Definition: Cluster tags. Value range: N/A |
| failedReason | ClusterListFailedReasons object | Definition: Cluster failure cause. If the cluster status is available, this parameter is not returned. Value range: N/A |
| period | Boolean | Definition: Whether a cluster is billed on the yearly/monthly mode. Value range: |
| bandwidthResourceId | String | Definition: ID of the resource accessible from the public network. Value range: N/A |
| ipv6Endpoint | String | Definition: IPv6 address and port number accessed from the cluster's private network. Value range: N/A |
| cmkId | String | Definition: Encryption key ID used by the current cluster. Value range: N/A |
| currentSubnetIds | String | Definition: Subnets used by all nodes in the cluster. If there are multiple subnets (two at most), separate them with a comma (,). Value range: N/A |
| desc | String | Definition: Cluster description. Value range: It can contain a maximum of 128 characters. |
| Parameter | Type | Description |
|---|---|---|
| type | String | Definition Cluster engine type. Range |
| version | String | Definition: Cluster engine version. Value range: For details, see the supported versions in Before You Start. |
| supportSecuritymode | Boolean | Definition: Whether the cluster supports the security mode. Value range: |
| subVersion | String | Definition: Cluster image version. Value range: N/A |
| isEosCluster | Boolean | Definition: Whether the cluster image version has reached EOS. Value range: |
| Parameter | Type | Description |
|---|---|---|
| backupEnable | Boolean | Definition: Whether to enable automatic snapshots for the cluster. Value range: |
| bakPeriod | String | Definition: Snapshot creation time. Value range: N/A |
| bakFrequency | String | Definition Snapshot backup interval. Range |
| bakKeepDay | Integer | Definition Number of snapshot backups that can be retained. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| status | String | Definition: Cluster node status. Value range: |
| type | String | Definition: Type of the current cluster node. Value range: |
| id | String | Definition: Instance ID. Value range: N/A |
| name | String | Definition Cluster instance name. Range N/A |
| specCode | String | Definition: Node flavor name. Value range: N/A |
| azCode | String | Definition AZ code of a cluster node. Range N/A |
| ip | String | Definition: Instance IP address. Value range: N/A |
| volume | ClusterVolumeRsp object | Definition Node storage type and capacity. Range N/A |
| resourceId | String | Definition: Instance resource ID. Value range: N/A |
| subnetId | String | Definition: Subnet ID of the current node. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| type | String | Definition: Instance disk type. Value range: N/A |
| size | Integer | Definition Instance disk size, in GB. Range N/A |
| resourceIds | Array of strings | Definition: Instance disk resource ID. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| eipSize | Integer | Definition: The bandwidth size in Mbit/s. Value range: N/A |
| elbWhiteListResp | kibanaElbWhiteListResp object | Definition: Kibana public network access control information. Value range: N/A |
| publicKibanaIp | String | Definition: IP address for accessing Kibana or Dashboards through the public network. Value range: N/A |
| bandwidthResourceId | String | Definition: Resource ID for Kibana/Dashboards public network access. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| enableWhiteList | Boolean | Definition Whether to enable the whitelist that controls public network access for Kibana or OpenSearch Dashboards. Range |
| whiteList | String | Definition Whitelist for accessing Kibana or Dashboards through the public network. Range IPv4 addresses are supported. Use commas (,) to separate multiple IP addresses. |
| Parameter | Type | Description |
|---|---|---|
| enableWhiteList | Boolean | Definition Whether to enable public network access control. If a whitelist is configured, only the IP addresses in the whitelist can access the cluster. If no whitelist is configured, all IP addresses can access the cluster. Range |
| whiteList | String | Definition Whitelist for public network access control. Range IP address. IPv4 addresses are supported. Use commas (,) to separate multiple IP addresses. |
| Parameter | Type | Description |
|---|---|---|
| key | String | Definition: Tag key. Value range: N/A |
| value | String | Definition: Tag value. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| errorCode | String | Definition: Error code. Value range:
|
| errorMsg | String | Definition: Error details. Value range: N/A |
Example Requests
-
Querying the First Two Clusters
- Method 1: GET https://{Endpoint}/v1.0/{project_id}/clusters?start=1&limit=2 - Method 2: GET https://{Endpoint}/v1.0/{project_id}/clusters?limit=2 -
Querying the First 10 Clusters
- Method 1: GET https://{Endpoint}/v1.0/{project_id}/clusters?start=1&limit=10 - Method 2: GET https://{Endpoint}/v1.0/{project_id}/clusters?limit=10
Example Responses
Status code: 200
Request succeeded. This is only an example. The responses to the four requests are similar. In the example, there is only one cluster list.
{
"totalSize" : 1,
"clusters" : [ {
"datastore" : {
"type" : "elasticsearch",
"version" : "7.10.2",
"subVersion" : "7.10.2_24.3.0_0827",
"isEosCluster" : false,
"supportSecuritymode" : false
},
"instances" : [ {
"status" : "200",
"type" : "ess",
"id" : "{INSTANCE_ID}",
"name" : "css-8bc5-ess-esn-1-1",
"specCode" : "ess.spec-4u8g",
"azCode" : "{AZ_CODE}",
"volume" : {
"type" : "ULTRAHIGH",
"size" : 40,
"resourceIds" : [ "{RESOURCE_ID}" ]
},
"ip" : "192.168.0.122",
"resourceId" : "{RESOURCE_ID}",
"subnetId" : "{SUBNET_ID}"
} ],
"publicKibanaResp" : {
"eipSize" : 10,
"publicKibanaIp" : "100.95.152.28:9200",
"bandwidthResourceId" : "18bec13f-5cc1-4631-867f-33505d15be12"
},
"elbWhiteList" : {
"whiteList" : "",
"enableWhiteList" : false
},
"updated" : "2023-10-09T02:07:13",
"name" : "css-8bc5",
"desc" : "csscluster",
"snapshotPolicy" : {
"backupEnable" : false,
"bakPeriod" : "",
"bakFrequency" : "",
"bakKeepDay" : 1
},
"publicIp" : "100.85.222.202",
"created" : "2023-10-09T02:07:13",
"id" : "{CLUSTER_ID}",
"status" : "200",
"endpoint" : "192.168.0.122:9200",
"vpcId" : "{VPC_ID}",
"subnetId" : "{SUBNET_ID}",
"currentSubnetIds" : "{SUBNET_ID}",
"securityGroupId" : "{SECURITY_GROUP_ID}",
"bandwidthResourceId" : "{BANDWIDTH_RESOURCE_ID}",
"bandwidthSize" : 3,
"httpsEnable" : true,
"authorityEnable" : true,
"diskEncrypted" : false,
"backupAvailable" : false,
"actionProgress" : { },
"actions" : [ ],
"enterpriseProjectId" : "0",
"tags" : [ ],
"period" : true
} ]
} SDK Sample Code
The SDK sample code is as follows.
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 | 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.css.v1.region.CssRegion; import com.huaweicloud.sdk.css.v1.*; import com.huaweicloud.sdk.css.v1.model.*; public class ListClustersDetailsSolution { 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); CssClient client = CssClient.newBuilder() .withCredential(auth) .withRegion(CssRegion.valueOf("<YOUR REGION>")) .build(); ListClustersDetailsRequest request = new ListClustersDetailsRequest(); try { ListClustersDetailsResponse response = client.listClustersDetails(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 | # coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkcss.v1.region.css_region import CssRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkcss.v1 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 = CssClient.new_builder() \ .with_credentials(credentials) \ .with_region(CssRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListClustersDetailsRequest() response = client.list_clusters_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) |
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 39 40 41 42 43 44 45 46 47 48 49 | package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" css "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/css/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/css/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/css/v1/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, err := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). SafeBuild() if err != nil { fmt.Println(err) return } hcClient, err := css.CssClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). SafeBuild() if err != nil { fmt.Println(err) return } client := css.NewCssClient(hcClient) request := &model.ListClustersDetailsRequest{} response, err := client.ListClustersDetails(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
More
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 | Request succeeded. This is only an example. The responses to the four requests are similar. In the example, there is only one cluster list. |
| 400 | Invalid request. Modify the request before retry. |
| 404 | The requested resource could not be found. Modify the request before retry. |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank 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