CreateNetworkInterface
1. API Description
This API (CreateNetworkInterface) is used to create an elastic vNIC.
Note
This API is an async API. A response is returned after the request is sent. However, it does not mean the operation has been completed. If the status changes from
PENDINGtoAvailable, it means that the vNIC has been created successfully. If the status changes toCREATE_FAILED, the creation is failed.
2. Input Parameters
The following request parameter list only provides API request parameters.
name
Yes
String
The name of the vNIC.
The length is 2 to 63 characters. Only letters, numbers, - and periods (.) are supported. The name must start and end with a number or a letter.
subnetId
Yes
String
ID of the subnet.
nicStackType
No
The IP stack type of the vNIC.
If not specified, it will be determined by the subnet’s stack type: IPv4 for an IPv4 subnet, and IPv6 for an IPv6 subnet.
Specify this parameter if you need IPv4_IPv6 vNIC IP stack type.
resourceGroupId
No
String
The resource group ID of the vNIC.
If you do not specify a resource group, it is placed in the default resource group.
securityGroupId
No
String
ID of the security group deployed on the primary vNIC.
Currently only one security group can be deployed.
If not specified, the security group associated with global VPC will be used by default.
internetChargeType
No
Network billing model.
See InternetChargeType for available values.
If the subnet stack type is IPv6 and the type is Public , this value is required.
bandwidth
No
Integer
Outbound public network bandwidth cap (Mbps). Unit: Mbps.
The value differs with different instance types.
Value range: [1, +)
packageSize
No
Float
Data transfer package size(TB).
The unit is TB.
This value takes effect only when internetChargeType is set to ByTrafficPackage .
The default value is 0.
Maximum of one decimal place.
Value range: [0.0, +)
clusterId
No
String
Bandwidth cluster ID.
If the value of internetChargeType is BandwidthCluster , the parameter is required.
3. Output Parameters
requestId
String
The unique request ID, which is returned for each request.
RequestId is required for locating a problem.
nicId
String
vNIC ID.
4. Code Example
Create an elastic vNIC.
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.
404
INVALID_EIP_NOT_FOUND
Elastic IP does not exist.
404
INVALID_INSTANCE_NOT_FOUND
Instance not found.
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.
400
INVALID_IP_OUT_OF_RANGE
Invalid IP address. It does not belong to the CIDR block.
409
INVALID_NIC_INSTANCE_REGION_MISMATCH
Instance and vNIC are not in the same zone.
400
INVALID_NIC_IPV6_EXISTS
vNIC already has an IPv6 assigned; operation not allowed.
400
INVALID_PARAMETER_BANDWIDTH_ERROR
Bandwidth size is below the minimum limit.
400
INVALID_PARAMETER_BANDWIDTH_EXCEED
Bandwidth size exceeds the upper limit.
400
INVALID_PARAMETER_FLOW_TRAFFIC_PACKAGE
Data transfer package size is invalid.
400
INVALID_PARAMETER_TRAFFIC_PACKAGE_EXCEED
Data traffic package exceeds the maximum limit.
400
INVALID_REGION_NOT_ON_SALE
Subnet is not available for sale in the specified region.
404
INVALID_SECURITY_GROUP_NOT_FOUND
The specified security group does not exist.
409
INVALID_SUBNET_IPV4_INSUFFICIENT
Insufficient available IPv4 addresses in the subnet.
409
INVALID_SUBNET_IPV6_INSUFFICIENT
Insufficient available IPv6 addresses in the subnet.
404
INVALID_SUBNET_NOT_FOUND
Subnet does not exist.
409
INVALID_SUBNET_PRIVATE_IPV4_IN_USED
Private IPv4 is occupied.
400
OPERATION_DENIED_EIP_IS_DEFAULT
Default public IP cannot be unbound.
400
OPERATION_DENIED_EIP_IS_NOT_UN_ASSIGN
Elastic IP is not in unassigned state.
400
OPERATION_DENIED_EIP_NIC_NOT_ADAPTER
Specified vNIC count does not match the number of elastic IPs to create.
400
OPERATION_DENIED_EIP_NOT_ASSIGNED
Elastic IP is not bound.
400
OPERATION_DENIED_EIP_NOT_SUPPORT_PASS_THROUGH_BIND_TYPE
Elastic IP does not support the Bypass mode.
400
OPERATION_DENIED_INSTANCE_NIC_NOT_ADAPTER
Specified instance count does not match the number of vNICs to create.
400
OPERATION_DENIED_INSTANCE_STATUS_NOT_SUPPORT
Current instance state does not allow this operation.
400
OPERATION_DENIED_INTERNET_CHARGE_TYPE_NOT_SUPPORT
IP network billing type is not supported.
400
OPERATION_DENIED_STACK_TYPE_NOT_SUPPORT
Stack type is not supported.
400
OPERATION_DENIED_SUBNET_TYPE_NOT_SUPPORT_IPV4
Subnet type does not support IPv4.
Last updated