Halaman ini belum tersedia dalam bahasa lokal Anda. Kami berusaha keras untuk menambahkan lebih banyak versi bahasa. Terima kasih atas dukungan Anda.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Querying the Cluster List

Function

This API is used to query and display the cluster list.

Call Method

For details, see Calling APIs.

URI

1
GET /v1.0/{project_id}/clusters
Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the ID, see Obtaining Project ID.

Request Parameters

None

Response parameters

Status code: 200

Table 2 Response body parameter

Parameter

Type

Description

clusters

Array of ClusterInfo objects

List of cluster objects

count

Integer

Total number of cluster objects

Table 3 ClusterInfo

Parameter

Type

Description

id

String

Cluster ID

name

String

Cluster name

status

String

Cluster status. The value can be one of the following:

  • CREATING: The cluster is being created.

  • ACTIVE: The cluster is available.

  • FAILED: The cluster is unavailable.

  • CREATION FAILED

  • DELETING: The cluster is being deleted.

  • DELETION FAILED: The deletion fails.

  • DELETED: The cluster is deleted.

  • STOPING: The task is being stopped.
  • STOPPED: The job has been stopped.
  • STARTING: The job is starting.
  • FROZEN: The cluster is frozen.

    NOTE:

    If the query result is AVAILABLE, the service is available.

version

String

Data warehouse version

updated

String

Last modification time of a cluster in ISO8601:YYYY-MM-DDThh:mm:ssZ format

created

String

Cluster creation time. Format: ISO8601:YYYY-MM-DDThh:mm:ssZ

port

Integer

Cluster service port.

endpoints

Array of Endpoints objects

Private network connection information about the cluster.

nodes

Array of Nodes objects

Cluster instance

tags

Array of Tags objects

Cluster tag

user_name

String

Administrator user name

number_of_node

Integer

Number of nodes in a cluster

recent_event

Integer

Number of events

availability_zone

String

AZ

enterprise_project_id

String

Enterprise project ID. The value 0 indicates the ID of the default enterprise project.

node_type

String

Node type.

vpc_id

String

VPC ID,

subnet_id

String

Subnet ID,

public_ip

PublicIp object

Public IP address. If the parameter is not specified, public connection is not used by default.

public_endpoints

Array of PublicEndpoints objects

Public network connection information about the cluster. If the parameter is not specified, the public network connection information is not used by default.

action_progress

Map<String,String>

Task information, consisting of a key and a value. The key indicates an ongoing task, and the value indicates the progress of the ongoing task. Valid key values include:

  • CREATING

  • RESTORING

  • SNAPSHOTTING

  • GROWING

  • REBOOTING

  • SETTING_CONFIGURATION

  • CONFIGURING_EXT_DATASOURCE

  • ADD_CN_ING: A CN is being added.

  • DEL_CN_ING: A CN is being deleted.

  • REDISTRIBUTING

  • ELB_BINDING: Associating ELB

  • ELB_UNBINDING: Disassociating ELB

  • ELB_SWITCHIN: Switching ELB nodes

  • NETWORK_CONFIGURING: The network is being configured.

  • DISK_EXPANDING: The disk capacity is being expanded.

  • ACTIVE_STANDY_SWITCHOVER: The active-standby switchover is being performed.

  • CLUSTER_SHRINKING: The cluster is being scaled in.

  • SHRINK_CHECKING: Scale-in detection is in progress.

  • FLAVOR_RESIZING: The instance flavor is being changed.

  • MANAGE_IP_BINDING: Login is being enabled.

  • FINE_GRAINED_RESTORING: Fine-grained restoration is in progress.

  • DR_RECOVERING: DR recovery is in progress.

  • REPAIRING

An example is as follows:

"action_progress":
{"SNAPSHOTTING":"16%"}

sub_status

String

Sub-status of clusters in the AVAILABLE state. The value can be one of the following:

  • NORMAL
  • READONLY
  • REDISTRIBUTING
  • REDISTRIBUTION-FAILURE
  • UNBALANCED
  • UNBALANCED | READONLY
  • DEGRADED
  • DEGRADED | READONLY
  • DEGRADED | UNBALANCED
  • UNBALANCED | REDISTRIBUTING
  • UNBALANCED | REDISTRIBUTION-FAILURE
  • READONLY | REDISTRIBUTION-FAILURE
  • UNBALANCED | READONLY | REDISTRIBUTION-FAILURE
  • DEGRADED | REDISTRIBUTION-FAILURE
  • DEGRADED | UNBALANCED | REDISTRIBUTION-FAILURE
  • DEGRADED | UNBALANCED | READONLY | REDISTRIBUTION-FAILURE
  • DEGRADED | UNBALANCED | READONLY

