Help Center> CodeArts Deploy> API Reference> APIs> Managing Hosts> Editing Host Information in a Host Cluster
Updated on 2024-07-05 GMT+08:00

Editing Host Information in a Host Cluster

Function

This API is used to edit host information in a host cluster by ID.

Calling Method

For details, see Calling APIs.

URI

PUT /v1/resources/host-groups/{group_id}/hosts/{host_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

group_id

Yes

String

Host cluster ID

Minimum: 32

Maximum: 32

host_id

Yes

String

Host ID

Minimum: 32

Maximum: 32

Request Parameters

Table 2 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 3 Request body parameters

Parameter

Mandatory

Type

Description

as_proxy

No

Boolean

Proxy host or not

authorization

No

DeploymentHostAuthorizationBody object

Log in to the host for authentication by password or key.

host_name

Yes

String

Host name

Minimum: 3

Maximum: 128

ip

Yes

String

Host IP address, for example, 161.17.101.12.

Minimum: 0

Maximum: 128

port

Yes

Integer

SSH Port number, for example, 22.

Minimum: 0

Maximum: 65535

proxy_host_id

No

String

Proxy host ID

Minimum: 32

Maximum: 32

sync

No

Boolean

Whether to sync host information

install_icagent

No

Boolean

Whether to install ICAgent

Table 4 DeploymentHostAuthorizationBody

Parameter

Mandatory

Type

Description

username

Yes

String

Username. The value can contain letters, digits, hyphens (-), underscores (_), and periods (.).

Minimum: 3

Maximum: 128

password

No

String

Password. When the authentication type is 0, the password is mandatory.

private_key

No

String

Key. When the authentication type is 1, the key is mandatory.

Minimum: 1

Maximum: 5000

trusted_type

Yes

Integer

Authentication type. 0 indicates password authentication, and 1 indicates key authentication.

Enumeration values:

  • 0

  • 1

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

status

String

Request success or failure status

id

String

Host ID

Minimum: 32

Maximum: 32

Example Requests

https://{endpoint}/v1/resources/host-groups/6bec5f67ab9b4c34a21c7ffe0b0191c8/hosts/a94facdc4b1e40d799dbe6de91167072

{
  "as_proxy" : false,
  "host_name" : "hostName",
  "install_icagent" : true,
  "ip" : "100.101.28.215",
  "port" : 22,
  "proxy_host_id" : "",
  "authorization" : {
    "username" : "root",
    "password" : "*****",
    "private_key" : "",
    "trusted_type" : 0
  }
}

Example Responses

Status code: 200

OK: The request is successful.

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

Status Codes

Status Code

Description

200

OK: The request is successful.

Error Codes

See Error Codes.