Updating Information About an IP-Domain Mapping

Sample Code

You can use the API to update information about an IP-domain mapping. Sample code is as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
// Import classes:
import com.huaweicloud.cs.java.v1.client.ApiException;
import com.huaweicloud.cs.java.v1.ClusterApi;


ClusterApi apiInstance = new ClusterApi(apiClient);//apiClient is created when initializing a CS API client.
String xProjectId = "xProjectId_example"; // String | Project ID used for obtaining the token for the project.
Integer clusterId = 56; // Integer | ID of an exclusive cluster.
Long hostId = 789L; // Long | Domain name ID.
Body2 body = new Body2(); // Body2 | Request body in the JSON format.
try {
    UpdateHostsInfoResponse result = apiInstance.updateHostsInfo(xProjectId, clusterId, hostId, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ClusterApi#updateHostsInfo");
    System.err.println(e.getResponseBody());
    e.printStackTrace();
}

Parameters

Table 1 Parameters

Parameter

Mandatory

Type

Description

xProjectId

Yes

String

Project ID. This parameter is used to obtain the token for the project.

clusterId

Yes

Integer

ID of an exclusive cluster.

hostId

Yes

Integer

Domain name ID.

body

Yes

-

Request body in the JSON format. For details about parameter types, see Table 2.

Table 2 Parameters involved in Body2

Parameter

Mandatory

Type

Description

hostsInfo

No

-

Information about the domain name. For details about parameter types, see Table 3.

Table 3 Parameters involved in HostIpInfo

Parameter

Mandatory

Type

Description

hostname

No

String

Information about the domain name.

ip

No

String

IP address.

Table 4 Parameters involved in UpdateHostsInfoResponse

Parameter

Mandatory

Type

Description

messageId

No

String

Message type ID.

message

No

String

Message content.

currentTime

No

Integer

Current time, expressed by milliseconds.