Help Center> Virtual Private Cloud> API Reference> API V3> Supplementary Network Interfaces> Creating Supplementary Network Interfaces in Batches
Updated on 2024-06-27 GMT+08:00

Creating Supplementary Network Interfaces in Batches

Function

This API is used to create supplementary network interfaces in batches.

URI

POST /v3/{project_id}/vpc/sub-network-interfaces/batch-create

Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Request Parameters

Table 2 Request body parameter

Parameter

Mandatory

Type

Description

dry_run

No

Boolean

  • Whether to only send the check request.
  • The value can be:
    • true: A check request will be sent and no supplementary network interface will be created. Check items include mandatory parameters, request format, and permission verification. If the check fails, the system returns an error. If the check succeeds, response code 202 will be returned.
    • false (default value): A request will be sent and a supplementary network interface will be created.

sub_network_interface

Yes

BatchCreateSubNetworkInterfaceOption object

Request body for creating a supplementary network interface.

count

Yes

Integer

  • Number of supplementary network interfaces to be created in batches.
  • Minimum value: 1
  • Maximum value: 20
Table 3 BatchCreateSubNetworkInterfaceOption

Parameter

Mandatory

Type

Description

virsubnet_id

Yes

String

  • Virtual subnet ID, which is the subnet ID and is the same as the network ID displayed on the subnet summary page on the console.
  • The value must be in standard UUID format.

parent_id

Yes

String

  • ID of the elastic network interface
  • The value must be in standard UUID format.
  • The value must be an existing port ID.

security_groups

No

Array of strings

  • Security group IDs, for example, "security_groups": ["a0608cbf-d047-4f54-8b28-cd7b59853fff"]
  • The default value is the default security group.

description

No

String

  • Description of the supplementary network interface
  • The value can contain up to 255 characters and cannot contain angle brackets (< or >).

ipv6_enable

No

Boolean

  • Whether to enable IPv6 for the supplementary network interface
  • The value can be:
    • true: Enable
    • false: Disable
  • The default value is false.

project_id

No

String

  • Project ID of the supplementary network interface
  • The value must be in standard UUID format.
  • Only administrators have permissions to specify project IDs.

Response Parameters

When the status code is 201, the response parameters are as follows:

Table 4 Response body parameters

Parameter

Type

Description

request_id

String

Request ID.

sub_network_interfaces

Array of SubNetworkInterface objects

Response body for creating supplementary network interfaces in batches.

Table 5 SubNetworkInterface

Parameter

Type

Description

id

String

  • Unique identifier of the supplementary network interface.
  • The value is in UUID format with hyphens (-).

virsubnet_id

String

  • Virtual subnet ID, also the subnet ID, which is the same as the network ID displayed on the subnet summary page on the console.
  • The value must be in standard UUID format.

private_ip_address

String

  • Private IPv4 address of the supplementary network interface.
  • The value must be within the virtual subnet. If this parameter is left blank, an IP address will be randomly assigned.

ipv6_ip_address

String

  • Private IPv6 address of the supplementary network interface.
  • The value must be within the virtual subnet. If this parameter is left blank, an IP address will be randomly assigned.

mac_address

String

  • MAC address of the supplementary network interface.
  • The value is a valid MAC address assigned by the system randomly.

parent_device_id

String

  • Device ID.
  • The value must be in standard UUID format.

parent_id

String

  • ID of the elastic network interface.
  • The value must be in standard UUID format.

description

String

  • Description of the supplementary network interface.
  • The value can contain up to 255 characters and cannot contain angle brackets (< or >).

vpc_id

String

  • VPC ID of the supplementary network interface.
  • The value must be in standard UUID format.

vlan_id

Integer

  • VLAN ID of the supplementary network interface.
  • The value can be from 1 to 4094.
  • Each supplementary network interface of an elastic network interface has a unique VLAN ID.

security_enabled

Boolean

  • Whether the security option is enabled for the supplementary network interface. If the option is not enabled, the security group does not take effect.

security_groups

Array of strings

  • Security group IDs, for example, "security_groups": ["a0608cbf-d047-4f54-8b28-cd7b59853fff"]
  • The default value is the default security group.

tags

