Associating Subnets with a Route Table¶
Function¶
This API is used to associate a subnet with a route table.
If a subnet has already been associated with route table A, you can associate the subnet with route table B directly without disassociating it from route table A first.
URI¶
POST /v1/{project_id}/routetables/{routetable_id}/action
Table 1 describes the parameters.
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Specifies the project ID. |
routetable_id | Yes | String | Specifies the route table ID, which uniquely identifies a route table. |
Request Parameters¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
routetable | Yes | routetable object | Specifies the route table. For details, see Table 3. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
subnets | Yes | subnet object |
|
Parameter | Mandatory | Type | Description |
---|---|---|---|
associate | No | Array of strings | Specifies a list of IDs of the subnets to be associated with the route table. |
disassociate | No | Array of strings | Specifies a list of IDs of the subnets to be disassociated from the route table. |
Example Request¶
Associate route table 3d42a0d4-a980-4613-ae76-a2cddecff054 with subnet 1a8b8c98-3976-401b-a735-8b058109268c.
POST https://{Endpoint}/v1/6fbe9263116a4b68818cf1edce16bc4f/routetables/3d42a0d4-a980-4613-ae76-a2cddecff054/action { "routetable": { "subnets": { "associate": [ "1a8b8c98-3976-401b-a735-8b058109268c" ] } } }
Response Parameters¶
Parameter | Type | Description |
---|---|---|
routetable | routetable object | Specifies the route table. For details, see Table 6. |
Parameter | Type | Description |
---|---|---|
id | String |
|
name | String |
|
default | Boolean |
|
routes | Array of route objects |
|
subnets | Array of subnet objects |
|
tenant_id | String |
|
vpc_id | String |
|
description | String |
|
Parameter | Type | Description |
---|---|---|
type | String |
|
destination | String |
|
nexthop | String |
|
description | String |
|
Parameter | Type | Description |
---|---|---|
id | String | Specifies the ID of the subnet associated with the route table. |
Example Response¶
{
"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"
}
}
Status Code¶
See Status Codes.
Error Code¶
See Error Codes.