路由表

1. CreateRouteTable

接口方法:POST

请求示例:

https://open.cn-east-1.163yun.com/vpc?Version=2017-11-30&Action=CreateRouteTable
-d'{
    "VpcId": "a007fc18-2b71-4aa7-b50f-c1becbdf1e7a",
    "Name": "myroutetable"
}'

url 参数:

参数是否必选说明
VersionAPI 版本号
ActionCreateRouteTable,新建路由表

body 参数:

参数是否必选说明
VpcIdVPC uuid, 可在控制台 "VPC详细信息" 中查看。
Name路由表名称

响应示例:

{
    "RouteTable": {
        "Description": null,
        "Id": "9baf4944-4a83-4533-9025-4941a8c5e64f",
        "VpcId": "a007fc18-2b71-4aa7-b50f-c1becbdf1e7a",
        "Name": "myroutetable",
        "AttachedSubnetIds": [],
        "RouteTableType": "User",
        "CreateAt": "2018-10-23T05:58:26Z",
        "UpdateAt": "2018-10-23T05:58:26Z"
    },
    "RequestId": "b50d2f92-114e-441f-ad0f-b26d3b36f480"
}

常见错误

网络和租户不匹配
{
    "Code": "InvalidParameterValue",
    "Message": "Network does not exist",
    "RequestId": "961e1bd0-50cb-499f-a488-1b31f5fe6349",
    "Result": ""
}

名字无效:

{
    "Code": "InvalidParameterValue",
    "Message": "Name is invalid",
    "RequestId": "be07b796-e87b-4a51-8ef0-591b2932f802",
    "Result": ""
}

方法走错:

{
    "Code": "MethodNotAllow",
    "Message": "Request method not supported",
    "RequestId": "f9bf1785-a051-4531-977c-040679ccdcbc",
    "Result": ""
}

2. DeleteRouteTable

接口方法:GET

请求示例:

https://open.cn-east-1.163yun.com/vpc?Version=2017-11-30&Action=DeleteRouteTable&Id=9baf4944-4a83-4533-9025-4941a8c5e64f

url 参数

参数是否必选说明
VersionAPI 版本号
ActionDeleteRouteTable,删除路由表
Id路由表的Id

响应示例

{
    "RouteTable": {
        "Description": null,
        "Id": "9baf4944-4a83-4533-9025-4941a8c5e64f",
        "VpcId": "a007fc18-2b71-4aa7-b50f-c1becbdf1e7a",
        "Name": "myroutetable",
        "AttachedSubnetIds": [],
        "RouteTableType": "User",
        "CreateAt": "2018-10-23T05:58:26Z",
        "UpdateAt": "2018-10-23T05:58:26Z"
    },
    "RequestId": "cbed7604-a110-4606-8f0c-73e0c1b209b7"
}

常见错误:

默认路由表不能删除

{
    "Code": "InvalidParameterValue",
    "Message": "Route table is default and can not be operated",
    "RequestId": "57dffb91-fa38-46be-9a92-da0d9b21601e",
    "Result": ""
}

有关联子网的路由表不能删除
{
    "Code": "InvalidParameterValue",
    "Message": "RouteTable has attached subnet and can not be deleted",
    "RequestId": "aee1ad0d-daf0-4bc1-bd24-8478a90b56d0",
    "Result": ""
}

3. GetRouteTable

接口方法:GET

请求示例:

https://open.cn-east-1.163yun.com/vpc?Version=2017-11-30&Action=GetRouteTable&Id=6236f2a8-d125-436e-9670-10a7b69bb177

url 参数

参数是否必选说明
VersionAPI 版本号
ActionGetRouteTable,获取指定的路由表的详细信息
Id路由表 Id,可在控制台路由表的"详细信息"中查看

响应示例:

{
    "RouteTable": {
        "Description": null,
        "Id": "6236f2a8-d125-436e-9670-10a7b69bb177",
        "VpcId": "a007fc18-2b71-4aa7-b50f-c1becbdf1e7a",
        "Name": "main_route_table",
        "AttachedSubnetIds": [
            "0def8457-ce0d-4b4d-91d0-83d93ce9d110"
        ],
        "RouteTableType": "System",
        "CreateAt": "2018-08-02T02:27:05Z",
        "UpdateAt": "2018-08-02T02:27:05Z"
    },
    "RequestId": "9a064876-8181-462d-88e3-77b9b24f88f7"
}

