Skip to main content

peerings

Creates, updates, deletes, gets or lists a peerings resource.

Overview

Namepeerings
TypeResource
Iddigitalocean.vpcs.peerings

Fields

The following fields are returned by SELECT queries:

The response will be a JSON object with a key called peerings. This will be set to an array of objects, each of which will contain the standard attributes associated with a VPC peering.

NameDatatypeDescription
idstring (uuid)A unique ID that can be used to identify and reference the VPC peering. (example: 5a4981aa-9653-4bd1-bef5-d6bff52042e4)
namestringThe name of the VPC peering. Must be unique within the team and may only contain alphanumeric characters and dashes. (pattern: ^[a-zA-Z0-9-]+$, example: nyc1-blr1-peering)
created_atstring (date-time)A time value given in ISO8601 combined date and time format. (example: 2020-03-13T19:20:47.442049222Z)
statusstringThe current status of the VPC peering. (example: ACTIVE)
vpc_idsarrayAn array of the two peered VPCs IDs.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
vpcs_list_peeringsselectvpc_idper_page, pageTo list all of a VPC's peerings, send a GET request to
/v2/vpcs/$VPC_ID/peerings.
vpcs_create_peeringsinsertvpc_id, data__name, data__vpc_idTo create a new VPC peering for a given VPC, send a POST request to
/v2/vpcs/$VPC_ID/peerings.
vpcs_patch_peeringsupdatevpc_id, vpc_peering_id, data__nameTo update the name of a VPC peering in a particular VPC, send a PATCH request
to /v2/vpcs/$VPC_ID/peerings/$VPC_PEERING_ID with the new name in the
request body.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
vpc_idstring (uuid)A unique identifier for a VPC. (example: 4de7ac8b-495b-4884-9a69-1050c6793cd6)
vpc_peering_idstring (uuid)A unique identifier for a VPC peering. (example: 5a4981aa-9653-4bd1-bef5-d6bff52042e4)
pageintegerWhich 'page' of paginated results to return. (example: 1)
per_pageintegerNumber of items returned per page (example: 2)

SELECT examples

To list all of a VPC's peerings, send a GET request to
/v2/vpcs/$VPC_ID/peerings.

SELECT
id,
name,
created_at,
status,
vpc_ids
FROM digitalocean.vpcs.peerings
WHERE vpc_id = '{{ vpc_id }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}';

INSERT examples

To create a new VPC peering for a given VPC, send a POST request to
/v2/vpcs/$VPC_ID/peerings.

INSERT INTO digitalocean.vpcs.peerings (
data__name,
data__vpc_id,
vpc_id
)
SELECT
'{{ name }}' --required,
'{{ vpc_id }}' --required,
'{{ vpc_id }}'
RETURNING
peering
;

UPDATE examples

To update the name of a VPC peering in a particular VPC, send a PATCH request
to /v2/vpcs/$VPC_ID/peerings/$VPC_PEERING_ID with the new name in the
request body.

UPDATE digitalocean.vpcs.peerings
SET
data__name = '{{ name }}'
WHERE
vpc_id = '{{ vpc_id }}' --required
AND vpc_peering_id = '{{ vpc_peering_id }}' --required
AND data__name = '{{ name }}' --required
RETURNING
peering;