Skip to main content

allowlist

Creates, updates, deletes, gets or lists an allowlist resource.

Overview

Nameallowlist
TypeResource
Idcloudflare.ddos_protection.allowlist

Fields

The following fields are returned by SELECT queries:

List all allowlist prefixes response.

NameDatatypeDescription
idstringThe unique ID of the allowlist prefix.
commentstringAn optional comment describing the allowlist prefix.
created_onstring (date-time)The creation timestamp of the allowlist prefix.
enabledbooleanWhether to enable the allowlist prefix into effect. Defaults to false.
modified_onstring (date-time)The last modification timestamp of the allowlist prefix.
prefixstringThe allowlist prefix in CIDR format.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectaccount_idpage, per_page, order, directionList all allowlist prefixes for an account.
createinsertaccount_id, prefix, comment, enabledCreate an allowlist prefix for an account.
bulk_deletedeleteaccount_idDelete all allowlist prefixes for an account.

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.
directionstringThe direction of ordering (ASC or DESC). Defaults to 'ASC'.
orderstringThe field to order by. Defaults to 'prefix'.
pageinteger (int64)The page number for pagination. Defaults to 1.
per_pageinteger (int64)The number of items per page. Must be between 10 and 1000. Defaults to 25.

SELECT examples

List all allowlist prefixes for an account.

SELECT
id,
comment,
created_on,
enabled,
modified_on,
prefix
FROM cloudflare.ddos_protection.allowlist
WHERE account_id = '{{ account_id }}' -- required
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
AND order = '{{ order }}'
AND direction = '{{ direction }}'
;

INSERT examples

Create an allowlist prefix for an account.

INSERT INTO cloudflare.ddos_protection.allowlist (
comment,
enabled,
prefix,
account_id
)
SELECT
'{{ comment }}' /* required */,
{{ enabled }} /* required */,
'{{ prefix }}' /* required */,
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

DELETE examples

Delete all allowlist prefixes for an account.

DELETE FROM cloudflare.ddos_protection.allowlist
WHERE account_id = '{{ account_id }}' --required
;