CreateIPv4Block
1. API Description
This API is used to create one or more IPv4 CIDR blocks.
Prerequisites
Query stock: call AvaialbeIPv4 to check available resources.
Cost estimation: know of CIDR block pricing. See Billing Method for more details.
2. Input Parameters
The following request parameter list only provides API request parameters.
zoneId
Yes
String
Zone ID to which the CIDR blocks belong.
name
No
String
CIDR block name to be displayed.
This parameter can contain up to 64 characters.
chargeType
Yes
String
CIDR block pricing model.
PREPAID: subscription
POSTPAID: pay-as-you-go
chargePrepaid
No
Details of the monthly subscription, including the purchase period, auto-renewal. It is required if the chargeType is PREPAID.
netmask
Yes
Integer
Netmasks you want to purchase.
Value range: [1,32].
You can find the available netmasks in the response by calling AvailableIPv4.
amount
No
Integer
Quantity of IPv4 CIDR blocks you want to purchase.
Default value: 1.
resourceGroupId
No
String
Resource group ID where the CIDR blocks reside.
If an available VLAN exists in the specified zone, this parameter will be ignored. The created CIDR blocks will be added to the resource group of the VLAN.
3. Output Parameters
requestId
String
The unique request ID, which is returned for each request. RequestId is required for locating a problem.
orderNumber
String
Number of order.
cidrBlockIds
Array of String
List of CIDR block IDs.
4. Code Example
Create a postpaid IPv4 CIDR block example1 with the netmask of 29 in IST-B, belonging to Default Resource Group.
POST / HTTP/1.1
Host: console.harmonynetworks.net/api/v2/bmc
Content-Type: application/json
X-ZC-Action: CreateIPv4Block
<Common Request Params>
Request:
{
"zoneId": "IST-B",
"name": "example1",
"chargeType": "POSTPAID",
"netmask": 29
}
Response:
{
"requestId": "T135376EE-7090-4773-B81E-7FB38358B656",
"response": {
"requestId": "T135376EE-7090-4773-B81E-7FB38358B656",
"orderNumber": "orderNum",
"cidrBlockIds": [
"cidrBlockId"
]
}
}Create a prepaid IPv4 CIDR block example2 with the netmask of 29 **** in AMS-D, belonging to Default Resource Group.
POST / HTTP/1.1
Host: console.harmonynetworks.net/api/v2/bmc
Content-Type: application/json
X-ZC-Action: CreateIPv4Block
<Common Request Params>
Request:
{
"zoneId": "AMS-D",
"name": "example2",
"chargeType": "PREPAID",
"chargePrepaid": {
"period": 1
},
"netmask": 29,
"amount": 1
}
Response:
{
"requestId": "T3B843750-5B98-421B-9D74-D3234C664760",
"response": {
"requestId": "T3B843750-5B98-421B-9D74-D3234C664760",
"orderNumber": "orderNum",
"cidrBlockIds": [
"cidrBlockId"
]
}
}5. 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_ZONE_NOT_FOUND
Zone not found.
403
OPERATION_DENIED_NETMASK_OUT_OF_STOCK
Netmask out of stock.
403
RESOURCE_INSUFFICIENT_PRODUCT_SOLD_OUT
Resources sold out.
Last updated