ua_rules
Creates, updates, deletes, gets or lists a ua_rules resource.
Overview
| Name | ua_rules |
| Type | Resource |
| Id | cloudflare.firewall.ua_rules |
Fields
The following fields are returned by SELECT queries:
- get
- list
Get a User Agent Blocking rule response
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier of the User Agent Blocking rule. (example: 372e67954025e0ba6aaa6d586b9e0b59) |
configuration | object | The configuration object for the current rule. |
description | string | An informative summary of the rule. (example: Prevent access from abusive clients identified by this User Agent to mitigate a DDoS attack) |
mode | string | The action to apply to a matched request. (block, challenge, js_challenge, managed_challenge) (example: js_challenge) |
paused | boolean | When true, indicates that the rule is currently paused. |
List User Agent Blocking rules response
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier of the User Agent Blocking rule. (example: 372e67954025e0ba6aaa6d586b9e0b59) |
configuration | object | The configuration object for the current rule. |
description | string | An informative summary of the rule. (example: Prevent access from abusive clients identified by this User Agent to mitigate a DDoS attack) |
mode | string | The action to apply to a matched request. (block, challenge, js_challenge, managed_challenge) (example: js_challenge) |
paused | boolean | When true, indicates that the rule is currently paused. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | ua_rule_id, zone_id | Fetches the details of a User Agent Blocking rule. | |
list | select | zone_id | page, description, per_page, user_agent, paused | Fetches User Agent Blocking rules in a zone. You can filter the results using several optional parameters. |
create | insert | zone_id, mode, configuration | Creates a new User Agent Blocking rule in a zone. | |
update | replace | ua_rule_id, zone_id, mode, configuration | Updates an existing User Agent Blocking rule. | |
delete | delete | ua_rule_id, zone_id | Deletes an existing User Agent Blocking rule. |
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 |
|---|---|---|
ua_rule_id | string | |
zone_id | string | The Cloudflare zone ID. |
description | string | |
page | number | |
paused | boolean | |
per_page | number | |
user_agent | string |
SELECT examples
- get
- list
Fetches the details of a User Agent Blocking rule.
SELECT
id,
configuration,
description,
mode,
paused
FROM cloudflare.firewall.ua_rules
WHERE ua_rule_id = '{{ ua_rule_id }}' -- required
AND zone_id = '{{ zone_id }}' -- required
;
Fetches User Agent Blocking rules in a zone. You can filter the results using several optional parameters.
SELECT
id,
configuration,
description,
mode,
paused
FROM cloudflare.firewall.ua_rules
WHERE zone_id = '{{ zone_id }}' -- required
AND page = '{{ page }}'
AND description = '{{ description }}'
AND per_page = '{{ per_page }}'
AND user_agent = '{{ user_agent }}'
AND paused = '{{ paused }}'
;
INSERT examples
- create
- Manifest
Creates a new User Agent Blocking rule in a zone.
INSERT INTO cloudflare.firewall.ua_rules (
configuration,
description,
mode,
paused,
zone_id
)
SELECT
'{{ configuration }}' /* required */,
'{{ description }}',
'{{ mode }}' /* required */,
{{ paused }},
'{{ zone_id }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: ua_rules
props:
- name: zone_id
value: "{{ zone_id }}"
description: Required parameter for the ua_rules resource.
- name: configuration
value:
target: "{{ target }}"
value: "{{ value }}"
- name: description
value: "{{ description }}"
description: |
An informative summary of the rule. This value is sanitized and any tags will be removed.
- name: mode
value: "{{ mode }}"
description: |
The action to apply to a matched request.
valid_values: ['block', 'challenge', 'whitelist', 'js_challenge', 'managed_challenge']
- name: paused
value: {{ paused }}
description: |
When true, indicates that the rule is currently paused.
default: false
REPLACE examples
- update
Updates an existing User Agent Blocking rule.
REPLACE cloudflare.firewall.ua_rules
SET
configuration = '{{ configuration }}',
description = '{{ description }}',
mode = '{{ mode }}',
paused = {{ paused }}
WHERE
ua_rule_id = '{{ ua_rule_id }}' --required
AND zone_id = '{{ zone_id }}' --required
AND mode = '{{ mode }}' --required
AND configuration = '{{ configuration }}' --required
RETURNING
errors,
messages,
result,
success;
DELETE examples
- delete
Deletes an existing User Agent Blocking rule.
DELETE FROM cloudflare.firewall.ua_rules
WHERE ua_rule_id = '{{ ua_rule_id }}' --required
AND zone_id = '{{ zone_id }}' --required
;