全部产品
Search
文档中心

专有网络 VPC:DeleteNatGateway - 删除指定的NAT网关

更新时间:Mar 04, 2024

调用DeleteNatGateway接口删除指定的公网NAT网关。

接口说明

  • DeleteNatGateway 接口属于异步接口,即系统会先返回一个请求 ID,但该 NAT 网关实例并未删除完成,系统后台的删除任务仍在进行。您可以调用 DescribeNatGateways 查询 NAT 网关的状态:

    • 当 NAT 网关处于 Deleting 状态时,表示 NAT 网关正在删除中,在该状态下,您只能执行查询操作,不能执行其他操作。

    • 当查询不到该 NAT 网关实例时,表示 NAT 网关删除完成。

      删除 NAT 网关操作不可恢复,请您谨慎操作。

  • DeleteNatGateway 接口在同一个 NAT 网关内不支持并发删除 NAT 网关。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。
  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:
    • 对于必选的资源类型,用背景高亮的方式表示。
    • 对于不支持资源级授权的操作,用全部资源表示。
  • 条件关键字:是指云产品自身定义的条件关键字。
  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作访问级别资源类型条件关键字关联操作
vpc:DeleteNatGatewayWrite
  • NatGateway
    acs:vpc:{#regionId}:{#accountId}:natgateway/{#natgatewayid}

请求参数

名称类型必填描述示例值
RegionIdstring

NAT 网关所在的地域 ID。

您可以通过调用 DescribeRegions 接口获取地域 ID。

cn-hangzhou
NatGatewayIdstring

要删除的 NAT 网关的实例 ID。

ngw-bp1uewa15k4iy5770****
Forceboolean

是否强制删除 NAT 网关,取值:

  • true:强制删除。当取值为 true 时,说明如下:

    • 如果 NAT 网关有 SNAT 规则,系统会自动帮您删除 SNAT 规则。

    • 如果 NAT 网关有 DNAT 规则,系统会自动帮您删除 DNAT 规则。

    • 如果 NAT 网关有绑定 EIP,系统会自动帮您解绑。

    • 如果 NAT 网关有未删除的 NAT 带宽包,系统会自动帮您删除 NAT 带宽包。

  • false(默认值):不强制删除。当取值为 false 时,说明如下:

    • 如果 NAT 网关有未删除的 NAT 带宽包,请先删除 NAT 带宽包。

    • 如果 NAT 网关有 SNAT 规则,请先删除 SNAT 规则。

    • 如果 NAT 网关有 DNAT 规则,请先删除 DNAT 规则。

    • 如果 NAT 网关有绑定 EIP,请先解绑 EIP。

false

返回参数

名称类型描述示例值
object

请求 ID。

RequestIdstring

请求 ID。

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

示例

正常返回示例

JSON格式

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

错误码

HTTP status code错误码错误信息描述
400DependencyViolation.VpcEndpointServiceThe specified resource of %s depends on %s, so the operation cannot be completed.NAT有依赖的终端节点服务,所以此操作不能进行
400DependencyViolation.FullNatEntryThe specified resource of %s depends on %s, so the operation cannot be completed.-
400DependencyViolation.RouterEntryThe specified resource of %s depends on %s, so the operation cannot be completed.NAT有依赖的路由条目,所以此操作不能进行
400DependencyViolation.BandwidthPackagesThere are BandwidthPackages on specified NatGateway not deleted.NAT网关上有尚未删除的带宽包,请删除NAT网关下的所有带宽包后再重新操作。
400DependencyViolation.EIPSThere are Eips on specified NatGateway, please unbind it first.指定的NAT网关已绑定了弹性公网IP,请先将其从NAT网关解绑。
400Forbidden.PrePaidNatGatewayThe specified NatGateway is PrePaid.-
400InvalidOperation.DeletionProtectionThe instance cannnot delete because of deletion protecion.-
400DependencyViolation.SnatEntryThe specified resource of %s depends on %s, so the operation cannot be completed.-
400IncorrectStatus.SnatEntryThe status of %s [%s] is incorrect.-
400DependencyViolation.ForwardEntryThe specified resource of %s depends on %s, so the operation cannot be completed.-
400IncorrectStatus.ForwardEntryThe status of %s [%s] is incorrect.要删除的DNAT条目实例状态不对
400DependencyViolation.NatIpThe specified resource of %s depends on %s, so the operation cannot be completed.有依赖的NAT IP,所以此操作不能进行
400IncorrectStatus.NatIpThe status of %s [%s] is incorrect.NatIp当前状态不正确。
400DependencyViolation.NatIpCidrThe specified resource of %s depends on %s, so the operation cannot be completed.NAT有依赖的NAT IP CIDR,所以此操作不能进行
400IncorrectStatus.NatGatewayThe NatGateway instance is being deleted and needs to wait until the process is complete.NAT网关实例正在被删除,无法重复删除,需要等待删除过程完成。
400IncorrectStatus.RouterEntryThe status of %s [%s] is incorrect.RouterEntry当前状态不正确。
400IncorrectStatus.VSwitchThe specified vSwitch status is invalid.虚拟交换机状态异常。
404INSTANCE_NOT_EXISTSInstance not exists.-
404InvalidRegionId.NotFoundThe specified RegionId does not exist in our records.指定的RegionId不存在。
404InvalidNatGatewayId.NotFoundThe specified NatGatewayId does not exist in our records.指定的 NatGatewayId 不存在,请您检查填写的 NatGatewayId 是否正确。
404IncorrectStatus.NatGateway%s-
404ResourceNotFound.NatGatewayThe specified resource of %s is not found.-

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
2024-01-18OpenAPI 错误码发生变更看变更集
变更项变更内容
错误码OpenAPI 错误码发生变更
    错误码 400 变更
    删除错误码:404
2023-12-20OpenAPI 错误码发生变更看变更集
变更项变更内容
错误码OpenAPI 错误码发生变更
    错误码 400 变更
    删除错误码:404
2023-07-24OpenAPI 描述信息更新、OpenAPI 错误码发生变更看变更集
变更项变更内容
API 描述OpenAPI 描述信息更新
错误码OpenAPI 错误码发生变更
    删除错误码:400
    删除错误码:404