prefixes
Creates, updates, deletes, gets or lists a prefixes resource.
Overview
| Name | prefixes |
| Type | Resource |
| Id | cloudflare.ddos_protection.prefixes |
Fields
The following fields are returned by SELECT queries:
- list
List all prefixes response.
| Name | Datatype | Description |
|---|---|---|
id | string | The unique ID of the prefix. |
comment | string | A comment describing the prefix. |
created_on | string (date-time) | The creation timestamp of the prefix. |
excluded | boolean | Whether to exclude the prefix from protection. |
modified_on | string (date-time) | The last modification timestamp of the prefix. |
prefix | string | The prefix in CIDR format. (example: 192.0.2.0/24) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | account_id | page, per_page, order, direction | List all prefixes for an account. |
create | insert | account_id, prefix, comment, excluded | Create a prefix for an account. | |
bulk_delete | delete | account_id | Delete all prefixes for an account. | |
bulk | exec | account_id | Create 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.
| Name | Datatype | Description |
|---|---|---|
account_id | string | The Cloudflare account ID. |
direction | string | The direction of ordering (ASC or DESC). Defaults to 'ASC'. |
order | string | The field to order by. Defaults to 'prefix'. |
page | integer (int64) | The page number for pagination. Defaults to 1. |
per_page | integer (int64) | The number of items per page. Must be between 10 and 1000. Defaults to 25. |
SELECT examples
- list
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
- Manifest
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
;
# Description fields are for documentation purposes
- name: prefixes
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the prefixes resource.
- name: comment
value: "{{ comment }}"
description: |
A comment describing the prefix.
- name: excluded
value: {{ excluded }}
description: |
Whether to exclude the prefix from protection.
- name: prefix
value: "{{ prefix }}"
description: |
The prefix to add in CIDR format.
DELETE examples
- bulk_delete
Delete all prefixes for an account.
DELETE FROM cloudflare.ddos_protection.prefixes
WHERE account_id = '{{ account_id }}' --required
;
Lifecycle Methods
- bulk
Create multiple prefixes for an account.
EXEC cloudflare.ddos_protection.prefixes.bulk
@account_id='{{ account_id }}' --required
;