lists
Creates, updates, deletes, gets or lists a lists resource.
Overview
| Name | lists |
| Type | Resource |
| Id | cloudflare.rules.lists |
Fields
The following fields are returned by SELECT queries:
- get
- list
Get a list response.
| Name | Datatype | Description |
|---|---|---|
id | string | The unique ID of the list. (example: 2c0fc9fa937b11eaa1b71c4d701ab86e) |
name | string | An informative name for the list. Use this name in filter and rule expressions. (example: list1) |
created_on | string | The RFC 3339 timestamp of when the list was created. (example: 2020-01-01T08:00:00Z) |
description | string | An informative summary of the list. (example: This is a note) |
kind | string | The type of the list. Each type supports specific list items (IP addresses, ASNs, hostnames or redirects). (ip, redirect, hostname, asn) (example: ip) |
modified_on | string | The RFC 3339 timestamp of when the list was last modified. (example: 2020-01-10T14:00:00Z) |
num_items | number | The number of items in the list. |
num_referencing_filters | number | The number of filters referencing the list. |
Get lists response.
| Name | Datatype | Description |
|---|---|---|
id | string | The unique ID of the list. (example: 2c0fc9fa937b11eaa1b71c4d701ab86e) |
name | string | An informative name for the list. Use this name in filter and rule expressions. (example: list1) |
created_on | string | The RFC 3339 timestamp of when the list was created. (example: 2020-01-01T08:00:00Z) |
description | string | An informative summary of the list. (example: This is a note) |
kind | string | The type of the list. Each type supports specific list items (IP addresses, ASNs, hostnames or redirects). (ip, redirect, hostname, asn) (example: ip) |
modified_on | string | The RFC 3339 timestamp of when the list was last modified. (example: 2020-01-10T14:00:00Z) |
num_items | number | The number of items in the list. |
num_referencing_filters | number | The number of filters referencing the list. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | list_id, account_id | Fetches the details of a list. | |
list | select | account_id | Fetches all lists in the account. | |
create | insert | account_id, name, kind | Creates a new list of the specified kind. | |
update | replace | list_id, account_id | Updates the description of a list. | |
delete | delete | list_id, account_id | Deletes a specific list and all its items. |
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. |
list_id | string |
SELECT examples
- get
- list
Fetches the details of a list.
SELECT
id,
name,
created_on,
description,
kind,
modified_on,
num_items,
num_referencing_filters
FROM cloudflare.rules.lists
WHERE list_id = '{{ list_id }}' -- required
AND account_id = '{{ account_id }}' -- required
;
Fetches all lists in the account.
SELECT
id,
name,
created_on,
description,
kind,
modified_on,
num_items,
num_referencing_filters
FROM cloudflare.rules.lists
WHERE account_id = '{{ account_id }}' -- required
;
INSERT examples
- create
- Manifest
Creates a new list of the specified kind.
INSERT INTO cloudflare.rules.lists (
description,
kind,
name,
account_id
)
SELECT
'{{ description }}',
'{{ kind }}' /* required */,
'{{ name }}' /* required */,
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: lists
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the lists resource.
- name: description
value: "{{ description }}"
description: |
An informative summary of the list.
- name: kind
value: "{{ kind }}"
description: |
The type of the list. Each type supports specific list items (IP addresses, ASNs, hostnames or redirects).
valid_values: ['ip', 'redirect', 'hostname', 'asn']
- name: name
value: "{{ name }}"
description: |
An informative name for the list. Use this name in filter and rule expressions.
REPLACE examples
- update
Updates the description of a list.
REPLACE cloudflare.rules.lists
SET
description = '{{ description }}'
WHERE
list_id = '{{ list_id }}' --required
AND account_id = '{{ account_id }}' --required
RETURNING
errors,
messages,
result,
success;
DELETE examples
- delete
Deletes a specific list and all its items.
DELETE FROM cloudflare.rules.lists
WHERE list_id = '{{ list_id }}' --required
AND account_id = '{{ account_id }}' --required
;