全部產品
Search
文件中心

Virtual Private Cloud:DeleteVSwitch

更新時間:Jul 14, 2026

呼叫 DeleteVSwitch 介面刪除交換器。

介面說明

呼叫該介面刪除交換器時,請注意以下事項:

  • 刪除交換器之前,需要先釋放或移走 VPC 內的所有資源,包括交換器、雲端產品執行個體、路由器介面、HaVip 等。

  • 只有處於 Available 狀態的交換器可以被刪除。

  • 交換器所在的 VPC 正在建立或刪除交換器或路由條目時,無法刪除交換器。

  • DeleteVSwitch 介面屬於非同步介面,即系統會返回一個請求 ID,但該交換器尚未刪除成功,系統背景的刪除任務仍在進行。您可以呼叫 DescribeVSwitchAttributes 查詢交換器的刪除狀態:

    • 當交換器處於 Pending 狀態時,表示交換器正在刪除中。

    • 當查詢不到指定的交換器時,表示交換器刪除成功。

  • DeleteVSwitch 介面不支援並行刪除同一個交換器。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

vpc:DeleteVSwitch

delete

*VSwitch

acs:vpc:{#regionId}:{#accountId}:vswitch/{#VSwitchId}

請求參數

名稱

類型

必填

描述

樣本值

VSwitchId

string

要刪除的交換器 ID。

vsw-asdfjlna****

RegionId

string

要刪除的交換器的地域 ID。

您可以透過呼叫 DescribeRegions 介面取得地域 ID。

cn-hangzhou

DryRun

boolean

是否僅預檢此次請求。取值:

  • true:傳送檢查請求,不會刪除交換器。檢查項目包括是否填寫了必要參數、請求格式、業務限制。如果檢查未通過,則返回對應錯誤。如果檢查通過,則返回錯誤碼 DryRunOperation

  • false(預設值):傳送正常請求,通過檢查後返回 HTTP 2xx 狀態碼並直接進行刪除。

false

返回參數

名稱

類型

描述

樣本值

object

返回資訊。

RequestId

string

請求 ID。

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

樣本

正常返回樣本

JSON格式

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

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 OperationDenied.OtherSubnetProcessing other subnet is processing. 無法刪除目前虛擬交換器(vSwitch),因為有其他子網路正在操作中。
400 IncorrectVSwitchStatus vpc subnet is in middle status.
400 DependencyViolation Resources deployed in the vSwitch have not been deleted. 無法執行該操作,目前路由表中有路由條目的狀態為 pending 或 modifying。
400 IncorrectRouteEntryStatus Some route entry status blocked this operation.
400 DependencyViolation.HaVip VSwitch cannot be deleted when there are some HaVip dependent with it. 無法刪除交換器,該交換器下有關聯的 HaVip。
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. 操作過於頻繁,請稍候再重試。
400 DependencyViolation.SNAT The vswitch cannot be deleted when used by snat. 當 SNAT 使用時,無法刪除 VSwitch。
400 DeleteVSwitch.IncorrectStatus.cbnStatus Current CBN status does not support this operation. 目前 CBN 狀態不支援刪除虛擬交換器(VSwitch)操作。
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. 當存在網路 ACL 時,無法刪除 VSwitch。
400 DependencyViolation.EnhancedNatgw VSwitch cannot be deleted when natgw exist. 當 NAT 閘道器存在時,無法刪除 VSwitch。
400 DependencyViolation.ResourceShare VSwitch cannot be deleted when resource share exist.
400 OperationFailed.SystemBusy Operation failed because system is busy. 系統繁忙,請稍後重試。
400 DependencyViolation.MulticastDomain VSwitch cannot be deleted when associated with multicast domain. VSwitch 加入了群播域,無法刪除。
400 DependencyViolation.VSwitchCidrReservation VSwitch cannot be deleted when vswitch cidr reservation exist. 該 VSwitch 存在 VSwitchCidrReservation 使用中,不允許刪除。
400 DependencyViolation.CloudService VSwitch cannot be deleted when uesd by cloud service. 目前交換器正被雲端服務使用無法刪除,請確認雲端服務使用場景。
400 InvalidVSwitchId.NotFound VSwitch not exist.
400 OperationFailed.Ipv6InstanceExist Operation failed because vswitch has ipv6 instance. 交換器中存在 IPv6 執行個體。
400 DependencyViolation.Ipv6Address The specified resource of %s depends on %s, so the operation cannot be completed. 您指定的資源被其他的資源依賴,不允許進行目前操作。
400 DependencyViolation.%s The specified resource of [%s] depends on [%s], so the operation cannot be completed. 操作的資源 [%s] 依賴了 [%s],請先刪除依賴資源後再操作。
400 Forbidden.RegionNotFound Specified instance is not found during access authentication. 目前 Region 不支援。
400 IncorrectStatus Vswtich status not stable.
400 DependencyViolation.RouterInterface Specified object has dependent resources RouterInterface.
400 InvalidRegionId.NotFound The specified region is not found. 參數錯誤。
400 DependencyViolation.NATGW Nat gateway exists in the VSwitch, so the VSwitch cannot be deleted. 目前 VSwitch 還存在未刪除的 NAT 閘道器,VSwitch 刪除失敗,請先刪除該 VSwitch 下的 NAT 閘道器後再刪除 VSwitch。
404 IncorrectVSwitchId Specified vSwtich instance is not found during access authentication. 權限驗證過程中,未找到指定的虛擬交換器(vSwitch)執行個體。
404 InvalidVSwitchId.NotFound VSwitch not exist.

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情