Skip to main content

previews

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

Overview

Namepreviews
TypeResource
Idcloudflare.healthchecks.previews

Fields

The following fields are returned by SELECT queries:

Health Check Preview Details response.

NameDatatypeDescription
idstringIdentifier (example: 023e105f4ecef8ad9ca31a8372d0c353)
namestringA short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed. (example: server-1)
addressstringThe hostname or IP address of the origin server to run health checks on. (example: www.example.com)
check_regionsarrayA list of regions from which to run health checks. Null means Cloudflare will pick a default region.
consecutive_failsintegerThe number of consecutive fails required from a health check before changing the health to unhealthy.
consecutive_successesintegerThe number of consecutive successes required from a health check before changing the health to healthy.
created_onstring (date-time) (example: 2014-01-01T05:20:00.12345Z)
descriptionstringA human-readable description of the health check. (example: Health check for www.example.com)
failure_reasonstringThe current failure reason if status is unhealthy. (example: )
http_configobjectParameters specific to an HTTP or HTTPS health check.
intervalintegerThe 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_onstring (date-time) (example: 2014-01-01T05:20:00.12345Z)
retriesintegerThe number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.
statusstringThe current status of the origin server according to the health check. (unknown, healthy, unhealthy, suspended) (example: healthy)
suspendedbooleanIf suspended, no health checks are sent to the origin.
tcp_configobjectParameters specific to TCP health check.
timeoutintegerThe timeout (in seconds) before marking the health check as failed.
typestringThe 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:

NameAccessible byRequired ParamsOptional ParamsDescription
getselecthealthcheck_id, zone_idFetch a single configured health check preview.
createinsertzone_id, name, addressCreate a new preview health check.
deletedeletehealthcheck_id, zone_idDelete 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.

NameDatatypeDescription
healthcheck_idstring
zone_idstringThe Cloudflare zone ID.

SELECT examples

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 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
;

DELETE examples

Delete a health check.

DELETE FROM cloudflare.healthchecks.previews
WHERE healthcheck_id = '{{ healthcheck_id }}' --required
AND zone_id = '{{ zone_id }}' --required
;