Skip to main content

routes

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

Overview

Nameroutes
TypeResource
Idcloudflare.zero_trust.routes

Fields

The following fields are returned by SELECT queries:

Get a tunnel route response

NameDatatypeDescription
idstringUUID of the route. (example: f70ff985-a4ef-4643-bbbc-4a0ed4fc8415)
tunnel_idstring (uuid)UUID of the tunnel. (example: f70ff985-a4ef-4643-bbbc-4a0ed4fc8415)
virtual_network_idstring (uuid)UUID of the virtual network. (example: f70ff985-a4ef-4643-bbbc-4a0ed4fc8415)
commentstringOptional remark describing the route. (default: , example: Example comment for this route.)
created_atstring (date-time)Timestamp of when the resource was created. (example: 2021-01-25T18:22:34.317854Z)
deleted_atstring (date-time)Timestamp of when the resource was deleted. If null, the resource has not been deleted. (example: 2009-11-10T23:00:00.000000Z)
networkstringThe private IPv4 or IPv6 range connected by the route, in CIDR notation. (example: 172.16.0.0/16)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectaccount_id, route_idGet a private network route in an account.
listselectaccount_idcomment, is_deleted, network_subset, network_superset, existed_at, tunnel_id, route_id, tun_types, virtual_network_id, per_page, pageLists and filters private network routes in an account.
createinsertaccount_id, network, tunnel_idRoutes a private network through a Cloudflare Tunnel.
editupdateroute_id, account_idUpdates an existing private network route in an account. The fields that are meant to be updated should be provided in the body of the request.
deletedeleteroute_id, account_idDeletes a private network route from an account.
create_by_accountexecip_network_encoded, account_id, tunnel_idRoutes a private network through a Cloudflare Tunnel. The CIDR in ip_network_encoded must be written in URL-encoded format.

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
account_idstringThe Cloudflare account ID.
ip_network_encodedstring
route_idstring
commentstring
existed_atstring (url-encoded-date-time)
is_deletedboolean
network_subsetstring
network_supersetstring
pagenumber
per_pagenumber
route_idstring
tun_typesarray
tunnel_idstring (uuid)
virtual_network_idstring (uuid)

SELECT examples

Get a private network route in an account.

SELECT
id,
tunnel_id,
virtual_network_id,
comment,
created_at,
deleted_at,
network
FROM cloudflare.zero_trust.routes
WHERE account_id = '{{ account_id }}' -- required
AND route_id = '{{ route_id }}' -- required
;

INSERT examples

Routes a private network through a Cloudflare Tunnel.

INSERT INTO cloudflare.zero_trust.routes (
comment,
network,
tunnel_id,
virtual_network_id,
account_id
)
SELECT
'{{ comment }}',
'{{ network }}' /* required */,
'{{ tunnel_id }}' /* required */,
'{{ virtual_network_id }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

UPDATE examples

Updates an existing private network route in an account. The fields that are meant to be updated should be provided in the body of the request.

UPDATE cloudflare.zero_trust.routes
SET
comment = '{{ comment }}',
network = '{{ network }}',
tunnel_id = '{{ tunnel_id }}',
virtual_network_id = '{{ virtual_network_id }}'
WHERE
route_id = '{{ route_id }}' --required
AND account_id = '{{ account_id }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Deletes a private network route from an account.

DELETE FROM cloudflare.zero_trust.routes
WHERE route_id = '{{ route_id }}' --required
AND account_id = '{{ account_id }}' --required
;

Lifecycle Methods

Routes a private network through a Cloudflare Tunnel. The CIDR in ip_network_encoded must be written in URL-encoded format.

EXEC cloudflare.zero_trust.routes.create_by_account
@ip_network_encoded='{{ ip_network_encoded }}' --required,
@account_id='{{ account_id }}' --required
@@json=
'{
"comment": "{{ comment }}",
"tunnel_id": "{{ tunnel_id }}",
"virtual_network_id": "{{ virtual_network_id }}"
}'
;