AssignNetworkInterfaceIpv4

AssignNetworkInterfaceIpv4

1. API Description

This API is used to assign the private IPv4 to the vNIC.

Note

  • vNIC state must be AVAILABLE or USED.

  • The private IPv4 to bind must be in unbound state.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

nicId

Yes

String

ID of the vNIC.

ipAddress

Yes

String

Private IPv4.

3. Output Parameters

Parameter Name
Type
Description

requestId

String

The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Code Example

Assign the private IPv4 to the vNIC.

POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: AssignNetworkInterfaceIpv4
<Common Request Params>

Request:
{
  "nicId": "XXX",
  "ipAddress": "xxx"
}

Response:
{
  "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
  "response": {
    "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F"
  }
}

5. Developer Resources

Zenlayer Cloud API 2.0 integrates SDKs to make it easier for you to call APIs. More programming languages will be supported.

6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

HTTP Status Code
Error Code
Description

400

INVALID_NIC_STATUS

vNIC state is not supported.

400

OPERATION_DENIED_SUBNET_TYPE_NOT_SUPPORT_IPV4

Subnet type does not support IPv4.

409

INVALID_SUBNET_PRIVATE_IPV4_IN_USED

Private IPv4 is occupied.

400

INVALID_IP_OUT_OF_RANGE

Private IPv4 does not belong to the IP range of the subnet.

403

INVALID_NIC_PRIVATE_IP_EXCEED_LIMIT

Quantity of private IPv4 addresses exceeds limit.

404

OPERATION_FAILED_RESOURCE_NOT_FOUND

Resources are not found.

400

INVALID_IP_NETWORK_ADDRESS

The IP address is not available.

400

INVALID_IP_BROADCAST_ADDRESS

The broadcast address is not available.

400

INVALID_IP_FIRST_ADDRESS

The gateway address is not available.

Last updated