access_rules
Creates, updates, deletes, gets or lists an access_rules resource.
Overview
| Name | access_rules |
| Type | Resource |
| Id | cloudflare.firewall.access_rules |
Fields
The following fields are returned by SELECT queries:
- get_by_account
- get_by_zone
- list_by_account
- list_by_zone
Get an IP Access rule response.
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier of the IP Access rule. (example: 92f17202ed8bd63d69a66b86a49a8f6b) |
allowed_modes | array | The available actions that a rule can apply to a matched request. |
configuration | object | The rule configuration. (title: An IP address configuration.) |
created_on | string (date-time) | The timestamp of when the rule was created. (example: 2014-01-01T05:20:00.12345Z) |
mode | string | The action to apply to a matched request. (block, challenge, whitelist, js_challenge, managed_challenge) (example: challenge) |
modified_on | string (date-time) | The timestamp of when the rule was last modified. (example: 2014-01-01T05:20:00.12345Z) |
notes | string | An informative summary of the rule, typically used as a reminder or explanation. (example: This rule is enabled because of an event that occurred on date X.) |
scope | object | All zones owned by the user will have the rule applied. |
Get an IP Access rule response.
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier of the IP Access rule. (example: 92f17202ed8bd63d69a66b86a49a8f6b) |
allowed_modes | array | The available actions that a rule can apply to a matched request. |
configuration | object | The rule configuration. (title: An IP address configuration.) |
created_on | string (date-time) | The timestamp of when the rule was created. (example: 2014-01-01T05:20:00.12345Z) |
mode | string | The action to apply to a matched request. (block, challenge, whitelist, js_challenge, managed_challenge) (example: challenge) |
modified_on | string (date-time) | The timestamp of when the rule was last modified. (example: 2014-01-01T05:20:00.12345Z) |
notes | string | An informative summary of the rule, typically used as a reminder or explanation. (example: This rule is enabled because of an event that occurred on date X.) |
scope | object | All zones owned by the user will have the rule applied. |
List IP Access rules response.
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier of the IP Access rule. (example: 92f17202ed8bd63d69a66b86a49a8f6b) |
allowed_modes | array | The available actions that a rule can apply to a matched request. |
configuration | object | The rule configuration. (title: An IP address configuration.) |
created_on | string (date-time) | The timestamp of when the rule was created. (example: 2014-01-01T05:20:00.12345Z) |
mode | string | The action to apply to a matched request. (block, challenge, whitelist, js_challenge, managed_challenge) (example: challenge) |
modified_on | string (date-time) | The timestamp of when the rule was last modified. (example: 2014-01-01T05:20:00.12345Z) |
notes | string | An informative summary of the rule, typically used as a reminder or explanation. (example: This rule is enabled because of an event that occurred on date X.) |
scope | object | All zones owned by the user will have the rule applied. |
List IP Access rules response.
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier of the IP Access rule. (example: 92f17202ed8bd63d69a66b86a49a8f6b) |
allowed_modes | array | The available actions that a rule can apply to a matched request. |
configuration | object | The rule configuration. (title: An IP address configuration.) |
created_on | string (date-time) | The timestamp of when the rule was created. (example: 2014-01-01T05:20:00.12345Z) |
mode | string | The action to apply to a matched request. (block, challenge, whitelist, js_challenge, managed_challenge) (example: challenge) |
modified_on | string (date-time) | The timestamp of when the rule was last modified. (example: 2014-01-01T05:20:00.12345Z) |
notes | string | An informative summary of the rule, typically used as a reminder or explanation. (example: This rule is enabled because of an event that occurred on date X.) |
scope | object | All zones owned by the user will have the rule applied. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_by_account | select | rule_id, account_id | Fetches the details of an IP Access rule defined. | |
get_by_zone | select | rule_id, zone_id | Fetches the details of an IP Access rule defined. | |
list_by_account | select | account_id | mode, configuration.target, configuration.value, notes, match, page, per_page, order, direction | Fetches IP Access rules of an account or zone. These rules apply to all the zones in the account or zone. You can filter the results using several optional parameters. |
list_by_zone | select | zone_id | mode, configuration.target, configuration.value, notes, match, page, per_page, order, direction | Fetches IP Access rules of an account or zone. These rules apply to all the zones in the account or zone. You can filter the results using several optional parameters. |
create_by_account | insert | account_id, mode, configuration | Creates a new IP Access rule for an account or zone. The rule will apply to all zones in the account or zone. Note: To create an IP Access rule that applies to a single zone, refer to the IP Access rules for a zone endpoints. | |
create_by_zone | insert | zone_id, mode, configuration | Creates a new IP Access rule for an account or zone. The rule will apply to all zones in the account or zone. Note: To create an IP Access rule that applies to a single zone, refer to the IP Access rules for a zone endpoints. | |
edit_by_account | update | rule_id, account_id, mode, configuration | Updates an IP Access rule defined. Note: This operation will affect all zones in the account or zone. | |
edit_by_zone | update | rule_id, zone_id, mode, configuration | Updates an IP Access rule defined. Note: This operation will affect all zones in the account or zone. | |
delete_by_account | delete | rule_id, account_id | Deletes an existing IP Access rule defined. Note: This operation will affect all zones in the account or zone. | |
delete_by_zone | delete | rule_id, zone_id | Deletes an existing IP Access rule defined. Note: This operation will affect all zones in the account or zone. |
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. |
rule_id | string | The rule ID. |
zone_id | string | The Cloudflare zone ID. |
configuration.target | string | |
configuration.value | string | |
direction | string | |
match | string | |
mode | string | |
notes | string | |
order | string | |
page | number | |
per_page | number |
SELECT examples
- get_by_account
- get_by_zone
- list_by_account
- list_by_zone
Fetches the details of an IP Access rule defined.
SELECT
id,
allowed_modes,
configuration,
created_on,
mode,
modified_on,
notes,
scope
FROM cloudflare.firewall.access_rules
WHERE rule_id = '{{ rule_id }}' -- required
AND account_id = '{{ account_id }}' -- required
;
Fetches the details of an IP Access rule defined.
SELECT
id,
allowed_modes,
configuration,
created_on,
mode,
modified_on,
notes,
scope
FROM cloudflare.firewall.access_rules
WHERE rule_id = '{{ rule_id }}' -- required
AND zone_id = '{{ zone_id }}' -- required
;
Fetches IP Access rules of an account or zone. These rules apply to all the zones in the account or zone. You can filter the results using several optional parameters.
SELECT
id,
allowed_modes,
configuration,
created_on,
mode,
modified_on,
notes,
scope
FROM cloudflare.firewall.access_rules
WHERE account_id = '{{ account_id }}' -- required
AND mode = '{{ mode }}'
AND configuration.target = '{{ configuration.target }}'
AND configuration.value = '{{ configuration.value }}'
AND notes = '{{ notes }}'
AND match = '{{ match }}'
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
AND order = '{{ order }}'
AND direction = '{{ direction }}'
;
Fetches IP Access rules of an account or zone. These rules apply to all the zones in the account or zone. You can filter the results using several optional parameters.
SELECT
id,
allowed_modes,
configuration,
created_on,
mode,
modified_on,
notes,
scope
FROM cloudflare.firewall.access_rules
WHERE zone_id = '{{ zone_id }}' -- required
AND mode = '{{ mode }}'
AND configuration.target = '{{ configuration.target }}'
AND configuration.value = '{{ configuration.value }}'
AND notes = '{{ notes }}'
AND match = '{{ match }}'
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
AND order = '{{ order }}'
AND direction = '{{ direction }}'
;
INSERT examples
- create_by_account
- create_by_zone
- Manifest
Creates a new IP Access rule for an account or zone. The rule will apply to all zones in the account or zone. Note: To create an IP Access rule that applies to a single zone, refer to the IP Access rules for a zone endpoints.
INSERT INTO cloudflare.firewall.access_rules (
configuration,
mode,
notes,
account_id
)
SELECT
'{{ configuration }}' /* required */,
'{{ mode }}' /* required */,
'{{ notes }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;
Creates a new IP Access rule for an account or zone. The rule will apply to all zones in the account or zone. Note: To create an IP Access rule that applies to a single zone, refer to the IP Access rules for a zone endpoints.
INSERT INTO cloudflare.firewall.access_rules (
configuration,
mode,
notes,
zone_id
)
SELECT
'{{ configuration }}' /* required */,
'{{ mode }}' /* required */,
'{{ notes }}',
'{{ zone_id }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: access_rules
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the access_rules resource.
- name: zone_id
value: "{{ zone_id }}"
description: Required parameter for the access_rules resource.
- name: configuration
description: |
The rule configuration.
value:
target: "{{ target }}"
value: "{{ value }}"
- name: mode
value: "{{ mode }}"
description: |
The action to apply to a matched request.
valid_values: ['block', 'challenge', 'whitelist', 'js_challenge', 'managed_challenge']
- name: notes
value: "{{ notes }}"
description: |
An informative summary of the rule, typically used as a reminder or explanation.
default:
UPDATE examples
- edit_by_account
- edit_by_zone
Updates an IP Access rule defined. Note: This operation will affect all zones in the account or zone.
UPDATE cloudflare.firewall.access_rules
SET
configuration = '{{ configuration }}',
mode = '{{ mode }}',
notes = '{{ notes }}'
WHERE
rule_id = '{{ rule_id }}' --required
AND account_id = '{{ account_id }}' --required
AND mode = '{{ mode }}' --required
AND configuration = '{{ configuration }}' --required
RETURNING
errors,
messages,
result,
success;
Updates an IP Access rule defined. Note: This operation will affect all zones in the account or zone.
UPDATE cloudflare.firewall.access_rules
SET
configuration = '{{ configuration }}',
mode = '{{ mode }}',
notes = '{{ notes }}'
WHERE
rule_id = '{{ 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_by_account
- delete_by_zone
Deletes an existing IP Access rule defined. Note: This operation will affect all zones in the account or zone.
DELETE FROM cloudflare.firewall.access_rules
WHERE rule_id = '{{ rule_id }}' --required
AND account_id = '{{ account_id }}' --required
;
Deletes an existing IP Access rule defined. Note: This operation will affect all zones in the account or zone.
DELETE FROM cloudflare.firewall.access_rules
WHERE rule_id = '{{ rule_id }}' --required
AND zone_id = '{{ zone_id }}' --required
;