task_status

String

Cluster management task. The value can be one of the following:

  • UNFREEZING

  • FREEZING

  • RESTORING

  • SNAPSHOTTING

  • GROWING

  • REBOOTING

  • SETTING_CONFIGURATION

  • CONFIGURING_EXT_DATASOURCE

  • DELETING_EXT_DATASOURCE

  • REBOOT_FAILURE

  • RESIZE_FAILURE

  • ADD_CN_ING: A CN is being added.

  • DEL_CN_ING: A CN is being deleted.

  • CREATING_NODE: Add a node.

  • CREATE_NODE_FAILED: Failed to add the node.

  • DELETING_NODE: Delete a node.

  • DELETE_NODE_FAILED: Failed to delete the node.

  • REDISTRIBUTING

  • REDISTRIBUTE_FAILURE: The redistribution failed.

  • WAITING_REDISTRIBUTION: Waiting to be redistributed

  • REDISTRIBUTION_PAUSED: Redistribution is paused.

  • ELB_BINDING: ELB is being bound.

  • ELB_BIND_FAILED: Failed to associate ELB

  • ELB_UNBINDING: ELB is being unbound.

  • ELB_UNBIND_FAILED: Failed to disassociate ELB.

  • ELB_SWITCHING: ELB nodes are being switched.

  • ELB_SWITCHING_FAILED: Failed to switch ELB nodes.

  • NETWORK_CONFIGURING: The network is being configured.

  • NETWORK_CONFIG_FAILED: Failed to configure the network.

  • DISK_EXPAND_FAILED: Failed to expand the disk capacity.

  • DISK_EXPANDING: The disk capacity is being expanded.

  • ACTIVE_STANDY_SWITCHOVER: The active-standby switchover is being performed.

  • ACTIVE_STANDY_SWITCHOVER_FAILURE: The active-standby switchover failed.

  • CLUSTER_SHRINK_FAILED: Failed to scale-in.

  • CLUSTER_SHRINKING: The cluster is being scaled in.

  • SHRINK_CHECK_FAILED: The scale-in detection failed.

  • SHRINK_CHECKING: Scale-in detection is in progress.

  • FLAVOR_RESIZING_FAILED: Failed to change the flavor.

  • FLAVOR_RESIZING: The instance flavor is being changed.

  • MANAGE_IP_BIND_FAILED: Failed to enable login.

  • MANAGE_IP_BINDING: Login is being enabled.

  • ORDER_PENDING: The order is pending to be paid.

  • FINE_GRAINED_RESTORING: Fine-grained restoration is in progress.

  • DR_RECOVERING: DR recovery is in progress.

security_group_id

String

Security group ID

failed_reasons

FailedReason object

Cause of failure. If the parameter is left empty, the cluster is in the normal state.

Table 4 Endpoints

Parameter

Type

Description

connect_info

String

Private network connection information

jdbc_url

String

Intranet JDBC URL. The default format is jdbc:postgresql://<connect_info>/<YOUR_DATABASE_NAME>

Table 5 Nodes

Parameter

Type

Description

id

String

Cluster instance ID

status

String

Cluster instance status

  • 100: Creating

  • 199: Idle

  • 200: Available

  • 300: Unavailable

  • 303: Creation failed.

  • 304: Deleting

  • 305: Deletion failed.

  • 400: Deleted

Table 6 Tags

Parameter

Type

Description

key

String

Key. A tag key can contain a maximum of 128 characters. It cannot be an empty string or start or end with a space. Only letters, digits, hyphens (-), and underscores (_) are allowed. It cannot contain the following characters: =*<>\,|/

value

String

Value. A tag value can contain a maximum of 255 characters, which can be an empty string. It cannot start or end with a space. Only letters, digits, hyphens (-), and underscores (_) are allowed. It cannot contain the following characters: =*<>\,|/

