Help Center/ CodeArts Deploy/ API Reference/ APIs/ Host Cluster Management/ Creating a Host Cluster (Recommended)
Updated on 2023-11-28 GMT+08:00

Creating a Host Cluster (Recommended)

Function

This API is used to create a host cluster in a project.

URI

POST /v1/resources/host-groups

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format). Possible values: application/json;charset=utf-8 application/json

Default: application/json;charset=utf-8

Enumeration values:

  • application/json;charset=utf-8

  • application/json

X-Auth-Token

Yes

String

User token. It can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token.

Minimum: 0

Maximum: 20000

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Host cluster name.

Minimum: 3

Maximum: 128

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID.

os

Yes

String

Operating system: windows and linux.

Enumeration values:

  • windows

  • linux

slave_cluster_id

No

String

Slave cluster ID. If the value is null, the default slave cluster is used. If slave is user-defined, the slave cluster ID is used.

description

No

String

Description.

Minimum: 0

Maximum: 500

is_proxy_mode

Yes

Integer

Whether the host cluster is in poxy access mode. 1: yes; 0: no.

Enumeration values:

  • 0

  • 1

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

id

String

Host cluster ID.

status

String

Request status.

Example Requests

When creating a host cluster, you need to enter basic information, including the host cluster name, description, operating system, and whether be proxy access mode.

https://{endpoint}/v1/resources/host-groups

{
  "name" : "test123",
  "description" : "",
  "project_id" : "6039d4480efc4dddb178abff98719913",
  "os" : "linux",
  "slave_cluster_id" : "",
  "is_proxy_mode" : 1
}

Example Responses

Status code: 200

OK: The request is successful.

{
  "status" : "success",
  "id" : "f3938bd63e354d2bb9d9cf7b5dc3bf95"
}

Status Codes

Status Code

Description

200

OK: The request is successful.

Error Codes

See Error Codes.