previews
Creates, updates, deletes, gets or lists a previews resource.
Overview
| Name | previews |
| Type | Resource |
| Id | cloudflare.healthchecks.previews |
Fields
The following fields are returned by SELECT queries:
- get
Health Check Preview Details response.
| Name | Datatype | Description |
|---|---|---|
id | string | Identifier (example: 023e105f4ecef8ad9ca31a8372d0c353) |
name | string | A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed. (example: server-1) |
address | string | The hostname or IP address of the origin server to run health checks on. (example: www.example.com) |
check_regions | array | A list of regions from which to run health checks. Null means Cloudflare will pick a default region. |
consecutive_fails | integer | The number of consecutive fails required from a health check before changing the health to unhealthy. |
consecutive_successes | integer | The number of consecutive successes required from a health check before changing the health to healthy. |
created_on | string (date-time) | (example: 2014-01-01T05:20:00.12345Z) |
description | string | A human-readable description of the health check. (example: Health check for www.example.com) |
failure_reason | string | The current failure reason if status is unhealthy. (example: ) |
http_config | object | Parameters specific to an HTTP or HTTPS health check. |
interval | integer | The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations. |
modified_on | string (date-time) | (example: 2014-01-01T05:20:00.12345Z) |
retries | integer | The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. |
status | string | The current status of the origin server according to the health check. (unknown, healthy, unhealthy, suspended) (example: healthy) |
suspended | boolean | If suspended, no health checks are sent to the origin. |
tcp_config | object | Parameters specific to TCP health check. |
timeout | integer | The timeout (in seconds) before marking the health check as failed. |
type | string | The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'. (default: HTTP, example: HTTPS) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | healthcheck_id, zone_id | Fetch a single configured health check preview. | |
create | insert | zone_id, name, address | Create a new preview health check. | |
delete | delete | healthcheck_id, zone_id | Delete a health check. |
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 |
|---|---|---|
healthcheck_id | string | |
zone_id | string | The Cloudflare zone ID. |
SELECT examples
- get
Fetch a single configured health check preview.
SELECT
id,
name,
address,
check_regions,
consecutive_fails,
consecutive_successes,
created_on,
description,
failure_reason,
http_config,
interval,
modified_on,
retries,
status,
suspended,
tcp_config,
timeout,
type
FROM cloudflare.healthchecks.previews
WHERE healthcheck_id = '{{ healthcheck_id }}' -- required
AND zone_id = '{{ zone_id }}' -- required
;
INSERT examples
- create
- Manifest
Create a new preview health check.
INSERT INTO cloudflare.healthchecks.previews (
address,
check_regions,
consecutive_fails,
consecutive_successes,
description,
http_config,
interval,
name,
retries,
suspended,
tcp_config,
timeout,
type,
zone_id
)
SELECT
'{{ address }}' /* required */,
'{{ check_regions }}',
{{ consecutive_fails }},
{{ consecutive_successes }},
'{{ description }}',
'{{ http_config }}',
{{ interval }},
'{{ name }}' /* required */,
{{ retries }},
{{ suspended }},
'{{ tcp_config }}',
{{ timeout }},
'{{ type }}',
'{{ zone_id }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: previews
props:
- name: zone_id
value: "{{ zone_id }}"
description: Required parameter for the previews resource.
- name: address
value: "{{ address }}"
description: |
The hostname or IP address of the origin server to run health checks on.
- name: check_regions
value:
- "{{ check_regions }}"
description: |
A list of regions from which to run health checks. Null means Cloudflare will pick a default region.
- name: consecutive_fails
value: {{ consecutive_fails }}
description: |
The number of consecutive fails required from a health check before changing the health to unhealthy.
default: 1
- name: consecutive_successes
value: {{ consecutive_successes }}
description: |
The number of consecutive successes required from a health check before changing the health to healthy.
default: 1
- name: description
value: "{{ description }}"
description: |
A human-readable description of the health check.
- name: http_config
description: |
Parameters specific to an HTTP or HTTPS health check.
value:
allow_insecure: {{ allow_insecure }}
expected_body: "{{ expected_body }}"
expected_codes:
- "{{ expected_codes }}"
follow_redirects: {{ follow_redirects }}
header: "{{ header }}"
method: "{{ method }}"
path: "{{ path }}"
port: {{ port }}
- name: interval
value: {{ interval }}
description: |
The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.
default: 60
- name: name
value: "{{ name }}"
description: |
A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.
- name: retries
value: {{ retries }}
description: |
The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.
default: 2
- name: suspended
value: {{ suspended }}
description: |
If suspended, no health checks are sent to the origin.
default: false
- name: tcp_config
description: |
Parameters specific to TCP health check.
value:
method: "{{ method }}"
port: {{ port }}
- name: timeout
value: {{ timeout }}
description: |
The timeout (in seconds) before marking the health check as failed.
default: 5
- name: type
value: "{{ type }}"
description: |
The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.
default: HTTP
DELETE examples
- delete
Delete a health check.
DELETE FROM cloudflare.healthchecks.previews
WHERE healthcheck_id = '{{ healthcheck_id }}' --required
AND zone_id = '{{ zone_id }}' --required
;