Deletes a VSwitch.
Operation description
When you call this operation to delete a VSwitch, take note of the following items:
-
Before you delete a VSwitch, you must release or migrate all resources in the VPC, including VSwitches, cloud product instances, router interfaces, and HaVip resources.
-
Only VSwitches in the Available state can be deleted.
-
A VSwitch cannot be deleted if the VPC to which it belongs is creating or deleting a VSwitch or route entry.
-
The DeleteVSwitch operation is asynchronous. After you send a request, the system returns a request ID, but the VSwitch is not yet deleted. The deletion task is still running in the background. You can call DescribeVSwitchAttributes to query the deletion status of the VSwitch:
If the VSwitch is in the Pending state, the VSwitch is being deleted.
If the specified VSwitch cannot be found, the VSwitch is deleted.
-
The DeleteVSwitch operation does not support concurrent deletion of the same VSwitch.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
vpc:DeleteVSwitch |
delete |
*VSwitch
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| VSwitchId |
string |
Yes |
The ID of the VSwitch to delete. |
vsw-asdfjlna**** |
| RegionId |
string |
No |
The region ID of the VSwitch to delete. You can call the DescribeRegions operation to query region IDs. |
cn-hangzhou |
| DryRun |
boolean |
No |
Specifies whether to perform a dry run. Valid values:
|
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| RequestId |
string |
The request ID. |
0ED8D006-F706-4D23-88ED-E11ED28DCAC0 |
Examples
Success response
JSON format
{
"RequestId": "0ED8D006-F706-4D23-88ED-E11ED28DCAC0"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | OperationDenied.OtherSubnetProcessing | other subnet is processing. | You cannot delete the vSwitch because other subnets are being managed. |
| 400 | IncorrectVSwitchStatus | vpc subnet is in middle status. | |
| 400 | DependencyViolation | Resources deployed in the vSwitch have not been deleted. | Failed to delete the vSwitch because resources attached to the vSwitch are not released. |
| 400 | IncorrectRouteEntryStatus | Some route entry status blocked this operation. | |
| 400 | DependencyViolation.HaVip | VSwitch cannot be deleted when there are some HaVip dependent with it. | The vSwitch is associated with an HAVIP and the vSwitch cannot be deleted. |
| 400 | DependencyViolation.RouteTable | VSwitch cannot be deleted when associated with route table | |
| 400 | MissingParameter | Miss mandatory parameter. | |
| 400 | TaskConflict | The operation is too frequent, TaskConflict. | The system is unavailable. Try again later. |
| 400 | DependencyViolation.SNAT | The vswitch cannot be deleted when used by snat. | You cannot delete a vSwitch when SNAT is used. |
| 400 | DeleteVSwitch.IncorrectStatus.cbnStatus | Current CBN status does not support this operation. | You cannot delete the vSwitch when the CEN instance is in the current state. |
| 400 | AttrMismatching.NaclAndBindInstance | The network acl and resource not in same vpc. | |
| 400 | InvalidResource.NotBinding | The resource has not been binded. | |
| 400 | DependencyViolation.SnatEntry | VSwitch cannot be deleted when snat entry exist. | |
| 400 | DependencyViolation.NetworkAcl | VSwitch cannot be deleted when network acl exist. | You cannot delete the vSwitch because a network ACL exists in the vSwitch. |
| 400 | DependencyViolation.EnhancedNatgw | VSwitch cannot be deleted when natgw exist. | You cannot delete the vSwitch because a NAT gateway exists in the vSwitch. |
| 400 | DependencyViolation.ResourceShare | VSwitch cannot be deleted when resource share exist. | |
| 400 | OperationFailed.SystemBusy | Operation failed because system is busy. | The error message returned because the system is busy. Try again later. |
| 400 | DependencyViolation.MulticastDomain | VSwitch cannot be deleted when associated with multicast domain. | The vSwitch is added to a multicast domain and cannot be deleted. |
| 400 | DependencyViolation.VSwitchCidrReservation | VSwitch cannot be deleted when vswitch cidr reservation exist. | The error message returned because a CIDR block is reserved for the vSwitch and the vSwitch cannot be deleted. |
| 400 | DependencyViolation.CloudService | VSwitch cannot be deleted when uesd by cloud service. | The error message returned because the vSwitch is being used by a cloud service and cannot be deleted. Check the use scenario of the cloud service. |
| 400 | InvalidVSwitchId.NotFound | VSwitch not exist. | |
| 400 | OperationFailed.Ipv6InstanceExist | Operation failed because vswitch has ipv6 instance. | IPv6 instances exist in the vSwitch. |
| 400 | DependencyViolation.Ipv6Address | The specified resource of %s depends on %s, so the operation cannot be completed. | The specified resource is dependent on other resources and the current operation is not allowed. |
| 400 | DependencyViolation.%s | The specified resource of [%s] depends on [%s], so the operation cannot be completed. | The specified resource of [%s] depends on [%s], so the operation cannot be completed. |
| 400 | Forbidden.RegionNotFound | Specified instance is not found during access authentication. | The error message returned because the region is not supported. |
| 400 | IncorrectStatus | Vswtich status not stable. | |
| 400 | DependencyViolation.RouterInterface | Specified object has dependent resources RouterInterface. | |
| 400 | InvalidRegionId.NotFound | The specified region is not found. | The specified region does not exist. |
| 404 | IncorrectVSwitchId | Specified vSwtich instance is not found during access authentication. | The vSwitch is not found during the permission verification progress. |
| 404 | InvalidVSwitchId.NotFound | VSwitch not exist. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.