Updated on 2026-08-24 GMT+08:00

Creating a Cluster (Discarded)

Function

This API can only be used to create clusters that contain a single type of nodes. To create clusters that contain multiple types of nodes (ess, ess-cold, ess-client, and ess-master), use the API for Creating a Cluster v2.

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:create

    Write

    cluster *

    -

    -

    • ecs:cloudServerFlavors:get
    • evs:types:get
    • vpc:vpcs:list
    • vpc:securityGroups:list
    • vpc:securityGroups:get
    • vpc:subnets:list
    • vpc:subnets:get
    • vpc:ports:create
    • vpc:ports:update
    • vpc:ports:delete
    • vpc:ports:get
    • sfsturbo:shares:getAllShares
    • kms:cmk:listGrants
    • kms:cmk:createGrant
    • kms:cmk:list
    • kms:cmk:get
    • css:cluster:getAgencies
    • iam:agencies:listAgencies
    • iam:permissions:listRolesForAgency
    • iam:permissions:listRolesForAgencyOnProject
    • iam:agencies:pass

    -

    • g:EnterpriseProjectId

    • g:RequestTag/<tag-key>

    • g:TagKeys

URI

POST /v1.0/{project_id}/clusters

Table 1 Path Parameters

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

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

cluster

Yes

CreateClusterBody object

Definition

Cluster object.

Constraints

N/A

Table 3 CreateClusterBody

Parameter

Mandatory

Type

Description

instance

Yes

CreateClusterInstanceBody object

Definition

Instance.

Constraints

N/A

datastore

Yes

CreateClusterDatastoreBody object

Definition

Search engine type.

Constraints

N/A

name

Yes

String

Definition

Cluster name.

Constraints

N/A

Range

The value can contain 4 to 32 characters and must start with a letter. Only letters, digits, hyphens (-), and underscores (_) are allowed. The name must be unique.

Default Value

N/A

desc

No

String

Definition

Cluster description.

Constraints

N/A

Range

The value can contain at most 128 characters.

Default Value

N/A

instanceNum

Yes

Integer

Definition:

Number of cluster instances.

Constraints:

N/A

Value range:

1–32.

Default value:

N/A

backupStrategy

No

CreateClusterBackupStrategyBody object

Definition

Whether to enable automatic snapshot creation.

Constraints

An automatic snapshot creation policy can be enabled only if backupStrategy is not left blank.

httpsEnable

No

Boolean

Definition

Whether communication is encrypted on the cluster.

Constraints

This parameter is supported only by security-mode clusters of Elasticsearch 6.5.4 and later.

HTTPS access can be disabled only for OpenSearch 1.3.6 and 2.19.0 security-mode clusters. For other versions, HTTPS access is forcibly enabled and cannot be disabled.

When httpsEnable is set to true, authorityEnable must be set to true.

Range

  • true: Communication is encrypted on the cluster.

  • false: Communication is not encrypted for the cluster.

Default Value

false

authorityEnable

No

Boolean

Definition

Whether to enable authentication.

Constraints

This parameter is supported only by security-mode clusters of Elasticsearch 6.5.4 and later.

Range

  • true: Authentication is enabled for the cluster.

  • false: Authentication is disabled for the cluster.

Default Value

false

adminPwd

No

String

Definition

Password of the administrator admin for a security-mode cluster. Weak password verification is required for a security-mode cluster. You are advised to set a strong password.

Constraints

This parameter is mandatory only when authorityEnable is set to true during cluster creation.

Range

  • Contain 8 to 32 characters.

  • Contain at least three of the following types: uppercase letters, lowercase letters, digits, and special characters, which can be ~!@#$%^&*()-_=+\|[{}];:,<.>/?

Default Value

N/A

enterprise_project_id

No

String

Definition

Enterprise project ID. When you create a cluster, associate the enterprise project ID with the cluster. 0 indicates the default enterprise project.

For details about how to obtain the enterprise project ID, see Listing Enterprise Projects.

Constraints

N/A

Range

The value can contain at most 36 characters. It is string 0 or in UUID format with hyphens (-).

Default Value

N/A

tags

No

Array of CreateClusterTagsBody objects

Definition

Cluster tag. Each tag contains a key and a value, which are used to classify and filter clusters.

Constraints

N/A

payInfo

No

payInfoBody object

Definition

Parameters related to yearly/monthly clusters.

Constraints

This parameter is used only when you subscribe to a yearly/monthly cluster.

ipv6_enable

No

Boolean

Definition

Whether to enable automatic IPv6 address assignment for the cluster.

Constraints

N/A

Range

