更新时间:2023-11-02 GMT+08:00

查询路由表

功能介绍

查询路由表详情。

URI

GET /v1/{project_id}/routetables/{routetable_id}

参数说明请参见表1

表1 参数说明

名称

是否必选

参数类型

说明

project_id

String

项目ID,请参见获取项目ID

routetable_id

String

路由表ID,路由表唯一标识

请求参数

请求示例

GET https://{Endpoint}/v1/26ae5181a416420998eb2093aaed84d9/routetables/66df8c1f-d4f6-4a63-9abb-09701fe27b39

响应参数

表2 响应参数

名称

参数类型

说明

routetable

routetable object

路由表对象,参见表3

表3 routetable字段说明

名称

参数类型

说明

id

String

  • 功能说明:路由表唯一标识
  • 取值范围:标准UUID

name

String

  • 功能说明:路由表名称
  • 取值范围:0-64个字符,支持数字、字母、中文、_(下划线)、-(中划线)、.(点)

default

Boolean

  • 功能说明:是否为默认路由表
  • 取值范围:true表示默认路由表;false表示自定义路由表

routes

Array of route objects

  • 功能说明:路由对象列表,参见表4
  • 约束:每个路由表最大关联200条路由

subnets

Array of subnet objects

  • 功能说明:路由表所关联的子网,参见表5
  • 约束:只能关联路由表所属VPC下的子网

tenant_id

String

  • 功能说明:项目ID

vpc_id

String

  • 功能说明:路由表所属VPC的ID

description

String

  • 路由表的描述信息
  • 取值范围:0-255个字符,不能包含“<”和“>”

created_at

String

  • 功能说明:资源创建时间,UTC时间
  • 格式:yyyy-MM-ddTHH:mm:ss

updated_at

String

  • 功能说明:资源更新时间,UTC时间
  • 格式:yyyy-MM-ddTHH:mm:ss
表4 route字段说明

名称

参数类型

说明

type

String

  • 功能说明:路由的类型
  • 取值范围:
    • ecs:弹性云服务器
    • eni:网卡
    • vip:虚拟IP
    • nat:NAT网关
    • peering:对等连接
    • vpn:虚拟专用网络
    • dc:云专线
    • cc:云连接
    • egw:VPC终端节点
    • er:企业路由器

destination

String

  • 功能说明:路由目的网段
  • 约束:合法的CIDR格式

nexthop

String

  • 功能说明:路由下一跳对象的ID
  • 取值范围:
    • 当type为ecs时,传入ecs实例ID
    • 当type为eni时,取值为从网卡ID
    • 当type为vip时,取值为vip对应的IP地址
    • 当type为nat时,取值为nat实例对应的ID
    • 当type为peering时,取值为peering对应实例ID
    • 当type为vpn时,取值为vpn实例ID
    • 当type为dc时,取值为dc实例ID
    • 当type为cc时,取值为cc的实例ID
    • 当type为egw时,取值为vpc终端节点的实例ID
    • 当type为er时,取值为企业路由器的实例ID

description

String

  • 功能说明:路由的描述信息
  • 取值范围:0-255个字符,不能包含“<”和“>”
表5 subnet字段说明

名称

参数类型

说明

id

String

路由表关联的子网ID

响应示例

{
 "routetable": {
  "id": "05250d7e-0396-4fc9-9c9c-e4d5594784e4",
  "name": "rtb-vpc-l2cg-1",
  "routes": [
   {
    "type": "local",
    "destination": "192.168.4.0/24",
    "nexthop": "-"
   },
   {
    "type": "local",
    "destination": "192.168.1.0/24",
    "nexthop": "-"
   },
   {
    "type": "local",
    "destination": "198.19.128.0/20",
    "nexthop": "-"
   },
   {
    "type": "local",
    "destination": "127.0.0.0/8",
    "nexthop": "-"
   },
   {
    "type": "local",
    "destination": "100.64.0.0/10",
    "nexthop": "-"
   }
  ],
  "subnets": [
   {
    "id": "0e0faa8f-ea73-47aa-b919-8c133e98d5ac"
   },
   {
    "id": "e007e005-10aa-4614-b439-c9a14e55130e"
   }
  ],
  "vpc_id": "7978e43c-f892-49d8-9fab-9bb90a51709b",
  "default": true,
  "tenant_id": "05e369f07a800f802f41c002632ba5f9",
  "created_at": "2022-12-15T02:56:40",
  "updated_at": "2022-12-15T02:56:40"
 }
}

状态码

请参见状态码

错误码

请参考错误码