Skip to main content

wireguard_peers

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

Overview​

Namewireguard_peers
TypeResource
Idovh.over_the_box.wireguard_peers

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
namestringWireguard peer name
peer_idstringWireguard peer id (wire: peerId)
activebooleanWireguard peer status
descriptionstringWireguard peer description
private_ipv_4string (ipv4-block)Wireguard peer private IP (example: 192.0.2.0/24) (wire: privateIpv4)
public_keystringWireguard peer public key (wire: publicKey)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectpeer_id, service_nameReturns a WireGuard peer with its name, description, public key, private IPv4 and whether it is active. (Beta version)
listselectservice_namex_pagination_modeReturns the IDs of the WireGuard peers configured on the OverTheBox service. (Beta version)
createinsertservice_name, description, name, private_ipv_4, public_keyAdds a WireGuard peer to the service from its name, description, public key and private IPv4. Returns the created peer. (Beta version)
updateupdatepeer_id, service_nameChanges the name, description, public key, private IPv4 or active status of a WireGuard peer. Returns the task that applies the change. (Beta version)
deletedeletepeer_id, service_nameRemoves the WireGuard peer from the service. Returns the task that performs the removal. (Beta version)

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
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
peer_idstringPeer ID (wire: peerId)
service_namestringService name (wire: serviceName)
x_pagination_modestringSent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode)

SELECT examples​

Returns a WireGuard peer with its name, description, public key, private IPv4 and whether it is active. (Beta version)

SELECT
name,
peer_id,
active,
description,
private_ipv_4,
public_key
FROM ovh.over_the_box.wireguard_peers
WHERE peer_id = '{{ peer_id }}' -- required
AND service_name = '{{ service_name }}' -- required
;

INSERT examples​

Adds a WireGuard peer to the service from its name, description, public key and private IPv4. Returns the created peer. (Beta version)

INSERT INTO ovh.over_the_box.wireguard_peers (
description,
name,
private_ipv_4,
public_key,
service_name
)
SELECT
'{{ description }}' /* required */,
'{{ name }}' /* required */,
'{{ private_ipv_4 }}' /* required */,
'{{ public_key }}' /* required */,
'{{ service_name }}'
RETURNING
name,
peer_id,
active,
description,
private_ipv_4,
public_key
;

UPDATE examples​

Changes the name, description, public key, private IPv4 or active status of a WireGuard peer. Returns the task that applies the change. (Beta version)

UPDATE ovh.over_the_box.wireguard_peers
SET
active = {{ active }},
description = '{{ description }}',
name = '{{ name }}',
private_ipv_4 = '{{ private_ipv_4 }}',
public_key = '{{ public_key }}'
WHERE
peer_id = '{{ peer_id }}' --required
AND service_name = '{{ service_name }}' --required
RETURNING
name,
task_id,
status;

DELETE examples​

Removes the WireGuard peer from the service. Returns the task that performs the removal. (Beta version)

DELETE FROM ovh.over_the_box.wireguard_peers
WHERE peer_id = '{{ peer_id }}' --required
AND service_name = '{{ service_name }}' --required
;