Querying Cluster Details
Function
This API is used to query cluster details.
Calling Method
For details, see Calling APIs.
URI
GET /v1/{project_id}/service/instances/{instance_id}
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Project ID and Account ID. |
instance_id |
Yes |
String |
Cluster ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. This parameter is mandatory when token authentication is used. You can obtain it from the value of X-Subject-Token in the response message header returned by the "Obtaining a User Token" API of the IAM service. |
workspace |
Yes |
String |
Workspace ID. For details about how to obtain the workspace ID, see Instance ID and Workspace ID. |
Dlm-Type |
No |
String |
Specifies the version type of the data service. The value can be SHARED or EXCLUSIVE. |
Content-Type |
No |
String |
Type (format) of the message body. This parameter is mandatory if the message body exists. If the message body does not exist, leave this parameter blank. If the request body contains Chinese characters, use charset=utf8 to specify the Chinese character set, for example, application/json;charset=utf8. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
id |
String |
Cluster ID |
name |
String |
Cluster name |
description |
String |
Provides supplementary information about the cluster. |
external_address |
String |
External IP address. |
intranet_address |
String |
Internal IPv4 address. |
intranet_address_ipv6 |
String |
Internal IPv6 address. |
public_zone_id |
String |
Public zone ID. |
public_zone_name |
String |
Specifies the public zone name. |
private_zone_id |
String |
Specifies the private zone ID. |
private_zone_name |
String |
Specifies the private zone name. |
enterprise_project_id |
String |
Enterprise project ID |
create_time |
Long |
Creation time. |
create_user |
String |
Creator. |
current_namespace_publish_api_num |
Integer |
Number of APIs that have been published in the current workspace. |
all_namespace_publish_api_num |
Integer |
Number of APIs that have been published in all workspaces. |
api_publishable_num |
Integer |
Specifies the total API quota of a cluster. |
deletable |
Boolean |
Specifies whether a cluster can be deleted. |
charge_status |
String |
Charging status of a cluster. The options are as follows: NO_CHARGE: not charged; CHARGED: charged; GRACE: grace period; RETENTION: retention period. |
order_id |
String |
Order ID |
order_type |
String |
Order type. The options are as follows: PERIOD: yearly/monthly; ON_DEMAND: pay-per-use. |
period_type |
String |
Cluster subscription period type. |
instance_status |
String |
Cluster status. |
node_num |
Integer |
Number of nodes. |
flavor |
FlavorDTO object |
Cluster node specifications. |
gateway_version |
String |
Cluster version. |
availability_zone |
String |
Code of the AZ where the cluster is located. |
availability_zone_name |
String |
Name of the AZ where the cluster is located. |
vpc_id |
String |
ID of the VPC to which the cluster belongs. |
subnet_id |
String |
ID of the subnet where the cluster is located. |
security_group_id |
String |
ID of the security group to which the cluster belongs. |
nodes |
Array of InstanceNodeDTO objects |
Cluster node list. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Specifies the flavor ID. |
name |
String |
Flavor name |
disk |
Integer |
Disk size. |
cpu |
Integer |
Number of vCPUs. |
mem |
Integer |
Memory size. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Node ID. |
name |
String |
Node name. |
private_ip |
String |
IP addresses of the nodes |
status |
String |
Indicates the node status. |
create_user |
String |
Node creator. |
create_time |
String |
Time when a node is created |
gateway_version |
String |
Node version number. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Example Requests
Query the details of a cluster whose ID is 51159105c7838353d2834181d978af50.
/v1/0833a5737480d53b2f250010d01a7b88/service/instances/51159105c7838353d2834181d978af50
Example Responses
Status code: 200
Successfully queried.
{ "node_num" : 1, "flavor" : { "id" : "95d4e992-6e3c-11ea-8e90-fa163e35", "name" : "Small-scale dedicated for tests (x86)", "disk" : 120, "cpu" : 8, "mem" : 16 }, "gateway_version" : "3.0.5", "availability_zone" : "cn-north-7c", "availability_zone_name" : "AZ3", "vpc_id" : "791a1ee9-aacf-477a-b00e-dfb18aa364eb", "subnet_id" : "43de865d-e4ce-48c3-8c92-f4972026f4c4", "security_group_id" : "e7527b7f-03d2-49b8-9e78-f4fc3886e792", "nodes" : [ { "id" : "49fdf486-af68-4967-8d96-2aca93dc2dbb", "name" : "dlm_HCS_20240205-dayu_dlm-instance-1-1", "private_ip" : "192.168.0.130", "status" : "RUNNING", "create_user" : "user", "create_time" : "2024-02-20T03:59:25Z", "gateway_version" : "3.0.5" } ], "id" : "c830776ec23fdffe237a44845f871180", "name" : "dlm_HCS_20240205", "description" : "", "external_address" : "100.85.122.140", "intranet_address" : "192.168.0.157", "intranet_address_ipv6" : "2407:c080:11f0:535:8b8f:1825:a0d8:669", "private_zone_id" : null, "private_zone_name" : null, "public_zone_id" : null, "public_zone_name" : null, "instance_status" : "RUNNING", "enterprise_project_id" : "0", "create_time" : 1708400912000, "create_user" : "user", "current_namespace_publish_api_num" : null, "all_namespace_publish_api_num" : null, "api_publishable_num" : null, "deletable" : true, "charge_status" : "CHARGED", "period_type" : "ABSOLUTE", "order_type" : "ON_DEMAND", "order_id" : null }
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.dataartsstudio.v1.region.DataArtsStudioRegion; import com.huaweicloud.sdk.dataartsstudio.v1.*; import com.huaweicloud.sdk.dataartsstudio.v1.model.*; public class ShowDataServiceInstanceSolution { 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); DataArtsStudioClient client = DataArtsStudioClient.newBuilder() .withCredential(auth) .withRegion(DataArtsStudioRegion.valueOf("<YOUR REGION>")) .build(); ShowDataServiceInstanceRequest request = new ShowDataServiceInstanceRequest(); request.withInstanceId("{instance_id}"); try { ShowDataServiceInstanceResponse response = client.showDataServiceInstance(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 huaweicloudsdkdataartsstudio.v1.region.dataartsstudio_region import DataArtsStudioRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkdataartsstudio.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 = DataArtsStudioClient.new_builder() \ .with_credentials(credentials) \ .with_region(DataArtsStudioRegion.value_of("<YOUR REGION>")) \ .build() try: request = ShowDataServiceInstanceRequest() request.instance_id = "{instance_id}" response = client.show_data_service_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" dataartsstudio "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/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 := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := dataartsstudio.NewDataArtsStudioClient( dataartsstudio.DataArtsStudioClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ShowDataServiceInstanceRequest{} request.InstanceId = "{instance_id}" response, err := client.ShowDataServiceInstance(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 |
Successfully queried. |
400 |
Bad request |
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