常见错误:

缺少Id参数

{
    "Code": "MissingParameter",
    "Message": "Empty necessary param",
    "RequestId": "34b6dc4a-ddc8-4301-bb23-4b07d9f055e1",
    "Result": "Required String parameter 'Id' is not present"
}

路由表id与租户不匹配
{
    "Code": "InvalidParameterValue",
    "Message": "RouteTable is not found",
    "RequestId": "709ded72-e353-47de-914c-b0beb8f818ce",
    "Result": ""
}

4. ListRouteTable

接口方法:GET

请求示例:

https://open.cn-east-1.163yun.com/vpc?Version=2017-11-30&Action=ListRouteTable&VpcId=a007fc18-2b71-4aa7-b50f-c1becbdf1e7a

url 参数:

参数是否必选说明
VersionAPI 版本号
ActionListRouteTable,获取路由表列表
VpcId必选网络Id
Limit可选返回个数,不填默认20
Offset可选总偏移量,不填默认0
KeyWord可选搜索参数,可选,匹配范围为: routeTableId,routeTableName,description

响应示例:

{
    "Count": 1,
    "Offset": 0,
    "RequestId": "a99442eb-c016-45c5-a080-a0e6a5bc1afd",
    "RouteTables": [
        {
            "Description": null,
            "Id": "6236f2a8-d125-436e-9670-10a7b69bb177",
            "VpcId": "a007fc18-2b71-4aa7-b50f-c1becbdf1e7a",
            "Name": "main_route_table",
            "AttachedSubnetIds": [
                "0def8457-ce0d-4b4d-91d0-83d93ce9d110"
            ],
            "RouteTableType": "System",
            "CreateAt": "2018-08-02T02:27:05Z",
            "UpdateAt": "2018-08-02T02:27:05Z"
        }
    ],
    "Limit": 20
}

常见错误:

没有VpcId:
{
    "Code": "MissingParameter",
    "Message": "Empty necessary param",
    "RequestId": "be5915ae-5911-4c24-bbe1-995d657fcdd0",
    "Result": "Required String parameter 'VpcId' is not present"
}

VpcId和租户不匹配
{
    "Code": "InvalidParameterValue",
    "Message": "Network does not exist",
    "RequestId": "8d474222-6bb4-412d-8ccd-e19123f8e52c",
    "Result": ""
}

5. AttachSubnet

接口方法:POST

请求示例:

https://open.cn-east-1.163yun.com/vpc?Version=2017-11-30&Action=AttachSubnet
-d'{
    "SubnetId": "0def8457-ce0d-4b4d-91d0-83d93ce9d110",
    "RouteTableId": "6236f2a8-d125-436e-9670-10a7b69bb177"
}'

url 参数

参数是否必选说明
VersionAPI 版本号
ActionAttachSubnet,路由表和子网绑定

body 参数

参数是否必选说明
SubnetId子网 Id
RouteTableId路由表 Id

响应示例:

{
    "RouteTable": {
        "Description": null,
        "Id": "6236f2a8-d125-436e-9670-10a7b69bb177",
        "VpcId": "a007fc18-2b71-4aa7-b50f-c1becbdf1e7a",
        "Name": "main_route_table",
        "AttachedSubnetIds": [
            "0def8457-ce0d-4b4d-91d0-83d93ce9d110"
        ],
        "RouteTableType": "System",
        "CreateAt": "2018-08-02T02:27:05Z",
        "UpdateAt": "2018-08-02T02:27:05Z"
    },
    "RequestId": "3390ab8b-fa88-41c8-b5e9-66a134805cb7"
}

常见错误:

子网和租户不匹配
{
    "Code": "InvalidParameterValue",
    "Message": "Subnet id is invalid",
    "RequestId": "e069f6f2-01ca-4647-b0f1-430441b6caee",
    "Result": ""
}
路由表和租户不匹配
{
    "Code": "InvalidParameterValue",
    "Message": "RouteTableId is invalid",
    "RequestId": "eb9f5150-f4c5-4c96-a971-06c0bf2eafb4",
    "Result": ""
}
路由表和子网不在一个网络里
{
    "Code": "InvalidParameterValue",
    "Message": "SubnetId and RouteTableId do not belong to same network",
    "RequestId": "960f7aaf-7977-4538-bf88-c74271fb2f1a",
    "Result": ""
}