Checks whether a private IP address in a specified vSwitch is available.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
RegionId String Yes cn-qingdao

The region ID of the vSwitch to which the private IP address that you want to query belongs.

You can call the DescribeRegions operation to query the most recent region list.

VSwitchId String Yes vsw-m5ew3t46z2drmifnt****

The ID of the vSwitch to which the private IP address to be queried belongs.

PrivateIpAddress String Yes 10.0.0.7

To query whether a private IP address is available, the private IP address must belong to the vSwitch specified by the VSwitchId parameter.

IpVersion String No ipv4

The version of the private IP address. Valid values:

  • ipv4: IPv4 If you want to query an IPv4 address, this parameter is optional.
  • ipv6: IPv6 If you want to query an IPv6 address, this parameter is required.
Action String Yes CheckCanAllocateVpcPrivateIpAddress

The operation that you want to perform. Set the value to CheckCanAllocateVpcPrivateIpAddress.

Response parameters

Parameter Type Example Description
CanAllocate Boolean true

Indicates whether the private IP address is available. Valid values:

  • true: yes
  • false: no
RequestId String 93360B0-2969-40BF-8542-EBB34FD358AB

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?RegionId=cn-qingdao
&VSwitchId=vsw-m5ew3t46z2drmifnt****
&PrivateIpAddress=10.0.0.7
&IpVersion=ipv4
&Action=CheckCanAllocateVpcPrivateIpAddress
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CheckCanAllocateVpcPrivateIpAddressResponse>
    <CanAllocate>true</CanAllocate>
    <RequestId>93360B0-2969-40BF-8542-EBB34FD358AB</RequestId>
</CheckCanAllocateVpcPrivateIpAddressResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "CanAllocate" : true,
  "RequestId" : "93360B0-2969-40BF-8542-EBB34FD358AB"
}

Error codes

For a list of error codes, visit the API Error Center.