Table 7 PublicIp

Parameter

Type

Description

public_bind_type

String

Binding type of an EIP. The value can be one of the following:

  • auto_assign

  • not_use

  • bind_existing

eip_id

String

EIP ID

Table 8 PublicEndpoints

Parameter

Type

Description

public_connect_info

String

Public network connection information

jdbc_url

String

Public network JDBC URL. The default format is jdbc:postgresql://<public_connect_info>/<YOUR_DATABASE_name>.

Table 9 FailedReason

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Example Request

GET https://{Endpoint}/v1.0/89cd04f168b84af6be287f71730fdb4b/clusters

Example Response

Status code: 200

The cluster list is queried successfully.

{
  "clusters" : [ {
    "id" : "7d85f602-a948-4a30-afd4-e84f47471c15",
    "name" : "dws-1",
    "status" : "AVAILABLE",
    "version" : "1.2.0",
    "updated" : "2016-02-10T14:28:14Z",
    "created" : "2016-02-10T14:26:14Z",
    "port" : 8000,
    "endpoints" : [ {
      "connect_info" : "dws-1.cn-north-4.myhuaweicloud.com",
      "jdbc_url" : "jdbc:postgresql://dws-1.cn-north-4.myhuaweicloud.com/<YOUR_DATABASE_name>"
    } ],
    "nodes" : [ {
      "id" : "acaf62a4-41b3-4106-bf6b-2f669d88291e",
      "status" : "200"
    }, {
      "id" : "d32de51e-4fcd-4e5a-a9dc-bb903abb494b",
      "status" : "200"
    }, {
      "id" : "d71a4a25-c9bc-4ffd-9f4a-e422aef327f9",
      "status" : "200"
    } ],
    "tags" : [ {
      "key" : "key1",
      "value" : "value1"
    }, {
      "key" : "key2",
      "value" : "value2"
    } ],
    "user_name" : "dbadmin",
    "number_of_node" : 3,
    "recent_event" : 6,
    "availability_zone" : "cn-north-4b",
    "enterprise_project_id" : "0",
    "node_type" : "dws.d1.xlarge.ultrahigh",
    "vpc_id" : "85b20d7e-9eb7-4b2a-98f3-3c8843ea3574",
    "subnet_id" : "374eca02-cfc4-4de7-8ab5-dbebf7d9a720",
    "public_ip" : {
      "public_bind_type" : "auto_assign",
      "eip_id" : "85b20d7e-9eb7-4b2a-98f3-3c8843ea3574"
    },
    "public_endpoints" : [ {
      "public_connect_info" : "dws-1.cn-north-4.myhuaweicloud.com",
      "jdbc_url" : "jdbc:postgresql://dws-1.cn-north-4.myhuaweicloud.com/<YOUR_DATABASE_name>"
    } ],
    "action_progress" : {
      "SNAPSHOTTING" : "20%"
    },
    "sub_status" : "READONLY",
    "task_status" : "SNAPSHOTTING",
    "security_group_id" : "dc3ec145-9029-4b39-b5a3-ace5a01f772b"
  } ]
}

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
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 ListClustersSolution {

    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("cn-north-4"))
                .build();
        ListClustersRequest request = new ListClustersRequest();
        try {
            ListClustersResponse response = client.listClusters(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
# 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("cn-north-4")) \
        .build()

    try:
        request = ListClustersRequest()
        response = client.list_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
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("cn-north-4")).
            WithCredential(auth).
            Build())

    request := &model.ListClustersRequest{}
	response, err := client.ListClusters(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.

 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
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 ListClustersSolution {

    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("cn-north-4"))
                .build();
        ListClustersRequest request = new ListClustersRequest();
        try {
            ListClustersResponse response = client.listClusters(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
# 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("cn-north-4")) \
        .build()

    try:
        request = ListClustersRequest()
        response = client.list_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
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("cn-north-4")).
            WithCredential(auth).
            Build())

    request := &model.ListClustersRequest{}
	response, err := client.ListClusters(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.

Kami menggunakan cookie untuk meningkatkan kualitas situs kami dan pengalaman Anda. Dengan melanjutkan penelusuran di situs kami berarti Anda menerima kebijakan cookie kami. Cari tahu selengkapnya

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback