Creates a reserved CIDR block for a vSwitch.
Operation description
When you invoke this operation to create a reserved CIDR block for a vSwitch, take note of the following items:
The maximum number of reserved IPv4 and IPv6 CIDR blocks in a VPC is 100 each.
- A reserved CIDR block cannot contain the system reserved IP addresses of the vSwitch to which it belongs.
IPv4 CIDR block: The first and last three IP addresses of the vSwitch are system reserved IP addresses.
IPv6 CIDR block: The first and last nine IP addresses of the vSwitch are system reserved IP addresses.
- The CreateVSwitchCidrReservation operation is asynchronous. After you send a request, the system returns an instance ID, but the reserved CIDR block for a vSwitch has not been created. The system continues to run the background node. You can invoke ListVSwitchCidrReservations to query the creation status of the reserved CIDR block for a vSwitch:
If the reserved CIDR block for a vSwitch is in the Assigning state, the reserved CIDR block for a vSwitch is being allocated.
If the reserved CIDR block for a vSwitch is in the Assigned state, the reserved CIDR block for a vSwitch has been allocated.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
vpc:CreateVSwitchCidrReservation |
create |
*VSwitchCidrReservation
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Tag |
array<object> |
No |
The resource tags. |
|
|
object |
No |
The tag information. |
||
| Key |
string |
No |
The tag key of the resource. You can specify up to 20 tag keys. If you specify this parameter, the value cannot be an empty string. A tag key can be up to 128 characters in length and cannot start with aliyun or acs:. It cannot contain |
FinanceDept |
| Value |
string |
No |
The tag value of the resource. You can specify up to 20 tag values. If you specify this parameter, the value can be an empty string. The tag value can be up to 128 characters in length and cannot start with aliyun or acs:. It cannot contain |
FinanceJoshua |
| VSwitchId |
string |
Yes |
The ID of the vSwitch to which the reserved CIDR block for a vSwitch belongs. |
vsw-25navfgbue4g**** |
| VSwitchCidrReservationName |
string |
No |
The name of the reserved CIDR block for a vSwitch. The name must be 1 to 128 characters in length and must start with a letter or Chinese character. It can contain digits, underscores (_), and hyphens (-). It cannot start with |
ReservationName |
| VSwitchCidrReservationDescription |
string |
No |
The description of the reserved CIDR block for a vSwitch. If you do not specify this parameter, the description is empty. The default value is empty. The description must be 1 to 256 characters in length and must start with a letter or Chinese character. It cannot start with |
ReservationDescription |
| IpVersion |
string |
No |
The IP version of the reserved CIDR block for a vSwitch. Valid values:
Note
You do not need to specify this parameter when you create an IPv4 reserved CIDR block for a vSwitch. This parameter is required when you create an IPv6 reserved CIDR block for a vSwitch. |
IPv4 |
| VSwitchCidrReservationMask |
string |
No |
The mask of the reserved CIDR block for a vSwitch.
Note
|
28 |
| VSwitchCidrReservationCidr |
string |
No |
The reserved CIDR block for a vSwitch.
Note
|
192.168.1.64/28 |
| VSwitchCidrReservationType |
string |
No |
The type of the reserved CIDR block for a vSwitch. Valid values: prefix, which indicates that IP addresses are allocated by CIDR block. Note
When users or cloud services automatically assign CIDR blocks to elastic network interfaces (ENIs), the CIDR blocks must be allocated from the reserved CIDR block for a vSwitch. If the IP addresses in the reserved CIDR block for a vSwitch are exhausted, the system returns an error. |
prefix |
| IpPrefixNumber |
integer |
No |
The expected number of IP prefixes to reserve. Valid values: 1 to 32. |
1 |
| ClientToken |
string |
No |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters. Note
If you do not specify this parameter, the system automatically uses the RequestId of the API request as the ClientToken. The RequestId may be different for each API request. |
123e4567-e89b-12d3-a456-426655440000 |
| DryRun |
boolean |
No |
Specifies whether to perform only a dry run, without performing the actual request. Valid values:
|
false |
| RegionId |
string |
Yes |
The region ID of the vSwitch. You can call the DescribeRegions operation to query the most recent region list. |
cn-hangzhou |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The instance ID of the reserved CIDR block for a vSwitch. |
||
| VSwitchCidrReservationId |
string |
The instance ID of the reserved CIDR block for a vSwitch. |
vcr-bp1m12saqteraw3rp**** |
| RequestId |
string |
The request ID. |
54B48E3D-DF70-471B-AA93-08E683A1B45 |
Examples
Success response
JSON format
{
"VSwitchCidrReservationId": "vcr-bp1m12saqteraw3rp****",
"RequestId": "54B48E3D-DF70-471B-AA93-08E683A1B45"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | IllegalParamFormat | IllegalParamFormat | The parameter format is invalid. |
| 400 | IllegalParamFormat.VSwitchCidrReservationCidr | The param format of VSwitchCidrReservationCidr is illegal. | The VSwitchCidrReservationCidr value is invalid. |
| 400 | ResourceNotFound.VSwitch | The specified resource of VSwitch is not found. | The specified vSwitch does not exist. |
| 400 | UnsupportedFeature.ReservedType | The specified ReservedType is not supported. | The ReservedType value is invalid. |
| 400 | UnsupportedFeature.VSwitchIpv6 | The ipv6 feature of switch is not supported. | IPv6 is not enabled for the specified vSwitch. |
| 400 | OperationFailed.VSwitchCidrReservationCidr | The specified VSwitchCidrReservationCidr conflicts with existed cidr reservation or vswitch cidr. | The VSwitchCidrReservationCidr value conflicts with an existing VSwitchCidrReservation value. |
| 400 | MissingParam.CidrReservationMaskOrCidrReservationCidr | Either VSwitchCidrReservationMask or VSwitchCidrReservationCidr should be specified. | You cannot leave both the VSwitchCidrReservationMask and VSwitchCidrReservationCidr parameters empty. Set a value and try again. |
| 400 | UnsupportedRegion | UnsupportedRegion | The error message returned because the current region does not support this feature. |
| 400 | UnsupportedFeature.VpcAdvancedFeature | UnsupportedFeature.VpcAdvancedFeature | The error message returned because the VPC where the specified vSwitch is deployed does not support advanced VPC features. Specify another vSwitch and try again. |
| 400 | QuotaExceeded.CidrReservationCount | The quota of VSwitchCidrReservation is exceeded. | The VSwitchCidrReservation value exceeds the upper limit. |
| 400 | Conflict.CidrReservationMaskAndCidrReservationCidr | The specified VSwitchCidrReservationMask and VSwitchCidrReservationCidr is conflict. | The VSwitchCidrReservationMask value conflicts with the VSwitchCidrReservationCidr value. Adjust the values and try again. |
| 400 | OperationFailed.CidrNotEnoughInVSwitch | No enough cidr to allocate in this vswitch. | The specified vSwitch does not have sufficient CIDR blocks. |
| 400 | OperationFailed.SystemReservedIpContained | The specified VSwitchCidrReservationCidr cannot contain system reserved IP addresses. | VSwitchCidrReservationCidr cannot contain a reserved IP address. |
| 400 | OperationFailed.AlreadyUsedIpContained | The specified VSwitchCidrReservationCidr cannot contain already used IP addresses. | The reserved CIDR block cannot contain used IP addresses. |
| 400 | IncorrectStatus.VSWITCH | The status of the specified VSwitch is invalid. | The status of the specified VSwitch is invalid. |
| 400 | IllegalParam.VSwitchCidrReservationMask | The specified VSwitchCidrReservationMask must be at least 2 bits greater than the vSwitch mask. | The specified VSwitchCidrReservationMask must be at least 2 bits greater than the vSwitch mask. |
| 400 | QuotaExceeded.VSwitchCidrReservationMask | The operation is failed because of %s. The mask of the reserved subnet cidr exceeds the current default mask of IP Prefix, %s/%s. | The operation failed because of the quota %s. The mask of the reserved CIDR block exceeds the default mask of the current IP Prefix, %s/%s. |
| 400 | IllegalParam.ReservedType | IpPrefixNumber is only supported with Prefix reserved type. | IpPrefixNumber is only supported with Prefix reserved type. |
| 400 | MissingParam.VSwitchCidrReservationParam | One of IpPrefixNumber, VSwitchCidrReservationMask, or VSwitchCidrReservationCidr must be specified. | One of IpPrefixNumber, VSwitchCidrReservationMask, or VSwitchCidrReservationCidr must be specified. |
| 400 | Conflict.VSwitchCidrReservationParam | IpPrefixNumber cannot be used together with VSwitchCidrReservationCidr or VSwitchCidrReservationMask. | IpPrefixNumber cannot be used together with VSwitchCidrReservationCidr or VSwitchCidrReservationMask. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.