Adding the hosts File

Function

This API is used to add an IP-domain mapping for a specified cluster through file uploading. The hosts_file parameter is involved in this API, and the parameter must be in the "form-data" format.

Table 1 Parameter description

Parameter

Description

hosts_file

hosts file to be uploaded.

URI

  • URI format

    POST /v1.0/{project_id}/reserved_cluster/{cluster_id}/hosts_file

  • Parameter description
    Table 2 URI parameter description

    Parameter

    Mandatory

    Description

    project_id

    Yes

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

    cluster_id

    Yes

    Cluster ID.

Request

The request format is form-data. For details about the parameter configuration, see Table 1.

Response

  • Example response
    [
      {
        "message_id":"CS.22018",
        "message":"Host information is added successfully.",
        "current_time":1533686888000,
        "payload":{
          "host_id":1
        }
      }
    ]
  • Parameter description
    Table 3 Response parameters

    Parameter

    Mandatory

    Type

    Description

    message_id

    No

    String

    Message type ID.

    message

    No

    String

    Message content.

    current_time

    No

    Int

    Current time, expressed by milliseconds.

    host_id

    No

    Long

    Domain name ID.

Status Code

Table 4 describes the status code.

Table 4 Status code

Status Code

Description

200

The IP-domain mapping is added successfully.

400

The input parameters are invalid.

Error Code

For details, see Error Codes.