Creates a reserved CIDR block for a vSwitch.
Operation description
Description
Take note of the following items:
-
You can create at most 10 reserved IPv4 CIDR blocks and 10 reserved IPv6 CIDR blocks for each vSwitch in a virtual private cloud (VPC).
-
After you create a reserved CIDR block for a vSwitch, the CIDR block cannot contain the IP address of the subnet gateway of the VPC to which the vSwitch belongs.
-
CreateVSwitchCidrReservation is an asynchronous operation. After a request is sent, the system returns a request ID and runs the task in the background. You can call ListVSwitchCidrReservations to query the status of the task:
- If the vSwitch is in the Assigning state, the reserved CIDR block is being created.
- If the vSwitch is in the Assigned state, the reserved CIDR block is created.
-
When you create a reserved IPv4 CIDR block for a vSwitch, the first IP address and the last three IP addresses of the vSwitch are reserved by the system. The four IP addresses will not be allocated.
-
When you create a reserved IPv6 CIDR block for a vSwitch, the first IP address and the last nine IP addresses of the vSwitch are reserved by the system. The 10 IP addresses will not be allocated. For example, if you create a reserved IPv4 CIDR block for a vSwitch whose CIDR block is 192.168.1.0/24, the reserved CIDR block cannot contain the following IP addresses: 192.168.1.0, 192.168.1.253, 192.168.1.254, and 192.168.1.255.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
vpc:CreateVSwitchCidrReservation | create |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
Tag | array<object> | No | Resource tags | |
object | No | |||
Key | string | No | The key of tag N to add to the resource. You can specify at most 20 tag keys. The tag key cannot be an empty string. The tag key can be up to 128 characters in length. It cannot start with aliyun or acs:, and cannot contain http:// or https://. | FinanceDept |
Value | string | No | The value of tag N to add to the resource. You can specify at most 20 tag values. The tag value can be an empty string. The tag value can be up to 128 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://. | FinanceJoshua |
VSwitchId | string | Yes | The ID of the vSwitch to which the reserved CIDR block belongs. | vsw-25navfgbue4g**** |
VSwitchCidrReservationName | string | No | The name of the reserved CIDR block. The name must be 2 to 128 characters in length and can contain digits, underscores (_), and hyphens (-). It must start with a letter. | ReservationName |
VSwitchCidrReservationDescription | string | No | The description of the reserved CIDR block. This parameter is empty by default. The description must be 2 to 256 characters in length. It must start with a letter and cannot start with | ReservationDescription |
IpVersion | string | No | The IP version of the reserved CIDR block. Valid values:
| IPv4 |
VSwitchCidrReservationMask | string | No | The subnet mask of the reserved CIDR block.
Note
You must specify one of VSwitchCidrReservationMask and VSwitchCidrReservationCidr.
| 28 |
VSwitchCidrReservationCidr | string | No | The reserved CIDR block of the vSwitch.
Note
You must specify one of VSwitchCidrReservationMask and VSwitchCidrReservationCidr.
| 192.168.1.64/28 |
VSwitchCidrReservationType | string | No | The type of reserved CIDR block. Set the value to prefix. Note
When a user or a cloud service allocates a CIDR block to an elastic network interface (ENI), the CIDR block must be allocated from the reserved CIDR block. If the reserved CIDR block is exhausted, an error is returned.
| prefix |
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 request ID as the client token. The request ID may be different for each 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 ID of the region where the vSwitch is deployed. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
Response parameters
Examples
Sample success responses
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 | IllegalParam.VSwitchCidrReservationMask | The specified VSwitchCidrReservationMask must be greater than the VSwitch mask + 2. | VSwitchCidrReservationMask must be at least 3 bits greater than the vSwitch mask. |
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.VSwitchCidrReservationMask | The quota of VSwitchCidrReservationMask is exceeded. | The VSwitchCidrReservationMask value exceeds the upper limit. Adjust the value 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. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-11-27 | The Error code has changed | View Change Details |