Skip to main content

hostname_routes

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

Overview

Namehostname_routes
TypeResource
Idcloudflare.zero_trust.hostname_routes

Fields

The following fields are returned by SELECT queries:

Get hostname route response

NameDatatypeDescription
idstring (uuid)The hostname route ID. (example: f70ff985-a4ef-4643-bbbc-4a0ed4fc8415)
tunnel_idstring (uuid)UUID of the tunnel. (example: f70ff985-a4ef-4643-bbbc-4a0ed4fc8415)
tunnel_namestringA user-friendly name for a tunnel. (example: api-tunnel)
commentstringAn optional description of the hostname route. (example: example comment)
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)
hostnamestringThe hostname of the route. (example: office-1.local)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectaccount_id, hostname_route_idGet a hostname route.
listselectaccount_idid, hostname, tunnel_id, comment, existed_at, is_deleted, per_page, pageLists and filters hostname routes in an account.
createinsertaccount_idCreate a hostname route.
editupdateaccount_id, hostname_route_idUpdates a hostname route.
deletedeleteaccount_id, hostname_route_idDelete a hostname route.

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.
hostname_route_idstring (uuid)
commentstring
existed_atstring (url-encoded-date-time)
hostnamestringIf set, only list hostname routes that contain a substring of the given value, the filter is case-insensitive.
idstring (uuid)
is_deletedboolean
pagenumber
per_pagenumber
tunnel_idstring (uuid)If set, only list hostname routes that point to a specific tunnel.

SELECT examples

Get a hostname route.

SELECT
id,
tunnel_id,
tunnel_name,
comment,
created_at,
deleted_at,
hostname
FROM cloudflare.zero_trust.hostname_routes
WHERE account_id = '{{ account_id }}' -- required
AND hostname_route_id = '{{ hostname_route_id }}' -- required
;

INSERT examples

Create a hostname route.

INSERT INTO cloudflare.zero_trust.hostname_routes (
comment,
hostname,
tunnel_id,
account_id
)
SELECT
'{{ comment }}',
'{{ hostname }}',
'{{ tunnel_id }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

UPDATE examples

Updates a hostname route.

UPDATE cloudflare.zero_trust.hostname_routes
SET
comment = '{{ comment }}',
hostname = '{{ hostname }}',
tunnel_id = '{{ tunnel_id }}'
WHERE
account_id = '{{ account_id }}' --required
AND hostname_route_id = '{{ hostname_route_id }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Delete a hostname route.

DELETE FROM cloudflare.zero_trust.hostname_routes
WHERE account_id = '{{ account_id }}' --required
AND hostname_route_id = '{{ hostname_route_id }}' --required
;