hostname_routes
Creates, updates, deletes, gets or lists a hostname_routes resource.
Overview
| Name | hostname_routes |
| Type | Resource |
| Id | cloudflare.zero_trust.hostname_routes |
Fields
The following fields are returned by SELECT queries:
- get
- list
Get hostname route response
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | The hostname route ID. (example: f70ff985-a4ef-4643-bbbc-4a0ed4fc8415) |
tunnel_id | string (uuid) | UUID of the tunnel. (example: f70ff985-a4ef-4643-bbbc-4a0ed4fc8415) |
tunnel_name | string | A user-friendly name for a tunnel. (example: api-tunnel) |
comment | string | An optional description of the hostname route. (example: example comment) |
created_at | string (date-time) | Timestamp of when the resource was created. (example: 2021-01-25T18:22:34.317854Z) |
deleted_at | string (date-time) | Timestamp of when the resource was deleted. If null, the resource has not been deleted. (example: 2009-11-10T23:00:00.000000Z) |
hostname | string | The hostname of the route. (example: office-1.local) |
List hostname routes response
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | The hostname route ID. (example: f70ff985-a4ef-4643-bbbc-4a0ed4fc8415) |
tunnel_id | string (uuid) | UUID of the tunnel. (example: f70ff985-a4ef-4643-bbbc-4a0ed4fc8415) |
tunnel_name | string | A user-friendly name for a tunnel. (example: api-tunnel) |
comment | string | An optional description of the hostname route. (example: example comment) |
created_at | string (date-time) | Timestamp of when the resource was created. (example: 2021-01-25T18:22:34.317854Z) |
deleted_at | string (date-time) | Timestamp of when the resource was deleted. If null, the resource has not been deleted. (example: 2009-11-10T23:00:00.000000Z) |
hostname | string | The hostname of the route. (example: office-1.local) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | account_id, hostname_route_id | Get a hostname route. | |
list | select | account_id | id, hostname, tunnel_id, comment, existed_at, is_deleted, per_page, page | Lists and filters hostname routes in an account. |
create | insert | account_id | Create a hostname route. | |
edit | update | account_id, hostname_route_id | Updates a hostname route. | |
delete | delete | account_id, hostname_route_id | Delete 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.
| Name | Datatype | Description |
|---|---|---|
account_id | string | The Cloudflare account ID. |
hostname_route_id | string (uuid) | |
comment | string | |
existed_at | string (url-encoded-date-time) | |
hostname | string | If set, only list hostname routes that contain a substring of the given value, the filter is case-insensitive. |
id | string (uuid) | |
is_deleted | boolean | |
page | number | |
per_page | number | |
tunnel_id | string (uuid) | If set, only list hostname routes that point to a specific tunnel. |
SELECT examples
- get
- list
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
;
Lists and filters hostname routes in an account.
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 id = '{{ id }}'
AND hostname = '{{ hostname }}'
AND tunnel_id = '{{ tunnel_id }}'
AND comment = '{{ comment }}'
AND existed_at = '{{ existed_at }}'
AND is_deleted = '{{ is_deleted }}'
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;
INSERT examples
- create
- Manifest
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
;
# Description fields are for documentation purposes
- name: hostname_routes
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the hostname_routes resource.
- name: comment
value: "{{ comment }}"
description: |
An optional description of the hostname route.
- name: hostname
value: "{{ hostname }}"
description: |
The hostname of the route.
- name: tunnel_id
value: "{{ tunnel_id }}"
description: |
UUID of the tunnel.
UPDATE examples
- edit
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
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
;