You need to enable JavaScript to run this app.
导航

CreateRouteEntry

最近更新时间2024.04.22 14:38:11

首次发布时间2021.07.29 14:11:54

调用 CreateRouteEntry 接口,为路由表添加一条自定义路由条目。

调用说明

单个路由表默认最多可创建的自定义路由条目数量为200条。若默认配额无法满足需求,请前往 配额中心 提升相应配额。

调试

请求参数

参数名称
类型
是否必选
示例值
描述
ActionStringCreateRouteEntry要执行的操作,取值:CreateRouteEntry。
VersionString2020-04-01API版本信息,取值为:2020-04-01。

RouteTableId

String

vtb-2fdzao4h726f45oxruw******

路由表ID。
您可以调用 DescribeRouteTableList 接口,查询路由表的ID。

RouteEntryName

String

route-entry-1

路由条目名称。

  • 需要以字母、中文或数字开头,可包含点号(.)、下划线(_)和短横线(-)。
  • 长度限制为1 ~ 128个字符
  • 不填默认空字符串。

Description

String

This is first route entry

路由条目描述。

  • 需要以字母、中文或数字开头。可包含英文逗号(,)、点号(.)、下划线(_)、空格( )、等号(=)、短横线(-)、中文逗号(,)、中文句号(。)。
  • 长度限制为 0~ 255个字符。
  • 不填默认空字符串。
NextHopNameStringeni-01路由条目下一跳资源的名称。

NextHopType

String

NetworkInterface

自定义路由条目的下一跳的类型。取值如下:

  • Instance:ECS实例。
  • HaVip:高可用虚拟IP。
  • NetworkInterface:辅助网卡。
  • NatGW:NAT网关。
  • VpnGW:VPN网关。
  • TransitRouter:中转路由器。
  • IPv6GW:IPv6网关。
  • CloudConnector:云连接器。

说明

云连接器、高可用虚拟IP、IPv6网关正在邀测中,如需试用,请联系客户经理。

NextHopIdstringeni-2fdzbqxfwrt345oxru******下一跳资源ID。
请根据下一跳类型,传入正确的资源ID。

DestinationCidrBlock

String

8.XX.XX.8/32

路由条目的目标网段。

说明

  • NextHopType配置为“IPv6GW”时,该参数只能配置为::/0。
  • DestinationCidrBlockDestinationPrefixListId两个参数必须且只能传入一个。

DestinationPrefixListId

String

前缀列表的ID。
您可以调用 DescribePrefixLists 接口,查询前缀列表的ID。

说明

  • DestinationCidrBlockDestinationPrefixListId两个参数必须且只能传入一个。
  • 前缀列表正在邀测中,如需试用,请联系客户经理。

ClientToken

String

123e4567-e89b-12d3-a456-42665544****

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

  • 由客户端自动生成一个参数值,确保不同请求间该参数值唯一,避免当调用API超时或服务器内部错误时,客户端多次重试导致重复性操作。
  • 仅支持ASCII字符,且不能超过64个字符。
  • 若不传入ClientToken,则此次API调用不进行幂等校验。

返回数据

参数名称
类型
示例值
描述
RouteEntryIdStringrte-3tj9gw2pwq3vj0******新添加路由条目的ID。
RequestIdString2021062415303301022514515207C4****请求ID。

请求示例

GET /?Action=CreateRouteEntry&Version=2020-04-01&RouteTableId=vtb-2fdzao4h726f45oxruw******&DestinationCidrBlock=8.XX.XX.8/32&NextHopType=NetworkInterface&NextHopId=eni-2fdzbqxfwrt345oxru******&RouteEntryName=RouteEntry_1 HTTP/1.1
Host: open.volcengineapi.com
Service: vpc
Region: cn-beijing

返回示例

{
    "ResponseMetadata": {
        "RequestId": "2021062415303301022514515207C4****",
        "Action": "CreateRouteEntry",
        "Version": "2020-04-01",
        "Service": "vpc",
        "Region": "cn-beijing"
    },
    "Result": {
        "RequestId": "2021062415303301022514515207C4****",
        "RouteEntryId": "rte-3tj9gw2pwq3vj0******"
    }
}

