调用DeletionProtection设置实例删除保护功能。

API描述

为实例开启删除保护功能后,您将不能删除该实例。如需删除,请先关闭删除保护功能。

调试

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

请求参数

名称 类型 是否必选 示例值 描述
RegionId String cn-hangzhou

要设置删除保护功能的实例所在的地域ID。您可以调用DescribeRegions查看最新的阿里云地域列表。

ProtectionEnable Boolean true

是否开启删除保护功能,取值:

  • true:开启。
  • false:关闭。
Type String EIP

要设置删除保护功能的实例类型,取值:

  • EIP:弹性公网IP。
  • CBWP:共享带宽。
  • NATGW:NAT网关。
InstanceId String eip-uf6id7gvguruxe41v****

要设置删除保护功能的实例ID。

ClientToken String 123e4567-e89b-12d3-a456-426655440000

客户端Token,用于保证请求的幂等性。

从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken只支持ASCII字符。

说明 若您未指定,则系统自动使用API请求的 RequestId作为 ClientToken标识。每次API请求的 RequestId可能不一样。
Action String DeletionProtection

系统规定参数。取值:DeletionProtection

返回数据

名称 类型 示例值 描述
RequestId String BAAEF103-96C4-4454-9210-066F2405F511

请求ID。

示例

请求示例

http(s)://[Endpoint]/?RegionId=cn-hangzhou
&ProtectionEnable=true
&Type=EIP
&InstanceId=eip-uf6id7gvguruxe41v****
&ClientToken=123e4567-e89b-12d3-a456-426655440000	
&Action=DeletionProtection
&公共请求参数

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

<DeletionProtectionResponse>
    <RequestId>BAAEF103-96C4-4454-9210-066F2405F511</RequestId>
</DeletionProtectionResponse>

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "BAAEF103-96C4-4454-9210-066F2405F511"
}

错误码

HttpCode 错误码 错误信息 描述
400 DeletionProtection.ResourceNotExist The resource is not exist. 资源不存在
400 DeletionProtection.PrePaidNotSupport The prepaid resource is not support. 不支持预付费资源
400 DeletionProtection.TypeNotSupport The resource is not support. 不支持该类型资源
400 DeletionProtection.AlreadyEnabled The resource deletion protection is already enabled. 资源删除保护已启用
400 DeletionProtection.OwnerError The resource owner error. 您不是该资源的所有者,无法操作
404 InvalidAllocationId.NotFound Specified allocation ID is not found 指定的公网IP不存在,请您检查您填写的参数是否正确。
404 DeletionProtection.NotExist The resource deletion protection is not found 资源删除保护不存在

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