Function
This API is used to assign EIPs in batches.
URI
POST /v2/{project_id}/batchpublicips
Table 1 Path parameter Parameter | Mandatory | Type | Description |
|---|
project_id | Yes | String | Project ID |
Request Parameters
Table 2 Request body parameters Parameter | Mandatory | Type | Description |
|---|
bandwidth | Yes | BatchBandwidth object | Bandwidth information |
publicip | Yes | BatchPublicIp object | EIP information |
publicip_number | Yes | Integer | Number of EIPs to be created in batches |
enterprise_project_id | Yes | String | Enterprise project ID |
Table 3 BatchBandwidth Parameter | Mandatory | Type | Description |
|---|
charge_mode | No | String | - Whether the billing is based on traffic or bandwidth For IPv6 addresses, the default value is bandwidth outside China and is traffic in China. If the value is traffic, the billing is based on traffic.
Enumerated values: |
name | No | String | - Bandwidth name
- The value can contain 1 to 64 characters, including letters, digits, underscores (_), hyphens (-), and periods (.).
- This parameter is mandatory if share_type is set to PER. This parameter will be ignored if share_type is set to WHOLE with an ID specified.
Minimum length: 1 Maximum length: 64 |
share_type | No | String | - Bandwidth type.
- The value can be PER or WHOLE. IPv6 addresses do not support bandwidth whose type is WHOLE.
Enumerated values: |
size | Yes | Integer | - Bandwidth size (Mbit/s).
- The value ranges from 1 Mbit/s to 2000 Mbit/s by default. (The specific range may vary depending on the configuration in each region. You can see the available bandwidth range on the management console.)
- This parameter is mandatory if share_type is set to PER. This parameter will be ignored if share_type is set to WHOLE with an ID specified.
- The minimum increment for bandwidth adjustment varies depending on the bandwidth range. The details are as follows:
- The minimum increment is 1 Mbit/s if the allowed bandwidth ranges from 0 Mbit/s to 300 Mbit/s (with 300 Mbit/s included).
- The minimum increment is 50 Mbit/s if the allowed bandwidth ranges from 300 Mbit/s to 1000 Mbit/s (with 1000 Mbit/s included).
- The minimum increment is 500 Mbit/s if the allowed bandwidth is greater than 1000 Mbit/s.
|
id | No | String | - Bandwidth ID. You can specify an existing shared bandwidth ID when assigning an EIP that uses the bandwidth whose type is WHOLE.
- Value: ID of the bandwidth of type WHOLE
|
Table 4 BatchPublicIp Parameter | Mandatory | Type | Description |
|---|
id | No | String | Assigning an EIP by specifying an ID |
ip_version | No | String | EIP version, for example, IPv4 and IPv6. The default value is ipv4. |
enterprise_project_id | No | String | Enterprise project ID |
tags | No | Array of ResourceTagOption objects | - Tag list
- Format: The key and value of a tag are separated by an asterisk (*). If there are multiple tags, use commas (,) to separate different key-value pairs. For details, see the request example.
|
profile | No | BatchProfile object | Order information |
Table 5 ResourceTagOption Parameter | Mandatory | Type | Description |
|---|
key | Yes | String | - Tag key
- Constraints:
- Cannot be left blank.
- Can contain a maximum of 128 characters.
- Can contain letters, digits, underscores (_), and hyphens (-).
- The tag key of a resource must be unique.
Maximum length: 128 |
value | Yes | String | - Tag value
- Constraints:
- Can contain no more than 255 characters.
- Can contain letters, digits, underscores (_), and hyphens (-).
- The tag key of a resource must be unique.
Maximum length: 255 |
Table 6 BatchProfile Parameter | Mandatory | Type | Description |
|---|
user_id | No | String | User ID |
product_id | No | String | Product ID |
region_id | No | String | Region ID |
order_id | No | String | Order ID |
Response Parameters
Status code: 200
Table 7 Response body parameters Parameter | Type | Description |
|---|
job_id | String | Job ID. The netAPI needs to be called to view the job execution status. netAPI: /v1/{project_id}/jobs/{job_id} |
Example Request
Assign two EIPs and add tags to them. The EIPs use 5 Mbit/s dedicated bandwidth and are billed by bandwidth.
POST /v2/{project_id}/batchpublicips
{
"bandwidth" : {
"name" : "",
"size" : 5,
"charge_mode" : "bandwidth",
"share_type" : "PER"
},
"publicip" : {
"type" : "5_bgp",
"tags" : ["name*tom", "type*kkkk"]
},
"publicip_number" : 2,
"enterprise_project_id" : 0
} Example Response
Status code: 200
OK
{
"job_id" : "ff8080828436722c0184cdb88e9200a5"
}