错误码

此处仅展示当前API的错误码,更多错误码请参见公共错误码

HttpCode
错误码
错误信息
描述
400IdempotentParameterMismatchArguments on this idempotent request are inconsistent with arguments used in previous request(s).此幂等请求的参数与前一个请求中使用的参数不一致。
400InvalidCidr.MalformedThe specified cidr block is malformed.指定的网段格式不合法。
400InvalidDescription.MalformedThe specified description is malformed.指定的描述格式不合法。请修复描述格式后重试。
400InvalidDescription.MalformedThe specified description is malformed. Ensure the maximum length of description is 255.指定的描述格式不合法。描述长度不能超过255个字符。
400InvalidName.MalformedThe specified name is malformed. Ensure the maximum length of name is 128.指定的名称格式不合法。名称长度不能超过128个字符。
400InvalidName.MalformedThe specified name is malformed.指定的名称格式不合法。请修复名称格式后重试。
400InvalidParameter.ClientTokenMalformedThe specified parameter ClientToken is malformed.指定的参数ClientToken格式不合法,长度不能超过64个ASCII字符。
400InvalidParameter.IpVersionThe specified IP version is not supported.指定的IP地址类型不支持。
400InvalidPrefixList.InvalidStatusThe specified prefix list is not in the correct status for the request.指定的前缀列表所处状态无法响应该请求。
400InvalidPrefixListAssociation.InUseThe specified prefix list is already associated with the same resource.指定的前缀列表已经被同一资源引用。
400InvalidRouteCidr.MalformedThe specified CIDR is malformed.指定的网段不合法。
400InvalidRouteCidr.UnsupportedCidrThe specified CIDR is not supported, you can change the CIDR to ::/0.不支持指定的CIDR地址块,你可以切换为::/0后重试。
400InvalidRouteEntry.VpcMismatchThe specified route table and next hop instance are in different VPCs.指定的路由表和下一跳实例不在同一个VPC。
400InvalidRouteNextHop.MalformedThe specified next hop is malformed. Next hop not support IPv6.指定的下一跳不支持IPv6功能。
400InvalidRouteNextHop.MalformedThe specified next hop is malformed.指定的下一跳不合法。
400InvalidVpc.EnableIpv6Operation failed because IPv6 is not enabled for the VPC.指定的VPC尚未开启IPv6。
400InvalidVpc.InvalidStatusThe specified VPC is not in the correct status for the request.指定的VPC所处状态无法响应该请求。
400QuotaExceeded.PrefixListAssociationThe number of resources a prefix list can be referenced by exceeded quota.前缀列表绑定的资源数量超过配额限制。
400QuotaExceeded.RouteEntryRoute entry with HaVip of a vpc number exceeded quota.已达到目的地址指向指定高可用虚拟IP的路由条目的数量上限。
400QuotaExceeded.RouteEntryRoute entry of a route table number exceeded quota.已达到可创建路由条目的数量上限。
403ForbiddenYou are not authorized to access the prefix list.您无权限访问前缀列表。
404InvalidPrefixList.NotFoundThe specified prefix list does not exist.指定的前缀列表不存在。
404InvalidRouteNextHop.NotFoundThe specified next hop does not exist.指定的下一跳不存在。
404InvalidRouteTable.NotFoundThe specified route table does not exist.指定的路由表不存在。
409InvalidRouteCidr.ConflictThe specified CIDR block conflicts with that of another subnet in your VPC.指定的CIDR地址块与所属VPC中另一个子网的CIDR地址块冲突。
409InvalidRouteCidr.ConflictThe specified CIDR block conflicts with that of another route in your route table.指定的CIDR地址块与所属路由表中另一个规则CIDR地址块冲突。
412IdempotentProcessingThe request uses the same client token as a previous one that is still in process.幂等请求处理中。