DeleteVpc

更新時間:
Copy as MD

呼叫 DeleteVpc 介面刪除一個專有網路 VPC(Virtual Private Cloud)。

介面說明

呼叫該介面刪除 VPC 時,請注意:

  • 刪除 VPC 之前,需要先釋放或轉移 VPC 內的所有資源,包括交換機、雲端產品執行個體、高可用虛擬 IP 等。

  • 只有處於 Available 狀態的 VPC 才可以被刪除。

  • DeleteVpc 介面屬於非同步介面,即系統會返回一個請求 ID,但該 VPC 尚未刪除成功,系統後台的刪除任務仍在進行。您可以呼叫 DescribeVpcAttribute 查詢 VPC 的刪除狀態:

    • 當 VPC 處於 Deleting 狀態時,表示 VPC 正在刪除中。

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

  • DeleteVpc 介面不支援並行刪除同一個 VPC。

調試

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

調試

授權資訊

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

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

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

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

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

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

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

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

操作

存取層級

資源類型

條件關鍵字

關聯操作

vpc:DeleteVpc

delete

*VPC

acs:vpc:{#regionId}:{#accountId}:vpc/{#VpcId}

  • vpc:tag

請求參數

名稱

類型

必填

描述

樣本值

VpcId

string

要刪除的 VPC ID。

vpc-bp1m7v25emi1h5mtc****

RegionId

string

要刪除的 VPC 所在的地域 ID。

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

cn-hangzhou

ForceDelete

boolean

是否強制刪除 VPC。取值:

  • true:強制刪除。

  • false(預設值):不強制刪除。

當 VPC 下僅存在以下資源時可強制刪除 VPC:

  • 該 VPC 下僅存在 IPv4 閘道及指向 IPv4 閘道的路由。

  • 該 VPC 下僅存在 IPv6 閘道及指向 IPv6 閘道的路由。

false

DryRun

boolean

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

  • true:傳送檢查請求,不會刪除專有網路 VPC。檢查項包括是否填寫了必需參數、請求格式、業務限制。如果檢查不通過,則返回對應錯誤。如果檢查通過,則返回錯誤碼DryRunOperation

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

false

ClientToken

string

用戶端 Token,用於保證請求的冪等性。

從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。ClientToken 只支援 ASCII 字元。

說明

若您未指定,則系統自動使用 API 請求的 RequestId 作為 ClientToken 標識。每次 API 請求的 RequestId 可能不一樣。

123e4567-e89b-12d3-a456-426655440000

返回參數

名稱

類型

描述

樣本值

object

請求 ID。

RequestId

string

請求 ID。

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

樣本

正常返回樣本

JSON格式

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

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 IncorrectStatus.VpcDhcpStatus The DhcpOptionsSet status of vpc does not support this operation.
400 DependencyViolation.GatewayEndpoint The VPC contains endpoints and cannot be deleted.
400 IncorrectVpcStatus Current VPC status does not support this operation.
400 DependencyViolation.RouteEntry Specified object has dependent resources
400 DependencyViolation.Instance Specified object has dependent resources
400 DependencyViolation.VSwitch Specified object has dependent resources
400 DependencyViolation.RouteInterface Specified object has dependent route interface .
400 DependencyViolation.Tunnel Specified object has dependent tunnel.
400 DependencyViolation.NatGateway Specified object has dependent resources NatGateway.
400 DependencyViolation.RouterInterface Specified object has dependent resources RouterInterface.
400 DependencyViolation.SecurityGroup Specified object has dependent resources SecurityGroup.
400 Forbidden.VpcNotFound Specified VPC can not found.
400 Forbbiden Active custom route in vpc.
400 TaskConflict The eip operate too frequent, TaskConflict.
400 InvalidAction The VPC has been connected to the classic network ECS. Please cancel the connection before proceeding.
400 IncorrectStatus.cbnStatus Current CBN status does not support this operation.
400 DependencyViolation.RouteTable Specified object has dependent custom routeTable.
400 DependencyViolation.NetworkAcl Specified object has dependent resources network acl.
400 DependencyViolation.ClassicLinkInstance Specified object has active classicLink instance.
400 System.ServiceBusy System is busy, please try later.
400 DependencyViolation.DhcpOptionsSet The VPC cannot be deleted when it is associated with dhcpOptionsSet.
400 InvalidRegionId.NotFound The specified region is not found.
400 DependencyViolation.CustomRouteTable CustomRouteTable already exists.
400 DependencyViolation.Ipv4Gateway The VPC cannot be deleted when it has ipv4Gateway.
400 DependencyViolation.GatewayRouteTable Specified object has dependent resources gatewayRouteTable.
400 OperationDenied.VpcPeerExists The operation is not allowed because the VpcPeer exists.
400 DependencyViolation.AppAccess Specified object has dependent resources app access.
400 DependencyViolation.OppositeRouterInterface Failed to delete the VPC because it has peer router interfaces.
400 DependencyViolation.TransitRouter Specified object has attached to Transit Router.
400 DependencyViolation.Ipv6Gateway The VPC contains IPv6Gateway and cannot be deleted.
400 DependencyViolation.CloudServiceResource The VPC contains CloudServiceResource and cannot be deleted.
400 IncorrectStatus.VpcDnsHostnameStatus The DnsHostname status of vpc does not support this operation.
400 OperationDenied.AttachedToECR The operation is not allowed because the VPC is attached to ECR %s.
500 InternalError The request processing has failed due to some unknown error.
403 OperationDenied The operation is not supported in this status.
404 InvalidVpcId.NotFound Specified VPC does not exist.

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

變更歷史

更多資訊,參考變更詳情