调用CreateIpv4Gateway接口创建IPv4网关。

使用说明

  • CreateIpv4Gateway接口属于异步接口,即系统返回一个实例ID,但该IPv4网关尚未创建成功,系统后台的创建任务仍在进行。您可以调用GetIpv4GatewayAttribute查询IPv4网关的创建状态:
    • 当IPv4网关处于Creating状态时,表示IPv4网关正在创建中。
    • 当IPv4网关处于Created状态时,表示IPv4网关创建完成。
  • CreateIpv4Gateway接口不支持在同一个VPC下并发创建IPv4网关。

调试

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

请求参数

名称 类型 是否必选 示例值 描述
Action String CreateIpv4Gateway

系统规定参数。取值:CreateIpv4Gateway

Ipv4GatewayName String ipv4

创建的IPv4网关的名称。

名称长度为1~128个字符,不能以http://https://开头。

Ipv4GatewayDescription String test

创建的IPv4网关的描述信息。

描述长度为1~256个字符,不能以http://https://开头。

VpcId String vpc-5tss06uvoyps5xoya****

创建的IPv4网关所在VPC的ID。

一个VPC仅支持创建一个IPv4网关。

DryRun Boolean false

是否只预检此次请求。取值:

  • true:发送检查请求,不会创建IPv4网关。检查项包括是否填写了必需参数、请求格式、业务限制。如果检查不通过,则返回对应错误。如果检查通过,则返回错误码DryRunOperation
  • false(默认值):发送正常请求,通过检查后返回HTTP 2xx状态码并直接创建IPv4网关。
ClientToken String 123e4567-e89b-12d3-a456-426655440000

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

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

说明 若您未指定,则系统自动使用API请求的RequestId作为ClientToken标识。每次API请求的RequestId不一样。
RegionId String ap-southeast-6

创建IPv4网关的地域ID。

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

ResourceGroupId String rg-acfmxazb4ph6aiy****

资源组ID。

返回数据

名称 类型 示例值 描述
Ipv4GatewayId String ipv4gw-5tsnc6s4ogsedtp3k****

创建的IPv4网关的实例ID。

ResourceGroupId String rg-acfmxazb4ph6aiy****

资源组ID。

RequestId String F282742B-1BBB-5F63-A3AF-E92EC575A1A6

请求ID。

示例

请求示例

http(s)://[Endpoint]/?Action=CreateIpv4Gateway
&Ipv4GatewayName=ipv4
&Ipv4GatewayDescription=test
&VpcId=vpc-5tss06uvoyps5xoya****
&DryRun=false
&ClientToken=123e4567-e89b-12d3-a456-426655440000
&RegionId=ap-southeast-6
&ResourceGroupId=rg-acfmxazb4ph6aiy****
&公共请求参数

正常返回示例

XML格式

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

<CreateIpv4GatewayResponse>
    <Ipv4GatewayId>ipv4gw-5tsnc6s4ogsedtp3k****</Ipv4GatewayId>
    <ResourceGroupId>rg-acfmxazb4ph6aiy****</ResourceGroupId>
    <RequestId>F282742B-1BBB-5F63-A3AF-E92EC575A1A6</RequestId>
</CreateIpv4GatewayResponse>

JSON格式

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

{
  "Ipv4GatewayId" : "ipv4gw-5tsnc6s4ogsedtp3k****",
  "ResourceGroupId" : "rg-acfmxazb4ph6aiy****",
  "RequestId" : "F282742B-1BBB-5F63-A3AF-E92EC575A1A6"
}

错误码

HttpCode 错误码 错误信息 描述
400 OperationDenied.ExistDirectEip The operation is not allowed because of existing direct eip. 不允许创建ipv4网关,因为存在直通eip
400 UnsupportedRegion The feature of ipv4Gateway is not supported in the region. 该地域不支持ipv4网关
400 OperationDenied.SubnetRouteV1Exist The operation is not allowed because of existing subnetRouteV1. 操作不允许,该VPC下子网路由不符合规格
400 OperationDenied.NormalNatExist The operation is not allowed because of existing normalNat. 操作不允许,该VPC下存在普通型NAT网关
400 UnsupportedFeature.Ipv4Gateway The feature of ipv4Gateway is not supported for [%s]. 创建ipv4网关失败,因为不支持ipv4网关特性
400 OperationDenied.DirectEipExist The operation is not allowed because of existing directEip. 操作不允许,该VPC下存在直通EIP或增强型NAT网关
400 OperationFailed.VpcNotExist The operation is failed because of vpc is not found. 操作失败,未找到vpc

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