All Products
Search
Document Center

Virtual Private Cloud:DeleteVSwitch

Last Updated:Nov 13, 2024

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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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.
OperationAccess levelResource typeCondition keyAssociated operation
vpc:DeleteVSwitchdelete
  • VSwitch
    acs:vpc:{#regionId}:{#accountId}:vswitch/{#VSwitchId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
VSwitchIdstringYes

The ID of the vSwitch that you want to delete.

vsw-asdfjlna****
RegionIdstringNo

The region ID of the vSwitch.

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

cn-hangzhou

Response parameters

ParameterTypeDescriptionExample
object

The returned information.

RequestIdstring

The ID of the request.

0ED8D006-F706-4D23-88ED-E11ED28DCAC0

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400OperationDenied.OtherSubnetProcessingother subnet is processing.You cannot delete the vSwitch because other subnets are being managed.
400IncorrectVSwitchStatusvpc subnet is in middle status.-
400IncorrectVSwitchStatusvpc subnet status not working.-
400IncorrectVSwitchStatusThe 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.
400DependencyViolationResources deployed in the vSwitch have not been deleted.Failed to delete the vSwitch because resources attached to the vSwitch are not released.
400DependencyViolationSome route entry status blocked this operation.The operation is not supported because the route table contains routes in the Pending or Modifying state.
400IncorrectRouteEntryStatusSome route entry status blocked this operation.The operation is not supported because the route table contains routes in the Pending or Modifying state.
400DependencyViolation.HaVipVSwitch cannot be deleted when there are some HaVip dependent with it.The vSwitch is associated with an HAVIP and the vSwitch cannot be deleted.
400DependencyViolation.RouteTableVSwitch cannot be deleted when associated with route table-
400MissingParameterMiss mandatory parameter.Some required parameters are not specified. Specify all required parameters and try again.
400TaskConflictThe operation is too frequent, TaskConflict.The system is unavailable. Try again later.
400DependencyViolation.SNATThe vswitch cannot be deleted when used by snat.You cannot delete a vSwitch when SNAT is used.
400DeleteVSwitch.IncorrectStatus.cbnStatusCurrent CBN status does not support this operation.You cannot delete the vSwitch when the CEN instance is in the current state.
400AttrMismatching.NaclAndBindInstanceThe network acl and resource not in same vpc.-
400InvalidResource.NotBindingThe resource has not been binded.-
400DependencyViolation.SnatEntryVSwitch cannot be deleted when snat entry exist.-
400DependencyViolation.NetworkAclVSwitch cannot be deleted when network acl exist.You cannot delete the vSwitch because a network ACL exists in the vSwitch.
400DependencyViolation.EnhancedNatgwVSwitch cannot be deleted when natgw exist.You cannot delete the vSwitch because a NAT gateway exists in the vSwitch.
400DependencyViolation.ResourceShareVSwitch cannot be deleted when resource share exist.-
400OperationFailed.SystemBusyOperation failed because system is busy.The error message returned because the system is busy. Try again later.
400DependencyViolation.MulticastDomainVSwitch cannot be deleted when associated with multicast domain.The vSwitch is added to a multicast domain and cannot be deleted.
400DependencyViolation.VSwitchCidrReservationVSwitch 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.
400DependencyViolation.CloudServiceVSwitch 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.
400InvalidVSwitchId.NotFoundVSwitch not exist.The error message returned because the specified vSwitch does not exist. Check whether the specified vSwitch ID is valid.
400OperationFailed.Ipv6InstanceExistOperation failed because vswitch has ipv6 instance.IPv6 instances exist in the vSwitch.
400DependencyViolation.Ipv6AddressThe 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.
404Forbidden.RegionNotFoundSpecified instance is not found during access authentication.The error message returned because the region is not supported.
404IncorrectVSwitchIdSpecified vSwtich instance is not found during access authentication.The vSwitch is not found during the permission verification progress.
404IncorrectStatusVswtich status not stable.The VSwitch is in the status of Pending or Modifying. Please try again later.
404DependencyViolation.RouterInterfaceSpecified 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 timeSummary of changesOperation
2023-12-14The Error code has changedView Change Details
2023-10-10The Error code has changedView Change Details
2023-09-21The Error code has changedView Change Details
2023-06-25The Error code has changedView Change Details
2023-06-09The Error code has changedView Change Details
2023-03-17The Error code has changedView Change Details