CreateRoute
CreateRoute
1. API Description
This API is used to create a route.
Note
The specified next-hop network interface must be in one of the following states:
AVAILABLE,ATTACHING,DETACHING, orUSED.The specified next-hop network interface must belong to the specified VPC.
The route type supports creation of static routes and policy-based routes.
Within the same VPC, duplicate route configurations are not allowed:
For policy-based routes, the source IP and destination IP range cannot both be identical.
For static routes, the destination IP range must be unique.
2. Input Parameters
The following request parameter list only provides API request parameters.
vpcId
Yes
String
VPC ID.
priority
Yes
Integer
Priority.
The optional values are integers range from 1 to 65534.
name
Yes
String
Route name.
This parameter must start and end with a number or a letter, containing 2 to 63 characters. Only letters, numbers, - and periods (.) are supported.
sourceCidrBlock
No
String
Source CIDR block.
This field is applicable only when the route type is RouteTypePolicy (policy-based route).
destinationCidrBlock
No
String
Destination CIDR block for IPv4 or IPv6.
For example: 10.0.1.0/24.
cidrBlock
No
String
CIDR block destination address.
This field is deprecated. Please use destinationCidrBlock instead.
nextHopId
No
String
Next-hop resource ID. Currently, only network interface IDs are supported.
nextHotId
No
String
Next-hop resource ID.
Currently, only network interface IDs are supported.
This field is deprecated. Please use nextHopId instead.
3. Output Parameters
requestId
String
The unique request ID, which is returned for each request. RequestId is required for locating a problem.
routeId
String
Route ID.
4. Code Example
Create an IPv4 static route.
5. Developer Resources
Zenlayer Cloud API 2.0 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_NIC_NOT_FOUND
vNIC does not exist.
400
INVALID_NIC_STATUS
Operation is not supported for current vNIC state.
409
INVALID_NIC_ZBG_REGION_MISMATCH
Regions of vNIC and border gateway should be the same.
404
INVALID_REGION_NOT_FOUND
Region does not exist.
404
INVALID_VPC_NOT_FOUND
VPC does not exist.
404
INVALID_ZBG_NOT_FOUND
Border gateway does not exist.
400
OPERATION_DENIED_SUBNET_CIDR_CONFLICT
Conflicted CIDR blocks with subnet.
400
OPERATION_DENIED_VPC_NOT_EXIST_NIC
vNIC does not exist in the VPC.
400
INVALID_PARAMETER_CIDR_ILLEGAL
Invalid CIDR block.
Last updated