true: Automatically assign IPv6 address.

false: Do not assign IPv6 address.

Default Value

false

diskEncryption

No

diskEncryptionInfo object

Definition

Disk encryption information.

Constraints

N/A

Table 4 CreateClusterInstanceBody

Parameter

Mandatory

Type

Description

flavorRef

Yes

String

Parameter description:

Instance flavor name. For details about the current instance flavor, see the name attribute in Obtaining the Instance Specifications List.

Constraints:

N/A

Options:

N/A

Default value:

N/A

volume

Yes

CreateClusterInstanceVolumeBody object

Definition

Disk volume information of a node.

Constraints

You do not need to set this parameter when flavorRef is set to a local disk flavor. Currently, the following local disk flavors are supported:

  • ess.spec-i3small

  • ess.spec-i3medium

  • ess.spec-i3.8xlarge.8

Range

N/A

Default Value

N/A

nics

Yes

CreateClusterInstanceNicsBody object

Definition

Subnet information.

Constraints

N/A

availability_zone

Yes

String

Definition

AZ where the node is located. You need to specify the AZ name. Obtain it from Regions and Endpoints.

Constraints

When specifying the AZs of nodes, use commas (,) to separate different AZ names. For example, if multiple AZs are selected for general AZs, the value of availability_zone is region-1a,region-1b,region-1c.

NOTE:
If multiple AZs are selected, the name of each AZ must be unique, and the number of nodes must be greater than or equal to the number of AZs.

When selecting two AZs, each AZ must contain at least two data nodes (ess) or cold data nodes (ess-cold).

If the number of nodes is evenly divisible by the number of AZs, the nodes will be evenly distributed among all AZs.

If the number of nodes is not evenly divisible by the number of AZs, the absolute difference between node quantity in any two AZs is 1 at most.

Range

N/A

Default Value

availability_zone is empty by default, indicating that a single AZ is used.

Table 5 CreateClusterInstanceVolumeBody

Parameter

Mandatory

Type

Description

volume_type

Yes

String

Parameter description:

Volume type.

Constraints:

N/A

Options:

  • COMMON: common I/O

  • HIGH: high I/O

  • ULTRAHIGH: ultra-high I/O

  • ESSD: ultra-fast SSD

Default value:

N/A

size

Yes

Integer

Definition

Storage space in GB.

Constraints

The value must be greater than 0 and a common multiple of 4 and 10, in GB.

Range

You can obtain the disk size from the diskrange attribute in Obtaining the Instance Specifications List.

Default Value

  • ess and ess-cold nodes: 100 GB or the minimum disk capacity supported by the selected node flavor, whichever is larger.

  • ess-master and ess-client nodes: The default volume size is 40 GB and cannot be changed.

NOTE:
For ess and ess-cold nodes, 100 GB or a larger value is recommended.
Table 6 CreateClusterInstanceNicsBody

Parameter

Mandatory

Type

Description

vpcId

Yes

String

Definition

VPC ID, which is used for configuring cluster network. For details, see Querying VPCs.

Constraints

N/A

Range

N/A

Default Value

N/A

netId

Yes

String

Definition

Subnet ID (network ID). For details, see Obtaining the Subnet ID.

Constraints

N/A

Range

N/A

Default Value

N/A

securityGroupId

Yes

String

Definition

Security group ID. For details, see Querying Security Groups.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 7 CreateClusterDatastoreBody

Parameter

Mandatory

Type

Description

version

Yes

String

Parameter description:

Elasticsearch/Logstash engine version. For details, see the supported versions in Before You Start.

Constraints:

N/A

Options:

N/A

Default value:

N/A

type

Yes

String

Definition

Engine type of the cluster to be created.

Constraints

N/A

Range

  • elasticsearch: Elasticsearch cluster.

  • opensearch: OpenSearch cluster.

  • logstash: Logstash cluster.

Default Value

N/A

Table 8 CreateClusterBackupStrategyBody

Parameter

Mandatory

Type

Description

period

No

String

Definition

Time when a snapshot is created every day. The format is HH:mm z. HH:mm indicates the hour time and z indicates the time zone. For example, 00:00 GMT+08:00 and 01:00 GMT+08:00.

Constraints

Only the hour time is supported, and the time zone must be added.

NOTE:
When frequency is set to HOUR, you do not need to specify period. By default, snapshot creation starts from the next hour after the settings are successful.

Range

N/A

Default Value

00:00 GMT+08:00

prefix

Yes

String

Definition

Prefix of a snapshot that is automatically created, which is manually entered.

Constraints

N/A

Range

