Deletes a vSwitch.
Operation description
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.
-
DeleteVSwitch 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 the DescribeVSwitchAttributes operation to query the status of the task:
- 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
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:DeleteVSwitch | delete |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
VSwitchId | string | Yes | The ID of the vSwitch that you want to delete. | vsw-asdfjlna**** |
RegionId | string | No | The region ID of the vSwitch. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
Response parameters
Examples
Sample success responses
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 | IncorrectVSwitchStatus | vpc subnet status not working. | - |
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 | Resources deployed in the vSwitch have not been deleted. | Failed to delete the vSwitch because resources attached to the vSwitch are not released. |
400 | DependencyViolation | Some route entry status blocked this operation. | The operation is not supported because the route table contains routes in the Pending or Modifying state. |
400 | IncorrectRouteEntryStatus | Some route entry status blocked this operation. | The operation is not supported because the route table contains routes in the Pending or Modifying state. |
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. | Some required parameters are not specified. Specify all required parameters and try again. |
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. | The error message returned because the specified vSwitch does not exist. Check whether the specified vSwitch ID is valid. |
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. |
404 | Forbidden.RegionNotFound | Specified instance is not found during access authentication. | The error message returned because the region is not supported. |
404 | IncorrectVSwitchId | Specified vSwtich instance is not found during access authentication. | The vSwitch is not found during the permission verification progress. |
404 | IncorrectStatus | Vswtich status not stable. | The VSwitch is in the status of Pending or Modifying. Please try again later. |
404 | DependencyViolation.RouterInterface | Specified object has dependent resources RouterInterface. | The object is already associated with a router interface. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-12-14 | The Error code has changed | View Change Details |
2023-10-10 | The Error code has changed | View Change Details |
2023-09-21 | The Error code has changed | View Change Details |
2023-06-25 | The Error code has changed | View Change Details |
2023-06-09 | The Error code has changed | View Change Details |
2023-03-17 | The Error code has changed | View Change Details |