Skip to main content

prefixes

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

Overview

Nameprefixes
TypeResource
Idcloudflare.ddos_protection.prefixes

Fields

The following fields are returned by SELECT queries:

List all prefixes response.

NameDatatypeDescription
idstringThe unique ID of the prefix.
commentstringA comment describing the prefix.
created_onstring (date-time)The creation timestamp of the prefix.
excludedbooleanWhether to exclude the prefix from protection.
modified_onstring (date-time)The last modification timestamp of the prefix.
prefixstringThe prefix in CIDR format. (example: 192.0.2.0/24)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectaccount_idpage, per_page, order, directionList all prefixes for an account.
createinsertaccount_id, prefix, comment, excludedCreate a prefix for an account.
bulk_deletedeleteaccount_idDelete all prefixes for an account.
bulkexecaccount_idCreate multiple 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 prefixes for an account.

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

INSERT examples

Create a prefix for an account.

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

DELETE examples

Delete all prefixes for an account.

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

Lifecycle Methods

Create multiple prefixes for an account.

EXEC cloudflare.ddos_protection.prefixes.bulk
@account_id='{{ account_id }}' --required
;