# Querying VPC Peering Connections

#### Function

This API is used to query all VPC peering connections accessible to the tenant submitting the request. The connections are filtered based on the filtering condition. For details about pagination query, see section Pagination.

#### URI

GET /v2.0/vpc/peerings

Example:

    GET https://{Endpoint}/v2.0/vpc/peerings?id={id}&name={name}&status={status}&tenant_id={tenant_id}&vpc_id={vpc_id}&limit={limit}&marker={marker}

Table 1 describes the parameters.

Table 1 Parameter description
Name | Mandatory | Type | Description
--- | --- | --- | ---
id | No | String | Specifies that the VPC peering connection ID is used as the filtering condition.

name

No

String

- Specifies that the peering connection name is used as the filter.
- The value can contain no more than 64 characters.

status | No | String | Specifies that the VPC peering connection status is used as the filtering condition.
tenant_id | No | String | Specifies that the tenant ID is used as the filtering condition.
vpc_id | No | String | Specifies that the VPC ID is used as the filtering condition.

marker

No

String

Specifies a resource ID for pagination query, indicating that the query starts from the next record of the specified resource ID.

This parameter can work together with the parameter limit.

- If parameters marker and limit are not passed, all resource records will be returned.
- If the parameter marker is not passed and the value of parameter limit is set to 10, the first 10 resource records will be returned.
- If the value of the parameter marker is set to the resource ID of the 10th record and the value of parameter limit is set to 10, the 11th to 20th resource records will be returned.
- If the value of the parameter marker is set to the resource ID of the 10th record and the parameter limit is not passed, resource records starting from the 11th records (including 11th) will be returned.

limit | No | Integer | Specifies the number of records that will be returned on each page. The value is from 0 to intmax. limit can be used together with marker. For details, see the parameter description of marker. The default value is 2000.

#### Request Message

- Request parameter

  None

- Example request

      GET https://{Endpoint}/v2.0/vpc/peerings

#### Response Message

- Response parameter

  Table 2 Response parameter
  Parameter | Type | Description
  --- | --- | ---
  peerings | Array of peering objects | Specifies the VPC peering connection object list. For details, see Table 3.
  peerings_links | Array of peerings_link objects | Specifies the VPC peering connection object list. For details, see Table 5. The value of rel will be next and that of href will be a link only when limit is used for filtering and the number of resources exceeds the value of limit or 2000 (default value of limit).

  Table 3 peering objects
  Attribute | Type | Description
  --- | --- | ---
  id | String | Specifies the VPC peering connection ID.
  name | String | Specifies the VPC peering connection name.

  status

  String

  Specifies the VPC peering connection status. Possible values are as follows:
  - PENDING_ACCEPTANCE
  - REJECTED
  - EXPIRED
  - DELETED
  - ACTIVE

  request_vpc_info | vpc_info object | Specifies information about the local VPC. For details, see Table 4.
  accept_vpc_info | vpc_info object | Specifies information about the peer VPC. For details, see Table 4.
  description | String | Provides supplementary information about the VPC peering connection.
  created_at | String | Specifies the time (UTC) when the VPC peering connection is created. Format: yyyy-MM-ddTHH:mm:ss
  updated_at | String | Specifies the time (UTC) when the VPC peering connection is updated. Format: yyyy-MM-ddTHH:mm:ss

  Table 4 vpc_info objects
  Attribute | Type | Description
  --- | --- | ---
  vpc_id | String | Specifies the ID of a VPC involved in a VPC peering connection.
  tenant_id | String | Specifies the ID of the project to which a VPC involved in the VPC peering connection belongs.

  Table 5 peerings_link object
  Name | Type | Description
  --- | --- | ---
  href | String | Specifies the API link.
  rel | String | Specifies the relationship between the API link and the API version.

- Example response

      {
          "peerings": [
              {
                  "request_vpc_info": {
                      "vpc_id": "9daeac7c-a98f-430f-8e38-67f9c044e299",
                      "tenant_id": "f65e9ebc-ed5d-418b-a931-9a723718ba4e"
                  },
                  "accept_vpc_info": {
                      "vpc_id": "f583c072-0bb8-4e19-afb2-afb7c1693be5",
                      "tenant_id": "f65e9ebc-ed5d-418b-a931-9a723718ba4e"
                  },
                  "name": "test",
                  "id": "b147a74b-39bb-4c7a-aed5-19cac4c2df13",
                  "status": "ACTIVE"
              }
          ]
      }

#### Status Code

See Status Codes.

#### Error Code

See Error Codes.

Parent topic: VPC Peering Connection