targets
Creates, updates, deletes, gets or lists a targets resource.
Overview
| Name | targets |
| Type | Resource |
| Id | cloudflare.zero_trust.targets |
Fields
The following fields are returned by SELECT queries:
- get
- list
Successfully retrieved the target
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Target identifier (title: target_id) |
created_at | string (date-time) | Date and time at which the target was created (example: 2019-08-24T14:15:22Z) |
hostname | string | A non-unique field that refers to a target (example: infra-access-target) |
ip | object | The IPv4/IPv6 address that identifies where to reach a target |
modified_at | string (date-time) | Date and time at which the target was modified (example: 2019-08-24T14:15:22Z) |
Successfully retrieved all targets in the account
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Target identifier (title: target_id) |
created_at | string (date-time) | Date and time at which the target was created (example: 2019-08-24T14:15:22Z) |
hostname | string | A non-unique field that refers to a target (example: infra-access-target) |
ip | object | The IPv4/IPv6 address that identifies where to reach a target |
modified_at | string (date-time) | Date and time at which the target was modified (example: 2019-08-24T14:15:22Z) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | account_id, target_id | ||
list | select | account_id | hostname, hostname_contains, virtual_network_id, ip_v4, ip_v6, created_before, created_after, modified_before, modified_after, ips, target_ids, ip_like, ipv4_start, ipv4_end, ipv6_start, ipv6_end, page, per_page, order, direction | Lists and sorts an account’s targets. Filters are optional and are ANDed together. |
update | replace | account_id, target_id, hostname, ip | ||
delete | delete | account_id, target_id | ||
bulk_delete | delete | account_id | Removes one or more targets. | |
batch | exec | account_id | Adds one or more targets. | |
batch_delete | exec | account_id, target_ids | Removes one or more targets. |
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. |
target_id | string (uuid) | |
created_after | string (date-time) | Date and time at which the target was created after (inclusive) |
created_before | string (date-time) | Date and time at which the target was created before (inclusive) |
direction | string | The sorting direction. |
hostname | string | Hostname of a target |
hostname_contains | string | Partial match to the hostname of a target |
ip_like | string | Filters for targets whose IP addresses look like the specified string. Supports * as a wildcard character |
ip_v4 | string | IPv4 address of the target |
ip_v6 | string | IPv6 address of the target |
ips | array | Filters for targets that have any of the following IP addresses. Specify ips multiple times in query parameter to build list of candidates. |
ipv4_end | string | Defines an IPv4 filter range's ending value (inclusive). Requires ipv4_start to be specified as well. |
ipv4_start | string | Defines an IPv4 filter range's starting value (inclusive). Requires ipv4_end to be specified as well. |
ipv6_end | string | Defines an IPv6 filter range's ending value (inclusive). Requires ipv6_start to be specified as well. |
ipv6_start | string | Defines an IPv6 filter range's starting value (inclusive). Requires ipv6_end to be specified as well. |
modified_after | string (date-time) | Date and time at which the target was modified after (inclusive) |
modified_before | string (date-time) | Date and time at which the target was modified before (inclusive) |
order | string | The field to sort by. |
page | integer (int32) | Current page in the response |
per_page | integer (int32) | Max amount of entries returned per page |
target_ids | array | Filters for targets that have any of the following UUIDs. Specify target_ids multiple times in query parameter to build list of candidates. |
virtual_network_id | string (uuid) | Private virtual network identifier of the target |
SELECT examples
- get
- list
Successfully retrieved the target
SELECT
id,
created_at,
hostname,
ip,
modified_at
FROM cloudflare.zero_trust.targets
WHERE account_id = '{{ account_id }}' -- required
AND target_id = '{{ target_id }}' -- required
;
Lists and sorts an account’s targets. Filters are optional and are ANDed together.
SELECT
id,
created_at,
hostname,
ip,
modified_at
FROM cloudflare.zero_trust.targets
WHERE account_id = '{{ account_id }}' -- required
AND hostname = '{{ hostname }}'
AND hostname_contains = '{{ hostname_contains }}'
AND virtual_network_id = '{{ virtual_network_id }}'
AND ip_v4 = '{{ ip_v4 }}'
AND ip_v6 = '{{ ip_v6 }}'
AND created_before = '{{ created_before }}'
AND created_after = '{{ created_after }}'
AND modified_before = '{{ modified_before }}'
AND modified_after = '{{ modified_after }}'
AND ips = '{{ ips }}'
AND target_ids = '{{ target_ids }}'
AND ip_like = '{{ ip_like }}'
AND ipv4_start = '{{ ipv4_start }}'
AND ipv4_end = '{{ ipv4_end }}'
AND ipv6_start = '{{ ipv6_start }}'
AND ipv6_end = '{{ ipv6_end }}'
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
AND order = '{{ order }}'
AND direction = '{{ direction }}'
;
REPLACE examples
- update
No description available.
REPLACE cloudflare.zero_trust.targets
SET
hostname = '{{ hostname }}',
ip = '{{ ip }}'
WHERE
account_id = '{{ account_id }}' --required
AND target_id = '{{ target_id }}' --required
AND hostname = '{{ hostname }}' --required
AND ip = '{{ ip }}' --required
RETURNING
errors,
messages,
result,
success;
DELETE examples
- delete
- bulk_delete
No description available.
DELETE FROM cloudflare.zero_trust.targets
WHERE account_id = '{{ account_id }}' --required
AND target_id = '{{ target_id }}' --required
;
Removes one or more targets.
DELETE FROM cloudflare.zero_trust.targets
WHERE account_id = '{{ account_id }}' --required
;
Lifecycle Methods
- batch
- batch_delete
Adds one or more targets.
EXEC cloudflare.zero_trust.targets.batch
@account_id='{{ account_id }}' --required
;
Removes one or more targets.
EXEC cloudflare.zero_trust.targets.batch_delete
@account_id='{{ account_id }}' --required
@@json=
'{
"target_ids": "{{ target_ids }}"
}'
;