Querying Flavor Details of a Cluster
Function
This API is used to query flavor details of a cluster.
Calling Method
For details, see Calling APIs.
URI
GET /v2/{project_id}/clusters/{cluster_id}/flavor
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. To obtain the value, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
| cluster_id | Yes | String | Definition Cluster ID. For details about how to obtain the value, see Obtaining the Cluster ID. Constraints N/A Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| namespace | No | String | Definition Namespace. Generally, the value can only be DWS. Constraints N/A Range N/A Default Value N/A |
Request Parameters
None
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| flavor | ClusterFlavorDetailInfo object | Definition Cluster flavor details. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Flavor ID. Range N/A |
| spec_name | String | Definition Flavor code. Range N/A |
| current_node | Integer | Definition Number of existing nodes. Range N/A |
| min_node | Integer | Definition Minimum number of nodes. Range N/A |
| max_node | Integer | Definition Maximum number of nodes. Range N/A |
| classify | String | Definition Flavor type. Range N/A |
| datastore_version | String | Definition Data warehouse version. Range N/A |
| attribute | Array of FlavorAttributeInfo objects | Definition Extended information. Range N/A |
| volume_node | FlavorVolumeNodeInfo object | Definition Flavor used by the cluster. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| code | String | Definition Attribute code. Range N/A |
| value | String | Definition Attribute value. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| volume_type | String | Definition Storage type used by a node. Range N/A |
| volume_num | Integer | Definition Number of disks used by a node. Range N/A |
| capacity | Integer | Definition Available capacity of a node after copies are removed. Range N/A |
| volume_size | Integer | Definition Capacity of a single disk on a node. Range N/A |
Example Requests
Query the cluster flavor details.
GET https://{Endpoint}/v2/05f2cff45100d5112f4bc00b794ea08e/clusters/c4b7a057-b121-4a80-9855-8d850108f85f/flavor Example Responses
Status code: 200
Cluster flavors queried.
{
"flavor" : {
"id" : "d60ef487-7aa8-44b7-969a-d543ddc5b96f",
"spec_name" : "dwsk2.xlarge",
"current_node" : 3,
"min_node" : 3,
"max_node" : 256,
"classify" : "dws",
"attribute" : [ {
"code" : "cpuNum",
"value" : "4"
}, {
"code" : "diskType",
"value" : "SSD"
}, {
"code" : "ioGbSec",
"value" : ""
}, {
"code" : "localDisk",
"value" : "N"
}, {
"code" : "maxQueue",
"value" : ""
}, {
"code" : "memSize",
"value" : "32"
} ],
"volume_node" : {
"volume_type" : "SATA",
"volume_num" : 2,
"capacity" : 100,
"volume_size" : 100
},
"datastore_version" : "8.3.0.201"
}
} 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.dws.v2.region.DwsRegion; import com.huaweicloud.sdk.dws.v2.*; import com.huaweicloud.sdk.dws.v2.model.*; public class ShowClusterFlavorSolution { 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); DwsClient client = DwsClient.newBuilder() .withCredential(auth) .withRegion(DwsRegion.valueOf("<YOUR REGION>")) .build(); ShowClusterFlavorRequest request = new ShowClusterFlavorRequest(); request.withClusterId("{cluster_id}"); try { ShowClusterFlavorResponse response = client.showClusterFlavor(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 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.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = DwsClient.new_builder() \ .with_credentials(credentials) \ .with_region(DwsRegion.value_of("<YOUR REGION>")) \ .build() try: request = ShowClusterFlavorRequest() request.cluster_id = "{cluster_id}" response = client.show_cluster_flavor(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" 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") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := dws.NewDwsClient( dws.DwsClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ShowClusterFlavorRequest{} request.ClusterId = "{cluster_id}" response, err := client.ShowClusterFlavor(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 | Cluster flavors queried. |
| 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