Array of strings

  • Tags of the supplementary network interface.

project_id

String

  • Project ID of the supplementary network interface.

created_at

String

  • The time when the supplementary network interface is created
  • UTC time in the format of yyyy-MM-ddTHH:mm:ssZ

Example Request

Create three supplementary network interfaces in batches. Set the virtual subnet ID to 115b5a84-31dc-4b1e-8de9-bf5a75d2c566, elastic network interface ID to 8b6c46f1-c68d-4bba-a922-2d97da185af5, and associated security group to 6727c950-9f01-47a2-a7aa-7d3686c4c95b.

POST https://{Endpoint}/v3/8c6fb137a48a428aaf9a0229dca4edb3/vpc/sub-network-interfaces/batch-create

{
  "sub_network_interface" : {
    "virsubnet_id" : "115b5a84-31dc-4b1e-8de9-bf5a75d2c566",
    "security_groups" : [ "6727c950-9f01-47a2-a7aa-7d3686c4c95b" ],
    "parent_id" : "8b6c46f1-c68d-4bba-a922-2d97da185af5"
  },
  "count" : 3
}

Example Response

When the status code is 201, the response parameters are as follows:

Created

{
  "sub_network_interfaces" : [ {
    "id" : "d1f8094c-bb3d-43c5-b625-52dd43eab451",
    "project_id" : "8c6fb137a48a428aaf9a0229dca4edb3",
    "virsubnet_id" : "115b5a84-31dc-4b1e-8de9-bf5a75d2c566",
    "private_ip_address" : "192.168.6.245",
    "ipv6_ip_address" : "2001:db8:a583:5d:11e8:b908:4fe6:9802",
    "mac_address" : "fa:16:3e:97:1f:f5",
    "parent_device_id" : "11185aa2-4e08-4d9e-87ed-84817280eaa7",
    "security_groups" : [ "6727c950-9f01-47a2-a7aa-7d3686c4c95b" ],
    "vpc_id" : null,
    "description" : "",
    "parent_id" : "8b6c46f1-c68d-4bba-a922-2d97da185af5",
    "vlan_id" : 41,
    "tags" : [ ]
  }, {
    "id" : "0dce57ab-00de-443b-a7fe-e8ff68bd95bc",
    "project_id" : "8c6fb137a48a428aaf9a0229dca4edb3",
    "virsubnet_id" : "115b5a84-31dc-4b1e-8de9-bf5a75d2c566",
    "private_ip_address" : "192.168.6.75",
    "ipv6_ip_address" : "2001:db8:a583:5d:6c22:8ea2:c061:a802",
    "mac_address" : "fa:16:3e:5a:61:84",
    "parent_device_id" : "11185aa2-4e08-4d9e-87ed-84817280eaa7",
    "security_groups" : [ "6727c950-9f01-47a2-a7aa-7d3686c4c95b" ],
    "vpc_id" : null,
    "description" : "",
    "parent_id" : "8b6c46f1-c68d-4bba-a922-2d97da185af5",
    "vlan_id" : 42,
    "tags" : [ ]
  }, {
    "id" : "1eca03ee-c0f1-4434-9c4c-87fe4426718c",
    "project_id" : "8c6fb137a48a428aaf9a0229dca4edb3",
    "virsubnet_id" : "115b5a84-31dc-4b1e-8de9-bf5a75d2c566",
    "private_ip_address" : "192.168.6.194",
    "ipv6_ip_address" : "2001:db8:a583:5d:2b45:a3ae:17db:ec02",
    "mac_address" : "fa:16:3e:b8:ec:6d",
    "parent_device_id" : "11185aa2-4e08-4d9e-87ed-84817280eaa7",
    "security_groups" : [ "6727c950-9f01-47a2-a7aa-7d3686c4c95b" ],
    "vpc_id" : null,
    "description" : "",
    "parent_id" : "8b6c46f1-c68d-4bba-a922-2d97da185af5",
    "vlan_id" : 43,
    "tags" : [ ]
  } ],
  "request_id" : "344544c1-d053-4ad3-b673-900a0e01db7e"
}

Status Codes

Status Code

Description

201

Created

Error Codes

See Error Codes.