调用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代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | DeleteVpc | 系统规定参数。取值:DeleteVpc。 |
VpcId | String | 是 | vpc-bp1m7v25emi1h5mtc**** | 要删除的VPC ID。 |
RegionId | String | 否 | cn-hangzhou | 要删除的VPC所在的地域ID。 您可以通过调用DescribeRegions接口获取地域ID。 |
ForceDelete | Boolean | 否 | false | 是否强制删除VPC。取值:
当VPC下仅存在以下资源时可强制删除VPC:
|
DryRun | Boolean | 否 | false | 是否只预检此次请求。取值:
|
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
RequestId | String | 0ED8D006-F706-4D23-88ED-E11ED28DCAC0 | 请求ID。 |
示例
请求示例
http(s)://[Endpoint]/?Action=DeleteVpc
&VpcId=vpc-bp1m7v25emi1h5mtc****
&RegionId=cn-hangzhou
&ForceDelete=false
&DryRun=false
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<DeleteVpcResponse>
<RequestId>0ED8D006-F706-4D23-88ED-E11ED28DCAC0</RequestId>
</DeleteVpcResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "0ED8D006-F706-4D23-88ED-E11ED28DCAC0"
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | IncorrectStatus.VpcDhcpStatus | The DhcpOptionsSet status of vpc does not support this operation. | 当前VPC中的DHCP选项集实例状态不支持删除VPC |
400 | DependencyViolation.GatewayEndpoint | The VPC contains endpoints and cannot be deleted. | VPC中还有终端节点,不能被删除,请先删除该VPC中的终端节点再删除VPC。 |
400 | IncorrectVpcStatus | Current VPC status does not support this operation. | 当前VPC的状态无法支持这个操作。 |
400 | DependencyViolation.RouteEntry | Specified object has dependent resources | 当前VPC还存在未删除的自定义路由规则,VPC删除失败。 |
400 | DependencyViolation.Instance | Specified object has dependent resources | 该对象有关联的资源。 |
400 | DependencyViolation.VSwitch | Specified object has dependent resources | 当前VPC还存在未删除的交换机,VPC删除失败,删除VPC下的交换机后再尝试删除VPC。 |
400 | DependencyViolation.SecurityGroup | Specified object has dependent resources SecurityGroup. | 当前VPC还存在未删除的安全组,VPC删除失败,请先删除该VPC下的安全组后再删除VPC。 |
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. | VPC中还有NAT网关,不能被删除,请先删除该VPC中的NAT网关再删除VPC。 |
400 | DependencyViolation.RouterInterface | Specified object has dependent resources RouterInterface. | 该对象有关联的路由器接口。 |
400 | Forbidden.VpcNotFound | Specified VPC can not found. | 指定的VPC不存在,请您检查VPC是否正确。 |
400 | Forbbiden | Active custom route in vpc. | 您需要在VPC中添加自定义路由条目。 |
400 | TaskConflict | The eip operate too frequent, TaskConflict. | 操作过于频繁,任务冲突。 |
400 | IncorrectStatus.cbnStatus | Current CBN status does not support this operation. | CBN当前状态不正确 |
400 | DependencyViolation.DhcpOptionsSet | The VPC cannot be deleted when it is associated with dhcpOptionsSet. | 当前VPC还存在未删除的DHCP选项集实例,不允许删除 |
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. | 该VPC下存在IPV4网关,无法删除。 |
400 | OperationDenied.VpcPeerExists | The operation is not allowed because the VpcPeer exists. | 指定操作被禁止,因为VPC内存在VPC对等连接。 |
400 | DependencyViolation.AppAccess | Specified object has dependent resources app access. | 该VPC存在反向访问授权关系,无法删除 |
403 | OperationDenied | The operation is not supported in this status. | 当前状态无法执行该操作。 |
403 | OperationDenied | The snapshot creation for the specified disk is not finished yet. | 指定磁盘的快照创建尚未结束。 |
404 | InvalidVpcId.NotFound | Specified VPC does not exist. | 该VPC不存在。 |
500 | InternalError | The request processing has failed due to some unknown error. | 请求处理由于某些未知错误失败。 |
访问错误中心查看更多错误码。