创建路由表 - CreateRouteTable
功能介绍
创建路由表。
约束与限制:
- 自定义路由表的目的网段,不能被包含在local类型路由的网段内
- 同一个路由表,路由的目的网段不能相同
- 一次下发的路由条目数,不能超过5条
调试
您可以在API Explorer中调试该接口。
授权信息
账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权,具体权限要求请参见权限和授权项。
- 如果使用身份策略授权,需具备如下身份策略权限。
授权项
访问级别
资源类型(*为必须)
条件键
别名
依赖的授权项
vpc:routeTables:create
Write
routeTable *
-
-
-
vpc *
- g:EnterpriseProjectId
- g:ResourceTag/<tag-key>
- vpc:VpcId
请求参数
|
名称 |
是否必选 |
参数类型 |
说明 |
|---|---|---|---|
|
routetable |
是 |
routetable object |
路由表对象,参见表3。 |
|
名称 |
是否必选 |
参数类型 |
说明 |
|---|---|---|---|
|
name |
否 |
String |
|
|
routes |
否 |
Array of route objects |
|
|
vpc_id |
是 |
String |
|
|
description |
否 |
String |
|
|
名称 |
是否必选 |
参数类型 |
说明 |
|---|---|---|---|
|
type |
是 |
String |
|
|
destination |
是 |
String |
|
|
nexthop |
是 |
String |
|
|
description |
否 |
String |
|
请求示例
- 创建一个路由表,所在vpc id为60c809cb-6731-45d0-ace8-3bf5626421a9,命名为routetable-1234,包含一条ecs类型的路由。
POST https://{Endpoint}/v1/6fbe9263116a4b68818cf1edce16bc4f/routetables { "routetable": { "name": "routetable-1234", "vpc_id": "60c809cb-6731-45d0-ace8-3bf5626421a9", "routes":[ { "type": "ecs", "destination": "10.10.10.0/24", "nexthop":"7c50463d-d36c-4417-aa85-cc11fa10f341" } ], "description":"abc" } }
响应参数
|
名称 |
参数类型 |
说明 |
|---|---|---|
|
routetable |
routetable object |
路由表对象,参见表6。 |
|
名称 |
参数类型 |
说明 |
|---|---|---|
|
id |
String |
|
|
name |
String |
|
|
default |
Boolean |
|
|
routes |
Array of route objects |
|
|
subnets |
Array of subnet objects |
|
|
tenant_id |
String |
|
|
vpc_id |
String |
|
|
description |
String |
|
|
created_at |
String |
|
|
updated_at |
String |
|
|
名称 |
参数类型 |
说明 |
|---|---|---|
|
type |
String |
|
|
destination |
String |
|
|
nexthop |
String |
|
|
description |
String |
|
响应示例
{
"routetable": {
"id": "3d42a0d4-a980-4613-ae76-a2cddecff054",
"vpc_id": "ab78be2d-782f-42a5-aa72-35879f6890ff",
"description": "abc",
"routes": [
{
"type": "ecs",
"destination": "10.10.10.0/24",
"nexthop": "7c50463d-d36c-4417-aa85-cc11fa10f341",
"description": "abc"
}
],
"subnets": [
{
"id": "8d4ce32f-d68a-4c4c-9f18-c68d8a5c7f2f"
}
],
"tenant_id": "6fbe9263116a4b68818cf1edce16bc4f",
"created_at": "2022-12-15T02:56:40",
"updated_at": "2022-12-15T02:56:40"
}
}
状态码
请参见状态码。
错误码
请参考错误码。