The value can contain 1 to 32 characters and must start with a lowercase letter. Only lowercase letters, digits, hyphens (-), and underscores (_) are allowed.

Default Value

N/A

keepday

Yes

Integer

Definition

Customize the number of snapshots to be retained.

Constraints

Expired snapshots will be automatically deleted on the half hour. The deletion policy applies only to automated snapshots that are executed at the same frequency as the current automatic snapshot creation policy.

Range

1 to 90

Default Value

N/A

bucket

No

String

Definition

Name of the OBS bucket used for backup.

Constraints

N/A

Range

The bucket name can contain 3 to 63 characters. Only lowercase letters, digits, hyphens (-), and periods (.) are allowed.

Default Value

N/A

basePath

No

String

Definition

Storage path of the snapshot in the OBS bucket.

Constraints

The path must not contain the following special characters: :*?"<>{}'|

The path must not start with a slash (/).

The path must not start or end with a period (.).

The path must not contain two or more consecutive slashes (/) or periods (.).

Range

The path can contain 3 to 512 characters. Only letters, digits, hyphens (-), underscores (_), slashes (/), and periods (.) are allowed.

Default Value

N/A

agency

No

String

Definition

Agency name. You can create an agency to allow CSS to call other cloud services.

Constraints

N/A

Range

The agency name can contain at most 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

Default Value

N/A

NOTE:
If none of the bucket, basePath, and agency parameters are specified, the system will automatically create an OBS bucket and an IAM agency. If the creation fails, you need to manually configure correct parameters.

frequency

No

String

Definition:

Frequency of automatically creating snapshots.

Constraints:

N/A

Value range:

  • HOUR: Execute once every hour on the hour.

  • DAY: Execute once every day.

  • SUN, MON, TUE, WED, THU, FRI, and SAT: Execute the task at the specified day of every week. For example, SUN indicates that the task is executed once every Sunday.

  • The number of retained snapshots depends on the execution frequency and indexes set in the automatic snapshot creation policy. If the execution interval is short or the index data volume is large, the number of retained automatic snapshots may not reach the preset value. Set this value based on actual conditions.

Default value:

DAY

maxSnapshotBytesPerSeconds

No

String

Definition

Configures the maximum backup rate per node (per second). If the backup rate exceeds this value, throttling is applied to prevent excessive resource usage and protect system stability. The actual backup rate may not reach this value due to factors such as OBS and disk performance.

Constraints

N/A

Range

The following three input formats are supported:

  • Number + Unit

  • 0

  • -1

The numeric part supports values from 0 to 9999.

The unit supports k, kb, m, mb, g, gb, t, tb, p, pb, and b, case-insensitive.

If you set the parameter to 0mb, 0, or -1, the backup rate is unlimited. If the backup rate is too high, backup operations may consume excessive resources and affect system stability.

Default Value

The default value is 40mb. If this parameter is left blank, the default value is used.

maxRestoreBytesPerSeconds

No

String

Definition:

This parameter sets the maximum recovery speed per node (bytes per second). When it is exceeded, flow control is triggered to prevent excessive resource usage and ensure system stability. The actual recovery speed may not reach the configured value, as it depends on many factors, such as OBS performance and disk I/O.

Constraints:

For OpenSearch clusters and Elasticsearch clusters later than 7.6.2, the recovery speed is also limited by the indices.recovery.max_bytes_per_sec parameter. If Maximum recovery speed (per second) is lower than indices.recovery.max_bytes_per_sec, flow control is triggered when the former is reached. If Maximum recovery speed (per second) is higher than indices.recovery.max_bytes_per_sec, flow control is triggered when the latter is reached.

Value range:

The following values and formats are allowed:

  • Number + Unit

  • 0

  • -1

The number ranges from 0 to 9999.

The unit can be k, kb, m, mb, g, gb, t, tb, p, pb, or b (case-insensitive).

Setting this parameter to 0mb, 0, -1 means there is no speed limit. (However, for OpenSearch clusters and Elasticsearch clusters later than 7.6.2, the recovery speed is also limited by the indices.recovery.max_bytes_per_sec parameter.) An overly high recovery speed may lead to excessive resource usage, which may impact system stability.

Default value:

For Elasticsearch clusters of 7.6.2 or earlier, the default setting is 40 MB.

For OpenSearch clusters and Elasticsearch clusters later than 7.6.2, the default setting is no limit, but the recovery speed is still limited by the indices.recovery.max_bytes_per_sec parameter.

If this parameter is left blank, the default setting is used.

Table 9 CreateClusterTagsBody

Parameter

Mandatory

Type

