firewall_rules
Creates, updates, deletes, gets or lists a firewall_rules resource.
Overview
| Name | firewall_rules |
| Type | Resource |
| Id | cloudflare.firewall.firewall_rules |
Fields
The following fields are returned by SELECT queries:
- get_by_zone
- list_by_zone
Get a firewall rule response
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier of the firewall rule. (example: 372e67954025e0ba6aaa6d586b9e0b60) |
action | string | The action to apply to a matched request. The log action is only available on an Enterprise plan. (block, challenge, js_challenge, managed_challenge, allow, log, bypass) (example: block) |
description | string | An informative summary of the firewall rule. (example: Blocks traffic identified during investigation for MIR-31) |
filter | object | |
paused | boolean | When true, indicates that the firewall rule is currently paused. |
priority | number | The priority of the rule. Optional value used to define the processing order. A lower number indicates a higher priority. If not provided, rules with a defined priority will be processed before rules without a priority. |
products | array | |
ref | string | A short reference tag. Allows you to select related firewall rules. (example: MIR-31) |
List firewall rules response
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier of the firewall rule. (example: 372e67954025e0ba6aaa6d586b9e0b60) |
action | string | The action to apply to a matched request. The log action is only available on an Enterprise plan. (block, challenge, js_challenge, managed_challenge, allow, log, bypass) (example: block) |
description | string | An informative summary of the firewall rule. (example: Blocks traffic identified during investigation for MIR-31) |
filter | object | |
paused | boolean | When true, indicates that the firewall rule is currently paused. |
priority | number | The priority of the rule. Optional value used to define the processing order. A lower number indicates a higher priority. If not provided, rules with a defined priority will be processed before rules without a priority. |
products | array | |
ref | string | A short reference tag. Allows you to select related firewall rules. (example: MIR-31) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_by_zone | select | rule_id, zone_id | Fetches the details of a firewall rule. | |
list_by_zone | select | zone_id | description, action, page, per_page, id, paused | Fetches firewall rules in a zone. You can filter the results using several optional parameters. |
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 |
|---|---|---|
rule_id | string | The rule ID. |
zone_id | string | The Cloudflare zone ID. |
action | string | |
description | string | |
id | string | |
page | number | |
paused | boolean | |
per_page | number |
SELECT examples
- get_by_zone
- list_by_zone
Fetches the details of a firewall rule.
SELECT
id,
action,
description,
filter,
paused,
priority,
products,
ref
FROM cloudflare.firewall.firewall_rules
WHERE rule_id = '{{ rule_id }}' -- required
AND zone_id = '{{ zone_id }}' -- required
;
Fetches firewall rules in a zone. You can filter the results using several optional parameters.
SELECT
id,
action,
description,
filter,
paused,
priority,
products,
ref
FROM cloudflare.firewall.firewall_rules
WHERE zone_id = '{{ zone_id }}' -- required
AND description = '{{ description }}'
AND action = '{{ action }}'
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
AND id = '{{ id }}'
AND paused = '{{ paused }}'
;