AssignNetworkInterfaceIpv4

1. API Description

This API (AssignNetworkInterfaceIpv4) is used to assign the private IPv4 to the vNIC.

circle-info

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


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_IP_BROADCAST_ADDRESS

The IP address cannot be a broadcast address.

400

INVALID_IP_FIRST_ADDRESS

The IP address cannot be a gateway address.

400

INVALID_IP_NETWORK_ADDRESS

The IP address cannot be a network address.

404

INVALID_NIC_NOT_FOUND

vNIC does not exist.

400

INVALID_NIC_STATUS

Current vNIC state does not allow this operation.

400

OPERATION_DENIED_SUBNET_TYPE_NOT_SUPPORT_IPV4

Subnet type does not support IPv4.

400

INVALID_IP_OUT_OF_RANGE

Invalid IP address. It does not belong to the CIDR block.

409

INVALID_SUBNET_PRIVATE_IPV4_IN_USED

Private IPv4 is occupied.

Last updated