Description

key

Yes

String

Definition

Cluster tag key.

Constraints

N/A

Range

The value can contain 1 to 36 characters. Only digits, letters, hyphens (-), and underscores (_) are allowed.

Default Value

N/A

value

Yes

String

Definition

Cluster tag value.

Constraints

N/A

Range

The value can contain at most 255 characters. UTF-8 letters, digits, spaces, and the following special characters are allowed: _.://=+-@

Default Value

N/A

Table 10 payInfoBody

Parameter

Mandatory

Type

Description

payModel

Yes

Integer

Definition:

Subscription period type.

Constraints:

N/A

Value range:

  • 2: Monthly

  • 3: Yearly

Default value:

N/A

period

Yes

Integer

Definition

Number of subscription periods.

Constraints

  • If payModel is 2, the value ranges from 1 to 9.

  • If payModel is 3, the value ranges from 1 to 3.

Range

If payModel is 2, the value ranges from 1 to 9. If payModel is 3, the value ranges from 1 to 3.

Default Value

N/A

isAutoRenew

No

Integer

Definition:

Whether to automatically renew the subscription. If this parameter is not specified, the subscription is not automatically renewed.

Constraints:

N/A

Value range:

  • 1: Auto renewal is enabled.

  • 0: Auto renewal is disabled.

Default value:

0

isAutoPay

No

Integer

Definition

Whether to enable automatic payment from your Huawei Cloud account.

Constraints

This parameter applies to yearly/monthly clusters.

Range

  • 1: Automatic payment. Discounts and coupons are automatically selected, and the amount is automatically deducted from your Huawei Cloud account. If automatic payment fails, a pending payment order is generated (the amount payable is the discounted amount), and you need to complete the payment manually. During manual payment, the automatically selected discounts and coupons can be modified.

  • 0: Manual payment. You need to manually pay the order. During payment, discounts and coupons can be selected.

Default Value

0

Table 11 diskEncryptionInfo

Parameter

Mandatory

Type

Description

systemEncrypted

No

String

Definition

Whether to enable disk encryption.

Constraints

N/A

Range

  • 0: Disable disk encryption.

  • 1: Enable disk encryption.

Default Value

0

systemCmkid

No

String

Definition

KMS key ID. For details about how to obtain the key ID, see Querying the Key List.

Constraints

This parameter is valid only when systemEncrypted is set to 1.

Range

N/A

Default Value

N/A

Response Parameters

Status code: 200

Table 12 Response body parameters

Parameter

Type

Description

cluster

CreateClusterClusterResponse object

Definition

Cluster object.

orderId

String

Definition

Order ID. The orderId parameter is returned only when a yearly/monthly cluster is created.

Range

N/A

Table 13 CreateClusterClusterResponse

Parameter

Type

Description

id

String

Parameter description:

Cluster ID.

Options:

N/A

name

String

Parameter description:

Cluster name.

Options:

N/A

Example Requests

  • Example request for creating a yearly/monthly cluster.

    POST https://{Endpoint}/v1.0/{project_id}/clusters
    
    {
      "cluster" : {
        "instance" : {
          "flavorRef" : "ess.spec-4u16g",
          "volume" : {
            "volume_type" : "COMMON",
            "size" : 120
          },
          "nics" : {
            "vpcId" : "{VPC ID}",
            "netId" : "{NET ID}",
            "securityGroupId" : "{Security group ID}"
          },
          "availability_zone" : "{AZ CODE}"
        },
        "datastore" : {
          "version" : "{cluster-version}",
          "type" : "elasticsearch"
        },
        "name" : "cluster-name",
        "desc" : "Cluster testing",
        "instanceNum" : 3,
        "backupStrategy" : {
          "period" : "16:00 GMT+08:00",
          "prefix" : "snapshot",
          "keepday" : 7,
          "frequency" : "DAY",
          "bucket" : "css-obs-backup",
          "basePath" : "css_repository/obs-path",
          "agency" : "css_obs_agency",
          "maxSnapshotBytesPerSeconds" : "40MB",
          "maxRestoreBytesPerSeconds" : "40MB"
        },
        "httpsEnable" : true,
        "authorityEnable" : true,
        "adminPwd" : "{password}",
        "enterprise_project_id" : "0",
        "tags" : [ {
          "key" : "k1",
          "value" : "v1"
        }, {
          "key" : "k2",
          "value" : "v2"
        } ],
        "payInfo" : {
          "payModel" : 2,
          "period" : 1,
          "isAutoRenew" : 1,
          "isAutoPay" : 1
        }
      }
    }
  • Example request for creating a pay-per-use cluster.

    POST https://{Endpoint}/v1.0/{project_id}/clusters
    
    {
      "cluster" : {
        "instance" : {
          "flavorRef" : "ess.spec-4u16g",
          "volume" : {
            "volume_type" : "COMMON",
            "size" : 120
          },
          "nics" : {
            "vpcId" : "{VPC ID}",
            "netId" : "{NET ID}",
            "securityGroupId" : "{Security group ID}"
          },
          "availability_zone" : "{AZ CODE}"
        },
        "datastore" : {
          "version" : "{cluster-version}",
          "type" : "elasticsearch"
        },
        "name" : "cluster-name",
        "desc" : "Cluster testing",
        "instanceNum" : 3,
        "backupStrategy" : {
          "period" : "16:00 GMT+08:00",
          "prefix" : "snapshot",
          "keepday" : 7,
          "frequency" : "DAY",
          "bucket" : "css-obs-backup",
          "basePath" : "css_repository/obs-path",
          "agency" : "css_obs_agency",
          "maxSnapshotBytesPerSeconds" : "40MB",
          "maxRestoreBytesPerSeconds" : "40MB"
        },
        "httpsEnable" : true,
        "authorityEnable" : true,
        "adminPwd" : "{password}",
        "enterprise_project_id" : "0",
        "tags" : [ {
          "key" : "k1",
          "value" : "v1"
        }, {
          "key" : "k2",
          "value" : "v2"
        } ]
      }
    }

