Deletes a vSwitch.

Usage notes

When you call this operation, take note of the following limits:

  • Before you delete a vSwitch, you must first release or remove all virtual private cloud (VPC) resources, including vSwitches, instances, router interfaces, and high-availability virtual IP addresses (HAVIPs).
  • You can delete only vSwitches that are in the Available state.
  • You cannot delete a vSwitch from a VPC where a vSwitch or a route is being created or deleted.
  • The DeleteVSwitch operation is asynchronous. After you send the request, the system returns a request ID. However, the operation is still being performed in the system background. You can call the DescribeVSwitchAttributes operation to query the status of a vSwitch:
    • If the vSwitch is in the Pending state, the vSwitch is being deleted.
    • If you cannot query the vSwitch, the vSwitch is deleted.
  • You cannot repeatedly call the DeleteVSwitch operation to delete a vSwitch within the specified period of time.

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
Action String Yes DeleteVSwitch

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

VSwitchId String Yes vsw-asdfjlna****

The ID of the vSwitch that you want to delete.

RegionId String No cn-hangzhou

The region ID of the vSwitch.

Response parameters

Parameter Type Example Description
RequestId String 0ED8D006-F706-4D23-88ED-E11ED28DCAC0

The ID of the request.

Examples

Sample requests

http(s)://vpc.aliyuncs.com/?Action=DeleteVSwitch
&VSwitchId=vsw-asdfjlna****
&<Common request parameters>

Sample success responses

XML format

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

<DeleteVSwitchResponse>
    <RequestId>0ED8D006-F706-4D23-88ED-E11ED28DCAC0</RequestId>
</DeleteVSwitchResponse>

JSON format

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

{
  "RequestId" : "0ED8D006-F706-4D23-88ED-E11ED28DCAC0"
}

Error codes

HttpCode Error code Error message Description
400 OperationDenied.OtherSubnetProcessing other subnet is processing. The error message returned because you cannot delete the vSwitch because other subnets are being managed.
400 IncorrectVSwitchStatus The current virtual switch status does not support this operation. The error message returned because the vSwitch is in the Pending state and cannot be deleted.
400 DependencyViolation Specified object has dependent resources. The error message returned because resources deployed in the vSwitch are not deleted and the vSwitch cannot be deleted. Delete the resources deployed in the VPC first before you delete the VPC.
400 DependencyViolation Some route entry status blocked this operation. The error message returned because one or more route entries in the current route table are in the Pending or Modifying state.
400 IncorrectRouteEntryStatus Some route entry status blocked this operation. The error message returned because one or more route entries in the current route table are in the Pending or Modifying state.
400 DependencyViolation.HaVip VSwitch cannot be deleted when there are some HaVip dependent with it. The error message returned because the vSwitch is associated with an HAVIP and the vSwitch cannot be deleted.
400 MissingParameter Miss mandatory parameter. The error message returned because some required parameters are not set. Check whether you have set all required parameters before you call this operation.
400 TaskConflict The operation is too frequent, TaskConflict. The error message returned because the system is busy. Try again later.
400 DeleteVSwitch.IncorrectStatus.cbnStatus Current CBN status does not support this operation. The error message returned because you cannot delete the vSwitch when the CEN instance is in the current state.
400 DependencyViolation.MulticastDomain VSwitch cannot be deleted when associated with multicast domain. The error message returned because the vSwitch is added to a multicast domain and cannot be deleted.
404 IncorrectVSwitchId Specified vSwtich instance is not found during access authentication. The error message returned because the vSwitch is not found during the permission verification progress.
404 InvalidVSwitchId.NotFound VSwitch not exist. The error message returned because the specified vSwitch does not exist. Check whether the specified vSwitch ID is valid.
404 IncorrectStatus Vswtich status not stable. The error message returned because the vSwitch is in the Pending or Modifying state. Try again later.

For a list of error codes, see Service error codes.