Creating a Route to the Local VPC

Function

This API is used to create a route to the local end of a VPC peering connection. The prerequisite for calling this API is that the VPC peering connection request has been accepted. For details, see Accepting a VPC Peering Connection Request.

URI

  • URI format

    POST /v1.0/{project_id}/reserved_cluster/{cluster_id}/peering/{peering_id}/route

  • Parameter description
    Table 1 URI parameter description

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

    cluster_id

    Yes

    Cluster ID.

    peering_id

    Yes

    ID of the VPC peering connection.

Request

  • Example request
    {
      "destination": "192.168.0.0/16"
    }
  • Parameter description
    Table 2 Request parameter

    Parameter

    Mandatory

    Type

    Description

    destination

    Yes

    String

    Destination address in the CIDR notation format, which is generally the CIDR of the peer VPC.

Response

  • Example response
    {  
       "route":{  
          "type":"peering",
          "nexthop":"7e974044-bcc1-4f25-aff8-5f10cb347b0f",
          "destination":"192.168.0.0/16",
          "vpc_id":"83081290-198e-48e2-8e2d-64c50023d136",
          "tenant_id":"8185f87d043f4519a68420a282b5e2fa",
          "id":"75d289f7-9022-4950-a137-fed7aeae9cb1"
       }
    }
  • Parameter description
    Table 3 Response parameters

    Parameter

    Mandatory

    Type

    Description

    type

    Yes

    String

    Route type. Generally, this parameter is set to peering.

    nexthop

    Yes

    String

    Next hop address of a route. Generally, this parameter is set to the ID of the VPC peering connection.

    destination

    Yes

    String

    Destination address in the CIDR notation format.

    vpc_id

    Yes

    String

    ID of the VPC for which a route is to be added.

    tenant_id

    Yes

    String

    ID of the tenant who requests to add a route.

    id

    Yes

    String

    ID of a route.

Status Code

Table 4 Status code

Status Code

Description

201

A route is created successfully.

400

The input parameter is invalid.

500

Failed to complete the request because of an internal service error.

Error Code

For details, see Error Codes.