Example Responses

Status code: 200

Request succeeded.

  • Example response for creating a pay-per-use cluster.

    {
      "cluster" : {
        "id" : "ef683016-871e-48bc-bf93-74a29d60d214",
        "name" : "ES-Test"
      }
    }
  • Example response for creating a yearly/monthly cluster.

    {
      "cluster" : {
        "id" : "ef683016-871e-48bc-bf93-74a29d60d214",
        "name" : "ES-Test"
      },
      "orderId" : "CS2208241141LY94J"
    }

SDK Sample Code

The SDK sample code is as follows.

Java

  • Example request for creating a yearly/monthly cluster.

      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
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    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.*;
    
    import java.util.List;
    import java.util.ArrayList;
    
    public class CreateClusterSolution {
    
        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();
            CreateClusterRequest request = new CreateClusterRequest();
            CreateClusterReq body = new CreateClusterReq();
            PayInfoBody payInfoCluster = new PayInfoBody();
            payInfoCluster.withPayModel(2)
                .withPeriod(1)
                .withIsAutoRenew(1)
                .withIsAutoPay(1);
            List<CreateClusterTagsBody> listClusterTags = new ArrayList<>();
            listClusterTags.add(
                new CreateClusterTagsBody()
                    .withKey("k1")
                    .withValue("v1")
            );
            listClusterTags.add(
                new CreateClusterTagsBody()
                    .withKey("k2")
                    .withValue("v2")
            );
            CreateClusterBackupStrategyBody backupStrategyCluster = new CreateClusterBackupStrategyBody();
            backupStrategyCluster.withPeriod("16:00 GMT+08:00")
                .withPrefix("snapshot")
                .withKeepday(7)
                .withFrequency("DAY")
                .withBucket("css-obs-backup")
                .withBasePath("css_repository/obs-path")
                .withAgency("css_obs_agency")
                .withMaxSnapshotBytesPerSeconds("40MB")
                .withMaxRestoreBytesPerSeconds("40MB");
            CreateClusterDatastoreBody datastoreCluster = new CreateClusterDatastoreBody();
            datastoreCluster.withVersion("{cluster-version}")
                .withType("elasticsearch");
            CreateClusterInstanceNicsBody nicsInstance = new CreateClusterInstanceNicsBody();
            nicsInstance.withVpcId("{VPC ID}")
                .withNetId("{NET ID}")
                .withSecurityGroupId("{Security group ID}");
            CreateClusterInstanceVolumeBody volumeInstance = new CreateClusterInstanceVolumeBody();
            volumeInstance.withVolumeType("COMMON")
                .withSize(120);
            CreateClusterInstanceBody instanceCluster = new CreateClusterInstanceBody();
            instanceCluster.withFlavorRef("ess.spec-4u16g")
                .withVolume(volumeInstance)
                .withNics(nicsInstance)
                .withAvailabilityZone("{AZ CODE}");
            CreateClusterBody clusterbody = new CreateClusterBody();
            clusterbody.withInstance(instanceCluster)
                .withDatastore(datastoreCluster)
                .withName("cluster-name")
                .withInstanceNum(3)
                .withBackupStrategy(backupStrategyCluster)
                .withHttpsEnable(true)
                .withAuthorityEnable(true)
                .withAdminPwd("{password}")
                .withEnterpriseProjectId("0")
                .withTags(listClusterTags)
                .withPayInfo(payInfoCluster);
            body.withCluster(clusterbody);
            request.withBody(body);
            try {
                CreateClusterResponse response = client.createCluster(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());
            }
        }
    }
    
  • Example request for creating a pay-per-use cluster.

     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
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    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.*;
    
    import java.util.List;
    import java.util.ArrayList;
    
    public class CreateClusterSolution {
    
        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();
            CreateClusterRequest request = new CreateClusterRequest();
            CreateClusterReq body = new CreateClusterReq();
            List<CreateClusterTagsBody> listClusterTags = new ArrayList<>();
            listClusterTags.add(
                new CreateClusterTagsBody()
                    .withKey("k1")
                    .withValue("v1")
            );
            listClusterTags.add(
                new CreateClusterTagsBody()
                    .withKey("k2")
                    .withValue("v2")
            );
            CreateClusterBackupStrategyBody backupStrategyCluster = new CreateClusterBackupStrategyBody();
            backupStrategyCluster.withPeriod("16:00 GMT+08:00")
                .withPrefix("snapshot")
                .withKeepday(7)
                .withFrequency("DAY")
                .withBucket("css-obs-backup")
                .withBasePath("css_repository/obs-path")
                .withAgency("css_obs_agency")
                .withMaxSnapshotBytesPerSeconds("40MB")
                .withMaxRestoreBytesPerSeconds("40MB");
            CreateClusterDatastoreBody datastoreCluster = new CreateClusterDatastoreBody();
            datastoreCluster.withVersion("{cluster-version}")
                .withType("elasticsearch");
            CreateClusterInstanceNicsBody nicsInstance = new CreateClusterInstanceNicsBody();
            nicsInstance.withVpcId("{VPC ID}")
                .withNetId("{NET ID}")
                .withSecurityGroupId("{Security group ID}");
            CreateClusterInstanceVolumeBody volumeInstance = new CreateClusterInstanceVolumeBody();
            volumeInstance.withVolumeType("COMMON")
                .withSize(120);
            CreateClusterInstanceBody instanceCluster = new CreateClusterInstanceBody();
            instanceCluster.withFlavorRef("ess.spec-4u16g")
                .withVolume(volumeInstance)
                .withNics(nicsInstance)
                .withAvailabilityZone("{AZ CODE}");
            CreateClusterBody clusterbody = new CreateClusterBody();
            clusterbody.withInstance(instanceCluster)
                .withDatastore(datastoreCluster)
                .withName("cluster-name")
                .withInstanceNum(3)
                .withBackupStrategy(backupStrategyCluster)
                .withHttpsEnable(true)
                .withAuthorityEnable(true)
                .withAdminPwd("{password}")
                .withEnterpriseProjectId("0")
                .withTags(listClusterTags);
            body.withCluster(clusterbody);
            request.withBody(body);
            try {
                CreateClusterResponse response = client.createCluster(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

  • Example request for creating a yearly/monthly cluster.

     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
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    # 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 = CreateClusterRequest()
            payInfoCluster = PayInfoBody(
                pay_model=2,
                period=1,
                is_auto_renew=1,
                is_auto_pay=1
            )
            listTagsCluster = [
                CreateClusterTagsBody(
                    key="k1",
                    value="v1"
                ),
                CreateClusterTagsBody(
                    key="k2",
                    value="v2"
                )
            ]
            backupStrategyCluster = CreateClusterBackupStrategyBody(
                period="16:00 GMT+08:00",
                prefix="snapshot",
                keepday=7,
                frequency="DAY",
                bucket="css-obs-backup",
                base_path="css_repository/obs-path",
                agency="css_obs_agency",
                max_snapshot_bytes_per_seconds="40MB",
                max_restore_bytes_per_seconds="40MB"
            )
            datastoreCluster = CreateClusterDatastoreBody(
                version="{cluster-version}",
                type="elasticsearch"
            )
            nicsInstance = CreateClusterInstanceNicsBody(
                vpc_id="{VPC ID}",
                net_id="{NET ID}",
                security_group_id="{Security group ID}"
            )
            volumeInstance = CreateClusterInstanceVolumeBody(
                volume_type="COMMON",
                size=120
            )
            instanceCluster = CreateClusterInstanceBody(
                flavor_ref="ess.spec-4u16g",
                volume=volumeInstance,
                nics=nicsInstance,
                availability_zone="{AZ CODE}"
            )
            clusterbody = CreateClusterBody(
                instance=instanceCluster,
                datastore=datastoreCluster,
                name="cluster-name",
                instance_num=3,
                backup_strategy=backupStrategyCluster,
                https_enable=True,
                authority_enable=True,
                admin_pwd="{password}",
                enterprise_project_id="0",
                tags=listTagsCluster,
                pay_info=payInfoCluster
            )
            request.body = CreateClusterReq(
                cluster=clusterbody
            )
            response = client.create_cluster(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  • Example request for creating a pay-per-use cluster.

     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
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    # 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 = CreateClusterRequest()
            listTagsCluster = [
                CreateClusterTagsBody(
                    key="k1",
                    value="v1"
                ),
                CreateClusterTagsBody(
                    key="k2",
                    value="v2"
                )
            ]
            backupStrategyCluster = CreateClusterBackupStrategyBody(
                period="16:00 GMT+08:00",
                prefix="snapshot",
                keepday=7,
                frequency="DAY",
                bucket="css-obs-backup",
                base_path="css_repository/obs-path",
                agency="css_obs_agency",
                max_snapshot_bytes_per_seconds="40MB",
                max_restore_bytes_per_seconds="40MB"
            )
            datastoreCluster = CreateClusterDatastoreBody(
                version="{cluster-version}",
                type="elasticsearch"
            )
            nicsInstance = CreateClusterInstanceNicsBody(
                vpc_id="{VPC ID}",
                net_id="{NET ID}",
                security_group_id="{Security group ID}"
            )
            volumeInstance = CreateClusterInstanceVolumeBody(
                volume_type="COMMON",
                size=120
            )
            instanceCluster = CreateClusterInstanceBody(
                flavor_ref="ess.spec-4u16g",
                volume=volumeInstance,
                nics=nicsInstance,
                availability_zone="{AZ CODE}"
            )
            clusterbody = CreateClusterBody(
                instance=instanceCluster,
                datastore=datastoreCluster,
                name="cluster-name",
                instance_num=3,
                backup_strategy=backupStrategyCluster,
                https_enable=True,
                authority_enable=True,
                admin_pwd="{password}",
                enterprise_project_id="0",
                tags=listTagsCluster
            )
            request.body = CreateClusterReq(
                cluster=clusterbody
            )
            response = client.create_cluster(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

  • Example request for creating a yearly/monthly cluster.

      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
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    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.CreateClusterRequest{}
    	isAutoRenewPayInfo:= int32(1)
    	isAutoPayPayInfo:= int32(1)
    	payInfoCluster := &model.PayInfoBody{
    		PayModel: int32(2),
    		Period: int32(1),
    		IsAutoRenew: &isAutoRenewPayInfo,
    		IsAutoPay: &isAutoPayPayInfo,
    	}
    	var listTagsCluster = []model.CreateClusterTagsBody{
            {
                Key: "k1",
                Value: "v1",
            },
            {
                Key: "k2",
                Value: "v2",
            },
        }
    	frequencyBackupStrategy:= "DAY"
    	bucketBackupStrategy:= "css-obs-backup"
    	basePathBackupStrategy:= "css_repository/obs-path"
    	agencyBackupStrategy:= "css_obs_agency"
    	maxSnapshotBytesPerSecondsBackupStrategy:= "40MB"
    	maxRestoreBytesPerSecondsBackupStrategy:= "40MB"
    	backupStrategyCluster := &model.CreateClusterBackupStrategyBody{
    		Period: "16:00 GMT+08:00",
    		Prefix: "snapshot",
    		Keepday: int32(7),
    		Frequency: &frequencyBackupStrategy,
    		Bucket: &bucketBackupStrategy,
    		BasePath: &basePathBackupStrategy,
    		Agency: &agencyBackupStrategy,
    		MaxSnapshotBytesPerSeconds: &maxSnapshotBytesPerSecondsBackupStrategy,
    		MaxRestoreBytesPerSeconds: &maxRestoreBytesPerSecondsBackupStrategy,
    	}
    	datastoreCluster := &model.CreateClusterDatastoreBody{
    		Version: "{cluster-version}",
    		Type: "elasticsearch",
    	}
    	nicsInstance := &model.CreateClusterInstanceNicsBody{
    		VpcId: "{VPC ID}",
    		NetId: "{NET ID}",
    		SecurityGroupId: "{Security group ID}",
    	}
    	volumeInstance := &model.CreateClusterInstanceVolumeBody{
    		VolumeType: "COMMON",
    		Size: int32(120),
    	}
    	availabilityZoneInstance:= "{AZ CODE}"
    	instanceCluster := &model.CreateClusterInstanceBody{
    		FlavorRef: "ess.spec-4u16g",
    		Volume: volumeInstance,
    		Nics: nicsInstance,
    		AvailabilityZone: &availabilityZoneInstance,
    	}
    	httpsEnableCluster:= true
    	authorityEnableCluster:= true
    	adminPwdCluster:= "{password}"
    	enterpriseProjectIdCluster:= "0"
    	clusterbody := &model.CreateClusterBody{
    		Instance: instanceCluster,
    		Datastore: datastoreCluster,
    		Name: "cluster-name",
    		InstanceNum: int32(3),
    		BackupStrategy: backupStrategyCluster,
    		HttpsEnable: &httpsEnableCluster,
    		AuthorityEnable: &authorityEnableCluster,
    		AdminPwd: &adminPwdCluster,
    		EnterpriseProjectId: &enterpriseProjectIdCluster,
    		Tags: &listTagsCluster,
    		PayInfo: payInfoCluster,
    	}
    	request.Body = &model.CreateClusterReq{
    		Cluster: clusterbody,
    	}
    	response, err := client.CreateCluster(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    
  • Example request for creating a pay-per-use cluster.

      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
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    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.CreateClusterRequest{}
    	var listTagsCluster = []model.CreateClusterTagsBody{
            {
                Key: "k1",
                Value: "v1",
            },
            {
                Key: "k2",
                Value: "v2",
            },
        }
    	frequencyBackupStrategy:= "DAY"
    	bucketBackupStrategy:= "css-obs-backup"
    	basePathBackupStrategy:= "css_repository/obs-path"
    	agencyBackupStrategy:= "css_obs_agency"
    	maxSnapshotBytesPerSecondsBackupStrategy:= "40MB"
    	maxRestoreBytesPerSecondsBackupStrategy:= "40MB"
    	backupStrategyCluster := &model.CreateClusterBackupStrategyBody{
    		Period: "16:00 GMT+08:00",
    		Prefix: "snapshot",
    		Keepday: int32(7),
    		Frequency: &frequencyBackupStrategy,
    		Bucket: &bucketBackupStrategy,
    		BasePath: &basePathBackupStrategy,
    		Agency: &agencyBackupStrategy,
    		MaxSnapshotBytesPerSeconds: &maxSnapshotBytesPerSecondsBackupStrategy,
    		MaxRestoreBytesPerSeconds: &maxRestoreBytesPerSecondsBackupStrategy,
    	}
    	datastoreCluster := &model.CreateClusterDatastoreBody{
    		Version: "{cluster-version}",
    		Type: "elasticsearch",
    	}
    	nicsInstance := &model.CreateClusterInstanceNicsBody{
    		VpcId: "{VPC ID}",
    		NetId: "{NET ID}",
    		SecurityGroupId: "{Security group ID}",
    	}
    	volumeInstance := &model.CreateClusterInstanceVolumeBody{
    		VolumeType: "COMMON",
    		Size: int32(120),
    	}
    	availabilityZoneInstance:= "{AZ CODE}"
    	instanceCluster := &model.CreateClusterInstanceBody{
    		FlavorRef: "ess.spec-4u16g",
    		Volume: volumeInstance,
    		Nics: nicsInstance,
    		AvailabilityZone: &availabilityZoneInstance,
    	}
    	httpsEnableCluster:= true
    	authorityEnableCluster:= true
    	adminPwdCluster:= "{password}"
    	enterpriseProjectIdCluster:= "0"
    	clusterbody := &model.CreateClusterBody{
    		Instance: instanceCluster,
    		Datastore: datastoreCluster,
    		Name: "cluster-name",
    		InstanceNum: int32(3),
    		BackupStrategy: backupStrategyCluster,
    		HttpsEnable: &httpsEnableCluster,
    		AuthorityEnable: &authorityEnableCluster,
    		AdminPwd: &adminPwdCluster,
    		EnterpriseProjectId: &enterpriseProjectIdCluster,
    		Tags: &listTagsCluster,
    	}
    	request.Body = &model.CreateClusterReq{
    		Cluster: clusterbody,
    	}
    	response, err := client.CreateCluster(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.

400

Invalid request.

Modify the request before retry.

409

The request could not be completed due to a conflict with the current state of the resource.

The resource that the client attempts to create already exists, or the update request fails to be processed because of a conflict.

412

The server did not meet one of the preconditions contained in the request.

Error Codes

See Error Codes.