From 413836ba4a24f6ffcee7677666ec339a617a0c79 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 11 Apr 2024 23:48:02 +0000
Subject: [PATCH] feat(api): update via SDK Studio (#298)
---
.stats.yml | 2 +-
api.md | 54 +-
src/cloudflare/resources/rulesets/rules.py | 128 +--
.../dispatch/namespaces/scripts/__init__.py | 28 +
.../dispatch/namespaces/scripts/scripts.py | 64 ++
.../dispatch/namespaces/scripts/secrets.py | 327 ++++++
.../dispatch/namespaces/scripts/tags.py | 420 ++++++++
src/cloudflare/types/__init__.py | 2 -
src/cloudflare/types/hostname.py | 48 -
src/cloudflare/types/hostname_param.py | 23 -
src/cloudflare/types/ruleset_create_params.py | 879 +---------------
.../types/ruleset_create_response.py | 977 +-----------------
src/cloudflare/types/ruleset_get_response.py | 977 +-----------------
src/cloudflare/types/ruleset_update_params.py | 879 +---------------
.../types/ruleset_update_response.py | 977 +-----------------
src/cloudflare/types/rulesets/__init__.py | 24 +
.../types/rulesets/challenge_rule.py | 45 +
.../types/rulesets/challenge_rule_param.py | 35 +
.../types/rulesets/compress_response_rule.py | 55 +
.../rulesets/compress_response_rule_param.py | 46 +
.../types/rulesets/js_challenge_rule.py | 45 +
.../types/rulesets/js_challenge_rule_param.py | 35 +
.../types/rulesets/managed_challenge_rule.py | 45 +
.../rulesets/managed_challenge_rule_param.py | 35 +
.../types/rulesets/phase_get_response.py | 971 +----------------
.../types/rulesets/phase_update_params.py | 873 +---------------
.../types/rulesets/phase_update_response.py | 971 +----------------
.../rulesets/phases/version_get_response.py | 971 +----------------
.../types/rulesets/redirect_rule.py | 95 ++
.../types/rulesets/redirect_rule_param.py | 86 ++
src/cloudflare/types/rulesets/rewrite_rule.py | 93 ++
.../types/rulesets/rewrite_rule_param.py | 84 ++
.../types/rulesets/rewrite_uri_part.py | 20 +
.../types/rulesets/rewrite_uri_part_param.py | 21 +
src/cloudflare/types/rulesets/route_rule.py | 69 ++
.../types/rulesets/route_rule_param.py | 59 ++
.../types/rulesets/rule_create_params.py | 335 +++---
.../types/rulesets/rule_create_response.py | 971 +----------------
.../types/rulesets/rule_delete_response.py | 971 +----------------
.../types/rulesets/rule_edit_params.py | 335 +++---
.../types/rulesets/rule_edit_response.py | 971 +----------------
src/cloudflare/types/rulesets/score_rule.py | 53 +
.../types/rulesets/score_rule_param.py | 43 +
.../types/rulesets/serve_error_rule.py | 56 +
.../types/rulesets/serve_error_rule_param.py | 46 +
.../types/rulesets/set_cache_settings_rule.py | 322 ++++++
.../rulesets/set_cache_settings_rule_param.py | 319 ++++++
.../types/rulesets/set_config_rule.py | 103 ++
.../types/rulesets/set_config_rule_param.py | 93 ++
.../types/rulesets/version_get_response.py | 971 +----------------
.../rulesets/versions/by_tag_get_response.py | 971 +----------------
.../types/warp_connector_create_response.py | 39 +-
.../types/warp_connector_delete_response.py | 39 +-
.../types/warp_connector_edit_response.py | 39 +-
.../types/warp_connector_get_response.py | 39 +-
.../types/warp_connector_list_response.py | 39 +-
.../dispatch/namespaces/scripts/__init__.py | 6 +
.../scripts/secret_list_response.py | 16 +
.../scripts/secret_update_params.py | 24 +
.../scripts/secret_update_response.py | 16 +
.../namespaces/scripts/tag_list_response.py | 6 +
.../namespaces/scripts/tag_update_params.py | 19 +
.../namespaces/scripts/tag_update_response.py | 7 +
src/cloudflare/types/zero_trust/connection.py | 25 +-
src/cloudflare/types/zero_trust/tunnel.py | 38 +-
.../zero_trust/tunnel_create_response.py | 19 +-
.../zero_trust/tunnel_delete_response.py | 19 +-
.../types/zero_trust/tunnel_edit_response.py | 38 +-
.../types/zero_trust/tunnel_get_response.py | 19 +-
.../types/zero_trust/tunnel_list_response.py | 38 +-
.../types/zero_trust/tunnel_param.py | 32 +-
.../types/zero_trust/tunnels/client.py | 36 +-
.../namespaces/scripts/test_secrets.py | 310 ++++++
.../dispatch/namespaces/scripts/test_tags.py | 450 ++++++++
74 files changed, 4757 insertions(+), 13579 deletions(-)
create mode 100644 src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/secrets.py
create mode 100644 src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/tags.py
delete mode 100644 src/cloudflare/types/hostname.py
delete mode 100644 src/cloudflare/types/hostname_param.py
create mode 100644 src/cloudflare/types/rulesets/challenge_rule.py
create mode 100644 src/cloudflare/types/rulesets/challenge_rule_param.py
create mode 100644 src/cloudflare/types/rulesets/compress_response_rule.py
create mode 100644 src/cloudflare/types/rulesets/compress_response_rule_param.py
create mode 100644 src/cloudflare/types/rulesets/js_challenge_rule.py
create mode 100644 src/cloudflare/types/rulesets/js_challenge_rule_param.py
create mode 100644 src/cloudflare/types/rulesets/managed_challenge_rule.py
create mode 100644 src/cloudflare/types/rulesets/managed_challenge_rule_param.py
create mode 100644 src/cloudflare/types/rulesets/redirect_rule.py
create mode 100644 src/cloudflare/types/rulesets/redirect_rule_param.py
create mode 100644 src/cloudflare/types/rulesets/rewrite_rule.py
create mode 100644 src/cloudflare/types/rulesets/rewrite_rule_param.py
create mode 100644 src/cloudflare/types/rulesets/rewrite_uri_part.py
create mode 100644 src/cloudflare/types/rulesets/rewrite_uri_part_param.py
create mode 100644 src/cloudflare/types/rulesets/route_rule.py
create mode 100644 src/cloudflare/types/rulesets/route_rule_param.py
create mode 100644 src/cloudflare/types/rulesets/score_rule.py
create mode 100644 src/cloudflare/types/rulesets/score_rule_param.py
create mode 100644 src/cloudflare/types/rulesets/serve_error_rule.py
create mode 100644 src/cloudflare/types/rulesets/serve_error_rule_param.py
create mode 100644 src/cloudflare/types/rulesets/set_cache_settings_rule.py
create mode 100644 src/cloudflare/types/rulesets/set_cache_settings_rule_param.py
create mode 100644 src/cloudflare/types/rulesets/set_config_rule.py
create mode 100644 src/cloudflare/types/rulesets/set_config_rule_param.py
create mode 100644 src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_list_response.py
create mode 100644 src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_params.py
create mode 100644 src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_response.py
create mode 100644 src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_list_response.py
create mode 100644 src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_update_params.py
create mode 100644 src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_update_response.py
create mode 100644 tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_secrets.py
create mode 100644 tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_tags.py
diff --git a/.stats.yml b/.stats.yml
index 0818ecbb822..d0e375fdcb3 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1 +1 @@
-configured_endpoints: 1251
+configured_endpoints: 1256
diff --git a/api.md b/api.md
index 54eaf9c3a94..229e19728c8 100644
--- a/api.md
+++ b/api.md
@@ -2014,7 +2014,7 @@ Methods:
Types:
```python
-from cloudflare.types import Hostname, KeylessCertificate, Tunnel, KeylessCertificateDeleteResponse
+from cloudflare.types import KeylessCertificate, Tunnel, KeylessCertificateDeleteResponse
```
Methods:
@@ -2204,11 +2204,7 @@ Methods:
Types:
```python
-from cloudflare.types.origin_tls_client_auth import (
- AuthenticatedOriginPull,
- ID,
- HostnameUpdateResponse,
-)
+from cloudflare.types.origin_tls_client_auth import AuthenticatedOriginPull, HostnameUpdateResponse
```
Methods:
@@ -3043,10 +3039,22 @@ Types:
```python
from cloudflare.types.rulesets import (
BlockRule,
+ ChallengeRule,
+ CompressResponseRule,
ExecuteRule,
+ JsChallengeRule,
LogRule,
Logging,
+ ManagedChallengeRule,
+ RedirectRule,
+ RewriteRule,
+ RewriteURIPart,
+ RouteRule,
RulesetRule,
+ ScoreRule,
+ ServeErrorRule,
+ SetCacheSettingsRule,
+ SetConfigRule,
SkipRule,
RuleCreateResponse,
RuleDeleteResponse,
@@ -4684,6 +4692,40 @@ Methods:
- client.workers_for_platforms.dispatch.namespaces.scripts.bindings.get(script_name, \*, account_id, dispatch_namespace) -> BindingGetResponse
+##### Secrets
+
+Types:
+
+```python
+from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import (
+ SecretUpdateResponse,
+ SecretListResponse,
+)
+```
+
+Methods:
+
+- client.workers_for_platforms.dispatch.namespaces.scripts.secrets.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> SecretUpdateResponse
+- client.workers_for_platforms.dispatch.namespaces.scripts.secrets.list(script_name, \*, account_id, dispatch_namespace) -> SyncSinglePage[SecretListResponse]
+
+##### Tags
+
+Types:
+
+```python
+from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import (
+ TagUpdateResponse,
+ TagListResponse,
+ TagDeleteResponse,
+)
+```
+
+Methods:
+
+- client.workers_for_platforms.dispatch.namespaces.scripts.tags.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> TagUpdateResponse
+- client.workers_for_platforms.dispatch.namespaces.scripts.tags.list(script_name, \*, account_id, dispatch_namespace) -> SyncSinglePage[TagListResponse]
+- client.workers_for_platforms.dispatch.namespaces.scripts.tags.delete(tag, \*, account_id, dispatch_namespace, script_name) -> object
+
# ZeroTrust
## Devices
diff --git a/src/cloudflare/resources/rulesets/rules.py b/src/cloudflare/resources/rulesets/rules.py
index 7f07952a531..393df75653b 100644
--- a/src/cloudflare/resources/rulesets/rules.py
+++ b/src/cloudflare/resources/rulesets/rules.py
@@ -175,7 +175,7 @@ def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["compress_response"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsCompressResponseRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.CompressResponseRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -475,7 +475,7 @@ def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["redirect"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsRedirectRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.RedirectRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -535,7 +535,7 @@ def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["rewrite"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsRewriteRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.RewriteRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -595,7 +595,7 @@ def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["route"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsRouteRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.RouteRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -655,7 +655,7 @@ def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["score"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsScoreRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.ScoreRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -715,7 +715,7 @@ def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["serve_error"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsServeErrorRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.ServeErrorRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -775,7 +775,7 @@ def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["set_config"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsSetConfigRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.SetConfigRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -895,7 +895,7 @@ def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["set_cache_settings"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsSetCacheSettingsRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.SetCacheSettingsRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -971,16 +971,16 @@ def create(
| NotGiven = NOT_GIVEN,
action_parameters: rule_create_params.BlockRuleActionParameters
| object
- | rule_create_params.RulesetsCompressResponseRuleActionParameters
+ | rule_create_params.CompressResponseRuleActionParameters
| rule_create_params.ExecuteRuleActionParameters
- | rule_create_params.RulesetsRedirectRuleActionParameters
- | rule_create_params.RulesetsRewriteRuleActionParameters
- | rule_create_params.RulesetsRouteRuleActionParameters
- | rule_create_params.RulesetsScoreRuleActionParameters
- | rule_create_params.RulesetsServeErrorRuleActionParameters
- | rule_create_params.RulesetsSetConfigRuleActionParameters
+ | rule_create_params.RedirectRuleActionParameters
+ | rule_create_params.RewriteRuleActionParameters
+ | rule_create_params.RouteRuleActionParameters
+ | rule_create_params.ScoreRuleActionParameters
+ | rule_create_params.ServeErrorRuleActionParameters
+ | rule_create_params.SetConfigRuleActionParameters
| rule_create_params.SkipRuleActionParameters
- | rule_create_params.RulesetsSetCacheSettingsRuleActionParameters
+ | rule_create_params.SetCacheSettingsRuleActionParameters
| NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
@@ -1233,7 +1233,7 @@ def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["compress_response"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsCompressResponseRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.CompressResponseRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -1538,7 +1538,7 @@ def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["redirect"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsRedirectRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.RedirectRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -1599,7 +1599,7 @@ def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["rewrite"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsRewriteRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.RewriteRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -1660,7 +1660,7 @@ def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["route"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsRouteRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.RouteRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -1721,7 +1721,7 @@ def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["score"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsScoreRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.ScoreRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -1782,7 +1782,7 @@ def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["serve_error"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsServeErrorRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.ServeErrorRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -1843,7 +1843,7 @@ def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["set_config"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsSetConfigRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.SetConfigRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -1965,7 +1965,7 @@ def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["set_cache_settings"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsSetCacheSettingsRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.SetCacheSettingsRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -2059,16 +2059,16 @@ def edit(
| NotGiven = NOT_GIVEN,
action_parameters: rule_edit_params.BlockRuleActionParameters
| object
- | rule_edit_params.RulesetsCompressResponseRuleActionParameters
+ | rule_edit_params.CompressResponseRuleActionParameters
| rule_edit_params.ExecuteRuleActionParameters
- | rule_edit_params.RulesetsRedirectRuleActionParameters
- | rule_edit_params.RulesetsRewriteRuleActionParameters
- | rule_edit_params.RulesetsRouteRuleActionParameters
- | rule_edit_params.RulesetsScoreRuleActionParameters
- | rule_edit_params.RulesetsServeErrorRuleActionParameters
- | rule_edit_params.RulesetsSetConfigRuleActionParameters
+ | rule_edit_params.RedirectRuleActionParameters
+ | rule_edit_params.RewriteRuleActionParameters
+ | rule_edit_params.RouteRuleActionParameters
+ | rule_edit_params.ScoreRuleActionParameters
+ | rule_edit_params.ServeErrorRuleActionParameters
+ | rule_edit_params.SetConfigRuleActionParameters
| rule_edit_params.SkipRuleActionParameters
- | rule_edit_params.RulesetsSetCacheSettingsRuleActionParameters
+ | rule_edit_params.SetCacheSettingsRuleActionParameters
| NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
@@ -2265,7 +2265,7 @@ async def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["compress_response"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsCompressResponseRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.CompressResponseRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -2565,7 +2565,7 @@ async def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["redirect"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsRedirectRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.RedirectRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -2625,7 +2625,7 @@ async def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["rewrite"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsRewriteRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.RewriteRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -2685,7 +2685,7 @@ async def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["route"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsRouteRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.RouteRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -2745,7 +2745,7 @@ async def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["score"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsScoreRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.ScoreRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -2805,7 +2805,7 @@ async def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["serve_error"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsServeErrorRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.ServeErrorRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -2865,7 +2865,7 @@ async def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["set_config"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsSetConfigRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.SetConfigRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -2985,7 +2985,7 @@ async def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["set_cache_settings"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsSetCacheSettingsRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.SetCacheSettingsRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -3061,16 +3061,16 @@ async def create(
| NotGiven = NOT_GIVEN,
action_parameters: rule_create_params.BlockRuleActionParameters
| object
- | rule_create_params.RulesetsCompressResponseRuleActionParameters
+ | rule_create_params.CompressResponseRuleActionParameters
| rule_create_params.ExecuteRuleActionParameters
- | rule_create_params.RulesetsRedirectRuleActionParameters
- | rule_create_params.RulesetsRewriteRuleActionParameters
- | rule_create_params.RulesetsRouteRuleActionParameters
- | rule_create_params.RulesetsScoreRuleActionParameters
- | rule_create_params.RulesetsServeErrorRuleActionParameters
- | rule_create_params.RulesetsSetConfigRuleActionParameters
+ | rule_create_params.RedirectRuleActionParameters
+ | rule_create_params.RewriteRuleActionParameters
+ | rule_create_params.RouteRuleActionParameters
+ | rule_create_params.ScoreRuleActionParameters
+ | rule_create_params.ServeErrorRuleActionParameters
+ | rule_create_params.SetConfigRuleActionParameters
| rule_create_params.SkipRuleActionParameters
- | rule_create_params.RulesetsSetCacheSettingsRuleActionParameters
+ | rule_create_params.SetCacheSettingsRuleActionParameters
| NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
@@ -3323,7 +3323,7 @@ async def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["compress_response"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsCompressResponseRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.CompressResponseRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -3628,7 +3628,7 @@ async def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["redirect"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsRedirectRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.RedirectRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -3689,7 +3689,7 @@ async def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["rewrite"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsRewriteRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.RewriteRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -3750,7 +3750,7 @@ async def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["route"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsRouteRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.RouteRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -3811,7 +3811,7 @@ async def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["score"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsScoreRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.ScoreRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -3872,7 +3872,7 @@ async def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["serve_error"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsServeErrorRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.ServeErrorRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -3933,7 +3933,7 @@ async def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["set_config"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsSetConfigRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.SetConfigRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -4055,7 +4055,7 @@ async def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["set_cache_settings"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsSetCacheSettingsRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.SetCacheSettingsRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -4149,16 +4149,16 @@ async def edit(
| NotGiven = NOT_GIVEN,
action_parameters: rule_edit_params.BlockRuleActionParameters
| object
- | rule_edit_params.RulesetsCompressResponseRuleActionParameters
+ | rule_edit_params.CompressResponseRuleActionParameters
| rule_edit_params.ExecuteRuleActionParameters
- | rule_edit_params.RulesetsRedirectRuleActionParameters
- | rule_edit_params.RulesetsRewriteRuleActionParameters
- | rule_edit_params.RulesetsRouteRuleActionParameters
- | rule_edit_params.RulesetsScoreRuleActionParameters
- | rule_edit_params.RulesetsServeErrorRuleActionParameters
- | rule_edit_params.RulesetsSetConfigRuleActionParameters
+ | rule_edit_params.RedirectRuleActionParameters
+ | rule_edit_params.RewriteRuleActionParameters
+ | rule_edit_params.RouteRuleActionParameters
+ | rule_edit_params.ScoreRuleActionParameters
+ | rule_edit_params.ServeErrorRuleActionParameters
+ | rule_edit_params.SetConfigRuleActionParameters
| rule_edit_params.SkipRuleActionParameters
- | rule_edit_params.RulesetsSetCacheSettingsRuleActionParameters
+ | rule_edit_params.SetCacheSettingsRuleActionParameters
| NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/__init__.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/__init__.py
index 0b995bdf832..07bbce064b2 100644
--- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/__init__.py
+++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/__init__.py
@@ -1,5 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+from .tags import (
+ Tags,
+ AsyncTags,
+ TagsWithRawResponse,
+ AsyncTagsWithRawResponse,
+ TagsWithStreamingResponse,
+ AsyncTagsWithStreamingResponse,
+)
from .content import (
Content,
AsyncContent,
@@ -16,6 +24,14 @@
ScriptsWithStreamingResponse,
AsyncScriptsWithStreamingResponse,
)
+from .secrets import (
+ Secrets,
+ AsyncSecrets,
+ SecretsWithRawResponse,
+ AsyncSecretsWithRawResponse,
+ SecretsWithStreamingResponse,
+ AsyncSecretsWithStreamingResponse,
+)
from .bindings import (
Bindings,
AsyncBindings,
@@ -52,6 +68,18 @@
"AsyncBindingsWithRawResponse",
"BindingsWithStreamingResponse",
"AsyncBindingsWithStreamingResponse",
+ "Secrets",
+ "AsyncSecrets",
+ "SecretsWithRawResponse",
+ "AsyncSecretsWithRawResponse",
+ "SecretsWithStreamingResponse",
+ "AsyncSecretsWithStreamingResponse",
+ "Tags",
+ "AsyncTags",
+ "TagsWithRawResponse",
+ "AsyncTagsWithRawResponse",
+ "TagsWithStreamingResponse",
+ "AsyncTagsWithStreamingResponse",
"Scripts",
"AsyncScripts",
"ScriptsWithRawResponse",
diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py
index 3a82e2d2a85..4e7f2ed5fd7 100644
--- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py
+++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/scripts.py
@@ -6,6 +6,14 @@
import httpx
+from .tags import (
+ Tags,
+ AsyncTags,
+ TagsWithRawResponse,
+ AsyncTagsWithRawResponse,
+ TagsWithStreamingResponse,
+ AsyncTagsWithStreamingResponse,
+)
from .content import (
Content,
AsyncContent,
@@ -14,6 +22,14 @@
ContentWithStreamingResponse,
AsyncContentWithStreamingResponse,
)
+from .secrets import (
+ Secrets,
+ AsyncSecrets,
+ SecretsWithRawResponse,
+ AsyncSecretsWithRawResponse,
+ SecretsWithStreamingResponse,
+ AsyncSecretsWithStreamingResponse,
+)
from .bindings import (
Bindings,
AsyncBindings,
@@ -67,6 +83,14 @@ def settings(self) -> Settings:
def bindings(self) -> Bindings:
return Bindings(self._client)
+ @cached_property
+ def secrets(self) -> Secrets:
+ return Secrets(self._client)
+
+ @cached_property
+ def tags(self) -> Tags:
+ return Tags(self._client)
+
@cached_property
def with_raw_response(self) -> ScriptsWithRawResponse:
return ScriptsWithRawResponse(self)
@@ -328,6 +352,14 @@ def settings(self) -> AsyncSettings:
def bindings(self) -> AsyncBindings:
return AsyncBindings(self._client)
+ @cached_property
+ def secrets(self) -> AsyncSecrets:
+ return AsyncSecrets(self._client)
+
+ @cached_property
+ def tags(self) -> AsyncTags:
+ return AsyncTags(self._client)
+
@cached_property
def with_raw_response(self) -> AsyncScriptsWithRawResponse:
return AsyncScriptsWithRawResponse(self)
@@ -602,6 +634,14 @@ def settings(self) -> SettingsWithRawResponse:
def bindings(self) -> BindingsWithRawResponse:
return BindingsWithRawResponse(self._scripts.bindings)
+ @cached_property
+ def secrets(self) -> SecretsWithRawResponse:
+ return SecretsWithRawResponse(self._scripts.secrets)
+
+ @cached_property
+ def tags(self) -> TagsWithRawResponse:
+ return TagsWithRawResponse(self._scripts.tags)
+
class AsyncScriptsWithRawResponse:
def __init__(self, scripts: AsyncScripts) -> None:
@@ -629,6 +669,14 @@ def settings(self) -> AsyncSettingsWithRawResponse:
def bindings(self) -> AsyncBindingsWithRawResponse:
return AsyncBindingsWithRawResponse(self._scripts.bindings)
+ @cached_property
+ def secrets(self) -> AsyncSecretsWithRawResponse:
+ return AsyncSecretsWithRawResponse(self._scripts.secrets)
+
+ @cached_property
+ def tags(self) -> AsyncTagsWithRawResponse:
+ return AsyncTagsWithRawResponse(self._scripts.tags)
+
class ScriptsWithStreamingResponse:
def __init__(self, scripts: Scripts) -> None:
@@ -656,6 +704,14 @@ def settings(self) -> SettingsWithStreamingResponse:
def bindings(self) -> BindingsWithStreamingResponse:
return BindingsWithStreamingResponse(self._scripts.bindings)
+ @cached_property
+ def secrets(self) -> SecretsWithStreamingResponse:
+ return SecretsWithStreamingResponse(self._scripts.secrets)
+
+ @cached_property
+ def tags(self) -> TagsWithStreamingResponse:
+ return TagsWithStreamingResponse(self._scripts.tags)
+
class AsyncScriptsWithStreamingResponse:
def __init__(self, scripts: AsyncScripts) -> None:
@@ -682,3 +738,11 @@ def settings(self) -> AsyncSettingsWithStreamingResponse:
@cached_property
def bindings(self) -> AsyncBindingsWithStreamingResponse:
return AsyncBindingsWithStreamingResponse(self._scripts.bindings)
+
+ @cached_property
+ def secrets(self) -> AsyncSecretsWithStreamingResponse:
+ return AsyncSecretsWithStreamingResponse(self._scripts.secrets)
+
+ @cached_property
+ def tags(self) -> AsyncTagsWithStreamingResponse:
+ return AsyncTagsWithStreamingResponse(self._scripts.tags)
diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/secrets.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/secrets.py
new file mode 100644
index 00000000000..9aac5862840
--- /dev/null
+++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/secrets.py
@@ -0,0 +1,327 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Type, cast
+from typing_extensions import Literal
+
+import httpx
+
+from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ......_utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
+from ......_compat import cached_property
+from ......_resource import SyncAPIResource, AsyncAPIResource
+from ......_response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ......_wrappers import ResultWrapper
+from ......pagination import SyncSinglePage, AsyncSinglePage
+from ......_base_client import (
+ AsyncPaginator,
+ make_request_options,
+)
+from ......types.workers_for_platforms.dispatch.namespaces.scripts import (
+ SecretListResponse,
+ SecretUpdateResponse,
+ secret_update_params,
+)
+
+__all__ = ["Secrets", "AsyncSecrets"]
+
+
+class Secrets(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> SecretsWithRawResponse:
+ return SecretsWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> SecretsWithStreamingResponse:
+ return SecretsWithStreamingResponse(self)
+
+ def update(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ dispatch_namespace: str,
+ name: str | NotGiven = NOT_GIVEN,
+ text: str | NotGiven = NOT_GIVEN,
+ type: Literal["secret_text"] | NotGiven = NOT_GIVEN,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> SecretUpdateResponse:
+ """
+ Put secrets to a script uploaded to a Workers for Platforms namespace.
+
+ Args:
+ account_id: Identifier
+
+ dispatch_namespace: Name of the Workers for Platforms dispatch namespace.
+
+ script_name: Name of the script, used in URLs and route configuration.
+
+ name: The name of this secret, this is what will be to access it inside the Worker.
+
+ text: The value of the secret.
+
+ type: The type of secret to put.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not dispatch_namespace:
+ raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
+ if not script_name:
+ raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
+ return self._put(
+ f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets",
+ body=maybe_transform(
+ {
+ "name": name,
+ "text": text,
+ "type": type,
+ },
+ secret_update_params.SecretUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[SecretUpdateResponse], ResultWrapper[SecretUpdateResponse]),
+ )
+
+ def list(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ dispatch_namespace: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> SyncSinglePage[SecretListResponse]:
+ """
+ Fetch secrets from a script uploaded to a Workers for Platforms namespace.
+
+ Args:
+ account_id: Identifier
+
+ dispatch_namespace: Name of the Workers for Platforms dispatch namespace.
+
+ script_name: Name of the script, used in URLs and route configuration.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not dispatch_namespace:
+ raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
+ if not script_name:
+ raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets",
+ page=SyncSinglePage[SecretListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=SecretListResponse,
+ )
+
+
+class AsyncSecrets(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncSecretsWithRawResponse:
+ return AsyncSecretsWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncSecretsWithStreamingResponse:
+ return AsyncSecretsWithStreamingResponse(self)
+
+ async def update(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ dispatch_namespace: str,
+ name: str | NotGiven = NOT_GIVEN,
+ text: str | NotGiven = NOT_GIVEN,
+ type: Literal["secret_text"] | NotGiven = NOT_GIVEN,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> SecretUpdateResponse:
+ """
+ Put secrets to a script uploaded to a Workers for Platforms namespace.
+
+ Args:
+ account_id: Identifier
+
+ dispatch_namespace: Name of the Workers for Platforms dispatch namespace.
+
+ script_name: Name of the script, used in URLs and route configuration.
+
+ name: The name of this secret, this is what will be to access it inside the Worker.
+
+ text: The value of the secret.
+
+ type: The type of secret to put.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not dispatch_namespace:
+ raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
+ if not script_name:
+ raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
+ return await self._put(
+ f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets",
+ body=await async_maybe_transform(
+ {
+ "name": name,
+ "text": text,
+ "type": type,
+ },
+ secret_update_params.SecretUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[SecretUpdateResponse], ResultWrapper[SecretUpdateResponse]),
+ )
+
+ def list(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ dispatch_namespace: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> AsyncPaginator[SecretListResponse, AsyncSinglePage[SecretListResponse]]:
+ """
+ Fetch secrets from a script uploaded to a Workers for Platforms namespace.
+
+ Args:
+ account_id: Identifier
+
+ dispatch_namespace: Name of the Workers for Platforms dispatch namespace.
+
+ script_name: Name of the script, used in URLs and route configuration.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not dispatch_namespace:
+ raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
+ if not script_name:
+ raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/secrets",
+ page=AsyncSinglePage[SecretListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=SecretListResponse,
+ )
+
+
+class SecretsWithRawResponse:
+ def __init__(self, secrets: Secrets) -> None:
+ self._secrets = secrets
+
+ self.update = to_raw_response_wrapper(
+ secrets.update,
+ )
+ self.list = to_raw_response_wrapper(
+ secrets.list,
+ )
+
+
+class AsyncSecretsWithRawResponse:
+ def __init__(self, secrets: AsyncSecrets) -> None:
+ self._secrets = secrets
+
+ self.update = async_to_raw_response_wrapper(
+ secrets.update,
+ )
+ self.list = async_to_raw_response_wrapper(
+ secrets.list,
+ )
+
+
+class SecretsWithStreamingResponse:
+ def __init__(self, secrets: Secrets) -> None:
+ self._secrets = secrets
+
+ self.update = to_streamed_response_wrapper(
+ secrets.update,
+ )
+ self.list = to_streamed_response_wrapper(
+ secrets.list,
+ )
+
+
+class AsyncSecretsWithStreamingResponse:
+ def __init__(self, secrets: AsyncSecrets) -> None:
+ self._secrets = secrets
+
+ self.update = async_to_streamed_response_wrapper(
+ secrets.update,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ secrets.list,
+ )
diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/tags.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/tags.py
new file mode 100644
index 00000000000..188a42b443a
--- /dev/null
+++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/tags.py
@@ -0,0 +1,420 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import List, Type, cast
+
+import httpx
+
+from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ......_utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
+from ......_compat import cached_property
+from ......_resource import SyncAPIResource, AsyncAPIResource
+from ......_response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ......_wrappers import ResultWrapper
+from ......pagination import SyncSinglePage, AsyncSinglePage
+from ......_base_client import (
+ AsyncPaginator,
+ make_request_options,
+)
+from ......types.workers_for_platforms.dispatch.namespaces.scripts import (
+ TagListResponse,
+ TagUpdateResponse,
+ tag_update_params,
+)
+
+__all__ = ["Tags", "AsyncTags"]
+
+
+class Tags(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> TagsWithRawResponse:
+ return TagsWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> TagsWithStreamingResponse:
+ return TagsWithStreamingResponse(self)
+
+ def update(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ dispatch_namespace: str,
+ body: List[str],
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> TagUpdateResponse:
+ """
+ Put script tags for a script uploaded to a Workers for Platforms namespace.
+
+ Args:
+ account_id: Identifier
+
+ dispatch_namespace: Name of the Workers for Platforms dispatch namespace.
+
+ script_name: Name of the script, used in URLs and route configuration.
+
+ body: Tags to help you manage your Workers
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not dispatch_namespace:
+ raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
+ if not script_name:
+ raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
+ return self._put(
+ f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags",
+ body=maybe_transform(body, tag_update_params.TagUpdateParams),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[TagUpdateResponse], ResultWrapper[TagUpdateResponse]),
+ )
+
+ def list(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ dispatch_namespace: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> SyncSinglePage[TagListResponse]:
+ """
+ Fetch tags from a script uploaded to a Workers for Platforms namespace.
+
+ Args:
+ account_id: Identifier
+
+ dispatch_namespace: Name of the Workers for Platforms dispatch namespace.
+
+ script_name: Name of the script, used in URLs and route configuration.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not dispatch_namespace:
+ raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
+ if not script_name:
+ raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags",
+ page=SyncSinglePage[TagListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=str,
+ )
+
+ def delete(
+ self,
+ tag: str,
+ *,
+ account_id: str,
+ dispatch_namespace: str,
+ script_name: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> object:
+ """
+ Delete script tag for a script uploaded to a Workers for Platforms namespace.
+
+ Args:
+ account_id: Identifier
+
+ dispatch_namespace: Name of the Workers for Platforms dispatch namespace.
+
+ script_name: Name of the script, used in URLs and route configuration.
+
+ tag: Tag to help you manage your Worker
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not dispatch_namespace:
+ raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
+ if not script_name:
+ raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
+ if not tag:
+ raise ValueError(f"Expected a non-empty value for `tag` but received {tag!r}")
+ return self._delete(
+ f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags/{tag}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[object], ResultWrapper[object]),
+ )
+
+
+class AsyncTags(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncTagsWithRawResponse:
+ return AsyncTagsWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncTagsWithStreamingResponse:
+ return AsyncTagsWithStreamingResponse(self)
+
+ async def update(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ dispatch_namespace: str,
+ body: List[str],
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> TagUpdateResponse:
+ """
+ Put script tags for a script uploaded to a Workers for Platforms namespace.
+
+ Args:
+ account_id: Identifier
+
+ dispatch_namespace: Name of the Workers for Platforms dispatch namespace.
+
+ script_name: Name of the script, used in URLs and route configuration.
+
+ body: Tags to help you manage your Workers
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not dispatch_namespace:
+ raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
+ if not script_name:
+ raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
+ return await self._put(
+ f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags",
+ body=await async_maybe_transform(body, tag_update_params.TagUpdateParams),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[TagUpdateResponse], ResultWrapper[TagUpdateResponse]),
+ )
+
+ def list(
+ self,
+ script_name: str,
+ *,
+ account_id: str,
+ dispatch_namespace: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> AsyncPaginator[TagListResponse, AsyncSinglePage[TagListResponse]]:
+ """
+ Fetch tags from a script uploaded to a Workers for Platforms namespace.
+
+ Args:
+ account_id: Identifier
+
+ dispatch_namespace: Name of the Workers for Platforms dispatch namespace.
+
+ script_name: Name of the script, used in URLs and route configuration.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not dispatch_namespace:
+ raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
+ if not script_name:
+ raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags",
+ page=AsyncSinglePage[TagListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=str,
+ )
+
+ async def delete(
+ self,
+ tag: str,
+ *,
+ account_id: str,
+ dispatch_namespace: str,
+ script_name: str,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> object:
+ """
+ Delete script tag for a script uploaded to a Workers for Platforms namespace.
+
+ Args:
+ account_id: Identifier
+
+ dispatch_namespace: Name of the Workers for Platforms dispatch namespace.
+
+ script_name: Name of the script, used in URLs and route configuration.
+
+ tag: Tag to help you manage your Worker
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not dispatch_namespace:
+ raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
+ if not script_name:
+ raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
+ if not tag:
+ raise ValueError(f"Expected a non-empty value for `tag` but received {tag!r}")
+ return await self._delete(
+ f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/tags/{tag}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[object], ResultWrapper[object]),
+ )
+
+
+class TagsWithRawResponse:
+ def __init__(self, tags: Tags) -> None:
+ self._tags = tags
+
+ self.update = to_raw_response_wrapper(
+ tags.update,
+ )
+ self.list = to_raw_response_wrapper(
+ tags.list,
+ )
+ self.delete = to_raw_response_wrapper(
+ tags.delete,
+ )
+
+
+class AsyncTagsWithRawResponse:
+ def __init__(self, tags: AsyncTags) -> None:
+ self._tags = tags
+
+ self.update = async_to_raw_response_wrapper(
+ tags.update,
+ )
+ self.list = async_to_raw_response_wrapper(
+ tags.list,
+ )
+ self.delete = async_to_raw_response_wrapper(
+ tags.delete,
+ )
+
+
+class TagsWithStreamingResponse:
+ def __init__(self, tags: Tags) -> None:
+ self._tags = tags
+
+ self.update = to_streamed_response_wrapper(
+ tags.update,
+ )
+ self.list = to_streamed_response_wrapper(
+ tags.list,
+ )
+ self.delete = to_streamed_response_wrapper(
+ tags.delete,
+ )
+
+
+class AsyncTagsWithStreamingResponse:
+ def __init__(self, tags: AsyncTags) -> None:
+ self._tags = tags
+
+ self.update = async_to_streamed_response_wrapper(
+ tags.update,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ tags.list,
+ )
+ self.delete = async_to_streamed_response_wrapper(
+ tags.delete,
+ )
diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py
index 4b06fc7e734..827978ab0d0 100644
--- a/src/cloudflare/types/__init__.py
+++ b/src/cloudflare/types/__init__.py
@@ -37,7 +37,6 @@
from .setting import Setting as Setting
from .snippet import Snippet as Snippet
from .edge_ips import EdgeIPs as EdgeIPs
-from .hostname import Hostname as Hostname
from .settings import Settings as Settings
from .calls_app import CallsApp as CallsApp
from .dns_param import DNSParam as DNSParam
@@ -76,7 +75,6 @@
from .request_model import RequestModel as RequestModel
from .edge_ips_param import EdgeIPsParam as EdgeIPsParam
from .filter_options import FilterOptions as FilterOptions
-from .hostname_param import HostnameParam as HostnameParam
from .ip_list_params import IPListParams as IPListParams
from .labeled_region import LabeledRegion as LabeledRegion
from .migration_step import MigrationStep as MigrationStep
diff --git a/src/cloudflare/types/hostname.py b/src/cloudflare/types/hostname.py
deleted file mode 100644
index a4e440379c1..00000000000
--- a/src/cloudflare/types/hostname.py
+++ /dev/null
@@ -1,48 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import List, Optional
-from datetime import datetime
-from typing_extensions import Literal
-
-from .tunnel import Tunnel
-from .._models import BaseModel
-
-__all__ = ["Hostname"]
-
-
-class Hostname(BaseModel):
- id: str
- """Keyless certificate identifier tag."""
-
- created_on: datetime
- """When the Keyless SSL was created."""
-
- enabled: bool
- """Whether or not the Keyless SSL is on or off."""
-
- host: str
- """The keyless SSL name."""
-
- modified_on: datetime
- """When the Keyless SSL was last modified."""
-
- name: str
- """The keyless SSL name."""
-
- permissions: List[object]
- """
- Available permissions for the Keyless SSL for the current user requesting the
- item.
- """
-
- port: float
- """
- The keyless SSL port used to communicate between Cloudflare and the client's
- Keyless SSL server.
- """
-
- status: Literal["active", "deleted"]
- """Status of the Keyless SSL."""
-
- tunnel: Optional[Tunnel] = None
- """Configuration for using Keyless SSL through a Cloudflare Tunnel"""
diff --git a/src/cloudflare/types/hostname_param.py b/src/cloudflare/types/hostname_param.py
deleted file mode 100644
index 338408aac8b..00000000000
--- a/src/cloudflare/types/hostname_param.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-from typing_extensions import Required, TypedDict
-
-from .tunnel_param import TunnelParam
-
-__all__ = ["HostnameParam"]
-
-
-class HostnameParam(TypedDict, total=False):
- host: Required[str]
- """The keyless SSL name."""
-
- port: Required[float]
- """
- The keyless SSL port used to communicate between Cloudflare and the client's
- Keyless SSL server.
- """
-
- tunnel: TunnelParam
- """Configuration for using Keyless SSL through a Cloudflare Tunnel"""
diff --git a/src/cloudflare/types/ruleset_create_params.py b/src/cloudflare/types/ruleset_create_params.py
index 230242c5aa6..ed5e84c494e 100644
--- a/src/cloudflare/types/ruleset_create_params.py
+++ b/src/cloudflare/types/ruleset_create_params.py
@@ -2,69 +2,28 @@
from __future__ import annotations
-from typing import Dict, List, Union, Iterable
+from typing import Union, Iterable
from typing_extensions import Literal, Required, TypedDict
-from .rulesets import LoggingParam, LogRuleParam, SkipRuleParam, BlockRuleParam, ExecuteRuleParam
+from .rulesets import (
+ LogRuleParam,
+ SkipRuleParam,
+ BlockRuleParam,
+ RouteRuleParam,
+ ScoreRuleParam,
+ ExecuteRuleParam,
+ RewriteRuleParam,
+ RedirectRuleParam,
+ ChallengeRuleParam,
+ SetConfigRuleParam,
+ ServeErrorRuleParam,
+ JsChallengeRuleParam,
+ CompressResponseRuleParam,
+ ManagedChallengeRuleParam,
+ SetCacheSettingsRuleParam,
+)
-__all__ = [
- "RulesetCreateParams",
- "Rule",
- "RuleRulesetsChallengeRule",
- "RuleRulesetsCompressResponseRule",
- "RuleRulesetsCompressResponseRuleActionParameters",
- "RuleRulesetsCompressResponseRuleActionParametersAlgorithm",
- "RuleRulesetsJsChallengeRule",
- "RuleRulesetsManagedChallengeRule",
- "RuleRulesetsRedirectRule",
- "RuleRulesetsRedirectRuleActionParameters",
- "RuleRulesetsRedirectRuleActionParametersFromList",
- "RuleRulesetsRedirectRuleActionParametersFromValue",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURL",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
- "RuleRulesetsRewriteRule",
- "RuleRulesetsRewriteRuleActionParameters",
- "RuleRulesetsRewriteRuleActionParametersHeaders",
- "RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader",
- "RuleRulesetsRewriteRuleActionParametersURI",
- "RuleRulesetsRewriteRuleActionParametersURIPath",
- "RuleRulesetsRewriteRuleActionParametersURIPathStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue",
- "RuleRulesetsRewriteRuleActionParametersURIQuery",
- "RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue",
- "RuleRulesetsRouteRule",
- "RuleRulesetsRouteRuleActionParameters",
- "RuleRulesetsRouteRuleActionParametersOrigin",
- "RuleRulesetsRouteRuleActionParametersSni",
- "RuleRulesetsScoreRule",
- "RuleRulesetsScoreRuleActionParameters",
- "RuleRulesetsServeErrorRule",
- "RuleRulesetsServeErrorRuleActionParameters",
- "RuleRulesetsSetConfigRule",
- "RuleRulesetsSetConfigRuleActionParameters",
- "RuleRulesetsSetConfigRuleActionParametersAutominify",
- "RuleRulesetsSetCacheSettingsRule",
- "RuleRulesetsSetCacheSettingsRuleActionParameters",
- "RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
- "RuleRulesetsSetCacheSettingsRuleActionParametersServeStale",
-]
+__all__ = ["RulesetCreateParams", "Rule"]
class RulesetCreateParams(TypedDict, total=False):
@@ -116,798 +75,20 @@ class RulesetCreateParams(TypedDict, total=False):
"""An informative description of the ruleset."""
-class RuleRulesetsChallengeRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["challenge"]
- """The action to perform when the rule matches."""
-
- action_parameters: object
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsCompressResponseRuleActionParametersAlgorithm(TypedDict, total=False):
- name: Literal["none", "auto", "default", "gzip", "brotli"]
- """Name of compression algorithm to enable."""
-
-
-class RuleRulesetsCompressResponseRuleActionParameters(TypedDict, total=False):
- algorithms: Iterable[RuleRulesetsCompressResponseRuleActionParametersAlgorithm]
- """Custom order for compression algorithms."""
-
-
-class RuleRulesetsCompressResponseRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["compress_response"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsCompressResponseRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsJsChallengeRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["js_challenge"]
- """The action to perform when the rule matches."""
-
- action_parameters: object
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsManagedChallengeRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["managed_challenge"]
- """The action to perform when the rule matches."""
-
- action_parameters: object
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromList(TypedDict, total=False):
- key: str
- """Expression that evaluates to the list lookup key."""
-
- name: str
- """The name of the list to match against."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(TypedDict, total=False):
- value: str
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(TypedDict, total=False):
- expression: str
- """An expression to evaluate to get the URL to redirect the request to."""
-
-
-RuleRulesetsRedirectRuleActionParametersFromValueTargetURL = Union[
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
-]
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValue(TypedDict, total=False):
- preserve_query_string: bool
- """Keep the query string of the original request."""
-
- status_code: Literal[301, 302, 303, 307, 308]
- """The status code to be used for the redirect."""
-
- target_url: RuleRulesetsRedirectRuleActionParametersFromValueTargetURL
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParameters(TypedDict, total=False):
- from_list: RuleRulesetsRedirectRuleActionParametersFromList
- """Serve a redirect based on a bulk list lookup."""
-
- from_value: RuleRulesetsRedirectRuleActionParametersFromValue
- """Serve a redirect based on the request properties."""
-
-
-class RuleRulesetsRedirectRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["redirect"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsRedirectRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader(TypedDict, total=False):
- operation: Required[Literal["remove"]]
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader(TypedDict, total=False):
- operation: Required[Literal["set"]]
-
- value: Required[str]
- """Static value for the header."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader(TypedDict, total=False):
- expression: Required[str]
- """Expression for the header value."""
-
- operation: Required[Literal["set"]]
-
-
-RuleRulesetsRewriteRuleActionParametersHeaders = Union[
- RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathStaticValue(TypedDict, total=False):
- value: Required[str]
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue(TypedDict, total=False):
- expression: Required[str]
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIPath = Union[
- RuleRulesetsRewriteRuleActionParametersURIPathStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue(TypedDict, total=False):
- value: Required[str]
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue(TypedDict, total=False):
- expression: Required[str]
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIQuery = Union[
- RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURI(TypedDict, total=False):
- path: RuleRulesetsRewriteRuleActionParametersURIPath
- """Path portion rewrite."""
-
- query: RuleRulesetsRewriteRuleActionParametersURIQuery
- """Query portion rewrite."""
-
-
-class RuleRulesetsRewriteRuleActionParameters(TypedDict, total=False):
- headers: Dict[str, RuleRulesetsRewriteRuleActionParametersHeaders]
- """Map of request headers to modify."""
-
- uri: RuleRulesetsRewriteRuleActionParametersURI
- """URI to rewrite the request to."""
-
-
-class RuleRulesetsRewriteRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["rewrite"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsRewriteRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRouteRuleActionParametersOrigin(TypedDict, total=False):
- host: str
- """Override the resolved hostname."""
-
- port: float
- """Override the destination port."""
-
-
-class RuleRulesetsRouteRuleActionParametersSni(TypedDict, total=False):
- value: Required[str]
- """The SNI override."""
-
-
-class RuleRulesetsRouteRuleActionParameters(TypedDict, total=False):
- host_header: str
- """Rewrite the HTTP Host header."""
-
- origin: RuleRulesetsRouteRuleActionParametersOrigin
- """Override the IP/TCP destination."""
-
- sni: RuleRulesetsRouteRuleActionParametersSni
- """Override the Server Name Indication (SNI)."""
-
-
-class RuleRulesetsRouteRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["route"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsRouteRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsScoreRuleActionParameters(TypedDict, total=False):
- increment: int
- """
- Increment contains the delta to change the score and can be either positive or
- negative.
- """
-
-
-class RuleRulesetsScoreRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["score"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsScoreRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsServeErrorRuleActionParameters(TypedDict, total=False):
- content: str
- """Error response content."""
-
- content_type: Literal["application/json", "text/xml", "text/plain", "text/html"]
- """Content-type header to set with the response."""
-
- status_code: float
- """The status code to use for the error."""
-
-
-class RuleRulesetsServeErrorRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["serve_error"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsServeErrorRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetConfigRuleActionParametersAutominify(TypedDict, total=False):
- css: bool
- """Minify CSS files."""
-
- html: bool
- """Minify HTML files."""
-
- js: bool
- """Minify JS files."""
-
-
-class RuleRulesetsSetConfigRuleActionParameters(TypedDict, total=False):
- automatic_https_rewrites: bool
- """Turn on or off Automatic HTTPS Rewrites."""
-
- autominify: RuleRulesetsSetConfigRuleActionParametersAutominify
- """Select which file extensions to minify automatically."""
-
- bic: bool
- """Turn on or off Browser Integrity Check."""
-
- disable_apps: bool
- """Turn off all active Cloudflare Apps."""
-
- disable_zaraz: bool
- """Turn off Zaraz."""
-
- email_obfuscation: bool
- """Turn on or off Email Obfuscation."""
-
- hotlink_protection: bool
- """Turn on or off the Hotlink Protection."""
-
- mirage: bool
- """Turn on or off Mirage."""
-
- opportunistic_encryption: bool
- """Turn on or off Opportunistic Encryption."""
-
- polish: Literal["off", "lossless", "lossy"]
- """Configure the Polish level."""
-
- rocket_loader: bool
- """Turn on or off Rocket Loader"""
-
- security_level: Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]
- """Configure the Security Level."""
-
- server_side_excludes: bool
- """Turn on or off Server Side Excludes."""
-
- ssl: Literal["off", "flexible", "full", "strict", "origin_pull"]
- """Configure the SSL level."""
-
- sxg: bool
- """Turn on or off Signed Exchanges (SXG)."""
-
-
-class RuleRulesetsSetConfigRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["set_config"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsSetConfigRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL(TypedDict, total=False):
- mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]]
- """Determines which browser ttl mode to use."""
-
- default: int
- """The TTL (in seconds) if you choose override_origin mode."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(TypedDict, total=False):
- check_presence: List[str]
- """Checks for the presence of these cookie names.
-
- The presence of these cookies is used in building the cache key.
- """
-
- include: List[str]
- """Include these cookies' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(TypedDict, total=False):
- check_presence: List[str]
- """Checks for the presence of these header names.
-
- The presence of these headers is used in building the cache key.
- """
-
- exclude_origin: bool
- """Whether or not to include the origin header.
-
- A value of true will exclude the origin header in the cache key.
- """
-
- include: List[str]
- """Include these headers' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(TypedDict, total=False):
- resolved: bool
- """Use the resolved host in the cache key.
-
- A value of true will use the resolved host, while a value or false will use the
- original host.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(TypedDict, total=False):
- all: bool
- """Exclude all query string parameters from use in building the cache key."""
-
- list: List[str]
- """A list of query string parameters NOT used to build the cache key.
-
- All parameters present in the request but missing in this list will be used to
- build the cache key.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(TypedDict, total=False):
- all: bool
- """Use all query string parameters in the cache key."""
-
- list: List[str]
- """A list of query string parameters used to build the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(TypedDict, total=False):
- exclude: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude
- """
- build the cache key using all query string parameters EXCECPT these excluded
- parameters
- """
-
- include: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude
- """
- build the cache key using a list of query string parameters that ARE in the
- request.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(TypedDict, total=False):
- device_type: bool
- """Use the user agent's device type in the cache key."""
-
- geo: bool
- """Use the user agents's country in the cache key."""
-
- lang: bool
- """Use the user agent's language in the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey(TypedDict, total=False):
- cookie: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie
- """The cookies to include in building the cache key."""
-
- header: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader
- """The header names and values to include in building the cache key."""
-
- host: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost
- """Whether to use the original host or the resolved host in the cache key."""
-
- query_string: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString
- """
- Use the presence or absence of parameters in the query string to build the cache
- key.
- """
-
- user: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser
- """Characteristics of the request user agent used in building the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey(TypedDict, total=False):
- cache_by_device_type: bool
- """Separate cached content based on the visitor’s device type"""
-
- cache_deception_armor: bool
- """
- Protect from web cache deception attacks while allowing static assets to be
- cached
- """
-
- custom_key: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey
- """
- Customize which components of the request are included or excluded from the
- cache key.
- """
-
- ignore_query_strings_order: bool
- """
- Treat requests with the same query parameters the same, regardless of the order
- those query parameters are in. A value of true ignores the query strings' order.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve(TypedDict, total=False):
- eligible: Required[bool]
- """Determines whether cache reserve is enabled.
-
- If this is true and a request meets eligibility criteria, Cloudflare will write
- the resource to cache reserve.
- """
-
- min_file_size: Required[int]
- """The minimum file size eligible for store in cache reserve."""
-
-
-_RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords = TypedDict(
- "_RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords",
- {
- "from": int,
- },
- total=False,
-)
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(
- _RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords, total=False
-):
- to: Required[int]
- """response status code upper bound"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(TypedDict, total=False):
- value: Required[int]
- """Time to cache a response (in seconds).
-
- A value of 0 is equivalent to setting the Cache-Control header with the value
- "no-cache". A value of -1 is equivalent to setting Cache-Control header with the
- value of "no-store".
- """
-
- status_code_range: RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
- """The range of status codes used to apply the selected mode."""
-
- status_code_value: int
- """Set the ttl for responses with this specific status code"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL(TypedDict, total=False):
- default: Required[int]
- """The TTL (in seconds) if you choose override_origin mode."""
-
- mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]]
- """edge ttl options"""
-
- status_code_ttl: Required[Iterable[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]]
- """List of single status codes, or status code ranges to apply the selected mode"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersServeStale(TypedDict, total=False):
- disable_stale_while_updating: Required[bool]
- """Defines whether Cloudflare should serve stale content while updating.
-
- If true, Cloudflare will not serve stale content while getting the latest
- content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParameters(TypedDict, total=False):
- additional_cacheable_ports: Iterable[int]
- """List of additional ports that caching can be enabled on."""
-
- browser_ttl: RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL
- """Specify how long client browsers should cache the response.
-
- Cloudflare cache purge will not purge content cached on client browsers, so high
- browser TTLs may lead to stale content.
- """
-
- cache: bool
- """Mark whether the request’s response from origin is eligible for caching.
-
- Caching itself will still depend on the cache-control header and your other
- caching configurations.
- """
-
- cache_key: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey
- """
- Define which components of the request are included or excluded from the cache
- key Cloudflare uses to store the response in cache.
- """
-
- cache_reserve: RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve
- """
- Mark whether the request's response from origin is eligible for Cache Reserve
- (requires a Cache Reserve add-on plan).
- """
-
- edge_ttl: RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL
- """
- TTL (Time to Live) specifies the maximum time to cache a resource in the
- Cloudflare edge network.
- """
-
- origin_cache_control: bool
- """When enabled, Cloudflare will aim to strictly adhere to RFC 7234."""
-
- origin_error_page_passthru: bool
- """Generate Cloudflare error pages from issues sent from the origin server.
-
- When on, error pages will trigger for issues from the origin
- """
-
- read_timeout: int
- """
- Define a timeout value between two successive read operations to your origin
- server. Historically, the timeout value between two read options from Cloudflare
- to an origin server is 100 seconds. If you are attempting to reduce HTTP 524
- errors because of timeouts from an origin server, try increasing this timeout
- value.
- """
-
- respect_strong_etags: bool
- """
- Specify whether or not Cloudflare should respect strong ETag (entity tag)
- headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
- """
-
- serve_stale: RuleRulesetsSetCacheSettingsRuleActionParametersServeStale
- """
- Define if Cloudflare should serve stale content while getting the latest content
- from the origin. If on, Cloudflare will not serve stale content while getting
- the latest content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["set_cache_settings"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsSetCacheSettingsRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
Rule = Union[
BlockRuleParam,
- RuleRulesetsChallengeRule,
- RuleRulesetsCompressResponseRule,
+ ChallengeRuleParam,
+ CompressResponseRuleParam,
ExecuteRuleParam,
- RuleRulesetsJsChallengeRule,
+ JsChallengeRuleParam,
LogRuleParam,
- RuleRulesetsManagedChallengeRule,
- RuleRulesetsRedirectRule,
- RuleRulesetsRewriteRule,
- RuleRulesetsRouteRule,
- RuleRulesetsScoreRule,
- RuleRulesetsServeErrorRule,
- RuleRulesetsSetConfigRule,
+ ManagedChallengeRuleParam,
+ RedirectRuleParam,
+ RewriteRuleParam,
+ RouteRuleParam,
+ ScoreRuleParam,
+ ServeErrorRuleParam,
+ SetConfigRuleParam,
SkipRuleParam,
- RuleRulesetsSetCacheSettingsRule,
+ SetCacheSettingsRuleParam,
]
diff --git a/src/cloudflare/types/ruleset_create_response.py b/src/cloudflare/types/ruleset_create_response.py
index 983d53a5821..84bacfd8f1e 100644
--- a/src/cloudflare/types/ruleset_create_response.py
+++ b/src/cloudflare/types/ruleset_create_response.py
@@ -1,961 +1,46 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
-from pydantic import Field as FieldInfo
-
from .._models import BaseModel
-from .rulesets import Logging, LogRule, SkipRule, BlockRule, ExecuteRule
-
-__all__ = [
- "RulesetCreateResponse",
- "Rule",
- "RuleRulesetsChallengeRule",
- "RuleRulesetsCompressResponseRule",
- "RuleRulesetsCompressResponseRuleActionParameters",
- "RuleRulesetsCompressResponseRuleActionParametersAlgorithm",
- "RuleRulesetsJsChallengeRule",
- "RuleRulesetsManagedChallengeRule",
- "RuleRulesetsRedirectRule",
- "RuleRulesetsRedirectRuleActionParameters",
- "RuleRulesetsRedirectRuleActionParametersFromList",
- "RuleRulesetsRedirectRuleActionParametersFromValue",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURL",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
- "RuleRulesetsRewriteRule",
- "RuleRulesetsRewriteRuleActionParameters",
- "RuleRulesetsRewriteRuleActionParametersHeaders",
- "RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader",
- "RuleRulesetsRewriteRuleActionParametersURI",
- "RuleRulesetsRewriteRuleActionParametersURIPath",
- "RuleRulesetsRewriteRuleActionParametersURIPathStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue",
- "RuleRulesetsRewriteRuleActionParametersURIQuery",
- "RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue",
- "RuleRulesetsRouteRule",
- "RuleRulesetsRouteRuleActionParameters",
- "RuleRulesetsRouteRuleActionParametersOrigin",
- "RuleRulesetsRouteRuleActionParametersSni",
- "RuleRulesetsScoreRule",
- "RuleRulesetsScoreRuleActionParameters",
- "RuleRulesetsServeErrorRule",
- "RuleRulesetsServeErrorRuleActionParameters",
- "RuleRulesetsSetConfigRule",
- "RuleRulesetsSetConfigRuleActionParameters",
- "RuleRulesetsSetConfigRuleActionParametersAutominify",
- "RuleRulesetsSetCacheSettingsRule",
- "RuleRulesetsSetCacheSettingsRuleActionParameters",
- "RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
- "RuleRulesetsSetCacheSettingsRuleActionParametersServeStale",
-]
-
-
-class RuleRulesetsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsCompressResponseRuleActionParametersAlgorithm(BaseModel):
- name: Optional[Literal["none", "auto", "default", "gzip", "brotli"]] = None
- """Name of compression algorithm to enable."""
-
-
-class RuleRulesetsCompressResponseRuleActionParameters(BaseModel):
- algorithms: Optional[List[RuleRulesetsCompressResponseRuleActionParametersAlgorithm]] = None
- """Custom order for compression algorithms."""
-
-
-class RuleRulesetsCompressResponseRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["compress_response"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsCompressResponseRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsJsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["js_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsManagedChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["managed_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromList(BaseModel):
- key: Optional[str] = None
- """Expression that evaluates to the list lookup key."""
-
- name: Optional[str] = None
- """The name of the list to match against."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(BaseModel):
- value: Optional[str] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(BaseModel):
- expression: Optional[str] = None
- """An expression to evaluate to get the URL to redirect the request to."""
-
-
-RuleRulesetsRedirectRuleActionParametersFromValueTargetURL = Union[
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
-]
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValue(BaseModel):
- preserve_query_string: Optional[bool] = None
- """Keep the query string of the original request."""
-
- status_code: Optional[Literal[301, 302, 303, 307, 308]] = None
- """The status code to be used for the redirect."""
-
- target_url: Optional[RuleRulesetsRedirectRuleActionParametersFromValueTargetURL] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParameters(BaseModel):
- from_list: Optional[RuleRulesetsRedirectRuleActionParametersFromList] = None
- """Serve a redirect based on a bulk list lookup."""
-
- from_value: Optional[RuleRulesetsRedirectRuleActionParametersFromValue] = None
- """Serve a redirect based on the request properties."""
-
-
-class RuleRulesetsRedirectRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["redirect"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRedirectRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader(BaseModel):
- operation: Literal["remove"]
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader(BaseModel):
- operation: Literal["set"]
-
- value: str
- """Static value for the header."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader(BaseModel):
- expression: str
- """Expression for the header value."""
-
- operation: Literal["set"]
-
-
-RuleRulesetsRewriteRuleActionParametersHeaders = Union[
- RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIPath = Union[
- RuleRulesetsRewriteRuleActionParametersURIPathStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIQuery = Union[
- RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURI(BaseModel):
- path: Optional[RuleRulesetsRewriteRuleActionParametersURIPath] = None
- """Path portion rewrite."""
-
- query: Optional[RuleRulesetsRewriteRuleActionParametersURIQuery] = None
- """Query portion rewrite."""
-
-
-class RuleRulesetsRewriteRuleActionParameters(BaseModel):
- headers: Optional[Dict[str, RuleRulesetsRewriteRuleActionParametersHeaders]] = None
- """Map of request headers to modify."""
-
- uri: Optional[RuleRulesetsRewriteRuleActionParametersURI] = None
- """URI to rewrite the request to."""
-
-
-class RuleRulesetsRewriteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["rewrite"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRewriteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRouteRuleActionParametersOrigin(BaseModel):
- host: Optional[str] = None
- """Override the resolved hostname."""
-
- port: Optional[float] = None
- """Override the destination port."""
-
-
-class RuleRulesetsRouteRuleActionParametersSni(BaseModel):
- value: str
- """The SNI override."""
-
-
-class RuleRulesetsRouteRuleActionParameters(BaseModel):
- host_header: Optional[str] = None
- """Rewrite the HTTP Host header."""
-
- origin: Optional[RuleRulesetsRouteRuleActionParametersOrigin] = None
- """Override the IP/TCP destination."""
-
- sni: Optional[RuleRulesetsRouteRuleActionParametersSni] = None
- """Override the Server Name Indication (SNI)."""
-
-
-class RuleRulesetsRouteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["route"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRouteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsScoreRuleActionParameters(BaseModel):
- increment: Optional[int] = None
- """
- Increment contains the delta to change the score and can be either positive or
- negative.
- """
-
-
-class RuleRulesetsScoreRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["score"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsScoreRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsServeErrorRuleActionParameters(BaseModel):
- content: Optional[str] = None
- """Error response content."""
-
- content_type: Optional[Literal["application/json", "text/xml", "text/plain", "text/html"]] = None
- """Content-type header to set with the response."""
-
- status_code: Optional[float] = None
- """The status code to use for the error."""
-
-
-class RuleRulesetsServeErrorRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["serve_error"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsServeErrorRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetConfigRuleActionParametersAutominify(BaseModel):
- css: Optional[bool] = None
- """Minify CSS files."""
-
- html: Optional[bool] = None
- """Minify HTML files."""
-
- js: Optional[bool] = None
- """Minify JS files."""
-
-
-class RuleRulesetsSetConfigRuleActionParameters(BaseModel):
- automatic_https_rewrites: Optional[bool] = None
- """Turn on or off Automatic HTTPS Rewrites."""
-
- autominify: Optional[RuleRulesetsSetConfigRuleActionParametersAutominify] = None
- """Select which file extensions to minify automatically."""
-
- bic: Optional[bool] = None
- """Turn on or off Browser Integrity Check."""
-
- disable_apps: Optional[bool] = None
- """Turn off all active Cloudflare Apps."""
-
- disable_zaraz: Optional[bool] = None
- """Turn off Zaraz."""
-
- email_obfuscation: Optional[bool] = None
- """Turn on or off Email Obfuscation."""
-
- hotlink_protection: Optional[bool] = None
- """Turn on or off the Hotlink Protection."""
-
- mirage: Optional[bool] = None
- """Turn on or off Mirage."""
-
- opportunistic_encryption: Optional[bool] = None
- """Turn on or off Opportunistic Encryption."""
-
- polish: Optional[Literal["off", "lossless", "lossy"]] = None
- """Configure the Polish level."""
-
- rocket_loader: Optional[bool] = None
- """Turn on or off Rocket Loader"""
-
- security_level: Optional[Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]] = None
- """Configure the Security Level."""
-
- server_side_excludes: Optional[bool] = None
- """Turn on or off Server Side Excludes."""
-
- ssl: Optional[Literal["off", "flexible", "full", "strict", "origin_pull"]] = None
- """Configure the SSL level."""
-
- sxg: Optional[bool] = None
- """Turn on or off Signed Exchanges (SXG)."""
-
-
-class RuleRulesetsSetConfigRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_config"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetConfigRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL(BaseModel):
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """Determines which browser ttl mode to use."""
-
- default: Optional[int] = None
- """The TTL (in seconds) if you choose override_origin mode."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these cookie names.
-
- The presence of these cookies is used in building the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these cookies' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these header names.
-
- The presence of these headers is used in building the cache key.
- """
-
- exclude_origin: Optional[bool] = None
- """Whether or not to include the origin header.
-
- A value of true will exclude the origin header in the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these headers' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(BaseModel):
- resolved: Optional[bool] = None
- """Use the resolved host in the cache key.
-
- A value of true will use the resolved host, while a value or false will use the
- original host.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(BaseModel):
- all: Optional[bool] = None
- """Exclude all query string parameters from use in building the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters NOT used to build the cache key.
-
- All parameters present in the request but missing in this list will be used to
- build the cache key.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(BaseModel):
- all: Optional[bool] = None
- """Use all query string parameters in the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters used to build the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(BaseModel):
- exclude: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] = None
- """
- build the cache key using all query string parameters EXCECPT these excluded
- parameters
- """
-
- include: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] = None
- """
- build the cache key using a list of query string parameters that ARE in the
- request.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(BaseModel):
- device_type: Optional[bool] = None
- """Use the user agent's device type in the cache key."""
-
- geo: Optional[bool] = None
- """Use the user agents's country in the cache key."""
-
- lang: Optional[bool] = None
- """Use the user agent's language in the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey(BaseModel):
- cookie: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] = None
- """The cookies to include in building the cache key."""
-
- header: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] = None
- """The header names and values to include in building the cache key."""
-
- host: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] = None
- """Whether to use the original host or the resolved host in the cache key."""
-
- query_string: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] = None
- """
- Use the presence or absence of parameters in the query string to build the cache
- key.
- """
-
- user: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] = None
- """Characteristics of the request user agent used in building the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey(BaseModel):
- cache_by_device_type: Optional[bool] = None
- """Separate cached content based on the visitor’s device type"""
-
- cache_deception_armor: Optional[bool] = None
- """
- Protect from web cache deception attacks while allowing static assets to be
- cached
- """
-
- custom_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] = None
- """
- Customize which components of the request are included or excluded from the
- cache key.
- """
-
- ignore_query_strings_order: Optional[bool] = None
- """
- Treat requests with the same query parameters the same, regardless of the order
- those query parameters are in. A value of true ignores the query strings' order.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve(BaseModel):
- eligible: bool
- """Determines whether cache reserve is enabled.
-
- If this is true and a request meets eligibility criteria, Cloudflare will write
- the resource to cache reserve.
- """
-
- min_file_size: int
- """The minimum file size eligible for store in cache reserve."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(BaseModel):
- from_: int = FieldInfo(alias="from")
- """response status code lower bound"""
-
- to: int
- """response status code upper bound"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(BaseModel):
- value: int
- """Time to cache a response (in seconds).
-
- A value of 0 is equivalent to setting the Cache-Control header with the value
- "no-cache". A value of -1 is equivalent to setting Cache-Control header with the
- value of "no-store".
- """
-
- status_code_range: Optional[
- RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
- ] = None
- """The range of status codes used to apply the selected mode."""
-
- status_code_value: Optional[int] = None
- """Set the ttl for responses with this specific status code"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL(BaseModel):
- default: int
- """The TTL (in seconds) if you choose override_origin mode."""
-
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """edge ttl options"""
-
- status_code_ttl: List[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]
- """List of single status codes, or status code ranges to apply the selected mode"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersServeStale(BaseModel):
- disable_stale_while_updating: bool
- """Defines whether Cloudflare should serve stale content while updating.
-
- If true, Cloudflare will not serve stale content while getting the latest
- content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParameters(BaseModel):
- additional_cacheable_ports: Optional[List[int]] = None
- """List of additional ports that caching can be enabled on."""
-
- browser_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] = None
- """Specify how long client browsers should cache the response.
-
- Cloudflare cache purge will not purge content cached on client browsers, so high
- browser TTLs may lead to stale content.
- """
-
- cache: Optional[bool] = None
- """Mark whether the request’s response from origin is eligible for caching.
-
- Caching itself will still depend on the cache-control header and your other
- caching configurations.
- """
-
- cache_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey] = None
- """
- Define which components of the request are included or excluded from the cache
- key Cloudflare uses to store the response in cache.
- """
-
- cache_reserve: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve] = None
- """
- Mark whether the request's response from origin is eligible for Cache Reserve
- (requires a Cache Reserve add-on plan).
- """
-
- edge_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] = None
- """
- TTL (Time to Live) specifies the maximum time to cache a resource in the
- Cloudflare edge network.
- """
-
- origin_cache_control: Optional[bool] = None
- """When enabled, Cloudflare will aim to strictly adhere to RFC 7234."""
-
- origin_error_page_passthru: Optional[bool] = None
- """Generate Cloudflare error pages from issues sent from the origin server.
-
- When on, error pages will trigger for issues from the origin
- """
-
- read_timeout: Optional[int] = None
- """
- Define a timeout value between two successive read operations to your origin
- server. Historically, the timeout value between two read options from Cloudflare
- to an origin server is 100 seconds. If you are attempting to reduce HTTP 524
- errors because of timeouts from an origin server, try increasing this timeout
- value.
- """
-
- respect_strong_etags: Optional[bool] = None
- """
- Specify whether or not Cloudflare should respect strong ETag (entity tag)
- headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
- """
-
- serve_stale: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersServeStale] = None
- """
- Define if Cloudflare should serve stale content while getting the latest content
- from the origin. If on, Cloudflare will not serve stale content while getting
- the latest content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_cache_settings"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetCacheSettingsRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
+from .rulesets import (
+ LogRule,
+ SkipRule,
+ BlockRule,
+ RouteRule,
+ ScoreRule,
+ ExecuteRule,
+ RewriteRule,
+ RedirectRule,
+ ChallengeRule,
+ SetConfigRule,
+ ServeErrorRule,
+ JsChallengeRule,
+ CompressResponseRule,
+ ManagedChallengeRule,
+ SetCacheSettingsRule,
+)
+
+__all__ = ["RulesetCreateResponse", "Rule"]
Rule = Union[
BlockRule,
- RuleRulesetsChallengeRule,
- RuleRulesetsCompressResponseRule,
+ ChallengeRule,
+ CompressResponseRule,
ExecuteRule,
- RuleRulesetsJsChallengeRule,
+ JsChallengeRule,
LogRule,
- RuleRulesetsManagedChallengeRule,
- RuleRulesetsRedirectRule,
- RuleRulesetsRewriteRule,
- RuleRulesetsRouteRule,
- RuleRulesetsScoreRule,
- RuleRulesetsServeErrorRule,
- RuleRulesetsSetConfigRule,
+ ManagedChallengeRule,
+ RedirectRule,
+ RewriteRule,
+ RouteRule,
+ ScoreRule,
+ ServeErrorRule,
+ SetConfigRule,
SkipRule,
- RuleRulesetsSetCacheSettingsRule,
+ SetCacheSettingsRule,
]
diff --git a/src/cloudflare/types/ruleset_get_response.py b/src/cloudflare/types/ruleset_get_response.py
index 7171964af75..01e252fd950 100644
--- a/src/cloudflare/types/ruleset_get_response.py
+++ b/src/cloudflare/types/ruleset_get_response.py
@@ -1,961 +1,46 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
-from pydantic import Field as FieldInfo
-
from .._models import BaseModel
-from .rulesets import Logging, LogRule, SkipRule, BlockRule, ExecuteRule
-
-__all__ = [
- "RulesetGetResponse",
- "Rule",
- "RuleRulesetsChallengeRule",
- "RuleRulesetsCompressResponseRule",
- "RuleRulesetsCompressResponseRuleActionParameters",
- "RuleRulesetsCompressResponseRuleActionParametersAlgorithm",
- "RuleRulesetsJsChallengeRule",
- "RuleRulesetsManagedChallengeRule",
- "RuleRulesetsRedirectRule",
- "RuleRulesetsRedirectRuleActionParameters",
- "RuleRulesetsRedirectRuleActionParametersFromList",
- "RuleRulesetsRedirectRuleActionParametersFromValue",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURL",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
- "RuleRulesetsRewriteRule",
- "RuleRulesetsRewriteRuleActionParameters",
- "RuleRulesetsRewriteRuleActionParametersHeaders",
- "RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader",
- "RuleRulesetsRewriteRuleActionParametersURI",
- "RuleRulesetsRewriteRuleActionParametersURIPath",
- "RuleRulesetsRewriteRuleActionParametersURIPathStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue",
- "RuleRulesetsRewriteRuleActionParametersURIQuery",
- "RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue",
- "RuleRulesetsRouteRule",
- "RuleRulesetsRouteRuleActionParameters",
- "RuleRulesetsRouteRuleActionParametersOrigin",
- "RuleRulesetsRouteRuleActionParametersSni",
- "RuleRulesetsScoreRule",
- "RuleRulesetsScoreRuleActionParameters",
- "RuleRulesetsServeErrorRule",
- "RuleRulesetsServeErrorRuleActionParameters",
- "RuleRulesetsSetConfigRule",
- "RuleRulesetsSetConfigRuleActionParameters",
- "RuleRulesetsSetConfigRuleActionParametersAutominify",
- "RuleRulesetsSetCacheSettingsRule",
- "RuleRulesetsSetCacheSettingsRuleActionParameters",
- "RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
- "RuleRulesetsSetCacheSettingsRuleActionParametersServeStale",
-]
-
-
-class RuleRulesetsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsCompressResponseRuleActionParametersAlgorithm(BaseModel):
- name: Optional[Literal["none", "auto", "default", "gzip", "brotli"]] = None
- """Name of compression algorithm to enable."""
-
-
-class RuleRulesetsCompressResponseRuleActionParameters(BaseModel):
- algorithms: Optional[List[RuleRulesetsCompressResponseRuleActionParametersAlgorithm]] = None
- """Custom order for compression algorithms."""
-
-
-class RuleRulesetsCompressResponseRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["compress_response"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsCompressResponseRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsJsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["js_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsManagedChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["managed_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromList(BaseModel):
- key: Optional[str] = None
- """Expression that evaluates to the list lookup key."""
-
- name: Optional[str] = None
- """The name of the list to match against."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(BaseModel):
- value: Optional[str] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(BaseModel):
- expression: Optional[str] = None
- """An expression to evaluate to get the URL to redirect the request to."""
-
-
-RuleRulesetsRedirectRuleActionParametersFromValueTargetURL = Union[
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
-]
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValue(BaseModel):
- preserve_query_string: Optional[bool] = None
- """Keep the query string of the original request."""
-
- status_code: Optional[Literal[301, 302, 303, 307, 308]] = None
- """The status code to be used for the redirect."""
-
- target_url: Optional[RuleRulesetsRedirectRuleActionParametersFromValueTargetURL] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParameters(BaseModel):
- from_list: Optional[RuleRulesetsRedirectRuleActionParametersFromList] = None
- """Serve a redirect based on a bulk list lookup."""
-
- from_value: Optional[RuleRulesetsRedirectRuleActionParametersFromValue] = None
- """Serve a redirect based on the request properties."""
-
-
-class RuleRulesetsRedirectRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["redirect"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRedirectRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader(BaseModel):
- operation: Literal["remove"]
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader(BaseModel):
- operation: Literal["set"]
-
- value: str
- """Static value for the header."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader(BaseModel):
- expression: str
- """Expression for the header value."""
-
- operation: Literal["set"]
-
-
-RuleRulesetsRewriteRuleActionParametersHeaders = Union[
- RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIPath = Union[
- RuleRulesetsRewriteRuleActionParametersURIPathStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIQuery = Union[
- RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURI(BaseModel):
- path: Optional[RuleRulesetsRewriteRuleActionParametersURIPath] = None
- """Path portion rewrite."""
-
- query: Optional[RuleRulesetsRewriteRuleActionParametersURIQuery] = None
- """Query portion rewrite."""
-
-
-class RuleRulesetsRewriteRuleActionParameters(BaseModel):
- headers: Optional[Dict[str, RuleRulesetsRewriteRuleActionParametersHeaders]] = None
- """Map of request headers to modify."""
-
- uri: Optional[RuleRulesetsRewriteRuleActionParametersURI] = None
- """URI to rewrite the request to."""
-
-
-class RuleRulesetsRewriteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["rewrite"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRewriteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRouteRuleActionParametersOrigin(BaseModel):
- host: Optional[str] = None
- """Override the resolved hostname."""
-
- port: Optional[float] = None
- """Override the destination port."""
-
-
-class RuleRulesetsRouteRuleActionParametersSni(BaseModel):
- value: str
- """The SNI override."""
-
-
-class RuleRulesetsRouteRuleActionParameters(BaseModel):
- host_header: Optional[str] = None
- """Rewrite the HTTP Host header."""
-
- origin: Optional[RuleRulesetsRouteRuleActionParametersOrigin] = None
- """Override the IP/TCP destination."""
-
- sni: Optional[RuleRulesetsRouteRuleActionParametersSni] = None
- """Override the Server Name Indication (SNI)."""
-
-
-class RuleRulesetsRouteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["route"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRouteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsScoreRuleActionParameters(BaseModel):
- increment: Optional[int] = None
- """
- Increment contains the delta to change the score and can be either positive or
- negative.
- """
-
-
-class RuleRulesetsScoreRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["score"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsScoreRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsServeErrorRuleActionParameters(BaseModel):
- content: Optional[str] = None
- """Error response content."""
-
- content_type: Optional[Literal["application/json", "text/xml", "text/plain", "text/html"]] = None
- """Content-type header to set with the response."""
-
- status_code: Optional[float] = None
- """The status code to use for the error."""
-
-
-class RuleRulesetsServeErrorRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["serve_error"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsServeErrorRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetConfigRuleActionParametersAutominify(BaseModel):
- css: Optional[bool] = None
- """Minify CSS files."""
-
- html: Optional[bool] = None
- """Minify HTML files."""
-
- js: Optional[bool] = None
- """Minify JS files."""
-
-
-class RuleRulesetsSetConfigRuleActionParameters(BaseModel):
- automatic_https_rewrites: Optional[bool] = None
- """Turn on or off Automatic HTTPS Rewrites."""
-
- autominify: Optional[RuleRulesetsSetConfigRuleActionParametersAutominify] = None
- """Select which file extensions to minify automatically."""
-
- bic: Optional[bool] = None
- """Turn on or off Browser Integrity Check."""
-
- disable_apps: Optional[bool] = None
- """Turn off all active Cloudflare Apps."""
-
- disable_zaraz: Optional[bool] = None
- """Turn off Zaraz."""
-
- email_obfuscation: Optional[bool] = None
- """Turn on or off Email Obfuscation."""
-
- hotlink_protection: Optional[bool] = None
- """Turn on or off the Hotlink Protection."""
-
- mirage: Optional[bool] = None
- """Turn on or off Mirage."""
-
- opportunistic_encryption: Optional[bool] = None
- """Turn on or off Opportunistic Encryption."""
-
- polish: Optional[Literal["off", "lossless", "lossy"]] = None
- """Configure the Polish level."""
-
- rocket_loader: Optional[bool] = None
- """Turn on or off Rocket Loader"""
-
- security_level: Optional[Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]] = None
- """Configure the Security Level."""
-
- server_side_excludes: Optional[bool] = None
- """Turn on or off Server Side Excludes."""
-
- ssl: Optional[Literal["off", "flexible", "full", "strict", "origin_pull"]] = None
- """Configure the SSL level."""
-
- sxg: Optional[bool] = None
- """Turn on or off Signed Exchanges (SXG)."""
-
-
-class RuleRulesetsSetConfigRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_config"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetConfigRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL(BaseModel):
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """Determines which browser ttl mode to use."""
-
- default: Optional[int] = None
- """The TTL (in seconds) if you choose override_origin mode."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these cookie names.
-
- The presence of these cookies is used in building the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these cookies' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these header names.
-
- The presence of these headers is used in building the cache key.
- """
-
- exclude_origin: Optional[bool] = None
- """Whether or not to include the origin header.
-
- A value of true will exclude the origin header in the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these headers' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(BaseModel):
- resolved: Optional[bool] = None
- """Use the resolved host in the cache key.
-
- A value of true will use the resolved host, while a value or false will use the
- original host.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(BaseModel):
- all: Optional[bool] = None
- """Exclude all query string parameters from use in building the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters NOT used to build the cache key.
-
- All parameters present in the request but missing in this list will be used to
- build the cache key.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(BaseModel):
- all: Optional[bool] = None
- """Use all query string parameters in the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters used to build the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(BaseModel):
- exclude: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] = None
- """
- build the cache key using all query string parameters EXCECPT these excluded
- parameters
- """
-
- include: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] = None
- """
- build the cache key using a list of query string parameters that ARE in the
- request.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(BaseModel):
- device_type: Optional[bool] = None
- """Use the user agent's device type in the cache key."""
-
- geo: Optional[bool] = None
- """Use the user agents's country in the cache key."""
-
- lang: Optional[bool] = None
- """Use the user agent's language in the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey(BaseModel):
- cookie: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] = None
- """The cookies to include in building the cache key."""
-
- header: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] = None
- """The header names and values to include in building the cache key."""
-
- host: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] = None
- """Whether to use the original host or the resolved host in the cache key."""
-
- query_string: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] = None
- """
- Use the presence or absence of parameters in the query string to build the cache
- key.
- """
-
- user: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] = None
- """Characteristics of the request user agent used in building the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey(BaseModel):
- cache_by_device_type: Optional[bool] = None
- """Separate cached content based on the visitor’s device type"""
-
- cache_deception_armor: Optional[bool] = None
- """
- Protect from web cache deception attacks while allowing static assets to be
- cached
- """
-
- custom_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] = None
- """
- Customize which components of the request are included or excluded from the
- cache key.
- """
-
- ignore_query_strings_order: Optional[bool] = None
- """
- Treat requests with the same query parameters the same, regardless of the order
- those query parameters are in. A value of true ignores the query strings' order.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve(BaseModel):
- eligible: bool
- """Determines whether cache reserve is enabled.
-
- If this is true and a request meets eligibility criteria, Cloudflare will write
- the resource to cache reserve.
- """
-
- min_file_size: int
- """The minimum file size eligible for store in cache reserve."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(BaseModel):
- from_: int = FieldInfo(alias="from")
- """response status code lower bound"""
-
- to: int
- """response status code upper bound"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(BaseModel):
- value: int
- """Time to cache a response (in seconds).
-
- A value of 0 is equivalent to setting the Cache-Control header with the value
- "no-cache". A value of -1 is equivalent to setting Cache-Control header with the
- value of "no-store".
- """
-
- status_code_range: Optional[
- RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
- ] = None
- """The range of status codes used to apply the selected mode."""
-
- status_code_value: Optional[int] = None
- """Set the ttl for responses with this specific status code"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL(BaseModel):
- default: int
- """The TTL (in seconds) if you choose override_origin mode."""
-
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """edge ttl options"""
-
- status_code_ttl: List[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]
- """List of single status codes, or status code ranges to apply the selected mode"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersServeStale(BaseModel):
- disable_stale_while_updating: bool
- """Defines whether Cloudflare should serve stale content while updating.
-
- If true, Cloudflare will not serve stale content while getting the latest
- content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParameters(BaseModel):
- additional_cacheable_ports: Optional[List[int]] = None
- """List of additional ports that caching can be enabled on."""
-
- browser_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] = None
- """Specify how long client browsers should cache the response.
-
- Cloudflare cache purge will not purge content cached on client browsers, so high
- browser TTLs may lead to stale content.
- """
-
- cache: Optional[bool] = None
- """Mark whether the request’s response from origin is eligible for caching.
-
- Caching itself will still depend on the cache-control header and your other
- caching configurations.
- """
-
- cache_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey] = None
- """
- Define which components of the request are included or excluded from the cache
- key Cloudflare uses to store the response in cache.
- """
-
- cache_reserve: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve] = None
- """
- Mark whether the request's response from origin is eligible for Cache Reserve
- (requires a Cache Reserve add-on plan).
- """
-
- edge_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] = None
- """
- TTL (Time to Live) specifies the maximum time to cache a resource in the
- Cloudflare edge network.
- """
-
- origin_cache_control: Optional[bool] = None
- """When enabled, Cloudflare will aim to strictly adhere to RFC 7234."""
-
- origin_error_page_passthru: Optional[bool] = None
- """Generate Cloudflare error pages from issues sent from the origin server.
-
- When on, error pages will trigger for issues from the origin
- """
-
- read_timeout: Optional[int] = None
- """
- Define a timeout value between two successive read operations to your origin
- server. Historically, the timeout value between two read options from Cloudflare
- to an origin server is 100 seconds. If you are attempting to reduce HTTP 524
- errors because of timeouts from an origin server, try increasing this timeout
- value.
- """
-
- respect_strong_etags: Optional[bool] = None
- """
- Specify whether or not Cloudflare should respect strong ETag (entity tag)
- headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
- """
-
- serve_stale: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersServeStale] = None
- """
- Define if Cloudflare should serve stale content while getting the latest content
- from the origin. If on, Cloudflare will not serve stale content while getting
- the latest content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_cache_settings"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetCacheSettingsRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
+from .rulesets import (
+ LogRule,
+ SkipRule,
+ BlockRule,
+ RouteRule,
+ ScoreRule,
+ ExecuteRule,
+ RewriteRule,
+ RedirectRule,
+ ChallengeRule,
+ SetConfigRule,
+ ServeErrorRule,
+ JsChallengeRule,
+ CompressResponseRule,
+ ManagedChallengeRule,
+ SetCacheSettingsRule,
+)
+
+__all__ = ["RulesetGetResponse", "Rule"]
Rule = Union[
BlockRule,
- RuleRulesetsChallengeRule,
- RuleRulesetsCompressResponseRule,
+ ChallengeRule,
+ CompressResponseRule,
ExecuteRule,
- RuleRulesetsJsChallengeRule,
+ JsChallengeRule,
LogRule,
- RuleRulesetsManagedChallengeRule,
- RuleRulesetsRedirectRule,
- RuleRulesetsRewriteRule,
- RuleRulesetsRouteRule,
- RuleRulesetsScoreRule,
- RuleRulesetsServeErrorRule,
- RuleRulesetsSetConfigRule,
+ ManagedChallengeRule,
+ RedirectRule,
+ RewriteRule,
+ RouteRule,
+ ScoreRule,
+ ServeErrorRule,
+ SetConfigRule,
SkipRule,
- RuleRulesetsSetCacheSettingsRule,
+ SetCacheSettingsRule,
]
diff --git a/src/cloudflare/types/ruleset_update_params.py b/src/cloudflare/types/ruleset_update_params.py
index 4de369133c1..d0d49b584e1 100644
--- a/src/cloudflare/types/ruleset_update_params.py
+++ b/src/cloudflare/types/ruleset_update_params.py
@@ -2,69 +2,28 @@
from __future__ import annotations
-from typing import Dict, List, Union, Iterable
+from typing import Union, Iterable
from typing_extensions import Literal, Required, TypedDict
-from .rulesets import LoggingParam, LogRuleParam, SkipRuleParam, BlockRuleParam, ExecuteRuleParam
+from .rulesets import (
+ LogRuleParam,
+ SkipRuleParam,
+ BlockRuleParam,
+ RouteRuleParam,
+ ScoreRuleParam,
+ ExecuteRuleParam,
+ RewriteRuleParam,
+ RedirectRuleParam,
+ ChallengeRuleParam,
+ SetConfigRuleParam,
+ ServeErrorRuleParam,
+ JsChallengeRuleParam,
+ CompressResponseRuleParam,
+ ManagedChallengeRuleParam,
+ SetCacheSettingsRuleParam,
+)
-__all__ = [
- "RulesetUpdateParams",
- "Rule",
- "RuleRulesetsChallengeRule",
- "RuleRulesetsCompressResponseRule",
- "RuleRulesetsCompressResponseRuleActionParameters",
- "RuleRulesetsCompressResponseRuleActionParametersAlgorithm",
- "RuleRulesetsJsChallengeRule",
- "RuleRulesetsManagedChallengeRule",
- "RuleRulesetsRedirectRule",
- "RuleRulesetsRedirectRuleActionParameters",
- "RuleRulesetsRedirectRuleActionParametersFromList",
- "RuleRulesetsRedirectRuleActionParametersFromValue",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURL",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
- "RuleRulesetsRewriteRule",
- "RuleRulesetsRewriteRuleActionParameters",
- "RuleRulesetsRewriteRuleActionParametersHeaders",
- "RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader",
- "RuleRulesetsRewriteRuleActionParametersURI",
- "RuleRulesetsRewriteRuleActionParametersURIPath",
- "RuleRulesetsRewriteRuleActionParametersURIPathStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue",
- "RuleRulesetsRewriteRuleActionParametersURIQuery",
- "RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue",
- "RuleRulesetsRouteRule",
- "RuleRulesetsRouteRuleActionParameters",
- "RuleRulesetsRouteRuleActionParametersOrigin",
- "RuleRulesetsRouteRuleActionParametersSni",
- "RuleRulesetsScoreRule",
- "RuleRulesetsScoreRuleActionParameters",
- "RuleRulesetsServeErrorRule",
- "RuleRulesetsServeErrorRuleActionParameters",
- "RuleRulesetsSetConfigRule",
- "RuleRulesetsSetConfigRuleActionParameters",
- "RuleRulesetsSetConfigRuleActionParametersAutominify",
- "RuleRulesetsSetCacheSettingsRule",
- "RuleRulesetsSetCacheSettingsRuleActionParameters",
- "RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
- "RuleRulesetsSetCacheSettingsRuleActionParametersServeStale",
-]
+__all__ = ["RulesetUpdateParams", "Rule"]
class RulesetUpdateParams(TypedDict, total=False):
@@ -114,798 +73,20 @@ class RulesetUpdateParams(TypedDict, total=False):
"""The phase of the ruleset."""
-class RuleRulesetsChallengeRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["challenge"]
- """The action to perform when the rule matches."""
-
- action_parameters: object
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsCompressResponseRuleActionParametersAlgorithm(TypedDict, total=False):
- name: Literal["none", "auto", "default", "gzip", "brotli"]
- """Name of compression algorithm to enable."""
-
-
-class RuleRulesetsCompressResponseRuleActionParameters(TypedDict, total=False):
- algorithms: Iterable[RuleRulesetsCompressResponseRuleActionParametersAlgorithm]
- """Custom order for compression algorithms."""
-
-
-class RuleRulesetsCompressResponseRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["compress_response"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsCompressResponseRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsJsChallengeRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["js_challenge"]
- """The action to perform when the rule matches."""
-
- action_parameters: object
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsManagedChallengeRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["managed_challenge"]
- """The action to perform when the rule matches."""
-
- action_parameters: object
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromList(TypedDict, total=False):
- key: str
- """Expression that evaluates to the list lookup key."""
-
- name: str
- """The name of the list to match against."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(TypedDict, total=False):
- value: str
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(TypedDict, total=False):
- expression: str
- """An expression to evaluate to get the URL to redirect the request to."""
-
-
-RuleRulesetsRedirectRuleActionParametersFromValueTargetURL = Union[
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
-]
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValue(TypedDict, total=False):
- preserve_query_string: bool
- """Keep the query string of the original request."""
-
- status_code: Literal[301, 302, 303, 307, 308]
- """The status code to be used for the redirect."""
-
- target_url: RuleRulesetsRedirectRuleActionParametersFromValueTargetURL
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParameters(TypedDict, total=False):
- from_list: RuleRulesetsRedirectRuleActionParametersFromList
- """Serve a redirect based on a bulk list lookup."""
-
- from_value: RuleRulesetsRedirectRuleActionParametersFromValue
- """Serve a redirect based on the request properties."""
-
-
-class RuleRulesetsRedirectRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["redirect"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsRedirectRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader(TypedDict, total=False):
- operation: Required[Literal["remove"]]
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader(TypedDict, total=False):
- operation: Required[Literal["set"]]
-
- value: Required[str]
- """Static value for the header."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader(TypedDict, total=False):
- expression: Required[str]
- """Expression for the header value."""
-
- operation: Required[Literal["set"]]
-
-
-RuleRulesetsRewriteRuleActionParametersHeaders = Union[
- RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathStaticValue(TypedDict, total=False):
- value: Required[str]
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue(TypedDict, total=False):
- expression: Required[str]
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIPath = Union[
- RuleRulesetsRewriteRuleActionParametersURIPathStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue(TypedDict, total=False):
- value: Required[str]
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue(TypedDict, total=False):
- expression: Required[str]
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIQuery = Union[
- RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURI(TypedDict, total=False):
- path: RuleRulesetsRewriteRuleActionParametersURIPath
- """Path portion rewrite."""
-
- query: RuleRulesetsRewriteRuleActionParametersURIQuery
- """Query portion rewrite."""
-
-
-class RuleRulesetsRewriteRuleActionParameters(TypedDict, total=False):
- headers: Dict[str, RuleRulesetsRewriteRuleActionParametersHeaders]
- """Map of request headers to modify."""
-
- uri: RuleRulesetsRewriteRuleActionParametersURI
- """URI to rewrite the request to."""
-
-
-class RuleRulesetsRewriteRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["rewrite"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsRewriteRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRouteRuleActionParametersOrigin(TypedDict, total=False):
- host: str
- """Override the resolved hostname."""
-
- port: float
- """Override the destination port."""
-
-
-class RuleRulesetsRouteRuleActionParametersSni(TypedDict, total=False):
- value: Required[str]
- """The SNI override."""
-
-
-class RuleRulesetsRouteRuleActionParameters(TypedDict, total=False):
- host_header: str
- """Rewrite the HTTP Host header."""
-
- origin: RuleRulesetsRouteRuleActionParametersOrigin
- """Override the IP/TCP destination."""
-
- sni: RuleRulesetsRouteRuleActionParametersSni
- """Override the Server Name Indication (SNI)."""
-
-
-class RuleRulesetsRouteRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["route"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsRouteRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsScoreRuleActionParameters(TypedDict, total=False):
- increment: int
- """
- Increment contains the delta to change the score and can be either positive or
- negative.
- """
-
-
-class RuleRulesetsScoreRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["score"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsScoreRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsServeErrorRuleActionParameters(TypedDict, total=False):
- content: str
- """Error response content."""
-
- content_type: Literal["application/json", "text/xml", "text/plain", "text/html"]
- """Content-type header to set with the response."""
-
- status_code: float
- """The status code to use for the error."""
-
-
-class RuleRulesetsServeErrorRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["serve_error"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsServeErrorRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetConfigRuleActionParametersAutominify(TypedDict, total=False):
- css: bool
- """Minify CSS files."""
-
- html: bool
- """Minify HTML files."""
-
- js: bool
- """Minify JS files."""
-
-
-class RuleRulesetsSetConfigRuleActionParameters(TypedDict, total=False):
- automatic_https_rewrites: bool
- """Turn on or off Automatic HTTPS Rewrites."""
-
- autominify: RuleRulesetsSetConfigRuleActionParametersAutominify
- """Select which file extensions to minify automatically."""
-
- bic: bool
- """Turn on or off Browser Integrity Check."""
-
- disable_apps: bool
- """Turn off all active Cloudflare Apps."""
-
- disable_zaraz: bool
- """Turn off Zaraz."""
-
- email_obfuscation: bool
- """Turn on or off Email Obfuscation."""
-
- hotlink_protection: bool
- """Turn on or off the Hotlink Protection."""
-
- mirage: bool
- """Turn on or off Mirage."""
-
- opportunistic_encryption: bool
- """Turn on or off Opportunistic Encryption."""
-
- polish: Literal["off", "lossless", "lossy"]
- """Configure the Polish level."""
-
- rocket_loader: bool
- """Turn on or off Rocket Loader"""
-
- security_level: Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]
- """Configure the Security Level."""
-
- server_side_excludes: bool
- """Turn on or off Server Side Excludes."""
-
- ssl: Literal["off", "flexible", "full", "strict", "origin_pull"]
- """Configure the SSL level."""
-
- sxg: bool
- """Turn on or off Signed Exchanges (SXG)."""
-
-
-class RuleRulesetsSetConfigRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["set_config"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsSetConfigRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL(TypedDict, total=False):
- mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]]
- """Determines which browser ttl mode to use."""
-
- default: int
- """The TTL (in seconds) if you choose override_origin mode."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(TypedDict, total=False):
- check_presence: List[str]
- """Checks for the presence of these cookie names.
-
- The presence of these cookies is used in building the cache key.
- """
-
- include: List[str]
- """Include these cookies' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(TypedDict, total=False):
- check_presence: List[str]
- """Checks for the presence of these header names.
-
- The presence of these headers is used in building the cache key.
- """
-
- exclude_origin: bool
- """Whether or not to include the origin header.
-
- A value of true will exclude the origin header in the cache key.
- """
-
- include: List[str]
- """Include these headers' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(TypedDict, total=False):
- resolved: bool
- """Use the resolved host in the cache key.
-
- A value of true will use the resolved host, while a value or false will use the
- original host.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(TypedDict, total=False):
- all: bool
- """Exclude all query string parameters from use in building the cache key."""
-
- list: List[str]
- """A list of query string parameters NOT used to build the cache key.
-
- All parameters present in the request but missing in this list will be used to
- build the cache key.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(TypedDict, total=False):
- all: bool
- """Use all query string parameters in the cache key."""
-
- list: List[str]
- """A list of query string parameters used to build the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(TypedDict, total=False):
- exclude: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude
- """
- build the cache key using all query string parameters EXCECPT these excluded
- parameters
- """
-
- include: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude
- """
- build the cache key using a list of query string parameters that ARE in the
- request.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(TypedDict, total=False):
- device_type: bool
- """Use the user agent's device type in the cache key."""
-
- geo: bool
- """Use the user agents's country in the cache key."""
-
- lang: bool
- """Use the user agent's language in the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey(TypedDict, total=False):
- cookie: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie
- """The cookies to include in building the cache key."""
-
- header: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader
- """The header names and values to include in building the cache key."""
-
- host: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost
- """Whether to use the original host or the resolved host in the cache key."""
-
- query_string: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString
- """
- Use the presence or absence of parameters in the query string to build the cache
- key.
- """
-
- user: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser
- """Characteristics of the request user agent used in building the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey(TypedDict, total=False):
- cache_by_device_type: bool
- """Separate cached content based on the visitor’s device type"""
-
- cache_deception_armor: bool
- """
- Protect from web cache deception attacks while allowing static assets to be
- cached
- """
-
- custom_key: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey
- """
- Customize which components of the request are included or excluded from the
- cache key.
- """
-
- ignore_query_strings_order: bool
- """
- Treat requests with the same query parameters the same, regardless of the order
- those query parameters are in. A value of true ignores the query strings' order.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve(TypedDict, total=False):
- eligible: Required[bool]
- """Determines whether cache reserve is enabled.
-
- If this is true and a request meets eligibility criteria, Cloudflare will write
- the resource to cache reserve.
- """
-
- min_file_size: Required[int]
- """The minimum file size eligible for store in cache reserve."""
-
-
-_RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords = TypedDict(
- "_RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords",
- {
- "from": int,
- },
- total=False,
-)
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(
- _RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords, total=False
-):
- to: Required[int]
- """response status code upper bound"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(TypedDict, total=False):
- value: Required[int]
- """Time to cache a response (in seconds).
-
- A value of 0 is equivalent to setting the Cache-Control header with the value
- "no-cache". A value of -1 is equivalent to setting Cache-Control header with the
- value of "no-store".
- """
-
- status_code_range: RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
- """The range of status codes used to apply the selected mode."""
-
- status_code_value: int
- """Set the ttl for responses with this specific status code"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL(TypedDict, total=False):
- default: Required[int]
- """The TTL (in seconds) if you choose override_origin mode."""
-
- mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]]
- """edge ttl options"""
-
- status_code_ttl: Required[Iterable[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]]
- """List of single status codes, or status code ranges to apply the selected mode"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersServeStale(TypedDict, total=False):
- disable_stale_while_updating: Required[bool]
- """Defines whether Cloudflare should serve stale content while updating.
-
- If true, Cloudflare will not serve stale content while getting the latest
- content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParameters(TypedDict, total=False):
- additional_cacheable_ports: Iterable[int]
- """List of additional ports that caching can be enabled on."""
-
- browser_ttl: RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL
- """Specify how long client browsers should cache the response.
-
- Cloudflare cache purge will not purge content cached on client browsers, so high
- browser TTLs may lead to stale content.
- """
-
- cache: bool
- """Mark whether the request’s response from origin is eligible for caching.
-
- Caching itself will still depend on the cache-control header and your other
- caching configurations.
- """
-
- cache_key: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey
- """
- Define which components of the request are included or excluded from the cache
- key Cloudflare uses to store the response in cache.
- """
-
- cache_reserve: RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve
- """
- Mark whether the request's response from origin is eligible for Cache Reserve
- (requires a Cache Reserve add-on plan).
- """
-
- edge_ttl: RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL
- """
- TTL (Time to Live) specifies the maximum time to cache a resource in the
- Cloudflare edge network.
- """
-
- origin_cache_control: bool
- """When enabled, Cloudflare will aim to strictly adhere to RFC 7234."""
-
- origin_error_page_passthru: bool
- """Generate Cloudflare error pages from issues sent from the origin server.
-
- When on, error pages will trigger for issues from the origin
- """
-
- read_timeout: int
- """
- Define a timeout value between two successive read operations to your origin
- server. Historically, the timeout value between two read options from Cloudflare
- to an origin server is 100 seconds. If you are attempting to reduce HTTP 524
- errors because of timeouts from an origin server, try increasing this timeout
- value.
- """
-
- respect_strong_etags: bool
- """
- Specify whether or not Cloudflare should respect strong ETag (entity tag)
- headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
- """
-
- serve_stale: RuleRulesetsSetCacheSettingsRuleActionParametersServeStale
- """
- Define if Cloudflare should serve stale content while getting the latest content
- from the origin. If on, Cloudflare will not serve stale content while getting
- the latest content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["set_cache_settings"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsSetCacheSettingsRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
Rule = Union[
BlockRuleParam,
- RuleRulesetsChallengeRule,
- RuleRulesetsCompressResponseRule,
+ ChallengeRuleParam,
+ CompressResponseRuleParam,
ExecuteRuleParam,
- RuleRulesetsJsChallengeRule,
+ JsChallengeRuleParam,
LogRuleParam,
- RuleRulesetsManagedChallengeRule,
- RuleRulesetsRedirectRule,
- RuleRulesetsRewriteRule,
- RuleRulesetsRouteRule,
- RuleRulesetsScoreRule,
- RuleRulesetsServeErrorRule,
- RuleRulesetsSetConfigRule,
+ ManagedChallengeRuleParam,
+ RedirectRuleParam,
+ RewriteRuleParam,
+ RouteRuleParam,
+ ScoreRuleParam,
+ ServeErrorRuleParam,
+ SetConfigRuleParam,
SkipRuleParam,
- RuleRulesetsSetCacheSettingsRule,
+ SetCacheSettingsRuleParam,
]
diff --git a/src/cloudflare/types/ruleset_update_response.py b/src/cloudflare/types/ruleset_update_response.py
index 8ef688d6149..4fe157273a1 100644
--- a/src/cloudflare/types/ruleset_update_response.py
+++ b/src/cloudflare/types/ruleset_update_response.py
@@ -1,961 +1,46 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
-from pydantic import Field as FieldInfo
-
from .._models import BaseModel
-from .rulesets import Logging, LogRule, SkipRule, BlockRule, ExecuteRule
-
-__all__ = [
- "RulesetUpdateResponse",
- "Rule",
- "RuleRulesetsChallengeRule",
- "RuleRulesetsCompressResponseRule",
- "RuleRulesetsCompressResponseRuleActionParameters",
- "RuleRulesetsCompressResponseRuleActionParametersAlgorithm",
- "RuleRulesetsJsChallengeRule",
- "RuleRulesetsManagedChallengeRule",
- "RuleRulesetsRedirectRule",
- "RuleRulesetsRedirectRuleActionParameters",
- "RuleRulesetsRedirectRuleActionParametersFromList",
- "RuleRulesetsRedirectRuleActionParametersFromValue",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURL",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
- "RuleRulesetsRewriteRule",
- "RuleRulesetsRewriteRuleActionParameters",
- "RuleRulesetsRewriteRuleActionParametersHeaders",
- "RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader",
- "RuleRulesetsRewriteRuleActionParametersURI",
- "RuleRulesetsRewriteRuleActionParametersURIPath",
- "RuleRulesetsRewriteRuleActionParametersURIPathStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue",
- "RuleRulesetsRewriteRuleActionParametersURIQuery",
- "RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue",
- "RuleRulesetsRouteRule",
- "RuleRulesetsRouteRuleActionParameters",
- "RuleRulesetsRouteRuleActionParametersOrigin",
- "RuleRulesetsRouteRuleActionParametersSni",
- "RuleRulesetsScoreRule",
- "RuleRulesetsScoreRuleActionParameters",
- "RuleRulesetsServeErrorRule",
- "RuleRulesetsServeErrorRuleActionParameters",
- "RuleRulesetsSetConfigRule",
- "RuleRulesetsSetConfigRuleActionParameters",
- "RuleRulesetsSetConfigRuleActionParametersAutominify",
- "RuleRulesetsSetCacheSettingsRule",
- "RuleRulesetsSetCacheSettingsRuleActionParameters",
- "RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
- "RuleRulesetsSetCacheSettingsRuleActionParametersServeStale",
-]
-
-
-class RuleRulesetsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsCompressResponseRuleActionParametersAlgorithm(BaseModel):
- name: Optional[Literal["none", "auto", "default", "gzip", "brotli"]] = None
- """Name of compression algorithm to enable."""
-
-
-class RuleRulesetsCompressResponseRuleActionParameters(BaseModel):
- algorithms: Optional[List[RuleRulesetsCompressResponseRuleActionParametersAlgorithm]] = None
- """Custom order for compression algorithms."""
-
-
-class RuleRulesetsCompressResponseRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["compress_response"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsCompressResponseRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsJsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["js_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsManagedChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["managed_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromList(BaseModel):
- key: Optional[str] = None
- """Expression that evaluates to the list lookup key."""
-
- name: Optional[str] = None
- """The name of the list to match against."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(BaseModel):
- value: Optional[str] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(BaseModel):
- expression: Optional[str] = None
- """An expression to evaluate to get the URL to redirect the request to."""
-
-
-RuleRulesetsRedirectRuleActionParametersFromValueTargetURL = Union[
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
-]
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValue(BaseModel):
- preserve_query_string: Optional[bool] = None
- """Keep the query string of the original request."""
-
- status_code: Optional[Literal[301, 302, 303, 307, 308]] = None
- """The status code to be used for the redirect."""
-
- target_url: Optional[RuleRulesetsRedirectRuleActionParametersFromValueTargetURL] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParameters(BaseModel):
- from_list: Optional[RuleRulesetsRedirectRuleActionParametersFromList] = None
- """Serve a redirect based on a bulk list lookup."""
-
- from_value: Optional[RuleRulesetsRedirectRuleActionParametersFromValue] = None
- """Serve a redirect based on the request properties."""
-
-
-class RuleRulesetsRedirectRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["redirect"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRedirectRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader(BaseModel):
- operation: Literal["remove"]
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader(BaseModel):
- operation: Literal["set"]
-
- value: str
- """Static value for the header."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader(BaseModel):
- expression: str
- """Expression for the header value."""
-
- operation: Literal["set"]
-
-
-RuleRulesetsRewriteRuleActionParametersHeaders = Union[
- RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIPath = Union[
- RuleRulesetsRewriteRuleActionParametersURIPathStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIQuery = Union[
- RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURI(BaseModel):
- path: Optional[RuleRulesetsRewriteRuleActionParametersURIPath] = None
- """Path portion rewrite."""
-
- query: Optional[RuleRulesetsRewriteRuleActionParametersURIQuery] = None
- """Query portion rewrite."""
-
-
-class RuleRulesetsRewriteRuleActionParameters(BaseModel):
- headers: Optional[Dict[str, RuleRulesetsRewriteRuleActionParametersHeaders]] = None
- """Map of request headers to modify."""
-
- uri: Optional[RuleRulesetsRewriteRuleActionParametersURI] = None
- """URI to rewrite the request to."""
-
-
-class RuleRulesetsRewriteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["rewrite"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRewriteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRouteRuleActionParametersOrigin(BaseModel):
- host: Optional[str] = None
- """Override the resolved hostname."""
-
- port: Optional[float] = None
- """Override the destination port."""
-
-
-class RuleRulesetsRouteRuleActionParametersSni(BaseModel):
- value: str
- """The SNI override."""
-
-
-class RuleRulesetsRouteRuleActionParameters(BaseModel):
- host_header: Optional[str] = None
- """Rewrite the HTTP Host header."""
-
- origin: Optional[RuleRulesetsRouteRuleActionParametersOrigin] = None
- """Override the IP/TCP destination."""
-
- sni: Optional[RuleRulesetsRouteRuleActionParametersSni] = None
- """Override the Server Name Indication (SNI)."""
-
-
-class RuleRulesetsRouteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["route"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRouteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsScoreRuleActionParameters(BaseModel):
- increment: Optional[int] = None
- """
- Increment contains the delta to change the score and can be either positive or
- negative.
- """
-
-
-class RuleRulesetsScoreRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["score"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsScoreRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsServeErrorRuleActionParameters(BaseModel):
- content: Optional[str] = None
- """Error response content."""
-
- content_type: Optional[Literal["application/json", "text/xml", "text/plain", "text/html"]] = None
- """Content-type header to set with the response."""
-
- status_code: Optional[float] = None
- """The status code to use for the error."""
-
-
-class RuleRulesetsServeErrorRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["serve_error"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsServeErrorRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetConfigRuleActionParametersAutominify(BaseModel):
- css: Optional[bool] = None
- """Minify CSS files."""
-
- html: Optional[bool] = None
- """Minify HTML files."""
-
- js: Optional[bool] = None
- """Minify JS files."""
-
-
-class RuleRulesetsSetConfigRuleActionParameters(BaseModel):
- automatic_https_rewrites: Optional[bool] = None
- """Turn on or off Automatic HTTPS Rewrites."""
-
- autominify: Optional[RuleRulesetsSetConfigRuleActionParametersAutominify] = None
- """Select which file extensions to minify automatically."""
-
- bic: Optional[bool] = None
- """Turn on or off Browser Integrity Check."""
-
- disable_apps: Optional[bool] = None
- """Turn off all active Cloudflare Apps."""
-
- disable_zaraz: Optional[bool] = None
- """Turn off Zaraz."""
-
- email_obfuscation: Optional[bool] = None
- """Turn on or off Email Obfuscation."""
-
- hotlink_protection: Optional[bool] = None
- """Turn on or off the Hotlink Protection."""
-
- mirage: Optional[bool] = None
- """Turn on or off Mirage."""
-
- opportunistic_encryption: Optional[bool] = None
- """Turn on or off Opportunistic Encryption."""
-
- polish: Optional[Literal["off", "lossless", "lossy"]] = None
- """Configure the Polish level."""
-
- rocket_loader: Optional[bool] = None
- """Turn on or off Rocket Loader"""
-
- security_level: Optional[Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]] = None
- """Configure the Security Level."""
-
- server_side_excludes: Optional[bool] = None
- """Turn on or off Server Side Excludes."""
-
- ssl: Optional[Literal["off", "flexible", "full", "strict", "origin_pull"]] = None
- """Configure the SSL level."""
-
- sxg: Optional[bool] = None
- """Turn on or off Signed Exchanges (SXG)."""
-
-
-class RuleRulesetsSetConfigRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_config"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetConfigRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL(BaseModel):
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """Determines which browser ttl mode to use."""
-
- default: Optional[int] = None
- """The TTL (in seconds) if you choose override_origin mode."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these cookie names.
-
- The presence of these cookies is used in building the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these cookies' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these header names.
-
- The presence of these headers is used in building the cache key.
- """
-
- exclude_origin: Optional[bool] = None
- """Whether or not to include the origin header.
-
- A value of true will exclude the origin header in the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these headers' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(BaseModel):
- resolved: Optional[bool] = None
- """Use the resolved host in the cache key.
-
- A value of true will use the resolved host, while a value or false will use the
- original host.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(BaseModel):
- all: Optional[bool] = None
- """Exclude all query string parameters from use in building the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters NOT used to build the cache key.
-
- All parameters present in the request but missing in this list will be used to
- build the cache key.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(BaseModel):
- all: Optional[bool] = None
- """Use all query string parameters in the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters used to build the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(BaseModel):
- exclude: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] = None
- """
- build the cache key using all query string parameters EXCECPT these excluded
- parameters
- """
-
- include: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] = None
- """
- build the cache key using a list of query string parameters that ARE in the
- request.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(BaseModel):
- device_type: Optional[bool] = None
- """Use the user agent's device type in the cache key."""
-
- geo: Optional[bool] = None
- """Use the user agents's country in the cache key."""
-
- lang: Optional[bool] = None
- """Use the user agent's language in the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey(BaseModel):
- cookie: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] = None
- """The cookies to include in building the cache key."""
-
- header: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] = None
- """The header names and values to include in building the cache key."""
-
- host: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] = None
- """Whether to use the original host or the resolved host in the cache key."""
-
- query_string: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] = None
- """
- Use the presence or absence of parameters in the query string to build the cache
- key.
- """
-
- user: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] = None
- """Characteristics of the request user agent used in building the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey(BaseModel):
- cache_by_device_type: Optional[bool] = None
- """Separate cached content based on the visitor’s device type"""
-
- cache_deception_armor: Optional[bool] = None
- """
- Protect from web cache deception attacks while allowing static assets to be
- cached
- """
-
- custom_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] = None
- """
- Customize which components of the request are included or excluded from the
- cache key.
- """
-
- ignore_query_strings_order: Optional[bool] = None
- """
- Treat requests with the same query parameters the same, regardless of the order
- those query parameters are in. A value of true ignores the query strings' order.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve(BaseModel):
- eligible: bool
- """Determines whether cache reserve is enabled.
-
- If this is true and a request meets eligibility criteria, Cloudflare will write
- the resource to cache reserve.
- """
-
- min_file_size: int
- """The minimum file size eligible for store in cache reserve."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(BaseModel):
- from_: int = FieldInfo(alias="from")
- """response status code lower bound"""
-
- to: int
- """response status code upper bound"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(BaseModel):
- value: int
- """Time to cache a response (in seconds).
-
- A value of 0 is equivalent to setting the Cache-Control header with the value
- "no-cache". A value of -1 is equivalent to setting Cache-Control header with the
- value of "no-store".
- """
-
- status_code_range: Optional[
- RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
- ] = None
- """The range of status codes used to apply the selected mode."""
-
- status_code_value: Optional[int] = None
- """Set the ttl for responses with this specific status code"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL(BaseModel):
- default: int
- """The TTL (in seconds) if you choose override_origin mode."""
-
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """edge ttl options"""
-
- status_code_ttl: List[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]
- """List of single status codes, or status code ranges to apply the selected mode"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersServeStale(BaseModel):
- disable_stale_while_updating: bool
- """Defines whether Cloudflare should serve stale content while updating.
-
- If true, Cloudflare will not serve stale content while getting the latest
- content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParameters(BaseModel):
- additional_cacheable_ports: Optional[List[int]] = None
- """List of additional ports that caching can be enabled on."""
-
- browser_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] = None
- """Specify how long client browsers should cache the response.
-
- Cloudflare cache purge will not purge content cached on client browsers, so high
- browser TTLs may lead to stale content.
- """
-
- cache: Optional[bool] = None
- """Mark whether the request’s response from origin is eligible for caching.
-
- Caching itself will still depend on the cache-control header and your other
- caching configurations.
- """
-
- cache_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey] = None
- """
- Define which components of the request are included or excluded from the cache
- key Cloudflare uses to store the response in cache.
- """
-
- cache_reserve: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve] = None
- """
- Mark whether the request's response from origin is eligible for Cache Reserve
- (requires a Cache Reserve add-on plan).
- """
-
- edge_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] = None
- """
- TTL (Time to Live) specifies the maximum time to cache a resource in the
- Cloudflare edge network.
- """
-
- origin_cache_control: Optional[bool] = None
- """When enabled, Cloudflare will aim to strictly adhere to RFC 7234."""
-
- origin_error_page_passthru: Optional[bool] = None
- """Generate Cloudflare error pages from issues sent from the origin server.
-
- When on, error pages will trigger for issues from the origin
- """
-
- read_timeout: Optional[int] = None
- """
- Define a timeout value between two successive read operations to your origin
- server. Historically, the timeout value between two read options from Cloudflare
- to an origin server is 100 seconds. If you are attempting to reduce HTTP 524
- errors because of timeouts from an origin server, try increasing this timeout
- value.
- """
-
- respect_strong_etags: Optional[bool] = None
- """
- Specify whether or not Cloudflare should respect strong ETag (entity tag)
- headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
- """
-
- serve_stale: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersServeStale] = None
- """
- Define if Cloudflare should serve stale content while getting the latest content
- from the origin. If on, Cloudflare will not serve stale content while getting
- the latest content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_cache_settings"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetCacheSettingsRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
+from .rulesets import (
+ LogRule,
+ SkipRule,
+ BlockRule,
+ RouteRule,
+ ScoreRule,
+ ExecuteRule,
+ RewriteRule,
+ RedirectRule,
+ ChallengeRule,
+ SetConfigRule,
+ ServeErrorRule,
+ JsChallengeRule,
+ CompressResponseRule,
+ ManagedChallengeRule,
+ SetCacheSettingsRule,
+)
+
+__all__ = ["RulesetUpdateResponse", "Rule"]
Rule = Union[
BlockRule,
- RuleRulesetsChallengeRule,
- RuleRulesetsCompressResponseRule,
+ ChallengeRule,
+ CompressResponseRule,
ExecuteRule,
- RuleRulesetsJsChallengeRule,
+ JsChallengeRule,
LogRule,
- RuleRulesetsManagedChallengeRule,
- RuleRulesetsRedirectRule,
- RuleRulesetsRewriteRule,
- RuleRulesetsRouteRule,
- RuleRulesetsScoreRule,
- RuleRulesetsServeErrorRule,
- RuleRulesetsSetConfigRule,
+ ManagedChallengeRule,
+ RedirectRule,
+ RewriteRule,
+ RouteRule,
+ ScoreRule,
+ ServeErrorRule,
+ SetConfigRule,
SkipRule,
- RuleRulesetsSetCacheSettingsRule,
+ SetCacheSettingsRule,
]
diff --git a/src/cloudflare/types/rulesets/__init__.py b/src/cloudflare/types/rulesets/__init__.py
index 2a3e688b0f5..c84a6a31cd8 100644
--- a/src/cloudflare/types/rulesets/__init__.py
+++ b/src/cloudflare/types/rulesets/__init__.py
@@ -6,18 +6,42 @@
from .log_rule import LogRule as LogRule
from .skip_rule import SkipRule as SkipRule
from .block_rule import BlockRule as BlockRule
+from .route_rule import RouteRule as RouteRule
+from .score_rule import ScoreRule as ScoreRule
from .execute_rule import ExecuteRule as ExecuteRule
+from .rewrite_rule import RewriteRule as RewriteRule
from .logging_param import LoggingParam as LoggingParam
+from .redirect_rule import RedirectRule as RedirectRule
+from .challenge_rule import ChallengeRule as ChallengeRule
from .log_rule_param import LogRuleParam as LogRuleParam
+from .set_config_rule import SetConfigRule as SetConfigRule
from .skip_rule_param import SkipRuleParam as SkipRuleParam
from .block_rule_param import BlockRuleParam as BlockRuleParam
+from .rewrite_uri_part import RewriteURIPart as RewriteURIPart
+from .route_rule_param import RouteRuleParam as RouteRuleParam
from .rule_edit_params import RuleEditParams as RuleEditParams
+from .score_rule_param import ScoreRuleParam as ScoreRuleParam
+from .serve_error_rule import ServeErrorRule as ServeErrorRule
+from .js_challenge_rule import JsChallengeRule as JsChallengeRule
from .execute_rule_param import ExecuteRuleParam as ExecuteRuleParam
from .phase_get_response import PhaseGetResponse as PhaseGetResponse
+from .rewrite_rule_param import RewriteRuleParam as RewriteRuleParam
from .rule_create_params import RuleCreateParams as RuleCreateParams
from .rule_edit_response import RuleEditResponse as RuleEditResponse
from .phase_update_params import PhaseUpdateParams as PhaseUpdateParams
+from .redirect_rule_param import RedirectRuleParam as RedirectRuleParam
+from .challenge_rule_param import ChallengeRuleParam as ChallengeRuleParam
from .rule_create_response import RuleCreateResponse as RuleCreateResponse
from .rule_delete_response import RuleDeleteResponse as RuleDeleteResponse
from .version_get_response import VersionGetResponse as VersionGetResponse
from .phase_update_response import PhaseUpdateResponse as PhaseUpdateResponse
+from .set_config_rule_param import SetConfigRuleParam as SetConfigRuleParam
+from .compress_response_rule import CompressResponseRule as CompressResponseRule
+from .managed_challenge_rule import ManagedChallengeRule as ManagedChallengeRule
+from .rewrite_uri_part_param import RewriteURIPartParam as RewriteURIPartParam
+from .serve_error_rule_param import ServeErrorRuleParam as ServeErrorRuleParam
+from .js_challenge_rule_param import JsChallengeRuleParam as JsChallengeRuleParam
+from .set_cache_settings_rule import SetCacheSettingsRule as SetCacheSettingsRule
+from .compress_response_rule_param import CompressResponseRuleParam as CompressResponseRuleParam
+from .managed_challenge_rule_param import ManagedChallengeRuleParam as ManagedChallengeRuleParam
+from .set_cache_settings_rule_param import SetCacheSettingsRuleParam as SetCacheSettingsRuleParam
diff --git a/src/cloudflare/types/rulesets/challenge_rule.py b/src/cloudflare/types/rulesets/challenge_rule.py
new file mode 100644
index 00000000000..5443d8298e5
--- /dev/null
+++ b/src/cloudflare/types/rulesets/challenge_rule.py
@@ -0,0 +1,45 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .logging import Logging
+from ..._models import BaseModel
+
+__all__ = ["ChallengeRule"]
+
+
+class ChallengeRule(BaseModel):
+ last_updated: datetime
+ """The timestamp of when the rule was last modified."""
+
+ version: str
+ """The version of the rule."""
+
+ id: Optional[str] = None
+ """The unique ID of the rule."""
+
+ action: Optional[Literal["challenge"]] = None
+ """The action to perform when the rule matches."""
+
+ action_parameters: Optional[object] = None
+ """The parameters configuring the rule's action."""
+
+ categories: Optional[List[str]] = None
+ """The categories of the rule."""
+
+ description: Optional[str] = None
+ """An informative description of the rule."""
+
+ enabled: Optional[bool] = None
+ """Whether the rule should be executed."""
+
+ expression: Optional[str] = None
+ """The expression defining which traffic will match the rule."""
+
+ logging: Optional[Logging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/challenge_rule_param.py b/src/cloudflare/types/rulesets/challenge_rule_param.py
new file mode 100644
index 00000000000..d430a95a678
--- /dev/null
+++ b/src/cloudflare/types/rulesets/challenge_rule_param.py
@@ -0,0 +1,35 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, TypedDict
+
+from .logging_param import LoggingParam
+
+__all__ = ["ChallengeRuleParam"]
+
+
+class ChallengeRuleParam(TypedDict, total=False):
+ id: str
+ """The unique ID of the rule."""
+
+ action: Literal["challenge"]
+ """The action to perform when the rule matches."""
+
+ action_parameters: object
+ """The parameters configuring the rule's action."""
+
+ description: str
+ """An informative description of the rule."""
+
+ enabled: bool
+ """Whether the rule should be executed."""
+
+ expression: str
+ """The expression defining which traffic will match the rule."""
+
+ logging: LoggingParam
+ """An object configuring the rule's logging behavior."""
+
+ ref: str
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/compress_response_rule.py b/src/cloudflare/types/rulesets/compress_response_rule.py
new file mode 100644
index 00000000000..cfadff08d90
--- /dev/null
+++ b/src/cloudflare/types/rulesets/compress_response_rule.py
@@ -0,0 +1,55 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .logging import Logging
+from ..._models import BaseModel
+
+__all__ = ["CompressResponseRule", "ActionParameters", "ActionParametersAlgorithm"]
+
+
+class ActionParametersAlgorithm(BaseModel):
+ name: Optional[Literal["none", "auto", "default", "gzip", "brotli"]] = None
+ """Name of compression algorithm to enable."""
+
+
+class ActionParameters(BaseModel):
+ algorithms: Optional[List[ActionParametersAlgorithm]] = None
+ """Custom order for compression algorithms."""
+
+
+class CompressResponseRule(BaseModel):
+ last_updated: datetime
+ """The timestamp of when the rule was last modified."""
+
+ version: str
+ """The version of the rule."""
+
+ id: Optional[str] = None
+ """The unique ID of the rule."""
+
+ action: Optional[Literal["compress_response"]] = None
+ """The action to perform when the rule matches."""
+
+ action_parameters: Optional[ActionParameters] = None
+ """The parameters configuring the rule's action."""
+
+ categories: Optional[List[str]] = None
+ """The categories of the rule."""
+
+ description: Optional[str] = None
+ """An informative description of the rule."""
+
+ enabled: Optional[bool] = None
+ """Whether the rule should be executed."""
+
+ expression: Optional[str] = None
+ """The expression defining which traffic will match the rule."""
+
+ logging: Optional[Logging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/compress_response_rule_param.py b/src/cloudflare/types/rulesets/compress_response_rule_param.py
new file mode 100644
index 00000000000..79c4ef44957
--- /dev/null
+++ b/src/cloudflare/types/rulesets/compress_response_rule_param.py
@@ -0,0 +1,46 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Iterable
+from typing_extensions import Literal, TypedDict
+
+from .logging_param import LoggingParam
+
+__all__ = ["CompressResponseRuleParam", "ActionParameters", "ActionParametersAlgorithm"]
+
+
+class ActionParametersAlgorithm(TypedDict, total=False):
+ name: Literal["none", "auto", "default", "gzip", "brotli"]
+ """Name of compression algorithm to enable."""
+
+
+class ActionParameters(TypedDict, total=False):
+ algorithms: Iterable[ActionParametersAlgorithm]
+ """Custom order for compression algorithms."""
+
+
+class CompressResponseRuleParam(TypedDict, total=False):
+ id: str
+ """The unique ID of the rule."""
+
+ action: Literal["compress_response"]
+ """The action to perform when the rule matches."""
+
+ action_parameters: ActionParameters
+ """The parameters configuring the rule's action."""
+
+ description: str
+ """An informative description of the rule."""
+
+ enabled: bool
+ """Whether the rule should be executed."""
+
+ expression: str
+ """The expression defining which traffic will match the rule."""
+
+ logging: LoggingParam
+ """An object configuring the rule's logging behavior."""
+
+ ref: str
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/js_challenge_rule.py b/src/cloudflare/types/rulesets/js_challenge_rule.py
new file mode 100644
index 00000000000..c24e8833f87
--- /dev/null
+++ b/src/cloudflare/types/rulesets/js_challenge_rule.py
@@ -0,0 +1,45 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .logging import Logging
+from ..._models import BaseModel
+
+__all__ = ["JsChallengeRule"]
+
+
+class JsChallengeRule(BaseModel):
+ last_updated: datetime
+ """The timestamp of when the rule was last modified."""
+
+ version: str
+ """The version of the rule."""
+
+ id: Optional[str] = None
+ """The unique ID of the rule."""
+
+ action: Optional[Literal["js_challenge"]] = None
+ """The action to perform when the rule matches."""
+
+ action_parameters: Optional[object] = None
+ """The parameters configuring the rule's action."""
+
+ categories: Optional[List[str]] = None
+ """The categories of the rule."""
+
+ description: Optional[str] = None
+ """An informative description of the rule."""
+
+ enabled: Optional[bool] = None
+ """Whether the rule should be executed."""
+
+ expression: Optional[str] = None
+ """The expression defining which traffic will match the rule."""
+
+ logging: Optional[Logging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/js_challenge_rule_param.py b/src/cloudflare/types/rulesets/js_challenge_rule_param.py
new file mode 100644
index 00000000000..3dc666ae047
--- /dev/null
+++ b/src/cloudflare/types/rulesets/js_challenge_rule_param.py
@@ -0,0 +1,35 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, TypedDict
+
+from .logging_param import LoggingParam
+
+__all__ = ["JsChallengeRuleParam"]
+
+
+class JsChallengeRuleParam(TypedDict, total=False):
+ id: str
+ """The unique ID of the rule."""
+
+ action: Literal["js_challenge"]
+ """The action to perform when the rule matches."""
+
+ action_parameters: object
+ """The parameters configuring the rule's action."""
+
+ description: str
+ """An informative description of the rule."""
+
+ enabled: bool
+ """Whether the rule should be executed."""
+
+ expression: str
+ """The expression defining which traffic will match the rule."""
+
+ logging: LoggingParam
+ """An object configuring the rule's logging behavior."""
+
+ ref: str
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/managed_challenge_rule.py b/src/cloudflare/types/rulesets/managed_challenge_rule.py
new file mode 100644
index 00000000000..6c2772bd14d
--- /dev/null
+++ b/src/cloudflare/types/rulesets/managed_challenge_rule.py
@@ -0,0 +1,45 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .logging import Logging
+from ..._models import BaseModel
+
+__all__ = ["ManagedChallengeRule"]
+
+
+class ManagedChallengeRule(BaseModel):
+ last_updated: datetime
+ """The timestamp of when the rule was last modified."""
+
+ version: str
+ """The version of the rule."""
+
+ id: Optional[str] = None
+ """The unique ID of the rule."""
+
+ action: Optional[Literal["managed_challenge"]] = None
+ """The action to perform when the rule matches."""
+
+ action_parameters: Optional[object] = None
+ """The parameters configuring the rule's action."""
+
+ categories: Optional[List[str]] = None
+ """The categories of the rule."""
+
+ description: Optional[str] = None
+ """An informative description of the rule."""
+
+ enabled: Optional[bool] = None
+ """Whether the rule should be executed."""
+
+ expression: Optional[str] = None
+ """The expression defining which traffic will match the rule."""
+
+ logging: Optional[Logging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/managed_challenge_rule_param.py b/src/cloudflare/types/rulesets/managed_challenge_rule_param.py
new file mode 100644
index 00000000000..63ccee1f4a2
--- /dev/null
+++ b/src/cloudflare/types/rulesets/managed_challenge_rule_param.py
@@ -0,0 +1,35 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, TypedDict
+
+from .logging_param import LoggingParam
+
+__all__ = ["ManagedChallengeRuleParam"]
+
+
+class ManagedChallengeRuleParam(TypedDict, total=False):
+ id: str
+ """The unique ID of the rule."""
+
+ action: Literal["managed_challenge"]
+ """The action to perform when the rule matches."""
+
+ action_parameters: object
+ """The parameters configuring the rule's action."""
+
+ description: str
+ """An informative description of the rule."""
+
+ enabled: bool
+ """Whether the rule should be executed."""
+
+ expression: str
+ """The expression defining which traffic will match the rule."""
+
+ logging: LoggingParam
+ """An object configuring the rule's logging behavior."""
+
+ ref: str
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/phase_get_response.py b/src/cloudflare/types/rulesets/phase_get_response.py
index 7a4562b8e16..b0f1c8dc5c0 100644
--- a/src/cloudflare/types/rulesets/phase_get_response.py
+++ b/src/cloudflare/types/rulesets/phase_get_response.py
@@ -1,965 +1,44 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
-from pydantic import Field as FieldInfo
-
-from .logging import Logging
from .log_rule import LogRule
from ..._models import BaseModel
from .skip_rule import SkipRule
from .block_rule import BlockRule
+from .route_rule import RouteRule
+from .score_rule import ScoreRule
from .execute_rule import ExecuteRule
-
-__all__ = [
- "PhaseGetResponse",
- "Rule",
- "RuleRulesetsChallengeRule",
- "RuleRulesetsCompressResponseRule",
- "RuleRulesetsCompressResponseRuleActionParameters",
- "RuleRulesetsCompressResponseRuleActionParametersAlgorithm",
- "RuleRulesetsJsChallengeRule",
- "RuleRulesetsManagedChallengeRule",
- "RuleRulesetsRedirectRule",
- "RuleRulesetsRedirectRuleActionParameters",
- "RuleRulesetsRedirectRuleActionParametersFromList",
- "RuleRulesetsRedirectRuleActionParametersFromValue",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURL",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
- "RuleRulesetsRewriteRule",
- "RuleRulesetsRewriteRuleActionParameters",
- "RuleRulesetsRewriteRuleActionParametersHeaders",
- "RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader",
- "RuleRulesetsRewriteRuleActionParametersURI",
- "RuleRulesetsRewriteRuleActionParametersURIPath",
- "RuleRulesetsRewriteRuleActionParametersURIPathStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue",
- "RuleRulesetsRewriteRuleActionParametersURIQuery",
- "RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue",
- "RuleRulesetsRouteRule",
- "RuleRulesetsRouteRuleActionParameters",
- "RuleRulesetsRouteRuleActionParametersOrigin",
- "RuleRulesetsRouteRuleActionParametersSni",
- "RuleRulesetsScoreRule",
- "RuleRulesetsScoreRuleActionParameters",
- "RuleRulesetsServeErrorRule",
- "RuleRulesetsServeErrorRuleActionParameters",
- "RuleRulesetsSetConfigRule",
- "RuleRulesetsSetConfigRuleActionParameters",
- "RuleRulesetsSetConfigRuleActionParametersAutominify",
- "RuleRulesetsSetCacheSettingsRule",
- "RuleRulesetsSetCacheSettingsRuleActionParameters",
- "RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
- "RuleRulesetsSetCacheSettingsRuleActionParametersServeStale",
-]
-
-
-class RuleRulesetsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsCompressResponseRuleActionParametersAlgorithm(BaseModel):
- name: Optional[Literal["none", "auto", "default", "gzip", "brotli"]] = None
- """Name of compression algorithm to enable."""
-
-
-class RuleRulesetsCompressResponseRuleActionParameters(BaseModel):
- algorithms: Optional[List[RuleRulesetsCompressResponseRuleActionParametersAlgorithm]] = None
- """Custom order for compression algorithms."""
-
-
-class RuleRulesetsCompressResponseRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["compress_response"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsCompressResponseRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsJsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["js_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsManagedChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["managed_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromList(BaseModel):
- key: Optional[str] = None
- """Expression that evaluates to the list lookup key."""
-
- name: Optional[str] = None
- """The name of the list to match against."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(BaseModel):
- value: Optional[str] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(BaseModel):
- expression: Optional[str] = None
- """An expression to evaluate to get the URL to redirect the request to."""
-
-
-RuleRulesetsRedirectRuleActionParametersFromValueTargetURL = Union[
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
-]
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValue(BaseModel):
- preserve_query_string: Optional[bool] = None
- """Keep the query string of the original request."""
-
- status_code: Optional[Literal[301, 302, 303, 307, 308]] = None
- """The status code to be used for the redirect."""
-
- target_url: Optional[RuleRulesetsRedirectRuleActionParametersFromValueTargetURL] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParameters(BaseModel):
- from_list: Optional[RuleRulesetsRedirectRuleActionParametersFromList] = None
- """Serve a redirect based on a bulk list lookup."""
-
- from_value: Optional[RuleRulesetsRedirectRuleActionParametersFromValue] = None
- """Serve a redirect based on the request properties."""
-
-
-class RuleRulesetsRedirectRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["redirect"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRedirectRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader(BaseModel):
- operation: Literal["remove"]
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader(BaseModel):
- operation: Literal["set"]
-
- value: str
- """Static value for the header."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader(BaseModel):
- expression: str
- """Expression for the header value."""
-
- operation: Literal["set"]
-
-
-RuleRulesetsRewriteRuleActionParametersHeaders = Union[
- RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIPath = Union[
- RuleRulesetsRewriteRuleActionParametersURIPathStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIQuery = Union[
- RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURI(BaseModel):
- path: Optional[RuleRulesetsRewriteRuleActionParametersURIPath] = None
- """Path portion rewrite."""
-
- query: Optional[RuleRulesetsRewriteRuleActionParametersURIQuery] = None
- """Query portion rewrite."""
-
-
-class RuleRulesetsRewriteRuleActionParameters(BaseModel):
- headers: Optional[Dict[str, RuleRulesetsRewriteRuleActionParametersHeaders]] = None
- """Map of request headers to modify."""
-
- uri: Optional[RuleRulesetsRewriteRuleActionParametersURI] = None
- """URI to rewrite the request to."""
-
-
-class RuleRulesetsRewriteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["rewrite"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRewriteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRouteRuleActionParametersOrigin(BaseModel):
- host: Optional[str] = None
- """Override the resolved hostname."""
-
- port: Optional[float] = None
- """Override the destination port."""
-
-
-class RuleRulesetsRouteRuleActionParametersSni(BaseModel):
- value: str
- """The SNI override."""
-
-
-class RuleRulesetsRouteRuleActionParameters(BaseModel):
- host_header: Optional[str] = None
- """Rewrite the HTTP Host header."""
-
- origin: Optional[RuleRulesetsRouteRuleActionParametersOrigin] = None
- """Override the IP/TCP destination."""
-
- sni: Optional[RuleRulesetsRouteRuleActionParametersSni] = None
- """Override the Server Name Indication (SNI)."""
-
-
-class RuleRulesetsRouteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["route"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRouteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsScoreRuleActionParameters(BaseModel):
- increment: Optional[int] = None
- """
- Increment contains the delta to change the score and can be either positive or
- negative.
- """
-
-
-class RuleRulesetsScoreRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["score"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsScoreRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsServeErrorRuleActionParameters(BaseModel):
- content: Optional[str] = None
- """Error response content."""
-
- content_type: Optional[Literal["application/json", "text/xml", "text/plain", "text/html"]] = None
- """Content-type header to set with the response."""
-
- status_code: Optional[float] = None
- """The status code to use for the error."""
-
-
-class RuleRulesetsServeErrorRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["serve_error"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsServeErrorRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetConfigRuleActionParametersAutominify(BaseModel):
- css: Optional[bool] = None
- """Minify CSS files."""
-
- html: Optional[bool] = None
- """Minify HTML files."""
-
- js: Optional[bool] = None
- """Minify JS files."""
-
-
-class RuleRulesetsSetConfigRuleActionParameters(BaseModel):
- automatic_https_rewrites: Optional[bool] = None
- """Turn on or off Automatic HTTPS Rewrites."""
-
- autominify: Optional[RuleRulesetsSetConfigRuleActionParametersAutominify] = None
- """Select which file extensions to minify automatically."""
-
- bic: Optional[bool] = None
- """Turn on or off Browser Integrity Check."""
-
- disable_apps: Optional[bool] = None
- """Turn off all active Cloudflare Apps."""
-
- disable_zaraz: Optional[bool] = None
- """Turn off Zaraz."""
-
- email_obfuscation: Optional[bool] = None
- """Turn on or off Email Obfuscation."""
-
- hotlink_protection: Optional[bool] = None
- """Turn on or off the Hotlink Protection."""
-
- mirage: Optional[bool] = None
- """Turn on or off Mirage."""
-
- opportunistic_encryption: Optional[bool] = None
- """Turn on or off Opportunistic Encryption."""
-
- polish: Optional[Literal["off", "lossless", "lossy"]] = None
- """Configure the Polish level."""
-
- rocket_loader: Optional[bool] = None
- """Turn on or off Rocket Loader"""
-
- security_level: Optional[Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]] = None
- """Configure the Security Level."""
-
- server_side_excludes: Optional[bool] = None
- """Turn on or off Server Side Excludes."""
-
- ssl: Optional[Literal["off", "flexible", "full", "strict", "origin_pull"]] = None
- """Configure the SSL level."""
-
- sxg: Optional[bool] = None
- """Turn on or off Signed Exchanges (SXG)."""
-
-
-class RuleRulesetsSetConfigRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_config"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetConfigRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL(BaseModel):
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """Determines which browser ttl mode to use."""
-
- default: Optional[int] = None
- """The TTL (in seconds) if you choose override_origin mode."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these cookie names.
-
- The presence of these cookies is used in building the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these cookies' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these header names.
-
- The presence of these headers is used in building the cache key.
- """
-
- exclude_origin: Optional[bool] = None
- """Whether or not to include the origin header.
-
- A value of true will exclude the origin header in the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these headers' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(BaseModel):
- resolved: Optional[bool] = None
- """Use the resolved host in the cache key.
-
- A value of true will use the resolved host, while a value or false will use the
- original host.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(BaseModel):
- all: Optional[bool] = None
- """Exclude all query string parameters from use in building the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters NOT used to build the cache key.
-
- All parameters present in the request but missing in this list will be used to
- build the cache key.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(BaseModel):
- all: Optional[bool] = None
- """Use all query string parameters in the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters used to build the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(BaseModel):
- exclude: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] = None
- """
- build the cache key using all query string parameters EXCECPT these excluded
- parameters
- """
-
- include: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] = None
- """
- build the cache key using a list of query string parameters that ARE in the
- request.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(BaseModel):
- device_type: Optional[bool] = None
- """Use the user agent's device type in the cache key."""
-
- geo: Optional[bool] = None
- """Use the user agents's country in the cache key."""
-
- lang: Optional[bool] = None
- """Use the user agent's language in the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey(BaseModel):
- cookie: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] = None
- """The cookies to include in building the cache key."""
-
- header: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] = None
- """The header names and values to include in building the cache key."""
-
- host: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] = None
- """Whether to use the original host or the resolved host in the cache key."""
-
- query_string: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] = None
- """
- Use the presence or absence of parameters in the query string to build the cache
- key.
- """
-
- user: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] = None
- """Characteristics of the request user agent used in building the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey(BaseModel):
- cache_by_device_type: Optional[bool] = None
- """Separate cached content based on the visitor’s device type"""
-
- cache_deception_armor: Optional[bool] = None
- """
- Protect from web cache deception attacks while allowing static assets to be
- cached
- """
-
- custom_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] = None
- """
- Customize which components of the request are included or excluded from the
- cache key.
- """
-
- ignore_query_strings_order: Optional[bool] = None
- """
- Treat requests with the same query parameters the same, regardless of the order
- those query parameters are in. A value of true ignores the query strings' order.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve(BaseModel):
- eligible: bool
- """Determines whether cache reserve is enabled.
-
- If this is true and a request meets eligibility criteria, Cloudflare will write
- the resource to cache reserve.
- """
-
- min_file_size: int
- """The minimum file size eligible for store in cache reserve."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(BaseModel):
- from_: int = FieldInfo(alias="from")
- """response status code lower bound"""
-
- to: int
- """response status code upper bound"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(BaseModel):
- value: int
- """Time to cache a response (in seconds).
-
- A value of 0 is equivalent to setting the Cache-Control header with the value
- "no-cache". A value of -1 is equivalent to setting Cache-Control header with the
- value of "no-store".
- """
-
- status_code_range: Optional[
- RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
- ] = None
- """The range of status codes used to apply the selected mode."""
-
- status_code_value: Optional[int] = None
- """Set the ttl for responses with this specific status code"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL(BaseModel):
- default: int
- """The TTL (in seconds) if you choose override_origin mode."""
-
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """edge ttl options"""
-
- status_code_ttl: List[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]
- """List of single status codes, or status code ranges to apply the selected mode"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersServeStale(BaseModel):
- disable_stale_while_updating: bool
- """Defines whether Cloudflare should serve stale content while updating.
-
- If true, Cloudflare will not serve stale content while getting the latest
- content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParameters(BaseModel):
- additional_cacheable_ports: Optional[List[int]] = None
- """List of additional ports that caching can be enabled on."""
-
- browser_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] = None
- """Specify how long client browsers should cache the response.
-
- Cloudflare cache purge will not purge content cached on client browsers, so high
- browser TTLs may lead to stale content.
- """
-
- cache: Optional[bool] = None
- """Mark whether the request’s response from origin is eligible for caching.
-
- Caching itself will still depend on the cache-control header and your other
- caching configurations.
- """
-
- cache_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey] = None
- """
- Define which components of the request are included or excluded from the cache
- key Cloudflare uses to store the response in cache.
- """
-
- cache_reserve: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve] = None
- """
- Mark whether the request's response from origin is eligible for Cache Reserve
- (requires a Cache Reserve add-on plan).
- """
-
- edge_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] = None
- """
- TTL (Time to Live) specifies the maximum time to cache a resource in the
- Cloudflare edge network.
- """
-
- origin_cache_control: Optional[bool] = None
- """When enabled, Cloudflare will aim to strictly adhere to RFC 7234."""
-
- origin_error_page_passthru: Optional[bool] = None
- """Generate Cloudflare error pages from issues sent from the origin server.
-
- When on, error pages will trigger for issues from the origin
- """
-
- read_timeout: Optional[int] = None
- """
- Define a timeout value between two successive read operations to your origin
- server. Historically, the timeout value between two read options from Cloudflare
- to an origin server is 100 seconds. If you are attempting to reduce HTTP 524
- errors because of timeouts from an origin server, try increasing this timeout
- value.
- """
-
- respect_strong_etags: Optional[bool] = None
- """
- Specify whether or not Cloudflare should respect strong ETag (entity tag)
- headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
- """
-
- serve_stale: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersServeStale] = None
- """
- Define if Cloudflare should serve stale content while getting the latest content
- from the origin. If on, Cloudflare will not serve stale content while getting
- the latest content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_cache_settings"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetCacheSettingsRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
+from .rewrite_rule import RewriteRule
+from .redirect_rule import RedirectRule
+from .challenge_rule import ChallengeRule
+from .set_config_rule import SetConfigRule
+from .serve_error_rule import ServeErrorRule
+from .js_challenge_rule import JsChallengeRule
+from .compress_response_rule import CompressResponseRule
+from .managed_challenge_rule import ManagedChallengeRule
+from .set_cache_settings_rule import SetCacheSettingsRule
+
+__all__ = ["PhaseGetResponse", "Rule"]
Rule = Union[
BlockRule,
- RuleRulesetsChallengeRule,
- RuleRulesetsCompressResponseRule,
+ ChallengeRule,
+ CompressResponseRule,
ExecuteRule,
- RuleRulesetsJsChallengeRule,
+ JsChallengeRule,
LogRule,
- RuleRulesetsManagedChallengeRule,
- RuleRulesetsRedirectRule,
- RuleRulesetsRewriteRule,
- RuleRulesetsRouteRule,
- RuleRulesetsScoreRule,
- RuleRulesetsServeErrorRule,
- RuleRulesetsSetConfigRule,
+ ManagedChallengeRule,
+ RedirectRule,
+ RewriteRule,
+ RouteRule,
+ ScoreRule,
+ ServeErrorRule,
+ SetConfigRule,
SkipRule,
- RuleRulesetsSetCacheSettingsRule,
+ SetCacheSettingsRule,
]
diff --git a/src/cloudflare/types/rulesets/phase_update_params.py b/src/cloudflare/types/rulesets/phase_update_params.py
index 134d35989ff..35f0f070769 100644
--- a/src/cloudflare/types/rulesets/phase_update_params.py
+++ b/src/cloudflare/types/rulesets/phase_update_params.py
@@ -2,73 +2,26 @@
from __future__ import annotations
-from typing import Dict, List, Union, Iterable
+from typing import Union, Iterable
from typing_extensions import Literal, Required, TypedDict
-from .logging_param import LoggingParam
from .log_rule_param import LogRuleParam
from .skip_rule_param import SkipRuleParam
from .block_rule_param import BlockRuleParam
+from .route_rule_param import RouteRuleParam
+from .score_rule_param import ScoreRuleParam
from .execute_rule_param import ExecuteRuleParam
+from .rewrite_rule_param import RewriteRuleParam
+from .redirect_rule_param import RedirectRuleParam
+from .challenge_rule_param import ChallengeRuleParam
+from .set_config_rule_param import SetConfigRuleParam
+from .serve_error_rule_param import ServeErrorRuleParam
+from .js_challenge_rule_param import JsChallengeRuleParam
+from .compress_response_rule_param import CompressResponseRuleParam
+from .managed_challenge_rule_param import ManagedChallengeRuleParam
+from .set_cache_settings_rule_param import SetCacheSettingsRuleParam
-__all__ = [
- "PhaseUpdateParams",
- "Rule",
- "RuleRulesetsChallengeRule",
- "RuleRulesetsCompressResponseRule",
- "RuleRulesetsCompressResponseRuleActionParameters",
- "RuleRulesetsCompressResponseRuleActionParametersAlgorithm",
- "RuleRulesetsJsChallengeRule",
- "RuleRulesetsManagedChallengeRule",
- "RuleRulesetsRedirectRule",
- "RuleRulesetsRedirectRuleActionParameters",
- "RuleRulesetsRedirectRuleActionParametersFromList",
- "RuleRulesetsRedirectRuleActionParametersFromValue",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURL",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
- "RuleRulesetsRewriteRule",
- "RuleRulesetsRewriteRuleActionParameters",
- "RuleRulesetsRewriteRuleActionParametersHeaders",
- "RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader",
- "RuleRulesetsRewriteRuleActionParametersURI",
- "RuleRulesetsRewriteRuleActionParametersURIPath",
- "RuleRulesetsRewriteRuleActionParametersURIPathStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue",
- "RuleRulesetsRewriteRuleActionParametersURIQuery",
- "RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue",
- "RuleRulesetsRouteRule",
- "RuleRulesetsRouteRuleActionParameters",
- "RuleRulesetsRouteRuleActionParametersOrigin",
- "RuleRulesetsRouteRuleActionParametersSni",
- "RuleRulesetsScoreRule",
- "RuleRulesetsScoreRuleActionParameters",
- "RuleRulesetsServeErrorRule",
- "RuleRulesetsServeErrorRuleActionParameters",
- "RuleRulesetsSetConfigRule",
- "RuleRulesetsSetConfigRuleActionParameters",
- "RuleRulesetsSetConfigRuleActionParametersAutominify",
- "RuleRulesetsSetCacheSettingsRule",
- "RuleRulesetsSetCacheSettingsRuleActionParameters",
- "RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
- "RuleRulesetsSetCacheSettingsRuleActionParametersServeStale",
-]
+__all__ = ["PhaseUpdateParams", "Rule"]
class PhaseUpdateParams(TypedDict, total=False):
@@ -118,798 +71,20 @@ class PhaseUpdateParams(TypedDict, total=False):
"""The phase of the ruleset."""
-class RuleRulesetsChallengeRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["challenge"]
- """The action to perform when the rule matches."""
-
- action_parameters: object
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsCompressResponseRuleActionParametersAlgorithm(TypedDict, total=False):
- name: Literal["none", "auto", "default", "gzip", "brotli"]
- """Name of compression algorithm to enable."""
-
-
-class RuleRulesetsCompressResponseRuleActionParameters(TypedDict, total=False):
- algorithms: Iterable[RuleRulesetsCompressResponseRuleActionParametersAlgorithm]
- """Custom order for compression algorithms."""
-
-
-class RuleRulesetsCompressResponseRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["compress_response"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsCompressResponseRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsJsChallengeRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["js_challenge"]
- """The action to perform when the rule matches."""
-
- action_parameters: object
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsManagedChallengeRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["managed_challenge"]
- """The action to perform when the rule matches."""
-
- action_parameters: object
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromList(TypedDict, total=False):
- key: str
- """Expression that evaluates to the list lookup key."""
-
- name: str
- """The name of the list to match against."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(TypedDict, total=False):
- value: str
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(TypedDict, total=False):
- expression: str
- """An expression to evaluate to get the URL to redirect the request to."""
-
-
-RuleRulesetsRedirectRuleActionParametersFromValueTargetURL = Union[
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
-]
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValue(TypedDict, total=False):
- preserve_query_string: bool
- """Keep the query string of the original request."""
-
- status_code: Literal[301, 302, 303, 307, 308]
- """The status code to be used for the redirect."""
-
- target_url: RuleRulesetsRedirectRuleActionParametersFromValueTargetURL
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParameters(TypedDict, total=False):
- from_list: RuleRulesetsRedirectRuleActionParametersFromList
- """Serve a redirect based on a bulk list lookup."""
-
- from_value: RuleRulesetsRedirectRuleActionParametersFromValue
- """Serve a redirect based on the request properties."""
-
-
-class RuleRulesetsRedirectRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["redirect"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsRedirectRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader(TypedDict, total=False):
- operation: Required[Literal["remove"]]
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader(TypedDict, total=False):
- operation: Required[Literal["set"]]
-
- value: Required[str]
- """Static value for the header."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader(TypedDict, total=False):
- expression: Required[str]
- """Expression for the header value."""
-
- operation: Required[Literal["set"]]
-
-
-RuleRulesetsRewriteRuleActionParametersHeaders = Union[
- RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathStaticValue(TypedDict, total=False):
- value: Required[str]
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue(TypedDict, total=False):
- expression: Required[str]
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIPath = Union[
- RuleRulesetsRewriteRuleActionParametersURIPathStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue(TypedDict, total=False):
- value: Required[str]
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue(TypedDict, total=False):
- expression: Required[str]
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIQuery = Union[
- RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURI(TypedDict, total=False):
- path: RuleRulesetsRewriteRuleActionParametersURIPath
- """Path portion rewrite."""
-
- query: RuleRulesetsRewriteRuleActionParametersURIQuery
- """Query portion rewrite."""
-
-
-class RuleRulesetsRewriteRuleActionParameters(TypedDict, total=False):
- headers: Dict[str, RuleRulesetsRewriteRuleActionParametersHeaders]
- """Map of request headers to modify."""
-
- uri: RuleRulesetsRewriteRuleActionParametersURI
- """URI to rewrite the request to."""
-
-
-class RuleRulesetsRewriteRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["rewrite"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsRewriteRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRouteRuleActionParametersOrigin(TypedDict, total=False):
- host: str
- """Override the resolved hostname."""
-
- port: float
- """Override the destination port."""
-
-
-class RuleRulesetsRouteRuleActionParametersSni(TypedDict, total=False):
- value: Required[str]
- """The SNI override."""
-
-
-class RuleRulesetsRouteRuleActionParameters(TypedDict, total=False):
- host_header: str
- """Rewrite the HTTP Host header."""
-
- origin: RuleRulesetsRouteRuleActionParametersOrigin
- """Override the IP/TCP destination."""
-
- sni: RuleRulesetsRouteRuleActionParametersSni
- """Override the Server Name Indication (SNI)."""
-
-
-class RuleRulesetsRouteRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["route"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsRouteRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsScoreRuleActionParameters(TypedDict, total=False):
- increment: int
- """
- Increment contains the delta to change the score and can be either positive or
- negative.
- """
-
-
-class RuleRulesetsScoreRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["score"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsScoreRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsServeErrorRuleActionParameters(TypedDict, total=False):
- content: str
- """Error response content."""
-
- content_type: Literal["application/json", "text/xml", "text/plain", "text/html"]
- """Content-type header to set with the response."""
-
- status_code: float
- """The status code to use for the error."""
-
-
-class RuleRulesetsServeErrorRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["serve_error"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsServeErrorRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetConfigRuleActionParametersAutominify(TypedDict, total=False):
- css: bool
- """Minify CSS files."""
-
- html: bool
- """Minify HTML files."""
-
- js: bool
- """Minify JS files."""
-
-
-class RuleRulesetsSetConfigRuleActionParameters(TypedDict, total=False):
- automatic_https_rewrites: bool
- """Turn on or off Automatic HTTPS Rewrites."""
-
- autominify: RuleRulesetsSetConfigRuleActionParametersAutominify
- """Select which file extensions to minify automatically."""
-
- bic: bool
- """Turn on or off Browser Integrity Check."""
-
- disable_apps: bool
- """Turn off all active Cloudflare Apps."""
-
- disable_zaraz: bool
- """Turn off Zaraz."""
-
- email_obfuscation: bool
- """Turn on or off Email Obfuscation."""
-
- hotlink_protection: bool
- """Turn on or off the Hotlink Protection."""
-
- mirage: bool
- """Turn on or off Mirage."""
-
- opportunistic_encryption: bool
- """Turn on or off Opportunistic Encryption."""
-
- polish: Literal["off", "lossless", "lossy"]
- """Configure the Polish level."""
-
- rocket_loader: bool
- """Turn on or off Rocket Loader"""
-
- security_level: Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]
- """Configure the Security Level."""
-
- server_side_excludes: bool
- """Turn on or off Server Side Excludes."""
-
- ssl: Literal["off", "flexible", "full", "strict", "origin_pull"]
- """Configure the SSL level."""
-
- sxg: bool
- """Turn on or off Signed Exchanges (SXG)."""
-
-
-class RuleRulesetsSetConfigRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["set_config"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsSetConfigRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL(TypedDict, total=False):
- mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]]
- """Determines which browser ttl mode to use."""
-
- default: int
- """The TTL (in seconds) if you choose override_origin mode."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(TypedDict, total=False):
- check_presence: List[str]
- """Checks for the presence of these cookie names.
-
- The presence of these cookies is used in building the cache key.
- """
-
- include: List[str]
- """Include these cookies' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(TypedDict, total=False):
- check_presence: List[str]
- """Checks for the presence of these header names.
-
- The presence of these headers is used in building the cache key.
- """
-
- exclude_origin: bool
- """Whether or not to include the origin header.
-
- A value of true will exclude the origin header in the cache key.
- """
-
- include: List[str]
- """Include these headers' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(TypedDict, total=False):
- resolved: bool
- """Use the resolved host in the cache key.
-
- A value of true will use the resolved host, while a value or false will use the
- original host.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(TypedDict, total=False):
- all: bool
- """Exclude all query string parameters from use in building the cache key."""
-
- list: List[str]
- """A list of query string parameters NOT used to build the cache key.
-
- All parameters present in the request but missing in this list will be used to
- build the cache key.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(TypedDict, total=False):
- all: bool
- """Use all query string parameters in the cache key."""
-
- list: List[str]
- """A list of query string parameters used to build the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(TypedDict, total=False):
- exclude: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude
- """
- build the cache key using all query string parameters EXCECPT these excluded
- parameters
- """
-
- include: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude
- """
- build the cache key using a list of query string parameters that ARE in the
- request.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(TypedDict, total=False):
- device_type: bool
- """Use the user agent's device type in the cache key."""
-
- geo: bool
- """Use the user agents's country in the cache key."""
-
- lang: bool
- """Use the user agent's language in the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey(TypedDict, total=False):
- cookie: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie
- """The cookies to include in building the cache key."""
-
- header: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader
- """The header names and values to include in building the cache key."""
-
- host: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost
- """Whether to use the original host or the resolved host in the cache key."""
-
- query_string: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString
- """
- Use the presence or absence of parameters in the query string to build the cache
- key.
- """
-
- user: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser
- """Characteristics of the request user agent used in building the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey(TypedDict, total=False):
- cache_by_device_type: bool
- """Separate cached content based on the visitor’s device type"""
-
- cache_deception_armor: bool
- """
- Protect from web cache deception attacks while allowing static assets to be
- cached
- """
-
- custom_key: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey
- """
- Customize which components of the request are included or excluded from the
- cache key.
- """
-
- ignore_query_strings_order: bool
- """
- Treat requests with the same query parameters the same, regardless of the order
- those query parameters are in. A value of true ignores the query strings' order.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve(TypedDict, total=False):
- eligible: Required[bool]
- """Determines whether cache reserve is enabled.
-
- If this is true and a request meets eligibility criteria, Cloudflare will write
- the resource to cache reserve.
- """
-
- min_file_size: Required[int]
- """The minimum file size eligible for store in cache reserve."""
-
-
-_RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords = TypedDict(
- "_RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords",
- {
- "from": int,
- },
- total=False,
-)
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(
- _RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords, total=False
-):
- to: Required[int]
- """response status code upper bound"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(TypedDict, total=False):
- value: Required[int]
- """Time to cache a response (in seconds).
-
- A value of 0 is equivalent to setting the Cache-Control header with the value
- "no-cache". A value of -1 is equivalent to setting Cache-Control header with the
- value of "no-store".
- """
-
- status_code_range: RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
- """The range of status codes used to apply the selected mode."""
-
- status_code_value: int
- """Set the ttl for responses with this specific status code"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL(TypedDict, total=False):
- default: Required[int]
- """The TTL (in seconds) if you choose override_origin mode."""
-
- mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]]
- """edge ttl options"""
-
- status_code_ttl: Required[Iterable[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]]
- """List of single status codes, or status code ranges to apply the selected mode"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersServeStale(TypedDict, total=False):
- disable_stale_while_updating: Required[bool]
- """Defines whether Cloudflare should serve stale content while updating.
-
- If true, Cloudflare will not serve stale content while getting the latest
- content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParameters(TypedDict, total=False):
- additional_cacheable_ports: Iterable[int]
- """List of additional ports that caching can be enabled on."""
-
- browser_ttl: RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL
- """Specify how long client browsers should cache the response.
-
- Cloudflare cache purge will not purge content cached on client browsers, so high
- browser TTLs may lead to stale content.
- """
-
- cache: bool
- """Mark whether the request’s response from origin is eligible for caching.
-
- Caching itself will still depend on the cache-control header and your other
- caching configurations.
- """
-
- cache_key: RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey
- """
- Define which components of the request are included or excluded from the cache
- key Cloudflare uses to store the response in cache.
- """
-
- cache_reserve: RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve
- """
- Mark whether the request's response from origin is eligible for Cache Reserve
- (requires a Cache Reserve add-on plan).
- """
-
- edge_ttl: RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL
- """
- TTL (Time to Live) specifies the maximum time to cache a resource in the
- Cloudflare edge network.
- """
-
- origin_cache_control: bool
- """When enabled, Cloudflare will aim to strictly adhere to RFC 7234."""
-
- origin_error_page_passthru: bool
- """Generate Cloudflare error pages from issues sent from the origin server.
-
- When on, error pages will trigger for issues from the origin
- """
-
- read_timeout: int
- """
- Define a timeout value between two successive read operations to your origin
- server. Historically, the timeout value between two read options from Cloudflare
- to an origin server is 100 seconds. If you are attempting to reduce HTTP 524
- errors because of timeouts from an origin server, try increasing this timeout
- value.
- """
-
- respect_strong_etags: bool
- """
- Specify whether or not Cloudflare should respect strong ETag (entity tag)
- headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
- """
-
- serve_stale: RuleRulesetsSetCacheSettingsRuleActionParametersServeStale
- """
- Define if Cloudflare should serve stale content while getting the latest content
- from the origin. If on, Cloudflare will not serve stale content while getting
- the latest content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["set_cache_settings"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsSetCacheSettingsRuleActionParameters
- """The parameters configuring the rule's action."""
-
- description: str
- """An informative description of the rule."""
-
- enabled: bool
- """Whether the rule should be executed."""
-
- expression: str
- """The expression defining which traffic will match the rule."""
-
- logging: LoggingParam
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
Rule = Union[
BlockRuleParam,
- RuleRulesetsChallengeRule,
- RuleRulesetsCompressResponseRule,
+ ChallengeRuleParam,
+ CompressResponseRuleParam,
ExecuteRuleParam,
- RuleRulesetsJsChallengeRule,
+ JsChallengeRuleParam,
LogRuleParam,
- RuleRulesetsManagedChallengeRule,
- RuleRulesetsRedirectRule,
- RuleRulesetsRewriteRule,
- RuleRulesetsRouteRule,
- RuleRulesetsScoreRule,
- RuleRulesetsServeErrorRule,
- RuleRulesetsSetConfigRule,
+ ManagedChallengeRuleParam,
+ RedirectRuleParam,
+ RewriteRuleParam,
+ RouteRuleParam,
+ ScoreRuleParam,
+ ServeErrorRuleParam,
+ SetConfigRuleParam,
SkipRuleParam,
- RuleRulesetsSetCacheSettingsRule,
+ SetCacheSettingsRuleParam,
]
diff --git a/src/cloudflare/types/rulesets/phase_update_response.py b/src/cloudflare/types/rulesets/phase_update_response.py
index 5295d28b058..890bbbbb100 100644
--- a/src/cloudflare/types/rulesets/phase_update_response.py
+++ b/src/cloudflare/types/rulesets/phase_update_response.py
@@ -1,965 +1,44 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
-from pydantic import Field as FieldInfo
-
-from .logging import Logging
from .log_rule import LogRule
from ..._models import BaseModel
from .skip_rule import SkipRule
from .block_rule import BlockRule
+from .route_rule import RouteRule
+from .score_rule import ScoreRule
from .execute_rule import ExecuteRule
-
-__all__ = [
- "PhaseUpdateResponse",
- "Rule",
- "RuleRulesetsChallengeRule",
- "RuleRulesetsCompressResponseRule",
- "RuleRulesetsCompressResponseRuleActionParameters",
- "RuleRulesetsCompressResponseRuleActionParametersAlgorithm",
- "RuleRulesetsJsChallengeRule",
- "RuleRulesetsManagedChallengeRule",
- "RuleRulesetsRedirectRule",
- "RuleRulesetsRedirectRuleActionParameters",
- "RuleRulesetsRedirectRuleActionParametersFromList",
- "RuleRulesetsRedirectRuleActionParametersFromValue",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURL",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
- "RuleRulesetsRewriteRule",
- "RuleRulesetsRewriteRuleActionParameters",
- "RuleRulesetsRewriteRuleActionParametersHeaders",
- "RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader",
- "RuleRulesetsRewriteRuleActionParametersURI",
- "RuleRulesetsRewriteRuleActionParametersURIPath",
- "RuleRulesetsRewriteRuleActionParametersURIPathStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue",
- "RuleRulesetsRewriteRuleActionParametersURIQuery",
- "RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue",
- "RuleRulesetsRouteRule",
- "RuleRulesetsRouteRuleActionParameters",
- "RuleRulesetsRouteRuleActionParametersOrigin",
- "RuleRulesetsRouteRuleActionParametersSni",
- "RuleRulesetsScoreRule",
- "RuleRulesetsScoreRuleActionParameters",
- "RuleRulesetsServeErrorRule",
- "RuleRulesetsServeErrorRuleActionParameters",
- "RuleRulesetsSetConfigRule",
- "RuleRulesetsSetConfigRuleActionParameters",
- "RuleRulesetsSetConfigRuleActionParametersAutominify",
- "RuleRulesetsSetCacheSettingsRule",
- "RuleRulesetsSetCacheSettingsRuleActionParameters",
- "RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
- "RuleRulesetsSetCacheSettingsRuleActionParametersServeStale",
-]
-
-
-class RuleRulesetsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsCompressResponseRuleActionParametersAlgorithm(BaseModel):
- name: Optional[Literal["none", "auto", "default", "gzip", "brotli"]] = None
- """Name of compression algorithm to enable."""
-
-
-class RuleRulesetsCompressResponseRuleActionParameters(BaseModel):
- algorithms: Optional[List[RuleRulesetsCompressResponseRuleActionParametersAlgorithm]] = None
- """Custom order for compression algorithms."""
-
-
-class RuleRulesetsCompressResponseRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["compress_response"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsCompressResponseRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsJsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["js_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsManagedChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["managed_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromList(BaseModel):
- key: Optional[str] = None
- """Expression that evaluates to the list lookup key."""
-
- name: Optional[str] = None
- """The name of the list to match against."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(BaseModel):
- value: Optional[str] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(BaseModel):
- expression: Optional[str] = None
- """An expression to evaluate to get the URL to redirect the request to."""
-
-
-RuleRulesetsRedirectRuleActionParametersFromValueTargetURL = Union[
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
-]
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValue(BaseModel):
- preserve_query_string: Optional[bool] = None
- """Keep the query string of the original request."""
-
- status_code: Optional[Literal[301, 302, 303, 307, 308]] = None
- """The status code to be used for the redirect."""
-
- target_url: Optional[RuleRulesetsRedirectRuleActionParametersFromValueTargetURL] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParameters(BaseModel):
- from_list: Optional[RuleRulesetsRedirectRuleActionParametersFromList] = None
- """Serve a redirect based on a bulk list lookup."""
-
- from_value: Optional[RuleRulesetsRedirectRuleActionParametersFromValue] = None
- """Serve a redirect based on the request properties."""
-
-
-class RuleRulesetsRedirectRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["redirect"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRedirectRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader(BaseModel):
- operation: Literal["remove"]
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader(BaseModel):
- operation: Literal["set"]
-
- value: str
- """Static value for the header."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader(BaseModel):
- expression: str
- """Expression for the header value."""
-
- operation: Literal["set"]
-
-
-RuleRulesetsRewriteRuleActionParametersHeaders = Union[
- RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIPath = Union[
- RuleRulesetsRewriteRuleActionParametersURIPathStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIQuery = Union[
- RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURI(BaseModel):
- path: Optional[RuleRulesetsRewriteRuleActionParametersURIPath] = None
- """Path portion rewrite."""
-
- query: Optional[RuleRulesetsRewriteRuleActionParametersURIQuery] = None
- """Query portion rewrite."""
-
-
-class RuleRulesetsRewriteRuleActionParameters(BaseModel):
- headers: Optional[Dict[str, RuleRulesetsRewriteRuleActionParametersHeaders]] = None
- """Map of request headers to modify."""
-
- uri: Optional[RuleRulesetsRewriteRuleActionParametersURI] = None
- """URI to rewrite the request to."""
-
-
-class RuleRulesetsRewriteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["rewrite"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRewriteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRouteRuleActionParametersOrigin(BaseModel):
- host: Optional[str] = None
- """Override the resolved hostname."""
-
- port: Optional[float] = None
- """Override the destination port."""
-
-
-class RuleRulesetsRouteRuleActionParametersSni(BaseModel):
- value: str
- """The SNI override."""
-
-
-class RuleRulesetsRouteRuleActionParameters(BaseModel):
- host_header: Optional[str] = None
- """Rewrite the HTTP Host header."""
-
- origin: Optional[RuleRulesetsRouteRuleActionParametersOrigin] = None
- """Override the IP/TCP destination."""
-
- sni: Optional[RuleRulesetsRouteRuleActionParametersSni] = None
- """Override the Server Name Indication (SNI)."""
-
-
-class RuleRulesetsRouteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["route"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRouteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsScoreRuleActionParameters(BaseModel):
- increment: Optional[int] = None
- """
- Increment contains the delta to change the score and can be either positive or
- negative.
- """
-
-
-class RuleRulesetsScoreRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["score"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsScoreRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsServeErrorRuleActionParameters(BaseModel):
- content: Optional[str] = None
- """Error response content."""
-
- content_type: Optional[Literal["application/json", "text/xml", "text/plain", "text/html"]] = None
- """Content-type header to set with the response."""
-
- status_code: Optional[float] = None
- """The status code to use for the error."""
-
-
-class RuleRulesetsServeErrorRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["serve_error"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsServeErrorRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetConfigRuleActionParametersAutominify(BaseModel):
- css: Optional[bool] = None
- """Minify CSS files."""
-
- html: Optional[bool] = None
- """Minify HTML files."""
-
- js: Optional[bool] = None
- """Minify JS files."""
-
-
-class RuleRulesetsSetConfigRuleActionParameters(BaseModel):
- automatic_https_rewrites: Optional[bool] = None
- """Turn on or off Automatic HTTPS Rewrites."""
-
- autominify: Optional[RuleRulesetsSetConfigRuleActionParametersAutominify] = None
- """Select which file extensions to minify automatically."""
-
- bic: Optional[bool] = None
- """Turn on or off Browser Integrity Check."""
-
- disable_apps: Optional[bool] = None
- """Turn off all active Cloudflare Apps."""
-
- disable_zaraz: Optional[bool] = None
- """Turn off Zaraz."""
-
- email_obfuscation: Optional[bool] = None
- """Turn on or off Email Obfuscation."""
-
- hotlink_protection: Optional[bool] = None
- """Turn on or off the Hotlink Protection."""
-
- mirage: Optional[bool] = None
- """Turn on or off Mirage."""
-
- opportunistic_encryption: Optional[bool] = None
- """Turn on or off Opportunistic Encryption."""
-
- polish: Optional[Literal["off", "lossless", "lossy"]] = None
- """Configure the Polish level."""
-
- rocket_loader: Optional[bool] = None
- """Turn on or off Rocket Loader"""
-
- security_level: Optional[Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]] = None
- """Configure the Security Level."""
-
- server_side_excludes: Optional[bool] = None
- """Turn on or off Server Side Excludes."""
-
- ssl: Optional[Literal["off", "flexible", "full", "strict", "origin_pull"]] = None
- """Configure the SSL level."""
-
- sxg: Optional[bool] = None
- """Turn on or off Signed Exchanges (SXG)."""
-
-
-class RuleRulesetsSetConfigRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_config"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetConfigRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL(BaseModel):
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """Determines which browser ttl mode to use."""
-
- default: Optional[int] = None
- """The TTL (in seconds) if you choose override_origin mode."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these cookie names.
-
- The presence of these cookies is used in building the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these cookies' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these header names.
-
- The presence of these headers is used in building the cache key.
- """
-
- exclude_origin: Optional[bool] = None
- """Whether or not to include the origin header.
-
- A value of true will exclude the origin header in the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these headers' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(BaseModel):
- resolved: Optional[bool] = None
- """Use the resolved host in the cache key.
-
- A value of true will use the resolved host, while a value or false will use the
- original host.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(BaseModel):
- all: Optional[bool] = None
- """Exclude all query string parameters from use in building the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters NOT used to build the cache key.
-
- All parameters present in the request but missing in this list will be used to
- build the cache key.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(BaseModel):
- all: Optional[bool] = None
- """Use all query string parameters in the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters used to build the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(BaseModel):
- exclude: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] = None
- """
- build the cache key using all query string parameters EXCECPT these excluded
- parameters
- """
-
- include: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] = None
- """
- build the cache key using a list of query string parameters that ARE in the
- request.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(BaseModel):
- device_type: Optional[bool] = None
- """Use the user agent's device type in the cache key."""
-
- geo: Optional[bool] = None
- """Use the user agents's country in the cache key."""
-
- lang: Optional[bool] = None
- """Use the user agent's language in the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey(BaseModel):
- cookie: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] = None
- """The cookies to include in building the cache key."""
-
- header: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] = None
- """The header names and values to include in building the cache key."""
-
- host: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] = None
- """Whether to use the original host or the resolved host in the cache key."""
-
- query_string: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] = None
- """
- Use the presence or absence of parameters in the query string to build the cache
- key.
- """
-
- user: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] = None
- """Characteristics of the request user agent used in building the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey(BaseModel):
- cache_by_device_type: Optional[bool] = None
- """Separate cached content based on the visitor’s device type"""
-
- cache_deception_armor: Optional[bool] = None
- """
- Protect from web cache deception attacks while allowing static assets to be
- cached
- """
-
- custom_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] = None
- """
- Customize which components of the request are included or excluded from the
- cache key.
- """
-
- ignore_query_strings_order: Optional[bool] = None
- """
- Treat requests with the same query parameters the same, regardless of the order
- those query parameters are in. A value of true ignores the query strings' order.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve(BaseModel):
- eligible: bool
- """Determines whether cache reserve is enabled.
-
- If this is true and a request meets eligibility criteria, Cloudflare will write
- the resource to cache reserve.
- """
-
- min_file_size: int
- """The minimum file size eligible for store in cache reserve."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(BaseModel):
- from_: int = FieldInfo(alias="from")
- """response status code lower bound"""
-
- to: int
- """response status code upper bound"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(BaseModel):
- value: int
- """Time to cache a response (in seconds).
-
- A value of 0 is equivalent to setting the Cache-Control header with the value
- "no-cache". A value of -1 is equivalent to setting Cache-Control header with the
- value of "no-store".
- """
-
- status_code_range: Optional[
- RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
- ] = None
- """The range of status codes used to apply the selected mode."""
-
- status_code_value: Optional[int] = None
- """Set the ttl for responses with this specific status code"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL(BaseModel):
- default: int
- """The TTL (in seconds) if you choose override_origin mode."""
-
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """edge ttl options"""
-
- status_code_ttl: List[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]
- """List of single status codes, or status code ranges to apply the selected mode"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersServeStale(BaseModel):
- disable_stale_while_updating: bool
- """Defines whether Cloudflare should serve stale content while updating.
-
- If true, Cloudflare will not serve stale content while getting the latest
- content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParameters(BaseModel):
- additional_cacheable_ports: Optional[List[int]] = None
- """List of additional ports that caching can be enabled on."""
-
- browser_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] = None
- """Specify how long client browsers should cache the response.
-
- Cloudflare cache purge will not purge content cached on client browsers, so high
- browser TTLs may lead to stale content.
- """
-
- cache: Optional[bool] = None
- """Mark whether the request’s response from origin is eligible for caching.
-
- Caching itself will still depend on the cache-control header and your other
- caching configurations.
- """
-
- cache_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey] = None
- """
- Define which components of the request are included or excluded from the cache
- key Cloudflare uses to store the response in cache.
- """
-
- cache_reserve: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve] = None
- """
- Mark whether the request's response from origin is eligible for Cache Reserve
- (requires a Cache Reserve add-on plan).
- """
-
- edge_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] = None
- """
- TTL (Time to Live) specifies the maximum time to cache a resource in the
- Cloudflare edge network.
- """
-
- origin_cache_control: Optional[bool] = None
- """When enabled, Cloudflare will aim to strictly adhere to RFC 7234."""
-
- origin_error_page_passthru: Optional[bool] = None
- """Generate Cloudflare error pages from issues sent from the origin server.
-
- When on, error pages will trigger for issues from the origin
- """
-
- read_timeout: Optional[int] = None
- """
- Define a timeout value between two successive read operations to your origin
- server. Historically, the timeout value between two read options from Cloudflare
- to an origin server is 100 seconds. If you are attempting to reduce HTTP 524
- errors because of timeouts from an origin server, try increasing this timeout
- value.
- """
-
- respect_strong_etags: Optional[bool] = None
- """
- Specify whether or not Cloudflare should respect strong ETag (entity tag)
- headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
- """
-
- serve_stale: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersServeStale] = None
- """
- Define if Cloudflare should serve stale content while getting the latest content
- from the origin. If on, Cloudflare will not serve stale content while getting
- the latest content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_cache_settings"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetCacheSettingsRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
+from .rewrite_rule import RewriteRule
+from .redirect_rule import RedirectRule
+from .challenge_rule import ChallengeRule
+from .set_config_rule import SetConfigRule
+from .serve_error_rule import ServeErrorRule
+from .js_challenge_rule import JsChallengeRule
+from .compress_response_rule import CompressResponseRule
+from .managed_challenge_rule import ManagedChallengeRule
+from .set_cache_settings_rule import SetCacheSettingsRule
+
+__all__ = ["PhaseUpdateResponse", "Rule"]
Rule = Union[
BlockRule,
- RuleRulesetsChallengeRule,
- RuleRulesetsCompressResponseRule,
+ ChallengeRule,
+ CompressResponseRule,
ExecuteRule,
- RuleRulesetsJsChallengeRule,
+ JsChallengeRule,
LogRule,
- RuleRulesetsManagedChallengeRule,
- RuleRulesetsRedirectRule,
- RuleRulesetsRewriteRule,
- RuleRulesetsRouteRule,
- RuleRulesetsScoreRule,
- RuleRulesetsServeErrorRule,
- RuleRulesetsSetConfigRule,
+ ManagedChallengeRule,
+ RedirectRule,
+ RewriteRule,
+ RouteRule,
+ ScoreRule,
+ ServeErrorRule,
+ SetConfigRule,
SkipRule,
- RuleRulesetsSetCacheSettingsRule,
+ SetCacheSettingsRule,
]
diff --git a/src/cloudflare/types/rulesets/phases/version_get_response.py b/src/cloudflare/types/rulesets/phases/version_get_response.py
index 4bb716b1bb9..86bce386821 100644
--- a/src/cloudflare/types/rulesets/phases/version_get_response.py
+++ b/src/cloudflare/types/rulesets/phases/version_get_response.py
@@ -1,965 +1,44 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
-from pydantic import Field as FieldInfo
-
-from ..logging import Logging
from ..log_rule import LogRule
from ...._models import BaseModel
from ..skip_rule import SkipRule
from ..block_rule import BlockRule
+from ..route_rule import RouteRule
+from ..score_rule import ScoreRule
from ..execute_rule import ExecuteRule
-
-__all__ = [
- "VersionGetResponse",
- "Rule",
- "RuleRulesetsChallengeRule",
- "RuleRulesetsCompressResponseRule",
- "RuleRulesetsCompressResponseRuleActionParameters",
- "RuleRulesetsCompressResponseRuleActionParametersAlgorithm",
- "RuleRulesetsJsChallengeRule",
- "RuleRulesetsManagedChallengeRule",
- "RuleRulesetsRedirectRule",
- "RuleRulesetsRedirectRuleActionParameters",
- "RuleRulesetsRedirectRuleActionParametersFromList",
- "RuleRulesetsRedirectRuleActionParametersFromValue",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURL",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
- "RuleRulesetsRewriteRule",
- "RuleRulesetsRewriteRuleActionParameters",
- "RuleRulesetsRewriteRuleActionParametersHeaders",
- "RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader",
- "RuleRulesetsRewriteRuleActionParametersURI",
- "RuleRulesetsRewriteRuleActionParametersURIPath",
- "RuleRulesetsRewriteRuleActionParametersURIPathStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue",
- "RuleRulesetsRewriteRuleActionParametersURIQuery",
- "RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue",
- "RuleRulesetsRouteRule",
- "RuleRulesetsRouteRuleActionParameters",
- "RuleRulesetsRouteRuleActionParametersOrigin",
- "RuleRulesetsRouteRuleActionParametersSni",
- "RuleRulesetsScoreRule",
- "RuleRulesetsScoreRuleActionParameters",
- "RuleRulesetsServeErrorRule",
- "RuleRulesetsServeErrorRuleActionParameters",
- "RuleRulesetsSetConfigRule",
- "RuleRulesetsSetConfigRuleActionParameters",
- "RuleRulesetsSetConfigRuleActionParametersAutominify",
- "RuleRulesetsSetCacheSettingsRule",
- "RuleRulesetsSetCacheSettingsRuleActionParameters",
- "RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
- "RuleRulesetsSetCacheSettingsRuleActionParametersServeStale",
-]
-
-
-class RuleRulesetsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsCompressResponseRuleActionParametersAlgorithm(BaseModel):
- name: Optional[Literal["none", "auto", "default", "gzip", "brotli"]] = None
- """Name of compression algorithm to enable."""
-
-
-class RuleRulesetsCompressResponseRuleActionParameters(BaseModel):
- algorithms: Optional[List[RuleRulesetsCompressResponseRuleActionParametersAlgorithm]] = None
- """Custom order for compression algorithms."""
-
-
-class RuleRulesetsCompressResponseRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["compress_response"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsCompressResponseRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsJsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["js_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsManagedChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["managed_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromList(BaseModel):
- key: Optional[str] = None
- """Expression that evaluates to the list lookup key."""
-
- name: Optional[str] = None
- """The name of the list to match against."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(BaseModel):
- value: Optional[str] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(BaseModel):
- expression: Optional[str] = None
- """An expression to evaluate to get the URL to redirect the request to."""
-
-
-RuleRulesetsRedirectRuleActionParametersFromValueTargetURL = Union[
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
-]
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValue(BaseModel):
- preserve_query_string: Optional[bool] = None
- """Keep the query string of the original request."""
-
- status_code: Optional[Literal[301, 302, 303, 307, 308]] = None
- """The status code to be used for the redirect."""
-
- target_url: Optional[RuleRulesetsRedirectRuleActionParametersFromValueTargetURL] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParameters(BaseModel):
- from_list: Optional[RuleRulesetsRedirectRuleActionParametersFromList] = None
- """Serve a redirect based on a bulk list lookup."""
-
- from_value: Optional[RuleRulesetsRedirectRuleActionParametersFromValue] = None
- """Serve a redirect based on the request properties."""
-
-
-class RuleRulesetsRedirectRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["redirect"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRedirectRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader(BaseModel):
- operation: Literal["remove"]
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader(BaseModel):
- operation: Literal["set"]
-
- value: str
- """Static value for the header."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader(BaseModel):
- expression: str
- """Expression for the header value."""
-
- operation: Literal["set"]
-
-
-RuleRulesetsRewriteRuleActionParametersHeaders = Union[
- RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIPath = Union[
- RuleRulesetsRewriteRuleActionParametersURIPathStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIQuery = Union[
- RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURI(BaseModel):
- path: Optional[RuleRulesetsRewriteRuleActionParametersURIPath] = None
- """Path portion rewrite."""
-
- query: Optional[RuleRulesetsRewriteRuleActionParametersURIQuery] = None
- """Query portion rewrite."""
-
-
-class RuleRulesetsRewriteRuleActionParameters(BaseModel):
- headers: Optional[Dict[str, RuleRulesetsRewriteRuleActionParametersHeaders]] = None
- """Map of request headers to modify."""
-
- uri: Optional[RuleRulesetsRewriteRuleActionParametersURI] = None
- """URI to rewrite the request to."""
-
-
-class RuleRulesetsRewriteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["rewrite"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRewriteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRouteRuleActionParametersOrigin(BaseModel):
- host: Optional[str] = None
- """Override the resolved hostname."""
-
- port: Optional[float] = None
- """Override the destination port."""
-
-
-class RuleRulesetsRouteRuleActionParametersSni(BaseModel):
- value: str
- """The SNI override."""
-
-
-class RuleRulesetsRouteRuleActionParameters(BaseModel):
- host_header: Optional[str] = None
- """Rewrite the HTTP Host header."""
-
- origin: Optional[RuleRulesetsRouteRuleActionParametersOrigin] = None
- """Override the IP/TCP destination."""
-
- sni: Optional[RuleRulesetsRouteRuleActionParametersSni] = None
- """Override the Server Name Indication (SNI)."""
-
-
-class RuleRulesetsRouteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["route"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRouteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsScoreRuleActionParameters(BaseModel):
- increment: Optional[int] = None
- """
- Increment contains the delta to change the score and can be either positive or
- negative.
- """
-
-
-class RuleRulesetsScoreRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["score"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsScoreRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsServeErrorRuleActionParameters(BaseModel):
- content: Optional[str] = None
- """Error response content."""
-
- content_type: Optional[Literal["application/json", "text/xml", "text/plain", "text/html"]] = None
- """Content-type header to set with the response."""
-
- status_code: Optional[float] = None
- """The status code to use for the error."""
-
-
-class RuleRulesetsServeErrorRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["serve_error"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsServeErrorRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetConfigRuleActionParametersAutominify(BaseModel):
- css: Optional[bool] = None
- """Minify CSS files."""
-
- html: Optional[bool] = None
- """Minify HTML files."""
-
- js: Optional[bool] = None
- """Minify JS files."""
-
-
-class RuleRulesetsSetConfigRuleActionParameters(BaseModel):
- automatic_https_rewrites: Optional[bool] = None
- """Turn on or off Automatic HTTPS Rewrites."""
-
- autominify: Optional[RuleRulesetsSetConfigRuleActionParametersAutominify] = None
- """Select which file extensions to minify automatically."""
-
- bic: Optional[bool] = None
- """Turn on or off Browser Integrity Check."""
-
- disable_apps: Optional[bool] = None
- """Turn off all active Cloudflare Apps."""
-
- disable_zaraz: Optional[bool] = None
- """Turn off Zaraz."""
-
- email_obfuscation: Optional[bool] = None
- """Turn on or off Email Obfuscation."""
-
- hotlink_protection: Optional[bool] = None
- """Turn on or off the Hotlink Protection."""
-
- mirage: Optional[bool] = None
- """Turn on or off Mirage."""
-
- opportunistic_encryption: Optional[bool] = None
- """Turn on or off Opportunistic Encryption."""
-
- polish: Optional[Literal["off", "lossless", "lossy"]] = None
- """Configure the Polish level."""
-
- rocket_loader: Optional[bool] = None
- """Turn on or off Rocket Loader"""
-
- security_level: Optional[Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]] = None
- """Configure the Security Level."""
-
- server_side_excludes: Optional[bool] = None
- """Turn on or off Server Side Excludes."""
-
- ssl: Optional[Literal["off", "flexible", "full", "strict", "origin_pull"]] = None
- """Configure the SSL level."""
-
- sxg: Optional[bool] = None
- """Turn on or off Signed Exchanges (SXG)."""
-
-
-class RuleRulesetsSetConfigRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_config"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetConfigRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL(BaseModel):
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """Determines which browser ttl mode to use."""
-
- default: Optional[int] = None
- """The TTL (in seconds) if you choose override_origin mode."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these cookie names.
-
- The presence of these cookies is used in building the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these cookies' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these header names.
-
- The presence of these headers is used in building the cache key.
- """
-
- exclude_origin: Optional[bool] = None
- """Whether or not to include the origin header.
-
- A value of true will exclude the origin header in the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these headers' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(BaseModel):
- resolved: Optional[bool] = None
- """Use the resolved host in the cache key.
-
- A value of true will use the resolved host, while a value or false will use the
- original host.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(BaseModel):
- all: Optional[bool] = None
- """Exclude all query string parameters from use in building the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters NOT used to build the cache key.
-
- All parameters present in the request but missing in this list will be used to
- build the cache key.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(BaseModel):
- all: Optional[bool] = None
- """Use all query string parameters in the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters used to build the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(BaseModel):
- exclude: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] = None
- """
- build the cache key using all query string parameters EXCECPT these excluded
- parameters
- """
-
- include: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] = None
- """
- build the cache key using a list of query string parameters that ARE in the
- request.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(BaseModel):
- device_type: Optional[bool] = None
- """Use the user agent's device type in the cache key."""
-
- geo: Optional[bool] = None
- """Use the user agents's country in the cache key."""
-
- lang: Optional[bool] = None
- """Use the user agent's language in the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey(BaseModel):
- cookie: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] = None
- """The cookies to include in building the cache key."""
-
- header: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] = None
- """The header names and values to include in building the cache key."""
-
- host: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] = None
- """Whether to use the original host or the resolved host in the cache key."""
-
- query_string: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] = None
- """
- Use the presence or absence of parameters in the query string to build the cache
- key.
- """
-
- user: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] = None
- """Characteristics of the request user agent used in building the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey(BaseModel):
- cache_by_device_type: Optional[bool] = None
- """Separate cached content based on the visitor’s device type"""
-
- cache_deception_armor: Optional[bool] = None
- """
- Protect from web cache deception attacks while allowing static assets to be
- cached
- """
-
- custom_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] = None
- """
- Customize which components of the request are included or excluded from the
- cache key.
- """
-
- ignore_query_strings_order: Optional[bool] = None
- """
- Treat requests with the same query parameters the same, regardless of the order
- those query parameters are in. A value of true ignores the query strings' order.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve(BaseModel):
- eligible: bool
- """Determines whether cache reserve is enabled.
-
- If this is true and a request meets eligibility criteria, Cloudflare will write
- the resource to cache reserve.
- """
-
- min_file_size: int
- """The minimum file size eligible for store in cache reserve."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(BaseModel):
- from_: int = FieldInfo(alias="from")
- """response status code lower bound"""
-
- to: int
- """response status code upper bound"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(BaseModel):
- value: int
- """Time to cache a response (in seconds).
-
- A value of 0 is equivalent to setting the Cache-Control header with the value
- "no-cache". A value of -1 is equivalent to setting Cache-Control header with the
- value of "no-store".
- """
-
- status_code_range: Optional[
- RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
- ] = None
- """The range of status codes used to apply the selected mode."""
-
- status_code_value: Optional[int] = None
- """Set the ttl for responses with this specific status code"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL(BaseModel):
- default: int
- """The TTL (in seconds) if you choose override_origin mode."""
-
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """edge ttl options"""
-
- status_code_ttl: List[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]
- """List of single status codes, or status code ranges to apply the selected mode"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersServeStale(BaseModel):
- disable_stale_while_updating: bool
- """Defines whether Cloudflare should serve stale content while updating.
-
- If true, Cloudflare will not serve stale content while getting the latest
- content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParameters(BaseModel):
- additional_cacheable_ports: Optional[List[int]] = None
- """List of additional ports that caching can be enabled on."""
-
- browser_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] = None
- """Specify how long client browsers should cache the response.
-
- Cloudflare cache purge will not purge content cached on client browsers, so high
- browser TTLs may lead to stale content.
- """
-
- cache: Optional[bool] = None
- """Mark whether the request’s response from origin is eligible for caching.
-
- Caching itself will still depend on the cache-control header and your other
- caching configurations.
- """
-
- cache_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey] = None
- """
- Define which components of the request are included or excluded from the cache
- key Cloudflare uses to store the response in cache.
- """
-
- cache_reserve: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve] = None
- """
- Mark whether the request's response from origin is eligible for Cache Reserve
- (requires a Cache Reserve add-on plan).
- """
-
- edge_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] = None
- """
- TTL (Time to Live) specifies the maximum time to cache a resource in the
- Cloudflare edge network.
- """
-
- origin_cache_control: Optional[bool] = None
- """When enabled, Cloudflare will aim to strictly adhere to RFC 7234."""
-
- origin_error_page_passthru: Optional[bool] = None
- """Generate Cloudflare error pages from issues sent from the origin server.
-
- When on, error pages will trigger for issues from the origin
- """
-
- read_timeout: Optional[int] = None
- """
- Define a timeout value between two successive read operations to your origin
- server. Historically, the timeout value between two read options from Cloudflare
- to an origin server is 100 seconds. If you are attempting to reduce HTTP 524
- errors because of timeouts from an origin server, try increasing this timeout
- value.
- """
-
- respect_strong_etags: Optional[bool] = None
- """
- Specify whether or not Cloudflare should respect strong ETag (entity tag)
- headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
- """
-
- serve_stale: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersServeStale] = None
- """
- Define if Cloudflare should serve stale content while getting the latest content
- from the origin. If on, Cloudflare will not serve stale content while getting
- the latest content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_cache_settings"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetCacheSettingsRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
+from ..rewrite_rule import RewriteRule
+from ..redirect_rule import RedirectRule
+from ..challenge_rule import ChallengeRule
+from ..set_config_rule import SetConfigRule
+from ..serve_error_rule import ServeErrorRule
+from ..js_challenge_rule import JsChallengeRule
+from ..compress_response_rule import CompressResponseRule
+from ..managed_challenge_rule import ManagedChallengeRule
+from ..set_cache_settings_rule import SetCacheSettingsRule
+
+__all__ = ["VersionGetResponse", "Rule"]
Rule = Union[
BlockRule,
- RuleRulesetsChallengeRule,
- RuleRulesetsCompressResponseRule,
+ ChallengeRule,
+ CompressResponseRule,
ExecuteRule,
- RuleRulesetsJsChallengeRule,
+ JsChallengeRule,
LogRule,
- RuleRulesetsManagedChallengeRule,
- RuleRulesetsRedirectRule,
- RuleRulesetsRewriteRule,
- RuleRulesetsRouteRule,
- RuleRulesetsScoreRule,
- RuleRulesetsServeErrorRule,
- RuleRulesetsSetConfigRule,
+ ManagedChallengeRule,
+ RedirectRule,
+ RewriteRule,
+ RouteRule,
+ ScoreRule,
+ ServeErrorRule,
+ SetConfigRule,
SkipRule,
- RuleRulesetsSetCacheSettingsRule,
+ SetCacheSettingsRule,
]
diff --git a/src/cloudflare/types/rulesets/redirect_rule.py b/src/cloudflare/types/rulesets/redirect_rule.py
new file mode 100644
index 00000000000..9c8d6246760
--- /dev/null
+++ b/src/cloudflare/types/rulesets/redirect_rule.py
@@ -0,0 +1,95 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Union, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .logging import Logging
+from ..._models import BaseModel
+
+__all__ = [
+ "RedirectRule",
+ "ActionParameters",
+ "ActionParametersFromList",
+ "ActionParametersFromValue",
+ "ActionParametersFromValueTargetURL",
+ "ActionParametersFromValueTargetURLStaticURLRedirect",
+ "ActionParametersFromValueTargetURLDynamicURLRedirect",
+]
+
+
+class ActionParametersFromList(BaseModel):
+ key: Optional[str] = None
+ """Expression that evaluates to the list lookup key."""
+
+ name: Optional[str] = None
+ """The name of the list to match against."""
+
+
+class ActionParametersFromValueTargetURLStaticURLRedirect(BaseModel):
+ value: Optional[str] = None
+ """The URL to redirect the request to."""
+
+
+class ActionParametersFromValueTargetURLDynamicURLRedirect(BaseModel):
+ expression: Optional[str] = None
+ """An expression to evaluate to get the URL to redirect the request to."""
+
+
+ActionParametersFromValueTargetURL = Union[
+ ActionParametersFromValueTargetURLStaticURLRedirect, ActionParametersFromValueTargetURLDynamicURLRedirect
+]
+
+
+class ActionParametersFromValue(BaseModel):
+ preserve_query_string: Optional[bool] = None
+ """Keep the query string of the original request."""
+
+ status_code: Optional[Literal[301, 302, 303, 307, 308]] = None
+ """The status code to be used for the redirect."""
+
+ target_url: Optional[ActionParametersFromValueTargetURL] = None
+ """The URL to redirect the request to."""
+
+
+class ActionParameters(BaseModel):
+ from_list: Optional[ActionParametersFromList] = None
+ """Serve a redirect based on a bulk list lookup."""
+
+ from_value: Optional[ActionParametersFromValue] = None
+ """Serve a redirect based on the request properties."""
+
+
+class RedirectRule(BaseModel):
+ last_updated: datetime
+ """The timestamp of when the rule was last modified."""
+
+ version: str
+ """The version of the rule."""
+
+ id: Optional[str] = None
+ """The unique ID of the rule."""
+
+ action: Optional[Literal["redirect"]] = None
+ """The action to perform when the rule matches."""
+
+ action_parameters: Optional[ActionParameters] = None
+ """The parameters configuring the rule's action."""
+
+ categories: Optional[List[str]] = None
+ """The categories of the rule."""
+
+ description: Optional[str] = None
+ """An informative description of the rule."""
+
+ enabled: Optional[bool] = None
+ """Whether the rule should be executed."""
+
+ expression: Optional[str] = None
+ """The expression defining which traffic will match the rule."""
+
+ logging: Optional[Logging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/redirect_rule_param.py b/src/cloudflare/types/rulesets/redirect_rule_param.py
new file mode 100644
index 00000000000..ef67a8411f7
--- /dev/null
+++ b/src/cloudflare/types/rulesets/redirect_rule_param.py
@@ -0,0 +1,86 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Union
+from typing_extensions import Literal, TypedDict
+
+from .logging_param import LoggingParam
+
+__all__ = [
+ "RedirectRuleParam",
+ "ActionParameters",
+ "ActionParametersFromList",
+ "ActionParametersFromValue",
+ "ActionParametersFromValueTargetURL",
+ "ActionParametersFromValueTargetURLStaticURLRedirect",
+ "ActionParametersFromValueTargetURLDynamicURLRedirect",
+]
+
+
+class ActionParametersFromList(TypedDict, total=False):
+ key: str
+ """Expression that evaluates to the list lookup key."""
+
+ name: str
+ """The name of the list to match against."""
+
+
+class ActionParametersFromValueTargetURLStaticURLRedirect(TypedDict, total=False):
+ value: str
+ """The URL to redirect the request to."""
+
+
+class ActionParametersFromValueTargetURLDynamicURLRedirect(TypedDict, total=False):
+ expression: str
+ """An expression to evaluate to get the URL to redirect the request to."""
+
+
+ActionParametersFromValueTargetURL = Union[
+ ActionParametersFromValueTargetURLStaticURLRedirect, ActionParametersFromValueTargetURLDynamicURLRedirect
+]
+
+
+class ActionParametersFromValue(TypedDict, total=False):
+ preserve_query_string: bool
+ """Keep the query string of the original request."""
+
+ status_code: Literal[301, 302, 303, 307, 308]
+ """The status code to be used for the redirect."""
+
+ target_url: ActionParametersFromValueTargetURL
+ """The URL to redirect the request to."""
+
+
+class ActionParameters(TypedDict, total=False):
+ from_list: ActionParametersFromList
+ """Serve a redirect based on a bulk list lookup."""
+
+ from_value: ActionParametersFromValue
+ """Serve a redirect based on the request properties."""
+
+
+class RedirectRuleParam(TypedDict, total=False):
+ id: str
+ """The unique ID of the rule."""
+
+ action: Literal["redirect"]
+ """The action to perform when the rule matches."""
+
+ action_parameters: ActionParameters
+ """The parameters configuring the rule's action."""
+
+ description: str
+ """An informative description of the rule."""
+
+ enabled: bool
+ """Whether the rule should be executed."""
+
+ expression: str
+ """The expression defining which traffic will match the rule."""
+
+ logging: LoggingParam
+ """An object configuring the rule's logging behavior."""
+
+ ref: str
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/rewrite_rule.py b/src/cloudflare/types/rulesets/rewrite_rule.py
new file mode 100644
index 00000000000..aa76c3d0894
--- /dev/null
+++ b/src/cloudflare/types/rulesets/rewrite_rule.py
@@ -0,0 +1,93 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, List, Union, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .logging import Logging
+from ..._models import BaseModel
+from .rewrite_uri_part import RewriteURIPart
+
+__all__ = [
+ "RewriteRule",
+ "ActionParameters",
+ "ActionParametersHeaders",
+ "ActionParametersHeadersRemoveHeader",
+ "ActionParametersHeadersStaticHeader",
+ "ActionParametersHeadersDynamicHeader",
+ "ActionParametersURI",
+]
+
+
+class ActionParametersHeadersRemoveHeader(BaseModel):
+ operation: Literal["remove"]
+
+
+class ActionParametersHeadersStaticHeader(BaseModel):
+ operation: Literal["set"]
+
+ value: str
+ """Static value for the header."""
+
+
+class ActionParametersHeadersDynamicHeader(BaseModel):
+ expression: str
+ """Expression for the header value."""
+
+ operation: Literal["set"]
+
+
+ActionParametersHeaders = Union[
+ ActionParametersHeadersRemoveHeader, ActionParametersHeadersStaticHeader, ActionParametersHeadersDynamicHeader
+]
+
+
+class ActionParametersURI(BaseModel):
+ path: Optional[RewriteURIPart] = None
+ """Path portion rewrite."""
+
+ query: Optional[RewriteURIPart] = None
+ """Query portion rewrite."""
+
+
+class ActionParameters(BaseModel):
+ headers: Optional[Dict[str, ActionParametersHeaders]] = None
+ """Map of request headers to modify."""
+
+ uri: Optional[ActionParametersURI] = None
+ """URI to rewrite the request to."""
+
+
+class RewriteRule(BaseModel):
+ last_updated: datetime
+ """The timestamp of when the rule was last modified."""
+
+ version: str
+ """The version of the rule."""
+
+ id: Optional[str] = None
+ """The unique ID of the rule."""
+
+ action: Optional[Literal["rewrite"]] = None
+ """The action to perform when the rule matches."""
+
+ action_parameters: Optional[ActionParameters] = None
+ """The parameters configuring the rule's action."""
+
+ categories: Optional[List[str]] = None
+ """The categories of the rule."""
+
+ description: Optional[str] = None
+ """An informative description of the rule."""
+
+ enabled: Optional[bool] = None
+ """Whether the rule should be executed."""
+
+ expression: Optional[str] = None
+ """The expression defining which traffic will match the rule."""
+
+ logging: Optional[Logging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/rewrite_rule_param.py b/src/cloudflare/types/rulesets/rewrite_rule_param.py
new file mode 100644
index 00000000000..0b0e5617f65
--- /dev/null
+++ b/src/cloudflare/types/rulesets/rewrite_rule_param.py
@@ -0,0 +1,84 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Dict, Union
+from typing_extensions import Literal, Required, TypedDict
+
+from .logging_param import LoggingParam
+from .rewrite_uri_part_param import RewriteURIPartParam
+
+__all__ = [
+ "RewriteRuleParam",
+ "ActionParameters",
+ "ActionParametersHeaders",
+ "ActionParametersHeadersRemoveHeader",
+ "ActionParametersHeadersStaticHeader",
+ "ActionParametersHeadersDynamicHeader",
+ "ActionParametersURI",
+]
+
+
+class ActionParametersHeadersRemoveHeader(TypedDict, total=False):
+ operation: Required[Literal["remove"]]
+
+
+class ActionParametersHeadersStaticHeader(TypedDict, total=False):
+ operation: Required[Literal["set"]]
+
+ value: Required[str]
+ """Static value for the header."""
+
+
+class ActionParametersHeadersDynamicHeader(TypedDict, total=False):
+ expression: Required[str]
+ """Expression for the header value."""
+
+ operation: Required[Literal["set"]]
+
+
+ActionParametersHeaders = Union[
+ ActionParametersHeadersRemoveHeader, ActionParametersHeadersStaticHeader, ActionParametersHeadersDynamicHeader
+]
+
+
+class ActionParametersURI(TypedDict, total=False):
+ path: RewriteURIPartParam
+ """Path portion rewrite."""
+
+ query: RewriteURIPartParam
+ """Query portion rewrite."""
+
+
+class ActionParameters(TypedDict, total=False):
+ headers: Dict[str, ActionParametersHeaders]
+ """Map of request headers to modify."""
+
+ uri: ActionParametersURI
+ """URI to rewrite the request to."""
+
+
+class RewriteRuleParam(TypedDict, total=False):
+ id: str
+ """The unique ID of the rule."""
+
+ action: Literal["rewrite"]
+ """The action to perform when the rule matches."""
+
+ action_parameters: ActionParameters
+ """The parameters configuring the rule's action."""
+
+ description: str
+ """An informative description of the rule."""
+
+ enabled: bool
+ """Whether the rule should be executed."""
+
+ expression: str
+ """The expression defining which traffic will match the rule."""
+
+ logging: LoggingParam
+ """An object configuring the rule's logging behavior."""
+
+ ref: str
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/rewrite_uri_part.py b/src/cloudflare/types/rulesets/rewrite_uri_part.py
new file mode 100644
index 00000000000..b8620330c13
--- /dev/null
+++ b/src/cloudflare/types/rulesets/rewrite_uri_part.py
@@ -0,0 +1,20 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Union
+
+from ..._models import BaseModel
+
+__all__ = ["RewriteURIPart", "StaticValue", "DynamicValue"]
+
+
+class StaticValue(BaseModel):
+ value: str
+ """Predefined replacement value."""
+
+
+class DynamicValue(BaseModel):
+ expression: str
+ """Expression to evaluate for the replacement value."""
+
+
+RewriteURIPart = Union[StaticValue, DynamicValue]
diff --git a/src/cloudflare/types/rulesets/rewrite_uri_part_param.py b/src/cloudflare/types/rulesets/rewrite_uri_part_param.py
new file mode 100644
index 00000000000..32d4397ceee
--- /dev/null
+++ b/src/cloudflare/types/rulesets/rewrite_uri_part_param.py
@@ -0,0 +1,21 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Union
+from typing_extensions import Required, TypedDict
+
+__all__ = ["RewriteURIPartParam", "StaticValue", "DynamicValue"]
+
+
+class StaticValue(TypedDict, total=False):
+ value: Required[str]
+ """Predefined replacement value."""
+
+
+class DynamicValue(TypedDict, total=False):
+ expression: Required[str]
+ """Expression to evaluate for the replacement value."""
+
+
+RewriteURIPartParam = Union[StaticValue, DynamicValue]
diff --git a/src/cloudflare/types/rulesets/route_rule.py b/src/cloudflare/types/rulesets/route_rule.py
new file mode 100644
index 00000000000..79ac7512ba0
--- /dev/null
+++ b/src/cloudflare/types/rulesets/route_rule.py
@@ -0,0 +1,69 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .logging import Logging
+from ..._models import BaseModel
+
+__all__ = ["RouteRule", "ActionParameters", "ActionParametersOrigin", "ActionParametersSni"]
+
+
+class ActionParametersOrigin(BaseModel):
+ host: Optional[str] = None
+ """Override the resolved hostname."""
+
+ port: Optional[float] = None
+ """Override the destination port."""
+
+
+class ActionParametersSni(BaseModel):
+ value: str
+ """The SNI override."""
+
+
+class ActionParameters(BaseModel):
+ host_header: Optional[str] = None
+ """Rewrite the HTTP Host header."""
+
+ origin: Optional[ActionParametersOrigin] = None
+ """Override the IP/TCP destination."""
+
+ sni: Optional[ActionParametersSni] = None
+ """Override the Server Name Indication (SNI)."""
+
+
+class RouteRule(BaseModel):
+ last_updated: datetime
+ """The timestamp of when the rule was last modified."""
+
+ version: str
+ """The version of the rule."""
+
+ id: Optional[str] = None
+ """The unique ID of the rule."""
+
+ action: Optional[Literal["route"]] = None
+ """The action to perform when the rule matches."""
+
+ action_parameters: Optional[ActionParameters] = None
+ """The parameters configuring the rule's action."""
+
+ categories: Optional[List[str]] = None
+ """The categories of the rule."""
+
+ description: Optional[str] = None
+ """An informative description of the rule."""
+
+ enabled: Optional[bool] = None
+ """Whether the rule should be executed."""
+
+ expression: Optional[str] = None
+ """The expression defining which traffic will match the rule."""
+
+ logging: Optional[Logging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/route_rule_param.py b/src/cloudflare/types/rulesets/route_rule_param.py
new file mode 100644
index 00000000000..06ba330a332
--- /dev/null
+++ b/src/cloudflare/types/rulesets/route_rule_param.py
@@ -0,0 +1,59 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, Required, TypedDict
+
+from .logging_param import LoggingParam
+
+__all__ = ["RouteRuleParam", "ActionParameters", "ActionParametersOrigin", "ActionParametersSni"]
+
+
+class ActionParametersOrigin(TypedDict, total=False):
+ host: str
+ """Override the resolved hostname."""
+
+ port: float
+ """Override the destination port."""
+
+
+class ActionParametersSni(TypedDict, total=False):
+ value: Required[str]
+ """The SNI override."""
+
+
+class ActionParameters(TypedDict, total=False):
+ host_header: str
+ """Rewrite the HTTP Host header."""
+
+ origin: ActionParametersOrigin
+ """Override the IP/TCP destination."""
+
+ sni: ActionParametersSni
+ """Override the Server Name Indication (SNI)."""
+
+
+class RouteRuleParam(TypedDict, total=False):
+ id: str
+ """The unique ID of the rule."""
+
+ action: Literal["route"]
+ """The action to perform when the rule matches."""
+
+ action_parameters: ActionParameters
+ """The parameters configuring the rule's action."""
+
+ description: str
+ """An informative description of the rule."""
+
+ enabled: bool
+ """Whether the rule should be executed."""
+
+ expression: str
+ """The expression defining which traffic will match the rule."""
+
+ logging: LoggingParam
+ """An object configuring the rule's logging behavior."""
+
+ ref: str
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/rule_create_params.py b/src/cloudflare/types/rulesets/rule_create_params.py
index f6098adb173..02cb342935a 100644
--- a/src/cloudflare/types/rulesets/rule_create_params.py
+++ b/src/cloudflare/types/rulesets/rule_create_params.py
@@ -6,75 +6,70 @@
from typing_extensions import Literal, Required, TypedDict
from .logging_param import LoggingParam
+from .rewrite_uri_part_param import RewriteURIPartParam
__all__ = [
"RuleCreateParams",
"BlockRule",
"BlockRuleActionParameters",
"BlockRuleActionParametersResponse",
- "RulesetsChallengeRule",
- "RulesetsCompressResponseRule",
- "RulesetsCompressResponseRuleActionParameters",
- "RulesetsCompressResponseRuleActionParametersAlgorithm",
+ "ChallengeRule",
+ "CompressResponseRule",
+ "CompressResponseRuleActionParameters",
+ "CompressResponseRuleActionParametersAlgorithm",
"ExecuteRule",
"ExecuteRuleActionParameters",
"ExecuteRuleActionParametersMatchedData",
"ExecuteRuleActionParametersOverrides",
"ExecuteRuleActionParametersOverridesCategory",
"ExecuteRuleActionParametersOverridesRule",
- "RulesetsJsChallengeRule",
+ "JsChallengeRule",
"LogRule",
- "RulesetsManagedChallengeRule",
- "RulesetsRedirectRule",
- "RulesetsRedirectRuleActionParameters",
- "RulesetsRedirectRuleActionParametersFromList",
- "RulesetsRedirectRuleActionParametersFromValue",
- "RulesetsRedirectRuleActionParametersFromValueTargetURL",
- "RulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
- "RulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
- "RulesetsRewriteRule",
- "RulesetsRewriteRuleActionParameters",
- "RulesetsRewriteRuleActionParametersHeaders",
- "RulesetsRewriteRuleActionParametersHeadersRemoveHeader",
- "RulesetsRewriteRuleActionParametersHeadersStaticHeader",
- "RulesetsRewriteRuleActionParametersHeadersDynamicHeader",
- "RulesetsRewriteRuleActionParametersURI",
- "RulesetsRewriteRuleActionParametersURIPath",
- "RulesetsRewriteRuleActionParametersURIPathStaticValue",
- "RulesetsRewriteRuleActionParametersURIPathDynamicValue",
- "RulesetsRewriteRuleActionParametersURIQuery",
- "RulesetsRewriteRuleActionParametersURIQueryStaticValue",
- "RulesetsRewriteRuleActionParametersURIQueryDynamicValue",
- "RulesetsRouteRule",
- "RulesetsRouteRuleActionParameters",
- "RulesetsRouteRuleActionParametersOrigin",
- "RulesetsRouteRuleActionParametersSni",
- "RulesetsScoreRule",
- "RulesetsScoreRuleActionParameters",
- "RulesetsServeErrorRule",
- "RulesetsServeErrorRuleActionParameters",
- "RulesetsSetConfigRule",
- "RulesetsSetConfigRuleActionParameters",
- "RulesetsSetConfigRuleActionParametersAutominify",
+ "ManagedChallengeRule",
+ "RedirectRule",
+ "RedirectRuleActionParameters",
+ "RedirectRuleActionParametersFromList",
+ "RedirectRuleActionParametersFromValue",
+ "RedirectRuleActionParametersFromValueTargetURL",
+ "RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
+ "RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
+ "RewriteRule",
+ "RewriteRuleActionParameters",
+ "RewriteRuleActionParametersHeaders",
+ "RewriteRuleActionParametersHeadersRemoveHeader",
+ "RewriteRuleActionParametersHeadersStaticHeader",
+ "RewriteRuleActionParametersHeadersDynamicHeader",
+ "RewriteRuleActionParametersURI",
+ "RouteRule",
+ "RouteRuleActionParameters",
+ "RouteRuleActionParametersOrigin",
+ "RouteRuleActionParametersSni",
+ "ScoreRule",
+ "ScoreRuleActionParameters",
+ "ServeErrorRule",
+ "ServeErrorRuleActionParameters",
+ "SetConfigRule",
+ "SetConfigRuleActionParameters",
+ "SetConfigRuleActionParametersAutominify",
"SkipRule",
"SkipRuleActionParameters",
- "RulesetsSetCacheSettingsRule",
- "RulesetsSetCacheSettingsRuleActionParameters",
- "RulesetsSetCacheSettingsRuleActionParametersBrowserTTL",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKey",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
- "RulesetsSetCacheSettingsRuleActionParametersCacheReserve",
- "RulesetsSetCacheSettingsRuleActionParametersEdgeTTL",
- "RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
- "RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
- "RulesetsSetCacheSettingsRuleActionParametersServeStale",
+ "SetCacheSettingsRule",
+ "SetCacheSettingsRuleActionParameters",
+ "SetCacheSettingsRuleActionParametersBrowserTTL",
+ "SetCacheSettingsRuleActionParametersCacheKey",
+ "SetCacheSettingsRuleActionParametersCacheKeyCustomKey",
+ "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
+ "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
+ "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
+ "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
+ "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
+ "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
+ "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
+ "SetCacheSettingsRuleActionParametersCacheReserve",
+ "SetCacheSettingsRuleActionParametersEdgeTTL",
+ "SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
+ "SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
+ "SetCacheSettingsRuleActionParametersServeStale",
]
@@ -126,7 +121,7 @@ class BlockRuleActionParameters(TypedDict, total=False):
"""The response to show when the block is applied."""
-class RulesetsChallengeRule(TypedDict, total=False):
+class ChallengeRule(TypedDict, total=False):
account_id: str
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
@@ -158,7 +153,7 @@ class RulesetsChallengeRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsCompressResponseRule(TypedDict, total=False):
+class CompressResponseRule(TypedDict, total=False):
account_id: str
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
@@ -171,7 +166,7 @@ class RulesetsCompressResponseRule(TypedDict, total=False):
action: Literal["compress_response"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsCompressResponseRuleActionParameters
+ action_parameters: CompressResponseRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -190,13 +185,13 @@ class RulesetsCompressResponseRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsCompressResponseRuleActionParametersAlgorithm(TypedDict, total=False):
+class CompressResponseRuleActionParametersAlgorithm(TypedDict, total=False):
name: Literal["none", "auto", "default", "gzip", "brotli"]
"""Name of compression algorithm to enable."""
-class RulesetsCompressResponseRuleActionParameters(TypedDict, total=False):
- algorithms: Iterable[RulesetsCompressResponseRuleActionParametersAlgorithm]
+class CompressResponseRuleActionParameters(TypedDict, total=False):
+ algorithms: Iterable[CompressResponseRuleActionParametersAlgorithm]
"""Custom order for compression algorithms."""
@@ -309,7 +304,7 @@ class ExecuteRuleActionParameters(TypedDict, total=False):
"""A set of overrides to apply to the target ruleset."""
-class RulesetsJsChallengeRule(TypedDict, total=False):
+class JsChallengeRule(TypedDict, total=False):
account_id: str
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
@@ -373,7 +368,7 @@ class LogRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsManagedChallengeRule(TypedDict, total=False):
+class ManagedChallengeRule(TypedDict, total=False):
account_id: str
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
@@ -405,7 +400,7 @@ class RulesetsManagedChallengeRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsRedirectRule(TypedDict, total=False):
+class RedirectRule(TypedDict, total=False):
account_id: str
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
@@ -418,7 +413,7 @@ class RulesetsRedirectRule(TypedDict, total=False):
action: Literal["redirect"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsRedirectRuleActionParameters
+ action_parameters: RedirectRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -437,7 +432,7 @@ class RulesetsRedirectRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsRedirectRuleActionParametersFromList(TypedDict, total=False):
+class RedirectRuleActionParametersFromList(TypedDict, total=False):
key: str
"""Expression that evaluates to the list lookup key."""
@@ -445,42 +440,42 @@ class RulesetsRedirectRuleActionParametersFromList(TypedDict, total=False):
"""The name of the list to match against."""
-class RulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(TypedDict, total=False):
+class RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(TypedDict, total=False):
value: str
"""The URL to redirect the request to."""
-class RulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(TypedDict, total=False):
+class RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(TypedDict, total=False):
expression: str
"""An expression to evaluate to get the URL to redirect the request to."""
-RulesetsRedirectRuleActionParametersFromValueTargetURL = Union[
- RulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
- RulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
+RedirectRuleActionParametersFromValueTargetURL = Union[
+ RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
+ RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
]
-class RulesetsRedirectRuleActionParametersFromValue(TypedDict, total=False):
+class RedirectRuleActionParametersFromValue(TypedDict, total=False):
preserve_query_string: bool
"""Keep the query string of the original request."""
status_code: Literal[301, 302, 303, 307, 308]
"""The status code to be used for the redirect."""
- target_url: RulesetsRedirectRuleActionParametersFromValueTargetURL
+ target_url: RedirectRuleActionParametersFromValueTargetURL
"""The URL to redirect the request to."""
-class RulesetsRedirectRuleActionParameters(TypedDict, total=False):
- from_list: RulesetsRedirectRuleActionParametersFromList
+class RedirectRuleActionParameters(TypedDict, total=False):
+ from_list: RedirectRuleActionParametersFromList
"""Serve a redirect based on a bulk list lookup."""
- from_value: RulesetsRedirectRuleActionParametersFromValue
+ from_value: RedirectRuleActionParametersFromValue
"""Serve a redirect based on the request properties."""
-class RulesetsRewriteRule(TypedDict, total=False):
+class RewriteRule(TypedDict, total=False):
account_id: str
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
@@ -493,7 +488,7 @@ class RulesetsRewriteRule(TypedDict, total=False):
action: Literal["rewrite"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsRewriteRuleActionParameters
+ action_parameters: RewriteRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -512,78 +507,48 @@ class RulesetsRewriteRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsRewriteRuleActionParametersHeadersRemoveHeader(TypedDict, total=False):
+class RewriteRuleActionParametersHeadersRemoveHeader(TypedDict, total=False):
operation: Required[Literal["remove"]]
-class RulesetsRewriteRuleActionParametersHeadersStaticHeader(TypedDict, total=False):
+class RewriteRuleActionParametersHeadersStaticHeader(TypedDict, total=False):
operation: Required[Literal["set"]]
value: Required[str]
"""Static value for the header."""
-class RulesetsRewriteRuleActionParametersHeadersDynamicHeader(TypedDict, total=False):
+class RewriteRuleActionParametersHeadersDynamicHeader(TypedDict, total=False):
expression: Required[str]
"""Expression for the header value."""
operation: Required[Literal["set"]]
-RulesetsRewriteRuleActionParametersHeaders = Union[
- RulesetsRewriteRuleActionParametersHeadersRemoveHeader,
- RulesetsRewriteRuleActionParametersHeadersStaticHeader,
- RulesetsRewriteRuleActionParametersHeadersDynamicHeader,
+RewriteRuleActionParametersHeaders = Union[
+ RewriteRuleActionParametersHeadersRemoveHeader,
+ RewriteRuleActionParametersHeadersStaticHeader,
+ RewriteRuleActionParametersHeadersDynamicHeader,
]
-class RulesetsRewriteRuleActionParametersURIPathStaticValue(TypedDict, total=False):
- value: Required[str]
- """Predefined replacement value."""
-
-
-class RulesetsRewriteRuleActionParametersURIPathDynamicValue(TypedDict, total=False):
- expression: Required[str]
- """Expression to evaluate for the replacement value."""
-
-
-RulesetsRewriteRuleActionParametersURIPath = Union[
- RulesetsRewriteRuleActionParametersURIPathStaticValue, RulesetsRewriteRuleActionParametersURIPathDynamicValue
-]
-
-
-class RulesetsRewriteRuleActionParametersURIQueryStaticValue(TypedDict, total=False):
- value: Required[str]
- """Predefined replacement value."""
-
-
-class RulesetsRewriteRuleActionParametersURIQueryDynamicValue(TypedDict, total=False):
- expression: Required[str]
- """Expression to evaluate for the replacement value."""
-
-
-RulesetsRewriteRuleActionParametersURIQuery = Union[
- RulesetsRewriteRuleActionParametersURIQueryStaticValue, RulesetsRewriteRuleActionParametersURIQueryDynamicValue
-]
-
-
-class RulesetsRewriteRuleActionParametersURI(TypedDict, total=False):
- path: RulesetsRewriteRuleActionParametersURIPath
+class RewriteRuleActionParametersURI(TypedDict, total=False):
+ path: RewriteURIPartParam
"""Path portion rewrite."""
- query: RulesetsRewriteRuleActionParametersURIQuery
+ query: RewriteURIPartParam
"""Query portion rewrite."""
-class RulesetsRewriteRuleActionParameters(TypedDict, total=False):
- headers: Dict[str, RulesetsRewriteRuleActionParametersHeaders]
+class RewriteRuleActionParameters(TypedDict, total=False):
+ headers: Dict[str, RewriteRuleActionParametersHeaders]
"""Map of request headers to modify."""
- uri: RulesetsRewriteRuleActionParametersURI
+ uri: RewriteRuleActionParametersURI
"""URI to rewrite the request to."""
-class RulesetsRouteRule(TypedDict, total=False):
+class RouteRule(TypedDict, total=False):
account_id: str
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
@@ -596,7 +561,7 @@ class RulesetsRouteRule(TypedDict, total=False):
action: Literal["route"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsRouteRuleActionParameters
+ action_parameters: RouteRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -615,7 +580,7 @@ class RulesetsRouteRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsRouteRuleActionParametersOrigin(TypedDict, total=False):
+class RouteRuleActionParametersOrigin(TypedDict, total=False):
host: str
"""Override the resolved hostname."""
@@ -623,23 +588,23 @@ class RulesetsRouteRuleActionParametersOrigin(TypedDict, total=False):
"""Override the destination port."""
-class RulesetsRouteRuleActionParametersSni(TypedDict, total=False):
+class RouteRuleActionParametersSni(TypedDict, total=False):
value: Required[str]
"""The SNI override."""
-class RulesetsRouteRuleActionParameters(TypedDict, total=False):
+class RouteRuleActionParameters(TypedDict, total=False):
host_header: str
"""Rewrite the HTTP Host header."""
- origin: RulesetsRouteRuleActionParametersOrigin
+ origin: RouteRuleActionParametersOrigin
"""Override the IP/TCP destination."""
- sni: RulesetsRouteRuleActionParametersSni
+ sni: RouteRuleActionParametersSni
"""Override the Server Name Indication (SNI)."""
-class RulesetsScoreRule(TypedDict, total=False):
+class ScoreRule(TypedDict, total=False):
account_id: str
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
@@ -652,7 +617,7 @@ class RulesetsScoreRule(TypedDict, total=False):
action: Literal["score"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsScoreRuleActionParameters
+ action_parameters: ScoreRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -671,7 +636,7 @@ class RulesetsScoreRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsScoreRuleActionParameters(TypedDict, total=False):
+class ScoreRuleActionParameters(TypedDict, total=False):
increment: int
"""
Increment contains the delta to change the score and can be either positive or
@@ -679,7 +644,7 @@ class RulesetsScoreRuleActionParameters(TypedDict, total=False):
"""
-class RulesetsServeErrorRule(TypedDict, total=False):
+class ServeErrorRule(TypedDict, total=False):
account_id: str
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
@@ -692,7 +657,7 @@ class RulesetsServeErrorRule(TypedDict, total=False):
action: Literal["serve_error"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsServeErrorRuleActionParameters
+ action_parameters: ServeErrorRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -711,7 +676,7 @@ class RulesetsServeErrorRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsServeErrorRuleActionParameters(TypedDict, total=False):
+class ServeErrorRuleActionParameters(TypedDict, total=False):
content: str
"""Error response content."""
@@ -722,7 +687,7 @@ class RulesetsServeErrorRuleActionParameters(TypedDict, total=False):
"""The status code to use for the error."""
-class RulesetsSetConfigRule(TypedDict, total=False):
+class SetConfigRule(TypedDict, total=False):
account_id: str
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
@@ -735,7 +700,7 @@ class RulesetsSetConfigRule(TypedDict, total=False):
action: Literal["set_config"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsSetConfigRuleActionParameters
+ action_parameters: SetConfigRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -754,7 +719,7 @@ class RulesetsSetConfigRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsSetConfigRuleActionParametersAutominify(TypedDict, total=False):
+class SetConfigRuleActionParametersAutominify(TypedDict, total=False):
css: bool
"""Minify CSS files."""
@@ -765,11 +730,11 @@ class RulesetsSetConfigRuleActionParametersAutominify(TypedDict, total=False):
"""Minify JS files."""
-class RulesetsSetConfigRuleActionParameters(TypedDict, total=False):
+class SetConfigRuleActionParameters(TypedDict, total=False):
automatic_https_rewrites: bool
"""Turn on or off Automatic HTTPS Rewrites."""
- autominify: RulesetsSetConfigRuleActionParametersAutominify
+ autominify: SetConfigRuleActionParametersAutominify
"""Select which file extensions to minify automatically."""
bic: bool
@@ -899,7 +864,7 @@ class SkipRuleActionParameters(TypedDict, total=False):
"""
-class RulesetsSetCacheSettingsRule(TypedDict, total=False):
+class SetCacheSettingsRule(TypedDict, total=False):
account_id: str
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
@@ -912,7 +877,7 @@ class RulesetsSetCacheSettingsRule(TypedDict, total=False):
action: Literal["set_cache_settings"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsSetCacheSettingsRuleActionParameters
+ action_parameters: SetCacheSettingsRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -931,7 +896,7 @@ class RulesetsSetCacheSettingsRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsSetCacheSettingsRuleActionParametersBrowserTTL(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersBrowserTTL(TypedDict, total=False):
mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]]
"""Determines which browser ttl mode to use."""
@@ -939,7 +904,7 @@ class RulesetsSetCacheSettingsRuleActionParametersBrowserTTL(TypedDict, total=Fa
"""The TTL (in seconds) if you choose override_origin mode."""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(TypedDict, total=False):
check_presence: List[str]
"""Checks for the presence of these cookie names.
@@ -950,7 +915,7 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(TypedD
"""Include these cookies' names and their values."""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(TypedDict, total=False):
check_presence: List[str]
"""Checks for the presence of these header names.
@@ -967,7 +932,7 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(TypedD
"""Include these headers' names and their values."""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(TypedDict, total=False):
resolved: bool
"""Use the resolved host in the cache key.
@@ -976,7 +941,7 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(TypedDic
"""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(TypedDict, total=False):
all: bool
"""Exclude all query string parameters from use in building the cache key."""
@@ -988,7 +953,7 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringEx
"""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(TypedDict, total=False):
all: bool
"""Use all query string parameters in the cache key."""
@@ -996,21 +961,21 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIn
"""A list of query string parameters used to build the cache key."""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(TypedDict, total=False):
- exclude: RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude
+class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(TypedDict, total=False):
+ exclude: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude
"""
build the cache key using all query string parameters EXCECPT these excluded
parameters
"""
- include: RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude
+ include: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude
"""
build the cache key using a list of query string parameters that ARE in the
request.
"""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(TypedDict, total=False):
device_type: bool
"""Use the user agent's device type in the cache key."""
@@ -1021,27 +986,27 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(TypedDic
"""Use the user agent's language in the cache key."""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey(TypedDict, total=False):
- cookie: RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie
+class SetCacheSettingsRuleActionParametersCacheKeyCustomKey(TypedDict, total=False):
+ cookie: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie
"""The cookies to include in building the cache key."""
- header: RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader
+ header: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader
"""The header names and values to include in building the cache key."""
- host: RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost
+ host: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost
"""Whether to use the original host or the resolved host in the cache key."""
- query_string: RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString
+ query_string: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString
"""
Use the presence or absence of parameters in the query string to build the cache
key.
"""
- user: RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser
+ user: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser
"""Characteristics of the request user agent used in building the cache key."""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKey(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersCacheKey(TypedDict, total=False):
cache_by_device_type: bool
"""Separate cached content based on the visitor’s device type"""
@@ -1051,7 +1016,7 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheKey(TypedDict, total=Fals
cached
"""
- custom_key: RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey
+ custom_key: SetCacheSettingsRuleActionParametersCacheKeyCustomKey
"""
Customize which components of the request are included or excluded from the
cache key.
@@ -1064,7 +1029,7 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheKey(TypedDict, total=Fals
"""
-class RulesetsSetCacheSettingsRuleActionParametersCacheReserve(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersCacheReserve(TypedDict, total=False):
eligible: Required[bool]
"""Determines whether cache reserve is enabled.
@@ -1076,8 +1041,8 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheReserve(TypedDict, total=
"""The minimum file size eligible for store in cache reserve."""
-_RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords = TypedDict(
- "_RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords",
+_SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords = TypedDict(
+ "_SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords",
{
"from": int,
},
@@ -1085,14 +1050,14 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheReserve(TypedDict, total=
)
-class RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(
- _RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords, total=False
+class SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(
+ _SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords, total=False
):
to: Required[int]
"""response status code upper bound"""
-class RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(TypedDict, total=False):
value: Required[int]
"""Time to cache a response (in seconds).
@@ -1101,25 +1066,25 @@ class RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(TypedDict
value of "no-store".
"""
- status_code_range: RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
+ status_code_range: SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
"""The range of status codes used to apply the selected mode."""
status_code_value: int
"""Set the ttl for responses with this specific status code"""
-class RulesetsSetCacheSettingsRuleActionParametersEdgeTTL(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersEdgeTTL(TypedDict, total=False):
default: Required[int]
"""The TTL (in seconds) if you choose override_origin mode."""
mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]]
"""edge ttl options"""
- status_code_ttl: Required[Iterable[RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]]
+ status_code_ttl: Required[Iterable[SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]]
"""List of single status codes, or status code ranges to apply the selected mode"""
-class RulesetsSetCacheSettingsRuleActionParametersServeStale(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersServeStale(TypedDict, total=False):
disable_stale_while_updating: Required[bool]
"""Defines whether Cloudflare should serve stale content while updating.
@@ -1128,11 +1093,11 @@ class RulesetsSetCacheSettingsRuleActionParametersServeStale(TypedDict, total=Fa
"""
-class RulesetsSetCacheSettingsRuleActionParameters(TypedDict, total=False):
+class SetCacheSettingsRuleActionParameters(TypedDict, total=False):
additional_cacheable_ports: Iterable[int]
"""List of additional ports that caching can be enabled on."""
- browser_ttl: RulesetsSetCacheSettingsRuleActionParametersBrowserTTL
+ browser_ttl: SetCacheSettingsRuleActionParametersBrowserTTL
"""Specify how long client browsers should cache the response.
Cloudflare cache purge will not purge content cached on client browsers, so high
@@ -1146,19 +1111,19 @@ class RulesetsSetCacheSettingsRuleActionParameters(TypedDict, total=False):
caching configurations.
"""
- cache_key: RulesetsSetCacheSettingsRuleActionParametersCacheKey
+ cache_key: SetCacheSettingsRuleActionParametersCacheKey
"""
Define which components of the request are included or excluded from the cache
key Cloudflare uses to store the response in cache.
"""
- cache_reserve: RulesetsSetCacheSettingsRuleActionParametersCacheReserve
+ cache_reserve: SetCacheSettingsRuleActionParametersCacheReserve
"""
Mark whether the request's response from origin is eligible for Cache Reserve
(requires a Cache Reserve add-on plan).
"""
- edge_ttl: RulesetsSetCacheSettingsRuleActionParametersEdgeTTL
+ edge_ttl: SetCacheSettingsRuleActionParametersEdgeTTL
"""
TTL (Time to Live) specifies the maximum time to cache a resource in the
Cloudflare edge network.
@@ -1188,7 +1153,7 @@ class RulesetsSetCacheSettingsRuleActionParameters(TypedDict, total=False):
headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
"""
- serve_stale: RulesetsSetCacheSettingsRuleActionParametersServeStale
+ serve_stale: SetCacheSettingsRuleActionParametersServeStale
"""
Define if Cloudflare should serve stale content while getting the latest content
from the origin. If on, Cloudflare will not serve stale content while getting
@@ -1198,18 +1163,18 @@ class RulesetsSetCacheSettingsRuleActionParameters(TypedDict, total=False):
RuleCreateParams = Union[
BlockRule,
- RulesetsChallengeRule,
- RulesetsCompressResponseRule,
+ ChallengeRule,
+ CompressResponseRule,
ExecuteRule,
- RulesetsJsChallengeRule,
+ JsChallengeRule,
LogRule,
- RulesetsManagedChallengeRule,
- RulesetsRedirectRule,
- RulesetsRewriteRule,
- RulesetsRouteRule,
- RulesetsScoreRule,
- RulesetsServeErrorRule,
- RulesetsSetConfigRule,
+ ManagedChallengeRule,
+ RedirectRule,
+ RewriteRule,
+ RouteRule,
+ ScoreRule,
+ ServeErrorRule,
+ SetConfigRule,
SkipRule,
- RulesetsSetCacheSettingsRule,
+ SetCacheSettingsRule,
]
diff --git a/src/cloudflare/types/rulesets/rule_create_response.py b/src/cloudflare/types/rulesets/rule_create_response.py
index 76b96406f5d..8f06a060fef 100644
--- a/src/cloudflare/types/rulesets/rule_create_response.py
+++ b/src/cloudflare/types/rulesets/rule_create_response.py
@@ -1,965 +1,44 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
-from pydantic import Field as FieldInfo
-
-from .logging import Logging
from .log_rule import LogRule
from ..._models import BaseModel
from .skip_rule import SkipRule
from .block_rule import BlockRule
+from .route_rule import RouteRule
+from .score_rule import ScoreRule
from .execute_rule import ExecuteRule
-
-__all__ = [
- "RuleCreateResponse",
- "Rule",
- "RuleRulesetsChallengeRule",
- "RuleRulesetsCompressResponseRule",
- "RuleRulesetsCompressResponseRuleActionParameters",
- "RuleRulesetsCompressResponseRuleActionParametersAlgorithm",
- "RuleRulesetsJsChallengeRule",
- "RuleRulesetsManagedChallengeRule",
- "RuleRulesetsRedirectRule",
- "RuleRulesetsRedirectRuleActionParameters",
- "RuleRulesetsRedirectRuleActionParametersFromList",
- "RuleRulesetsRedirectRuleActionParametersFromValue",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURL",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
- "RuleRulesetsRewriteRule",
- "RuleRulesetsRewriteRuleActionParameters",
- "RuleRulesetsRewriteRuleActionParametersHeaders",
- "RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader",
- "RuleRulesetsRewriteRuleActionParametersURI",
- "RuleRulesetsRewriteRuleActionParametersURIPath",
- "RuleRulesetsRewriteRuleActionParametersURIPathStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue",
- "RuleRulesetsRewriteRuleActionParametersURIQuery",
- "RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue",
- "RuleRulesetsRouteRule",
- "RuleRulesetsRouteRuleActionParameters",
- "RuleRulesetsRouteRuleActionParametersOrigin",
- "RuleRulesetsRouteRuleActionParametersSni",
- "RuleRulesetsScoreRule",
- "RuleRulesetsScoreRuleActionParameters",
- "RuleRulesetsServeErrorRule",
- "RuleRulesetsServeErrorRuleActionParameters",
- "RuleRulesetsSetConfigRule",
- "RuleRulesetsSetConfigRuleActionParameters",
- "RuleRulesetsSetConfigRuleActionParametersAutominify",
- "RuleRulesetsSetCacheSettingsRule",
- "RuleRulesetsSetCacheSettingsRuleActionParameters",
- "RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
- "RuleRulesetsSetCacheSettingsRuleActionParametersServeStale",
-]
-
-
-class RuleRulesetsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsCompressResponseRuleActionParametersAlgorithm(BaseModel):
- name: Optional[Literal["none", "auto", "default", "gzip", "brotli"]] = None
- """Name of compression algorithm to enable."""
-
-
-class RuleRulesetsCompressResponseRuleActionParameters(BaseModel):
- algorithms: Optional[List[RuleRulesetsCompressResponseRuleActionParametersAlgorithm]] = None
- """Custom order for compression algorithms."""
-
-
-class RuleRulesetsCompressResponseRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["compress_response"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsCompressResponseRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsJsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["js_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsManagedChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["managed_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromList(BaseModel):
- key: Optional[str] = None
- """Expression that evaluates to the list lookup key."""
-
- name: Optional[str] = None
- """The name of the list to match against."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(BaseModel):
- value: Optional[str] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(BaseModel):
- expression: Optional[str] = None
- """An expression to evaluate to get the URL to redirect the request to."""
-
-
-RuleRulesetsRedirectRuleActionParametersFromValueTargetURL = Union[
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
-]
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValue(BaseModel):
- preserve_query_string: Optional[bool] = None
- """Keep the query string of the original request."""
-
- status_code: Optional[Literal[301, 302, 303, 307, 308]] = None
- """The status code to be used for the redirect."""
-
- target_url: Optional[RuleRulesetsRedirectRuleActionParametersFromValueTargetURL] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParameters(BaseModel):
- from_list: Optional[RuleRulesetsRedirectRuleActionParametersFromList] = None
- """Serve a redirect based on a bulk list lookup."""
-
- from_value: Optional[RuleRulesetsRedirectRuleActionParametersFromValue] = None
- """Serve a redirect based on the request properties."""
-
-
-class RuleRulesetsRedirectRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["redirect"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRedirectRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader(BaseModel):
- operation: Literal["remove"]
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader(BaseModel):
- operation: Literal["set"]
-
- value: str
- """Static value for the header."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader(BaseModel):
- expression: str
- """Expression for the header value."""
-
- operation: Literal["set"]
-
-
-RuleRulesetsRewriteRuleActionParametersHeaders = Union[
- RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIPath = Union[
- RuleRulesetsRewriteRuleActionParametersURIPathStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIQuery = Union[
- RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURI(BaseModel):
- path: Optional[RuleRulesetsRewriteRuleActionParametersURIPath] = None
- """Path portion rewrite."""
-
- query: Optional[RuleRulesetsRewriteRuleActionParametersURIQuery] = None
- """Query portion rewrite."""
-
-
-class RuleRulesetsRewriteRuleActionParameters(BaseModel):
- headers: Optional[Dict[str, RuleRulesetsRewriteRuleActionParametersHeaders]] = None
- """Map of request headers to modify."""
-
- uri: Optional[RuleRulesetsRewriteRuleActionParametersURI] = None
- """URI to rewrite the request to."""
-
-
-class RuleRulesetsRewriteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["rewrite"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRewriteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRouteRuleActionParametersOrigin(BaseModel):
- host: Optional[str] = None
- """Override the resolved hostname."""
-
- port: Optional[float] = None
- """Override the destination port."""
-
-
-class RuleRulesetsRouteRuleActionParametersSni(BaseModel):
- value: str
- """The SNI override."""
-
-
-class RuleRulesetsRouteRuleActionParameters(BaseModel):
- host_header: Optional[str] = None
- """Rewrite the HTTP Host header."""
-
- origin: Optional[RuleRulesetsRouteRuleActionParametersOrigin] = None
- """Override the IP/TCP destination."""
-
- sni: Optional[RuleRulesetsRouteRuleActionParametersSni] = None
- """Override the Server Name Indication (SNI)."""
-
-
-class RuleRulesetsRouteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["route"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRouteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsScoreRuleActionParameters(BaseModel):
- increment: Optional[int] = None
- """
- Increment contains the delta to change the score and can be either positive or
- negative.
- """
-
-
-class RuleRulesetsScoreRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["score"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsScoreRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsServeErrorRuleActionParameters(BaseModel):
- content: Optional[str] = None
- """Error response content."""
-
- content_type: Optional[Literal["application/json", "text/xml", "text/plain", "text/html"]] = None
- """Content-type header to set with the response."""
-
- status_code: Optional[float] = None
- """The status code to use for the error."""
-
-
-class RuleRulesetsServeErrorRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["serve_error"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsServeErrorRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetConfigRuleActionParametersAutominify(BaseModel):
- css: Optional[bool] = None
- """Minify CSS files."""
-
- html: Optional[bool] = None
- """Minify HTML files."""
-
- js: Optional[bool] = None
- """Minify JS files."""
-
-
-class RuleRulesetsSetConfigRuleActionParameters(BaseModel):
- automatic_https_rewrites: Optional[bool] = None
- """Turn on or off Automatic HTTPS Rewrites."""
-
- autominify: Optional[RuleRulesetsSetConfigRuleActionParametersAutominify] = None
- """Select which file extensions to minify automatically."""
-
- bic: Optional[bool] = None
- """Turn on or off Browser Integrity Check."""
-
- disable_apps: Optional[bool] = None
- """Turn off all active Cloudflare Apps."""
-
- disable_zaraz: Optional[bool] = None
- """Turn off Zaraz."""
-
- email_obfuscation: Optional[bool] = None
- """Turn on or off Email Obfuscation."""
-
- hotlink_protection: Optional[bool] = None
- """Turn on or off the Hotlink Protection."""
-
- mirage: Optional[bool] = None
- """Turn on or off Mirage."""
-
- opportunistic_encryption: Optional[bool] = None
- """Turn on or off Opportunistic Encryption."""
-
- polish: Optional[Literal["off", "lossless", "lossy"]] = None
- """Configure the Polish level."""
-
- rocket_loader: Optional[bool] = None
- """Turn on or off Rocket Loader"""
-
- security_level: Optional[Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]] = None
- """Configure the Security Level."""
-
- server_side_excludes: Optional[bool] = None
- """Turn on or off Server Side Excludes."""
-
- ssl: Optional[Literal["off", "flexible", "full", "strict", "origin_pull"]] = None
- """Configure the SSL level."""
-
- sxg: Optional[bool] = None
- """Turn on or off Signed Exchanges (SXG)."""
-
-
-class RuleRulesetsSetConfigRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_config"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetConfigRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL(BaseModel):
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """Determines which browser ttl mode to use."""
-
- default: Optional[int] = None
- """The TTL (in seconds) if you choose override_origin mode."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these cookie names.
-
- The presence of these cookies is used in building the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these cookies' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these header names.
-
- The presence of these headers is used in building the cache key.
- """
-
- exclude_origin: Optional[bool] = None
- """Whether or not to include the origin header.
-
- A value of true will exclude the origin header in the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these headers' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(BaseModel):
- resolved: Optional[bool] = None
- """Use the resolved host in the cache key.
-
- A value of true will use the resolved host, while a value or false will use the
- original host.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(BaseModel):
- all: Optional[bool] = None
- """Exclude all query string parameters from use in building the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters NOT used to build the cache key.
-
- All parameters present in the request but missing in this list will be used to
- build the cache key.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(BaseModel):
- all: Optional[bool] = None
- """Use all query string parameters in the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters used to build the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(BaseModel):
- exclude: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] = None
- """
- build the cache key using all query string parameters EXCECPT these excluded
- parameters
- """
-
- include: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] = None
- """
- build the cache key using a list of query string parameters that ARE in the
- request.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(BaseModel):
- device_type: Optional[bool] = None
- """Use the user agent's device type in the cache key."""
-
- geo: Optional[bool] = None
- """Use the user agents's country in the cache key."""
-
- lang: Optional[bool] = None
- """Use the user agent's language in the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey(BaseModel):
- cookie: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] = None
- """The cookies to include in building the cache key."""
-
- header: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] = None
- """The header names and values to include in building the cache key."""
-
- host: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] = None
- """Whether to use the original host or the resolved host in the cache key."""
-
- query_string: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] = None
- """
- Use the presence or absence of parameters in the query string to build the cache
- key.
- """
-
- user: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] = None
- """Characteristics of the request user agent used in building the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey(BaseModel):
- cache_by_device_type: Optional[bool] = None
- """Separate cached content based on the visitor’s device type"""
-
- cache_deception_armor: Optional[bool] = None
- """
- Protect from web cache deception attacks while allowing static assets to be
- cached
- """
-
- custom_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] = None
- """
- Customize which components of the request are included or excluded from the
- cache key.
- """
-
- ignore_query_strings_order: Optional[bool] = None
- """
- Treat requests with the same query parameters the same, regardless of the order
- those query parameters are in. A value of true ignores the query strings' order.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve(BaseModel):
- eligible: bool
- """Determines whether cache reserve is enabled.
-
- If this is true and a request meets eligibility criteria, Cloudflare will write
- the resource to cache reserve.
- """
-
- min_file_size: int
- """The minimum file size eligible for store in cache reserve."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(BaseModel):
- from_: int = FieldInfo(alias="from")
- """response status code lower bound"""
-
- to: int
- """response status code upper bound"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(BaseModel):
- value: int
- """Time to cache a response (in seconds).
-
- A value of 0 is equivalent to setting the Cache-Control header with the value
- "no-cache". A value of -1 is equivalent to setting Cache-Control header with the
- value of "no-store".
- """
-
- status_code_range: Optional[
- RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
- ] = None
- """The range of status codes used to apply the selected mode."""
-
- status_code_value: Optional[int] = None
- """Set the ttl for responses with this specific status code"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL(BaseModel):
- default: int
- """The TTL (in seconds) if you choose override_origin mode."""
-
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """edge ttl options"""
-
- status_code_ttl: List[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]
- """List of single status codes, or status code ranges to apply the selected mode"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersServeStale(BaseModel):
- disable_stale_while_updating: bool
- """Defines whether Cloudflare should serve stale content while updating.
-
- If true, Cloudflare will not serve stale content while getting the latest
- content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParameters(BaseModel):
- additional_cacheable_ports: Optional[List[int]] = None
- """List of additional ports that caching can be enabled on."""
-
- browser_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] = None
- """Specify how long client browsers should cache the response.
-
- Cloudflare cache purge will not purge content cached on client browsers, so high
- browser TTLs may lead to stale content.
- """
-
- cache: Optional[bool] = None
- """Mark whether the request’s response from origin is eligible for caching.
-
- Caching itself will still depend on the cache-control header and your other
- caching configurations.
- """
-
- cache_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey] = None
- """
- Define which components of the request are included or excluded from the cache
- key Cloudflare uses to store the response in cache.
- """
-
- cache_reserve: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve] = None
- """
- Mark whether the request's response from origin is eligible for Cache Reserve
- (requires a Cache Reserve add-on plan).
- """
-
- edge_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] = None
- """
- TTL (Time to Live) specifies the maximum time to cache a resource in the
- Cloudflare edge network.
- """
-
- origin_cache_control: Optional[bool] = None
- """When enabled, Cloudflare will aim to strictly adhere to RFC 7234."""
-
- origin_error_page_passthru: Optional[bool] = None
- """Generate Cloudflare error pages from issues sent from the origin server.
-
- When on, error pages will trigger for issues from the origin
- """
-
- read_timeout: Optional[int] = None
- """
- Define a timeout value between two successive read operations to your origin
- server. Historically, the timeout value between two read options from Cloudflare
- to an origin server is 100 seconds. If you are attempting to reduce HTTP 524
- errors because of timeouts from an origin server, try increasing this timeout
- value.
- """
-
- respect_strong_etags: Optional[bool] = None
- """
- Specify whether or not Cloudflare should respect strong ETag (entity tag)
- headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
- """
-
- serve_stale: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersServeStale] = None
- """
- Define if Cloudflare should serve stale content while getting the latest content
- from the origin. If on, Cloudflare will not serve stale content while getting
- the latest content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_cache_settings"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetCacheSettingsRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
+from .rewrite_rule import RewriteRule
+from .redirect_rule import RedirectRule
+from .challenge_rule import ChallengeRule
+from .set_config_rule import SetConfigRule
+from .serve_error_rule import ServeErrorRule
+from .js_challenge_rule import JsChallengeRule
+from .compress_response_rule import CompressResponseRule
+from .managed_challenge_rule import ManagedChallengeRule
+from .set_cache_settings_rule import SetCacheSettingsRule
+
+__all__ = ["RuleCreateResponse", "Rule"]
Rule = Union[
BlockRule,
- RuleRulesetsChallengeRule,
- RuleRulesetsCompressResponseRule,
+ ChallengeRule,
+ CompressResponseRule,
ExecuteRule,
- RuleRulesetsJsChallengeRule,
+ JsChallengeRule,
LogRule,
- RuleRulesetsManagedChallengeRule,
- RuleRulesetsRedirectRule,
- RuleRulesetsRewriteRule,
- RuleRulesetsRouteRule,
- RuleRulesetsScoreRule,
- RuleRulesetsServeErrorRule,
- RuleRulesetsSetConfigRule,
+ ManagedChallengeRule,
+ RedirectRule,
+ RewriteRule,
+ RouteRule,
+ ScoreRule,
+ ServeErrorRule,
+ SetConfigRule,
SkipRule,
- RuleRulesetsSetCacheSettingsRule,
+ SetCacheSettingsRule,
]
diff --git a/src/cloudflare/types/rulesets/rule_delete_response.py b/src/cloudflare/types/rulesets/rule_delete_response.py
index c475e49a89a..919358ff3fa 100644
--- a/src/cloudflare/types/rulesets/rule_delete_response.py
+++ b/src/cloudflare/types/rulesets/rule_delete_response.py
@@ -1,965 +1,44 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
-from pydantic import Field as FieldInfo
-
-from .logging import Logging
from .log_rule import LogRule
from ..._models import BaseModel
from .skip_rule import SkipRule
from .block_rule import BlockRule
+from .route_rule import RouteRule
+from .score_rule import ScoreRule
from .execute_rule import ExecuteRule
-
-__all__ = [
- "RuleDeleteResponse",
- "Rule",
- "RuleRulesetsChallengeRule",
- "RuleRulesetsCompressResponseRule",
- "RuleRulesetsCompressResponseRuleActionParameters",
- "RuleRulesetsCompressResponseRuleActionParametersAlgorithm",
- "RuleRulesetsJsChallengeRule",
- "RuleRulesetsManagedChallengeRule",
- "RuleRulesetsRedirectRule",
- "RuleRulesetsRedirectRuleActionParameters",
- "RuleRulesetsRedirectRuleActionParametersFromList",
- "RuleRulesetsRedirectRuleActionParametersFromValue",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURL",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
- "RuleRulesetsRewriteRule",
- "RuleRulesetsRewriteRuleActionParameters",
- "RuleRulesetsRewriteRuleActionParametersHeaders",
- "RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader",
- "RuleRulesetsRewriteRuleActionParametersURI",
- "RuleRulesetsRewriteRuleActionParametersURIPath",
- "RuleRulesetsRewriteRuleActionParametersURIPathStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue",
- "RuleRulesetsRewriteRuleActionParametersURIQuery",
- "RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue",
- "RuleRulesetsRouteRule",
- "RuleRulesetsRouteRuleActionParameters",
- "RuleRulesetsRouteRuleActionParametersOrigin",
- "RuleRulesetsRouteRuleActionParametersSni",
- "RuleRulesetsScoreRule",
- "RuleRulesetsScoreRuleActionParameters",
- "RuleRulesetsServeErrorRule",
- "RuleRulesetsServeErrorRuleActionParameters",
- "RuleRulesetsSetConfigRule",
- "RuleRulesetsSetConfigRuleActionParameters",
- "RuleRulesetsSetConfigRuleActionParametersAutominify",
- "RuleRulesetsSetCacheSettingsRule",
- "RuleRulesetsSetCacheSettingsRuleActionParameters",
- "RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
- "RuleRulesetsSetCacheSettingsRuleActionParametersServeStale",
-]
-
-
-class RuleRulesetsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsCompressResponseRuleActionParametersAlgorithm(BaseModel):
- name: Optional[Literal["none", "auto", "default", "gzip", "brotli"]] = None
- """Name of compression algorithm to enable."""
-
-
-class RuleRulesetsCompressResponseRuleActionParameters(BaseModel):
- algorithms: Optional[List[RuleRulesetsCompressResponseRuleActionParametersAlgorithm]] = None
- """Custom order for compression algorithms."""
-
-
-class RuleRulesetsCompressResponseRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["compress_response"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsCompressResponseRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsJsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["js_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsManagedChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["managed_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromList(BaseModel):
- key: Optional[str] = None
- """Expression that evaluates to the list lookup key."""
-
- name: Optional[str] = None
- """The name of the list to match against."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(BaseModel):
- value: Optional[str] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(BaseModel):
- expression: Optional[str] = None
- """An expression to evaluate to get the URL to redirect the request to."""
-
-
-RuleRulesetsRedirectRuleActionParametersFromValueTargetURL = Union[
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
-]
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValue(BaseModel):
- preserve_query_string: Optional[bool] = None
- """Keep the query string of the original request."""
-
- status_code: Optional[Literal[301, 302, 303, 307, 308]] = None
- """The status code to be used for the redirect."""
-
- target_url: Optional[RuleRulesetsRedirectRuleActionParametersFromValueTargetURL] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParameters(BaseModel):
- from_list: Optional[RuleRulesetsRedirectRuleActionParametersFromList] = None
- """Serve a redirect based on a bulk list lookup."""
-
- from_value: Optional[RuleRulesetsRedirectRuleActionParametersFromValue] = None
- """Serve a redirect based on the request properties."""
-
-
-class RuleRulesetsRedirectRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["redirect"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRedirectRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader(BaseModel):
- operation: Literal["remove"]
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader(BaseModel):
- operation: Literal["set"]
-
- value: str
- """Static value for the header."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader(BaseModel):
- expression: str
- """Expression for the header value."""
-
- operation: Literal["set"]
-
-
-RuleRulesetsRewriteRuleActionParametersHeaders = Union[
- RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIPath = Union[
- RuleRulesetsRewriteRuleActionParametersURIPathStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIQuery = Union[
- RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURI(BaseModel):
- path: Optional[RuleRulesetsRewriteRuleActionParametersURIPath] = None
- """Path portion rewrite."""
-
- query: Optional[RuleRulesetsRewriteRuleActionParametersURIQuery] = None
- """Query portion rewrite."""
-
-
-class RuleRulesetsRewriteRuleActionParameters(BaseModel):
- headers: Optional[Dict[str, RuleRulesetsRewriteRuleActionParametersHeaders]] = None
- """Map of request headers to modify."""
-
- uri: Optional[RuleRulesetsRewriteRuleActionParametersURI] = None
- """URI to rewrite the request to."""
-
-
-class RuleRulesetsRewriteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["rewrite"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRewriteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRouteRuleActionParametersOrigin(BaseModel):
- host: Optional[str] = None
- """Override the resolved hostname."""
-
- port: Optional[float] = None
- """Override the destination port."""
-
-
-class RuleRulesetsRouteRuleActionParametersSni(BaseModel):
- value: str
- """The SNI override."""
-
-
-class RuleRulesetsRouteRuleActionParameters(BaseModel):
- host_header: Optional[str] = None
- """Rewrite the HTTP Host header."""
-
- origin: Optional[RuleRulesetsRouteRuleActionParametersOrigin] = None
- """Override the IP/TCP destination."""
-
- sni: Optional[RuleRulesetsRouteRuleActionParametersSni] = None
- """Override the Server Name Indication (SNI)."""
-
-
-class RuleRulesetsRouteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["route"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRouteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsScoreRuleActionParameters(BaseModel):
- increment: Optional[int] = None
- """
- Increment contains the delta to change the score and can be either positive or
- negative.
- """
-
-
-class RuleRulesetsScoreRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["score"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsScoreRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsServeErrorRuleActionParameters(BaseModel):
- content: Optional[str] = None
- """Error response content."""
-
- content_type: Optional[Literal["application/json", "text/xml", "text/plain", "text/html"]] = None
- """Content-type header to set with the response."""
-
- status_code: Optional[float] = None
- """The status code to use for the error."""
-
-
-class RuleRulesetsServeErrorRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["serve_error"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsServeErrorRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetConfigRuleActionParametersAutominify(BaseModel):
- css: Optional[bool] = None
- """Minify CSS files."""
-
- html: Optional[bool] = None
- """Minify HTML files."""
-
- js: Optional[bool] = None
- """Minify JS files."""
-
-
-class RuleRulesetsSetConfigRuleActionParameters(BaseModel):
- automatic_https_rewrites: Optional[bool] = None
- """Turn on or off Automatic HTTPS Rewrites."""
-
- autominify: Optional[RuleRulesetsSetConfigRuleActionParametersAutominify] = None
- """Select which file extensions to minify automatically."""
-
- bic: Optional[bool] = None
- """Turn on or off Browser Integrity Check."""
-
- disable_apps: Optional[bool] = None
- """Turn off all active Cloudflare Apps."""
-
- disable_zaraz: Optional[bool] = None
- """Turn off Zaraz."""
-
- email_obfuscation: Optional[bool] = None
- """Turn on or off Email Obfuscation."""
-
- hotlink_protection: Optional[bool] = None
- """Turn on or off the Hotlink Protection."""
-
- mirage: Optional[bool] = None
- """Turn on or off Mirage."""
-
- opportunistic_encryption: Optional[bool] = None
- """Turn on or off Opportunistic Encryption."""
-
- polish: Optional[Literal["off", "lossless", "lossy"]] = None
- """Configure the Polish level."""
-
- rocket_loader: Optional[bool] = None
- """Turn on or off Rocket Loader"""
-
- security_level: Optional[Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]] = None
- """Configure the Security Level."""
-
- server_side_excludes: Optional[bool] = None
- """Turn on or off Server Side Excludes."""
-
- ssl: Optional[Literal["off", "flexible", "full", "strict", "origin_pull"]] = None
- """Configure the SSL level."""
-
- sxg: Optional[bool] = None
- """Turn on or off Signed Exchanges (SXG)."""
-
-
-class RuleRulesetsSetConfigRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_config"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetConfigRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL(BaseModel):
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """Determines which browser ttl mode to use."""
-
- default: Optional[int] = None
- """The TTL (in seconds) if you choose override_origin mode."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these cookie names.
-
- The presence of these cookies is used in building the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these cookies' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these header names.
-
- The presence of these headers is used in building the cache key.
- """
-
- exclude_origin: Optional[bool] = None
- """Whether or not to include the origin header.
-
- A value of true will exclude the origin header in the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these headers' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(BaseModel):
- resolved: Optional[bool] = None
- """Use the resolved host in the cache key.
-
- A value of true will use the resolved host, while a value or false will use the
- original host.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(BaseModel):
- all: Optional[bool] = None
- """Exclude all query string parameters from use in building the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters NOT used to build the cache key.
-
- All parameters present in the request but missing in this list will be used to
- build the cache key.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(BaseModel):
- all: Optional[bool] = None
- """Use all query string parameters in the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters used to build the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(BaseModel):
- exclude: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] = None
- """
- build the cache key using all query string parameters EXCECPT these excluded
- parameters
- """
-
- include: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] = None
- """
- build the cache key using a list of query string parameters that ARE in the
- request.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(BaseModel):
- device_type: Optional[bool] = None
- """Use the user agent's device type in the cache key."""
-
- geo: Optional[bool] = None
- """Use the user agents's country in the cache key."""
-
- lang: Optional[bool] = None
- """Use the user agent's language in the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey(BaseModel):
- cookie: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] = None
- """The cookies to include in building the cache key."""
-
- header: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] = None
- """The header names and values to include in building the cache key."""
-
- host: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] = None
- """Whether to use the original host or the resolved host in the cache key."""
-
- query_string: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] = None
- """
- Use the presence or absence of parameters in the query string to build the cache
- key.
- """
-
- user: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] = None
- """Characteristics of the request user agent used in building the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey(BaseModel):
- cache_by_device_type: Optional[bool] = None
- """Separate cached content based on the visitor’s device type"""
-
- cache_deception_armor: Optional[bool] = None
- """
- Protect from web cache deception attacks while allowing static assets to be
- cached
- """
-
- custom_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] = None
- """
- Customize which components of the request are included or excluded from the
- cache key.
- """
-
- ignore_query_strings_order: Optional[bool] = None
- """
- Treat requests with the same query parameters the same, regardless of the order
- those query parameters are in. A value of true ignores the query strings' order.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve(BaseModel):
- eligible: bool
- """Determines whether cache reserve is enabled.
-
- If this is true and a request meets eligibility criteria, Cloudflare will write
- the resource to cache reserve.
- """
-
- min_file_size: int
- """The minimum file size eligible for store in cache reserve."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(BaseModel):
- from_: int = FieldInfo(alias="from")
- """response status code lower bound"""
-
- to: int
- """response status code upper bound"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(BaseModel):
- value: int
- """Time to cache a response (in seconds).
-
- A value of 0 is equivalent to setting the Cache-Control header with the value
- "no-cache". A value of -1 is equivalent to setting Cache-Control header with the
- value of "no-store".
- """
-
- status_code_range: Optional[
- RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
- ] = None
- """The range of status codes used to apply the selected mode."""
-
- status_code_value: Optional[int] = None
- """Set the ttl for responses with this specific status code"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL(BaseModel):
- default: int
- """The TTL (in seconds) if you choose override_origin mode."""
-
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """edge ttl options"""
-
- status_code_ttl: List[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]
- """List of single status codes, or status code ranges to apply the selected mode"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersServeStale(BaseModel):
- disable_stale_while_updating: bool
- """Defines whether Cloudflare should serve stale content while updating.
-
- If true, Cloudflare will not serve stale content while getting the latest
- content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParameters(BaseModel):
- additional_cacheable_ports: Optional[List[int]] = None
- """List of additional ports that caching can be enabled on."""
-
- browser_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] = None
- """Specify how long client browsers should cache the response.
-
- Cloudflare cache purge will not purge content cached on client browsers, so high
- browser TTLs may lead to stale content.
- """
-
- cache: Optional[bool] = None
- """Mark whether the request’s response from origin is eligible for caching.
-
- Caching itself will still depend on the cache-control header and your other
- caching configurations.
- """
-
- cache_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey] = None
- """
- Define which components of the request are included or excluded from the cache
- key Cloudflare uses to store the response in cache.
- """
-
- cache_reserve: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve] = None
- """
- Mark whether the request's response from origin is eligible for Cache Reserve
- (requires a Cache Reserve add-on plan).
- """
-
- edge_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] = None
- """
- TTL (Time to Live) specifies the maximum time to cache a resource in the
- Cloudflare edge network.
- """
-
- origin_cache_control: Optional[bool] = None
- """When enabled, Cloudflare will aim to strictly adhere to RFC 7234."""
-
- origin_error_page_passthru: Optional[bool] = None
- """Generate Cloudflare error pages from issues sent from the origin server.
-
- When on, error pages will trigger for issues from the origin
- """
-
- read_timeout: Optional[int] = None
- """
- Define a timeout value between two successive read operations to your origin
- server. Historically, the timeout value between two read options from Cloudflare
- to an origin server is 100 seconds. If you are attempting to reduce HTTP 524
- errors because of timeouts from an origin server, try increasing this timeout
- value.
- """
-
- respect_strong_etags: Optional[bool] = None
- """
- Specify whether or not Cloudflare should respect strong ETag (entity tag)
- headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
- """
-
- serve_stale: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersServeStale] = None
- """
- Define if Cloudflare should serve stale content while getting the latest content
- from the origin. If on, Cloudflare will not serve stale content while getting
- the latest content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_cache_settings"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetCacheSettingsRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
+from .rewrite_rule import RewriteRule
+from .redirect_rule import RedirectRule
+from .challenge_rule import ChallengeRule
+from .set_config_rule import SetConfigRule
+from .serve_error_rule import ServeErrorRule
+from .js_challenge_rule import JsChallengeRule
+from .compress_response_rule import CompressResponseRule
+from .managed_challenge_rule import ManagedChallengeRule
+from .set_cache_settings_rule import SetCacheSettingsRule
+
+__all__ = ["RuleDeleteResponse", "Rule"]
Rule = Union[
BlockRule,
- RuleRulesetsChallengeRule,
- RuleRulesetsCompressResponseRule,
+ ChallengeRule,
+ CompressResponseRule,
ExecuteRule,
- RuleRulesetsJsChallengeRule,
+ JsChallengeRule,
LogRule,
- RuleRulesetsManagedChallengeRule,
- RuleRulesetsRedirectRule,
- RuleRulesetsRewriteRule,
- RuleRulesetsRouteRule,
- RuleRulesetsScoreRule,
- RuleRulesetsServeErrorRule,
- RuleRulesetsSetConfigRule,
+ ManagedChallengeRule,
+ RedirectRule,
+ RewriteRule,
+ RouteRule,
+ ScoreRule,
+ ServeErrorRule,
+ SetConfigRule,
SkipRule,
- RuleRulesetsSetCacheSettingsRule,
+ SetCacheSettingsRule,
]
diff --git a/src/cloudflare/types/rulesets/rule_edit_params.py b/src/cloudflare/types/rulesets/rule_edit_params.py
index 00117df9400..297e2a99aaf 100644
--- a/src/cloudflare/types/rulesets/rule_edit_params.py
+++ b/src/cloudflare/types/rulesets/rule_edit_params.py
@@ -6,75 +6,70 @@
from typing_extensions import Literal, Required, TypedDict
from .logging_param import LoggingParam
+from .rewrite_uri_part_param import RewriteURIPartParam
__all__ = [
"RuleEditParams",
"BlockRule",
"BlockRuleActionParameters",
"BlockRuleActionParametersResponse",
- "RulesetsChallengeRule",
- "RulesetsCompressResponseRule",
- "RulesetsCompressResponseRuleActionParameters",
- "RulesetsCompressResponseRuleActionParametersAlgorithm",
+ "ChallengeRule",
+ "CompressResponseRule",
+ "CompressResponseRuleActionParameters",
+ "CompressResponseRuleActionParametersAlgorithm",
"ExecuteRule",
"ExecuteRuleActionParameters",
"ExecuteRuleActionParametersMatchedData",
"ExecuteRuleActionParametersOverrides",
"ExecuteRuleActionParametersOverridesCategory",
"ExecuteRuleActionParametersOverridesRule",
- "RulesetsJsChallengeRule",
+ "JsChallengeRule",
"LogRule",
- "RulesetsManagedChallengeRule",
- "RulesetsRedirectRule",
- "RulesetsRedirectRuleActionParameters",
- "RulesetsRedirectRuleActionParametersFromList",
- "RulesetsRedirectRuleActionParametersFromValue",
- "RulesetsRedirectRuleActionParametersFromValueTargetURL",
- "RulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
- "RulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
- "RulesetsRewriteRule",
- "RulesetsRewriteRuleActionParameters",
- "RulesetsRewriteRuleActionParametersHeaders",
- "RulesetsRewriteRuleActionParametersHeadersRemoveHeader",
- "RulesetsRewriteRuleActionParametersHeadersStaticHeader",
- "RulesetsRewriteRuleActionParametersHeadersDynamicHeader",
- "RulesetsRewriteRuleActionParametersURI",
- "RulesetsRewriteRuleActionParametersURIPath",
- "RulesetsRewriteRuleActionParametersURIPathStaticValue",
- "RulesetsRewriteRuleActionParametersURIPathDynamicValue",
- "RulesetsRewriteRuleActionParametersURIQuery",
- "RulesetsRewriteRuleActionParametersURIQueryStaticValue",
- "RulesetsRewriteRuleActionParametersURIQueryDynamicValue",
- "RulesetsRouteRule",
- "RulesetsRouteRuleActionParameters",
- "RulesetsRouteRuleActionParametersOrigin",
- "RulesetsRouteRuleActionParametersSni",
- "RulesetsScoreRule",
- "RulesetsScoreRuleActionParameters",
- "RulesetsServeErrorRule",
- "RulesetsServeErrorRuleActionParameters",
- "RulesetsSetConfigRule",
- "RulesetsSetConfigRuleActionParameters",
- "RulesetsSetConfigRuleActionParametersAutominify",
+ "ManagedChallengeRule",
+ "RedirectRule",
+ "RedirectRuleActionParameters",
+ "RedirectRuleActionParametersFromList",
+ "RedirectRuleActionParametersFromValue",
+ "RedirectRuleActionParametersFromValueTargetURL",
+ "RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
+ "RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
+ "RewriteRule",
+ "RewriteRuleActionParameters",
+ "RewriteRuleActionParametersHeaders",
+ "RewriteRuleActionParametersHeadersRemoveHeader",
+ "RewriteRuleActionParametersHeadersStaticHeader",
+ "RewriteRuleActionParametersHeadersDynamicHeader",
+ "RewriteRuleActionParametersURI",
+ "RouteRule",
+ "RouteRuleActionParameters",
+ "RouteRuleActionParametersOrigin",
+ "RouteRuleActionParametersSni",
+ "ScoreRule",
+ "ScoreRuleActionParameters",
+ "ServeErrorRule",
+ "ServeErrorRuleActionParameters",
+ "SetConfigRule",
+ "SetConfigRuleActionParameters",
+ "SetConfigRuleActionParametersAutominify",
"SkipRule",
"SkipRuleActionParameters",
- "RulesetsSetCacheSettingsRule",
- "RulesetsSetCacheSettingsRuleActionParameters",
- "RulesetsSetCacheSettingsRuleActionParametersBrowserTTL",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKey",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
- "RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
- "RulesetsSetCacheSettingsRuleActionParametersCacheReserve",
- "RulesetsSetCacheSettingsRuleActionParametersEdgeTTL",
- "RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
- "RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
- "RulesetsSetCacheSettingsRuleActionParametersServeStale",
+ "SetCacheSettingsRule",
+ "SetCacheSettingsRuleActionParameters",
+ "SetCacheSettingsRuleActionParametersBrowserTTL",
+ "SetCacheSettingsRuleActionParametersCacheKey",
+ "SetCacheSettingsRuleActionParametersCacheKeyCustomKey",
+ "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
+ "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
+ "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
+ "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
+ "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
+ "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
+ "SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
+ "SetCacheSettingsRuleActionParametersCacheReserve",
+ "SetCacheSettingsRuleActionParametersEdgeTTL",
+ "SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
+ "SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
+ "SetCacheSettingsRuleActionParametersServeStale",
]
@@ -129,7 +124,7 @@ class BlockRuleActionParameters(TypedDict, total=False):
"""The response to show when the block is applied."""
-class RulesetsChallengeRule(TypedDict, total=False):
+class ChallengeRule(TypedDict, total=False):
ruleset_id: Required[str]
"""The unique ID of the ruleset."""
@@ -164,7 +159,7 @@ class RulesetsChallengeRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsCompressResponseRule(TypedDict, total=False):
+class CompressResponseRule(TypedDict, total=False):
ruleset_id: Required[str]
"""The unique ID of the ruleset."""
@@ -180,7 +175,7 @@ class RulesetsCompressResponseRule(TypedDict, total=False):
action: Literal["compress_response"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsCompressResponseRuleActionParameters
+ action_parameters: CompressResponseRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -199,13 +194,13 @@ class RulesetsCompressResponseRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsCompressResponseRuleActionParametersAlgorithm(TypedDict, total=False):
+class CompressResponseRuleActionParametersAlgorithm(TypedDict, total=False):
name: Literal["none", "auto", "default", "gzip", "brotli"]
"""Name of compression algorithm to enable."""
-class RulesetsCompressResponseRuleActionParameters(TypedDict, total=False):
- algorithms: Iterable[RulesetsCompressResponseRuleActionParametersAlgorithm]
+class CompressResponseRuleActionParameters(TypedDict, total=False):
+ algorithms: Iterable[CompressResponseRuleActionParametersAlgorithm]
"""Custom order for compression algorithms."""
@@ -321,7 +316,7 @@ class ExecuteRuleActionParameters(TypedDict, total=False):
"""A set of overrides to apply to the target ruleset."""
-class RulesetsJsChallengeRule(TypedDict, total=False):
+class JsChallengeRule(TypedDict, total=False):
ruleset_id: Required[str]
"""The unique ID of the ruleset."""
@@ -391,7 +386,7 @@ class LogRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsManagedChallengeRule(TypedDict, total=False):
+class ManagedChallengeRule(TypedDict, total=False):
ruleset_id: Required[str]
"""The unique ID of the ruleset."""
@@ -426,7 +421,7 @@ class RulesetsManagedChallengeRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsRedirectRule(TypedDict, total=False):
+class RedirectRule(TypedDict, total=False):
ruleset_id: Required[str]
"""The unique ID of the ruleset."""
@@ -442,7 +437,7 @@ class RulesetsRedirectRule(TypedDict, total=False):
action: Literal["redirect"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsRedirectRuleActionParameters
+ action_parameters: RedirectRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -461,7 +456,7 @@ class RulesetsRedirectRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsRedirectRuleActionParametersFromList(TypedDict, total=False):
+class RedirectRuleActionParametersFromList(TypedDict, total=False):
key: str
"""Expression that evaluates to the list lookup key."""
@@ -469,42 +464,42 @@ class RulesetsRedirectRuleActionParametersFromList(TypedDict, total=False):
"""The name of the list to match against."""
-class RulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(TypedDict, total=False):
+class RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(TypedDict, total=False):
value: str
"""The URL to redirect the request to."""
-class RulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(TypedDict, total=False):
+class RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(TypedDict, total=False):
expression: str
"""An expression to evaluate to get the URL to redirect the request to."""
-RulesetsRedirectRuleActionParametersFromValueTargetURL = Union[
- RulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
- RulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
+RedirectRuleActionParametersFromValueTargetURL = Union[
+ RedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
+ RedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
]
-class RulesetsRedirectRuleActionParametersFromValue(TypedDict, total=False):
+class RedirectRuleActionParametersFromValue(TypedDict, total=False):
preserve_query_string: bool
"""Keep the query string of the original request."""
status_code: Literal[301, 302, 303, 307, 308]
"""The status code to be used for the redirect."""
- target_url: RulesetsRedirectRuleActionParametersFromValueTargetURL
+ target_url: RedirectRuleActionParametersFromValueTargetURL
"""The URL to redirect the request to."""
-class RulesetsRedirectRuleActionParameters(TypedDict, total=False):
- from_list: RulesetsRedirectRuleActionParametersFromList
+class RedirectRuleActionParameters(TypedDict, total=False):
+ from_list: RedirectRuleActionParametersFromList
"""Serve a redirect based on a bulk list lookup."""
- from_value: RulesetsRedirectRuleActionParametersFromValue
+ from_value: RedirectRuleActionParametersFromValue
"""Serve a redirect based on the request properties."""
-class RulesetsRewriteRule(TypedDict, total=False):
+class RewriteRule(TypedDict, total=False):
ruleset_id: Required[str]
"""The unique ID of the ruleset."""
@@ -520,7 +515,7 @@ class RulesetsRewriteRule(TypedDict, total=False):
action: Literal["rewrite"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsRewriteRuleActionParameters
+ action_parameters: RewriteRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -539,78 +534,48 @@ class RulesetsRewriteRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsRewriteRuleActionParametersHeadersRemoveHeader(TypedDict, total=False):
+class RewriteRuleActionParametersHeadersRemoveHeader(TypedDict, total=False):
operation: Required[Literal["remove"]]
-class RulesetsRewriteRuleActionParametersHeadersStaticHeader(TypedDict, total=False):
+class RewriteRuleActionParametersHeadersStaticHeader(TypedDict, total=False):
operation: Required[Literal["set"]]
value: Required[str]
"""Static value for the header."""
-class RulesetsRewriteRuleActionParametersHeadersDynamicHeader(TypedDict, total=False):
+class RewriteRuleActionParametersHeadersDynamicHeader(TypedDict, total=False):
expression: Required[str]
"""Expression for the header value."""
operation: Required[Literal["set"]]
-RulesetsRewriteRuleActionParametersHeaders = Union[
- RulesetsRewriteRuleActionParametersHeadersRemoveHeader,
- RulesetsRewriteRuleActionParametersHeadersStaticHeader,
- RulesetsRewriteRuleActionParametersHeadersDynamicHeader,
+RewriteRuleActionParametersHeaders = Union[
+ RewriteRuleActionParametersHeadersRemoveHeader,
+ RewriteRuleActionParametersHeadersStaticHeader,
+ RewriteRuleActionParametersHeadersDynamicHeader,
]
-class RulesetsRewriteRuleActionParametersURIPathStaticValue(TypedDict, total=False):
- value: Required[str]
- """Predefined replacement value."""
-
-
-class RulesetsRewriteRuleActionParametersURIPathDynamicValue(TypedDict, total=False):
- expression: Required[str]
- """Expression to evaluate for the replacement value."""
-
-
-RulesetsRewriteRuleActionParametersURIPath = Union[
- RulesetsRewriteRuleActionParametersURIPathStaticValue, RulesetsRewriteRuleActionParametersURIPathDynamicValue
-]
-
-
-class RulesetsRewriteRuleActionParametersURIQueryStaticValue(TypedDict, total=False):
- value: Required[str]
- """Predefined replacement value."""
-
-
-class RulesetsRewriteRuleActionParametersURIQueryDynamicValue(TypedDict, total=False):
- expression: Required[str]
- """Expression to evaluate for the replacement value."""
-
-
-RulesetsRewriteRuleActionParametersURIQuery = Union[
- RulesetsRewriteRuleActionParametersURIQueryStaticValue, RulesetsRewriteRuleActionParametersURIQueryDynamicValue
-]
-
-
-class RulesetsRewriteRuleActionParametersURI(TypedDict, total=False):
- path: RulesetsRewriteRuleActionParametersURIPath
+class RewriteRuleActionParametersURI(TypedDict, total=False):
+ path: RewriteURIPartParam
"""Path portion rewrite."""
- query: RulesetsRewriteRuleActionParametersURIQuery
+ query: RewriteURIPartParam
"""Query portion rewrite."""
-class RulesetsRewriteRuleActionParameters(TypedDict, total=False):
- headers: Dict[str, RulesetsRewriteRuleActionParametersHeaders]
+class RewriteRuleActionParameters(TypedDict, total=False):
+ headers: Dict[str, RewriteRuleActionParametersHeaders]
"""Map of request headers to modify."""
- uri: RulesetsRewriteRuleActionParametersURI
+ uri: RewriteRuleActionParametersURI
"""URI to rewrite the request to."""
-class RulesetsRouteRule(TypedDict, total=False):
+class RouteRule(TypedDict, total=False):
ruleset_id: Required[str]
"""The unique ID of the ruleset."""
@@ -626,7 +591,7 @@ class RulesetsRouteRule(TypedDict, total=False):
action: Literal["route"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsRouteRuleActionParameters
+ action_parameters: RouteRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -645,7 +610,7 @@ class RulesetsRouteRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsRouteRuleActionParametersOrigin(TypedDict, total=False):
+class RouteRuleActionParametersOrigin(TypedDict, total=False):
host: str
"""Override the resolved hostname."""
@@ -653,23 +618,23 @@ class RulesetsRouteRuleActionParametersOrigin(TypedDict, total=False):
"""Override the destination port."""
-class RulesetsRouteRuleActionParametersSni(TypedDict, total=False):
+class RouteRuleActionParametersSni(TypedDict, total=False):
value: Required[str]
"""The SNI override."""
-class RulesetsRouteRuleActionParameters(TypedDict, total=False):
+class RouteRuleActionParameters(TypedDict, total=False):
host_header: str
"""Rewrite the HTTP Host header."""
- origin: RulesetsRouteRuleActionParametersOrigin
+ origin: RouteRuleActionParametersOrigin
"""Override the IP/TCP destination."""
- sni: RulesetsRouteRuleActionParametersSni
+ sni: RouteRuleActionParametersSni
"""Override the Server Name Indication (SNI)."""
-class RulesetsScoreRule(TypedDict, total=False):
+class ScoreRule(TypedDict, total=False):
ruleset_id: Required[str]
"""The unique ID of the ruleset."""
@@ -685,7 +650,7 @@ class RulesetsScoreRule(TypedDict, total=False):
action: Literal["score"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsScoreRuleActionParameters
+ action_parameters: ScoreRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -704,7 +669,7 @@ class RulesetsScoreRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsScoreRuleActionParameters(TypedDict, total=False):
+class ScoreRuleActionParameters(TypedDict, total=False):
increment: int
"""
Increment contains the delta to change the score and can be either positive or
@@ -712,7 +677,7 @@ class RulesetsScoreRuleActionParameters(TypedDict, total=False):
"""
-class RulesetsServeErrorRule(TypedDict, total=False):
+class ServeErrorRule(TypedDict, total=False):
ruleset_id: Required[str]
"""The unique ID of the ruleset."""
@@ -728,7 +693,7 @@ class RulesetsServeErrorRule(TypedDict, total=False):
action: Literal["serve_error"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsServeErrorRuleActionParameters
+ action_parameters: ServeErrorRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -747,7 +712,7 @@ class RulesetsServeErrorRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsServeErrorRuleActionParameters(TypedDict, total=False):
+class ServeErrorRuleActionParameters(TypedDict, total=False):
content: str
"""Error response content."""
@@ -758,7 +723,7 @@ class RulesetsServeErrorRuleActionParameters(TypedDict, total=False):
"""The status code to use for the error."""
-class RulesetsSetConfigRule(TypedDict, total=False):
+class SetConfigRule(TypedDict, total=False):
ruleset_id: Required[str]
"""The unique ID of the ruleset."""
@@ -774,7 +739,7 @@ class RulesetsSetConfigRule(TypedDict, total=False):
action: Literal["set_config"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsSetConfigRuleActionParameters
+ action_parameters: SetConfigRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -793,7 +758,7 @@ class RulesetsSetConfigRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsSetConfigRuleActionParametersAutominify(TypedDict, total=False):
+class SetConfigRuleActionParametersAutominify(TypedDict, total=False):
css: bool
"""Minify CSS files."""
@@ -804,11 +769,11 @@ class RulesetsSetConfigRuleActionParametersAutominify(TypedDict, total=False):
"""Minify JS files."""
-class RulesetsSetConfigRuleActionParameters(TypedDict, total=False):
+class SetConfigRuleActionParameters(TypedDict, total=False):
automatic_https_rewrites: bool
"""Turn on or off Automatic HTTPS Rewrites."""
- autominify: RulesetsSetConfigRuleActionParametersAutominify
+ autominify: SetConfigRuleActionParametersAutominify
"""Select which file extensions to minify automatically."""
bic: bool
@@ -941,7 +906,7 @@ class SkipRuleActionParameters(TypedDict, total=False):
"""
-class RulesetsSetCacheSettingsRule(TypedDict, total=False):
+class SetCacheSettingsRule(TypedDict, total=False):
ruleset_id: Required[str]
"""The unique ID of the ruleset."""
@@ -957,7 +922,7 @@ class RulesetsSetCacheSettingsRule(TypedDict, total=False):
action: Literal["set_cache_settings"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsSetCacheSettingsRuleActionParameters
+ action_parameters: SetCacheSettingsRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -976,7 +941,7 @@ class RulesetsSetCacheSettingsRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsSetCacheSettingsRuleActionParametersBrowserTTL(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersBrowserTTL(TypedDict, total=False):
mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]]
"""Determines which browser ttl mode to use."""
@@ -984,7 +949,7 @@ class RulesetsSetCacheSettingsRuleActionParametersBrowserTTL(TypedDict, total=Fa
"""The TTL (in seconds) if you choose override_origin mode."""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(TypedDict, total=False):
check_presence: List[str]
"""Checks for the presence of these cookie names.
@@ -995,7 +960,7 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(TypedD
"""Include these cookies' names and their values."""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(TypedDict, total=False):
check_presence: List[str]
"""Checks for the presence of these header names.
@@ -1012,7 +977,7 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(TypedD
"""Include these headers' names and their values."""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(TypedDict, total=False):
resolved: bool
"""Use the resolved host in the cache key.
@@ -1021,7 +986,7 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(TypedDic
"""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(TypedDict, total=False):
all: bool
"""Exclude all query string parameters from use in building the cache key."""
@@ -1033,7 +998,7 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringEx
"""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(TypedDict, total=False):
all: bool
"""Use all query string parameters in the cache key."""
@@ -1041,21 +1006,21 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringIn
"""A list of query string parameters used to build the cache key."""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(TypedDict, total=False):
- exclude: RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude
+class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(TypedDict, total=False):
+ exclude: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude
"""
build the cache key using all query string parameters EXCECPT these excluded
parameters
"""
- include: RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude
+ include: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude
"""
build the cache key using a list of query string parameters that ARE in the
request.
"""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(TypedDict, total=False):
device_type: bool
"""Use the user agent's device type in the cache key."""
@@ -1066,27 +1031,27 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(TypedDic
"""Use the user agent's language in the cache key."""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey(TypedDict, total=False):
- cookie: RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie
+class SetCacheSettingsRuleActionParametersCacheKeyCustomKey(TypedDict, total=False):
+ cookie: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie
"""The cookies to include in building the cache key."""
- header: RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader
+ header: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader
"""The header names and values to include in building the cache key."""
- host: RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost
+ host: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost
"""Whether to use the original host or the resolved host in the cache key."""
- query_string: RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString
+ query_string: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString
"""
Use the presence or absence of parameters in the query string to build the cache
key.
"""
- user: RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser
+ user: SetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser
"""Characteristics of the request user agent used in building the cache key."""
-class RulesetsSetCacheSettingsRuleActionParametersCacheKey(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersCacheKey(TypedDict, total=False):
cache_by_device_type: bool
"""Separate cached content based on the visitor’s device type"""
@@ -1096,7 +1061,7 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheKey(TypedDict, total=Fals
cached
"""
- custom_key: RulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey
+ custom_key: SetCacheSettingsRuleActionParametersCacheKeyCustomKey
"""
Customize which components of the request are included or excluded from the
cache key.
@@ -1109,7 +1074,7 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheKey(TypedDict, total=Fals
"""
-class RulesetsSetCacheSettingsRuleActionParametersCacheReserve(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersCacheReserve(TypedDict, total=False):
eligible: Required[bool]
"""Determines whether cache reserve is enabled.
@@ -1121,8 +1086,8 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheReserve(TypedDict, total=
"""The minimum file size eligible for store in cache reserve."""
-_RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords = TypedDict(
- "_RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords",
+_SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords = TypedDict(
+ "_SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords",
{
"from": int,
},
@@ -1130,14 +1095,14 @@ class RulesetsSetCacheSettingsRuleActionParametersCacheReserve(TypedDict, total=
)
-class RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(
- _RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords, total=False
+class SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(
+ _SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords, total=False
):
to: Required[int]
"""response status code upper bound"""
-class RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(TypedDict, total=False):
value: Required[int]
"""Time to cache a response (in seconds).
@@ -1146,25 +1111,25 @@ class RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(TypedDict
value of "no-store".
"""
- status_code_range: RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
+ status_code_range: SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
"""The range of status codes used to apply the selected mode."""
status_code_value: int
"""Set the ttl for responses with this specific status code"""
-class RulesetsSetCacheSettingsRuleActionParametersEdgeTTL(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersEdgeTTL(TypedDict, total=False):
default: Required[int]
"""The TTL (in seconds) if you choose override_origin mode."""
mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]]
"""edge ttl options"""
- status_code_ttl: Required[Iterable[RulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]]
+ status_code_ttl: Required[Iterable[SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]]
"""List of single status codes, or status code ranges to apply the selected mode"""
-class RulesetsSetCacheSettingsRuleActionParametersServeStale(TypedDict, total=False):
+class SetCacheSettingsRuleActionParametersServeStale(TypedDict, total=False):
disable_stale_while_updating: Required[bool]
"""Defines whether Cloudflare should serve stale content while updating.
@@ -1173,11 +1138,11 @@ class RulesetsSetCacheSettingsRuleActionParametersServeStale(TypedDict, total=Fa
"""
-class RulesetsSetCacheSettingsRuleActionParameters(TypedDict, total=False):
+class SetCacheSettingsRuleActionParameters(TypedDict, total=False):
additional_cacheable_ports: Iterable[int]
"""List of additional ports that caching can be enabled on."""
- browser_ttl: RulesetsSetCacheSettingsRuleActionParametersBrowserTTL
+ browser_ttl: SetCacheSettingsRuleActionParametersBrowserTTL
"""Specify how long client browsers should cache the response.
Cloudflare cache purge will not purge content cached on client browsers, so high
@@ -1191,19 +1156,19 @@ class RulesetsSetCacheSettingsRuleActionParameters(TypedDict, total=False):
caching configurations.
"""
- cache_key: RulesetsSetCacheSettingsRuleActionParametersCacheKey
+ cache_key: SetCacheSettingsRuleActionParametersCacheKey
"""
Define which components of the request are included or excluded from the cache
key Cloudflare uses to store the response in cache.
"""
- cache_reserve: RulesetsSetCacheSettingsRuleActionParametersCacheReserve
+ cache_reserve: SetCacheSettingsRuleActionParametersCacheReserve
"""
Mark whether the request's response from origin is eligible for Cache Reserve
(requires a Cache Reserve add-on plan).
"""
- edge_ttl: RulesetsSetCacheSettingsRuleActionParametersEdgeTTL
+ edge_ttl: SetCacheSettingsRuleActionParametersEdgeTTL
"""
TTL (Time to Live) specifies the maximum time to cache a resource in the
Cloudflare edge network.
@@ -1233,7 +1198,7 @@ class RulesetsSetCacheSettingsRuleActionParameters(TypedDict, total=False):
headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
"""
- serve_stale: RulesetsSetCacheSettingsRuleActionParametersServeStale
+ serve_stale: SetCacheSettingsRuleActionParametersServeStale
"""
Define if Cloudflare should serve stale content while getting the latest content
from the origin. If on, Cloudflare will not serve stale content while getting
@@ -1243,18 +1208,18 @@ class RulesetsSetCacheSettingsRuleActionParameters(TypedDict, total=False):
RuleEditParams = Union[
BlockRule,
- RulesetsChallengeRule,
- RulesetsCompressResponseRule,
+ ChallengeRule,
+ CompressResponseRule,
ExecuteRule,
- RulesetsJsChallengeRule,
+ JsChallengeRule,
LogRule,
- RulesetsManagedChallengeRule,
- RulesetsRedirectRule,
- RulesetsRewriteRule,
- RulesetsRouteRule,
- RulesetsScoreRule,
- RulesetsServeErrorRule,
- RulesetsSetConfigRule,
+ ManagedChallengeRule,
+ RedirectRule,
+ RewriteRule,
+ RouteRule,
+ ScoreRule,
+ ServeErrorRule,
+ SetConfigRule,
SkipRule,
- RulesetsSetCacheSettingsRule,
+ SetCacheSettingsRule,
]
diff --git a/src/cloudflare/types/rulesets/rule_edit_response.py b/src/cloudflare/types/rulesets/rule_edit_response.py
index 75a7e050b54..dd6f8f95ad9 100644
--- a/src/cloudflare/types/rulesets/rule_edit_response.py
+++ b/src/cloudflare/types/rulesets/rule_edit_response.py
@@ -1,965 +1,44 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
-from pydantic import Field as FieldInfo
-
-from .logging import Logging
from .log_rule import LogRule
from ..._models import BaseModel
from .skip_rule import SkipRule
from .block_rule import BlockRule
+from .route_rule import RouteRule
+from .score_rule import ScoreRule
from .execute_rule import ExecuteRule
-
-__all__ = [
- "RuleEditResponse",
- "Rule",
- "RuleRulesetsChallengeRule",
- "RuleRulesetsCompressResponseRule",
- "RuleRulesetsCompressResponseRuleActionParameters",
- "RuleRulesetsCompressResponseRuleActionParametersAlgorithm",
- "RuleRulesetsJsChallengeRule",
- "RuleRulesetsManagedChallengeRule",
- "RuleRulesetsRedirectRule",
- "RuleRulesetsRedirectRuleActionParameters",
- "RuleRulesetsRedirectRuleActionParametersFromList",
- "RuleRulesetsRedirectRuleActionParametersFromValue",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURL",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
- "RuleRulesetsRewriteRule",
- "RuleRulesetsRewriteRuleActionParameters",
- "RuleRulesetsRewriteRuleActionParametersHeaders",
- "RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader",
- "RuleRulesetsRewriteRuleActionParametersURI",
- "RuleRulesetsRewriteRuleActionParametersURIPath",
- "RuleRulesetsRewriteRuleActionParametersURIPathStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue",
- "RuleRulesetsRewriteRuleActionParametersURIQuery",
- "RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue",
- "RuleRulesetsRouteRule",
- "RuleRulesetsRouteRuleActionParameters",
- "RuleRulesetsRouteRuleActionParametersOrigin",
- "RuleRulesetsRouteRuleActionParametersSni",
- "RuleRulesetsScoreRule",
- "RuleRulesetsScoreRuleActionParameters",
- "RuleRulesetsServeErrorRule",
- "RuleRulesetsServeErrorRuleActionParameters",
- "RuleRulesetsSetConfigRule",
- "RuleRulesetsSetConfigRuleActionParameters",
- "RuleRulesetsSetConfigRuleActionParametersAutominify",
- "RuleRulesetsSetCacheSettingsRule",
- "RuleRulesetsSetCacheSettingsRuleActionParameters",
- "RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
- "RuleRulesetsSetCacheSettingsRuleActionParametersServeStale",
-]
-
-
-class RuleRulesetsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsCompressResponseRuleActionParametersAlgorithm(BaseModel):
- name: Optional[Literal["none", "auto", "default", "gzip", "brotli"]] = None
- """Name of compression algorithm to enable."""
-
-
-class RuleRulesetsCompressResponseRuleActionParameters(BaseModel):
- algorithms: Optional[List[RuleRulesetsCompressResponseRuleActionParametersAlgorithm]] = None
- """Custom order for compression algorithms."""
-
-
-class RuleRulesetsCompressResponseRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["compress_response"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsCompressResponseRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsJsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["js_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsManagedChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["managed_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromList(BaseModel):
- key: Optional[str] = None
- """Expression that evaluates to the list lookup key."""
-
- name: Optional[str] = None
- """The name of the list to match against."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(BaseModel):
- value: Optional[str] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(BaseModel):
- expression: Optional[str] = None
- """An expression to evaluate to get the URL to redirect the request to."""
-
-
-RuleRulesetsRedirectRuleActionParametersFromValueTargetURL = Union[
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
-]
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValue(BaseModel):
- preserve_query_string: Optional[bool] = None
- """Keep the query string of the original request."""
-
- status_code: Optional[Literal[301, 302, 303, 307, 308]] = None
- """The status code to be used for the redirect."""
-
- target_url: Optional[RuleRulesetsRedirectRuleActionParametersFromValueTargetURL] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParameters(BaseModel):
- from_list: Optional[RuleRulesetsRedirectRuleActionParametersFromList] = None
- """Serve a redirect based on a bulk list lookup."""
-
- from_value: Optional[RuleRulesetsRedirectRuleActionParametersFromValue] = None
- """Serve a redirect based on the request properties."""
-
-
-class RuleRulesetsRedirectRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["redirect"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRedirectRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader(BaseModel):
- operation: Literal["remove"]
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader(BaseModel):
- operation: Literal["set"]
-
- value: str
- """Static value for the header."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader(BaseModel):
- expression: str
- """Expression for the header value."""
-
- operation: Literal["set"]
-
-
-RuleRulesetsRewriteRuleActionParametersHeaders = Union[
- RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIPath = Union[
- RuleRulesetsRewriteRuleActionParametersURIPathStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIQuery = Union[
- RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURI(BaseModel):
- path: Optional[RuleRulesetsRewriteRuleActionParametersURIPath] = None
- """Path portion rewrite."""
-
- query: Optional[RuleRulesetsRewriteRuleActionParametersURIQuery] = None
- """Query portion rewrite."""
-
-
-class RuleRulesetsRewriteRuleActionParameters(BaseModel):
- headers: Optional[Dict[str, RuleRulesetsRewriteRuleActionParametersHeaders]] = None
- """Map of request headers to modify."""
-
- uri: Optional[RuleRulesetsRewriteRuleActionParametersURI] = None
- """URI to rewrite the request to."""
-
-
-class RuleRulesetsRewriteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["rewrite"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRewriteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRouteRuleActionParametersOrigin(BaseModel):
- host: Optional[str] = None
- """Override the resolved hostname."""
-
- port: Optional[float] = None
- """Override the destination port."""
-
-
-class RuleRulesetsRouteRuleActionParametersSni(BaseModel):
- value: str
- """The SNI override."""
-
-
-class RuleRulesetsRouteRuleActionParameters(BaseModel):
- host_header: Optional[str] = None
- """Rewrite the HTTP Host header."""
-
- origin: Optional[RuleRulesetsRouteRuleActionParametersOrigin] = None
- """Override the IP/TCP destination."""
-
- sni: Optional[RuleRulesetsRouteRuleActionParametersSni] = None
- """Override the Server Name Indication (SNI)."""
-
-
-class RuleRulesetsRouteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["route"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRouteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsScoreRuleActionParameters(BaseModel):
- increment: Optional[int] = None
- """
- Increment contains the delta to change the score and can be either positive or
- negative.
- """
-
-
-class RuleRulesetsScoreRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["score"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsScoreRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsServeErrorRuleActionParameters(BaseModel):
- content: Optional[str] = None
- """Error response content."""
-
- content_type: Optional[Literal["application/json", "text/xml", "text/plain", "text/html"]] = None
- """Content-type header to set with the response."""
-
- status_code: Optional[float] = None
- """The status code to use for the error."""
-
-
-class RuleRulesetsServeErrorRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["serve_error"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsServeErrorRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetConfigRuleActionParametersAutominify(BaseModel):
- css: Optional[bool] = None
- """Minify CSS files."""
-
- html: Optional[bool] = None
- """Minify HTML files."""
-
- js: Optional[bool] = None
- """Minify JS files."""
-
-
-class RuleRulesetsSetConfigRuleActionParameters(BaseModel):
- automatic_https_rewrites: Optional[bool] = None
- """Turn on or off Automatic HTTPS Rewrites."""
-
- autominify: Optional[RuleRulesetsSetConfigRuleActionParametersAutominify] = None
- """Select which file extensions to minify automatically."""
-
- bic: Optional[bool] = None
- """Turn on or off Browser Integrity Check."""
-
- disable_apps: Optional[bool] = None
- """Turn off all active Cloudflare Apps."""
-
- disable_zaraz: Optional[bool] = None
- """Turn off Zaraz."""
-
- email_obfuscation: Optional[bool] = None
- """Turn on or off Email Obfuscation."""
-
- hotlink_protection: Optional[bool] = None
- """Turn on or off the Hotlink Protection."""
-
- mirage: Optional[bool] = None
- """Turn on or off Mirage."""
-
- opportunistic_encryption: Optional[bool] = None
- """Turn on or off Opportunistic Encryption."""
-
- polish: Optional[Literal["off", "lossless", "lossy"]] = None
- """Configure the Polish level."""
-
- rocket_loader: Optional[bool] = None
- """Turn on or off Rocket Loader"""
-
- security_level: Optional[Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]] = None
- """Configure the Security Level."""
-
- server_side_excludes: Optional[bool] = None
- """Turn on or off Server Side Excludes."""
-
- ssl: Optional[Literal["off", "flexible", "full", "strict", "origin_pull"]] = None
- """Configure the SSL level."""
-
- sxg: Optional[bool] = None
- """Turn on or off Signed Exchanges (SXG)."""
-
-
-class RuleRulesetsSetConfigRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_config"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetConfigRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL(BaseModel):
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """Determines which browser ttl mode to use."""
-
- default: Optional[int] = None
- """The TTL (in seconds) if you choose override_origin mode."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these cookie names.
-
- The presence of these cookies is used in building the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these cookies' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these header names.
-
- The presence of these headers is used in building the cache key.
- """
-
- exclude_origin: Optional[bool] = None
- """Whether or not to include the origin header.
-
- A value of true will exclude the origin header in the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these headers' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(BaseModel):
- resolved: Optional[bool] = None
- """Use the resolved host in the cache key.
-
- A value of true will use the resolved host, while a value or false will use the
- original host.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(BaseModel):
- all: Optional[bool] = None
- """Exclude all query string parameters from use in building the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters NOT used to build the cache key.
-
- All parameters present in the request but missing in this list will be used to
- build the cache key.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(BaseModel):
- all: Optional[bool] = None
- """Use all query string parameters in the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters used to build the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(BaseModel):
- exclude: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] = None
- """
- build the cache key using all query string parameters EXCECPT these excluded
- parameters
- """
-
- include: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] = None
- """
- build the cache key using a list of query string parameters that ARE in the
- request.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(BaseModel):
- device_type: Optional[bool] = None
- """Use the user agent's device type in the cache key."""
-
- geo: Optional[bool] = None
- """Use the user agents's country in the cache key."""
-
- lang: Optional[bool] = None
- """Use the user agent's language in the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey(BaseModel):
- cookie: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] = None
- """The cookies to include in building the cache key."""
-
- header: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] = None
- """The header names and values to include in building the cache key."""
-
- host: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] = None
- """Whether to use the original host or the resolved host in the cache key."""
-
- query_string: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] = None
- """
- Use the presence or absence of parameters in the query string to build the cache
- key.
- """
-
- user: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] = None
- """Characteristics of the request user agent used in building the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey(BaseModel):
- cache_by_device_type: Optional[bool] = None
- """Separate cached content based on the visitor’s device type"""
-
- cache_deception_armor: Optional[bool] = None
- """
- Protect from web cache deception attacks while allowing static assets to be
- cached
- """
-
- custom_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] = None
- """
- Customize which components of the request are included or excluded from the
- cache key.
- """
-
- ignore_query_strings_order: Optional[bool] = None
- """
- Treat requests with the same query parameters the same, regardless of the order
- those query parameters are in. A value of true ignores the query strings' order.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve(BaseModel):
- eligible: bool
- """Determines whether cache reserve is enabled.
-
- If this is true and a request meets eligibility criteria, Cloudflare will write
- the resource to cache reserve.
- """
-
- min_file_size: int
- """The minimum file size eligible for store in cache reserve."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(BaseModel):
- from_: int = FieldInfo(alias="from")
- """response status code lower bound"""
-
- to: int
- """response status code upper bound"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(BaseModel):
- value: int
- """Time to cache a response (in seconds).
-
- A value of 0 is equivalent to setting the Cache-Control header with the value
- "no-cache". A value of -1 is equivalent to setting Cache-Control header with the
- value of "no-store".
- """
-
- status_code_range: Optional[
- RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
- ] = None
- """The range of status codes used to apply the selected mode."""
-
- status_code_value: Optional[int] = None
- """Set the ttl for responses with this specific status code"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL(BaseModel):
- default: int
- """The TTL (in seconds) if you choose override_origin mode."""
-
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """edge ttl options"""
-
- status_code_ttl: List[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]
- """List of single status codes, or status code ranges to apply the selected mode"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersServeStale(BaseModel):
- disable_stale_while_updating: bool
- """Defines whether Cloudflare should serve stale content while updating.
-
- If true, Cloudflare will not serve stale content while getting the latest
- content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParameters(BaseModel):
- additional_cacheable_ports: Optional[List[int]] = None
- """List of additional ports that caching can be enabled on."""
-
- browser_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] = None
- """Specify how long client browsers should cache the response.
-
- Cloudflare cache purge will not purge content cached on client browsers, so high
- browser TTLs may lead to stale content.
- """
-
- cache: Optional[bool] = None
- """Mark whether the request’s response from origin is eligible for caching.
-
- Caching itself will still depend on the cache-control header and your other
- caching configurations.
- """
-
- cache_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey] = None
- """
- Define which components of the request are included or excluded from the cache
- key Cloudflare uses to store the response in cache.
- """
-
- cache_reserve: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve] = None
- """
- Mark whether the request's response from origin is eligible for Cache Reserve
- (requires a Cache Reserve add-on plan).
- """
-
- edge_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] = None
- """
- TTL (Time to Live) specifies the maximum time to cache a resource in the
- Cloudflare edge network.
- """
-
- origin_cache_control: Optional[bool] = None
- """When enabled, Cloudflare will aim to strictly adhere to RFC 7234."""
-
- origin_error_page_passthru: Optional[bool] = None
- """Generate Cloudflare error pages from issues sent from the origin server.
-
- When on, error pages will trigger for issues from the origin
- """
-
- read_timeout: Optional[int] = None
- """
- Define a timeout value between two successive read operations to your origin
- server. Historically, the timeout value between two read options from Cloudflare
- to an origin server is 100 seconds. If you are attempting to reduce HTTP 524
- errors because of timeouts from an origin server, try increasing this timeout
- value.
- """
-
- respect_strong_etags: Optional[bool] = None
- """
- Specify whether or not Cloudflare should respect strong ETag (entity tag)
- headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
- """
-
- serve_stale: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersServeStale] = None
- """
- Define if Cloudflare should serve stale content while getting the latest content
- from the origin. If on, Cloudflare will not serve stale content while getting
- the latest content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_cache_settings"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetCacheSettingsRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
+from .rewrite_rule import RewriteRule
+from .redirect_rule import RedirectRule
+from .challenge_rule import ChallengeRule
+from .set_config_rule import SetConfigRule
+from .serve_error_rule import ServeErrorRule
+from .js_challenge_rule import JsChallengeRule
+from .compress_response_rule import CompressResponseRule
+from .managed_challenge_rule import ManagedChallengeRule
+from .set_cache_settings_rule import SetCacheSettingsRule
+
+__all__ = ["RuleEditResponse", "Rule"]
Rule = Union[
BlockRule,
- RuleRulesetsChallengeRule,
- RuleRulesetsCompressResponseRule,
+ ChallengeRule,
+ CompressResponseRule,
ExecuteRule,
- RuleRulesetsJsChallengeRule,
+ JsChallengeRule,
LogRule,
- RuleRulesetsManagedChallengeRule,
- RuleRulesetsRedirectRule,
- RuleRulesetsRewriteRule,
- RuleRulesetsRouteRule,
- RuleRulesetsScoreRule,
- RuleRulesetsServeErrorRule,
- RuleRulesetsSetConfigRule,
+ ManagedChallengeRule,
+ RedirectRule,
+ RewriteRule,
+ RouteRule,
+ ScoreRule,
+ ServeErrorRule,
+ SetConfigRule,
SkipRule,
- RuleRulesetsSetCacheSettingsRule,
+ SetCacheSettingsRule,
]
diff --git a/src/cloudflare/types/rulesets/score_rule.py b/src/cloudflare/types/rulesets/score_rule.py
new file mode 100644
index 00000000000..508adc8d594
--- /dev/null
+++ b/src/cloudflare/types/rulesets/score_rule.py
@@ -0,0 +1,53 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .logging import Logging
+from ..._models import BaseModel
+
+__all__ = ["ScoreRule", "ActionParameters"]
+
+
+class ActionParameters(BaseModel):
+ increment: Optional[int] = None
+ """
+ Increment contains the delta to change the score and can be either positive or
+ negative.
+ """
+
+
+class ScoreRule(BaseModel):
+ last_updated: datetime
+ """The timestamp of when the rule was last modified."""
+
+ version: str
+ """The version of the rule."""
+
+ id: Optional[str] = None
+ """The unique ID of the rule."""
+
+ action: Optional[Literal["score"]] = None
+ """The action to perform when the rule matches."""
+
+ action_parameters: Optional[ActionParameters] = None
+ """The parameters configuring the rule's action."""
+
+ categories: Optional[List[str]] = None
+ """The categories of the rule."""
+
+ description: Optional[str] = None
+ """An informative description of the rule."""
+
+ enabled: Optional[bool] = None
+ """Whether the rule should be executed."""
+
+ expression: Optional[str] = None
+ """The expression defining which traffic will match the rule."""
+
+ logging: Optional[Logging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/score_rule_param.py b/src/cloudflare/types/rulesets/score_rule_param.py
new file mode 100644
index 00000000000..9a1db280e51
--- /dev/null
+++ b/src/cloudflare/types/rulesets/score_rule_param.py
@@ -0,0 +1,43 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, TypedDict
+
+from .logging_param import LoggingParam
+
+__all__ = ["ScoreRuleParam", "ActionParameters"]
+
+
+class ActionParameters(TypedDict, total=False):
+ increment: int
+ """
+ Increment contains the delta to change the score and can be either positive or
+ negative.
+ """
+
+
+class ScoreRuleParam(TypedDict, total=False):
+ id: str
+ """The unique ID of the rule."""
+
+ action: Literal["score"]
+ """The action to perform when the rule matches."""
+
+ action_parameters: ActionParameters
+ """The parameters configuring the rule's action."""
+
+ description: str
+ """An informative description of the rule."""
+
+ enabled: bool
+ """Whether the rule should be executed."""
+
+ expression: str
+ """The expression defining which traffic will match the rule."""
+
+ logging: LoggingParam
+ """An object configuring the rule's logging behavior."""
+
+ ref: str
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/serve_error_rule.py b/src/cloudflare/types/rulesets/serve_error_rule.py
new file mode 100644
index 00000000000..2713e5ec61d
--- /dev/null
+++ b/src/cloudflare/types/rulesets/serve_error_rule.py
@@ -0,0 +1,56 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .logging import Logging
+from ..._models import BaseModel
+
+__all__ = ["ServeErrorRule", "ActionParameters"]
+
+
+class ActionParameters(BaseModel):
+ content: Optional[str] = None
+ """Error response content."""
+
+ content_type: Optional[Literal["application/json", "text/xml", "text/plain", "text/html"]] = None
+ """Content-type header to set with the response."""
+
+ status_code: Optional[float] = None
+ """The status code to use for the error."""
+
+
+class ServeErrorRule(BaseModel):
+ last_updated: datetime
+ """The timestamp of when the rule was last modified."""
+
+ version: str
+ """The version of the rule."""
+
+ id: Optional[str] = None
+ """The unique ID of the rule."""
+
+ action: Optional[Literal["serve_error"]] = None
+ """The action to perform when the rule matches."""
+
+ action_parameters: Optional[ActionParameters] = None
+ """The parameters configuring the rule's action."""
+
+ categories: Optional[List[str]] = None
+ """The categories of the rule."""
+
+ description: Optional[str] = None
+ """An informative description of the rule."""
+
+ enabled: Optional[bool] = None
+ """Whether the rule should be executed."""
+
+ expression: Optional[str] = None
+ """The expression defining which traffic will match the rule."""
+
+ logging: Optional[Logging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/serve_error_rule_param.py b/src/cloudflare/types/rulesets/serve_error_rule_param.py
new file mode 100644
index 00000000000..d9d51bdbc08
--- /dev/null
+++ b/src/cloudflare/types/rulesets/serve_error_rule_param.py
@@ -0,0 +1,46 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, TypedDict
+
+from .logging_param import LoggingParam
+
+__all__ = ["ServeErrorRuleParam", "ActionParameters"]
+
+
+class ActionParameters(TypedDict, total=False):
+ content: str
+ """Error response content."""
+
+ content_type: Literal["application/json", "text/xml", "text/plain", "text/html"]
+ """Content-type header to set with the response."""
+
+ status_code: float
+ """The status code to use for the error."""
+
+
+class ServeErrorRuleParam(TypedDict, total=False):
+ id: str
+ """The unique ID of the rule."""
+
+ action: Literal["serve_error"]
+ """The action to perform when the rule matches."""
+
+ action_parameters: ActionParameters
+ """The parameters configuring the rule's action."""
+
+ description: str
+ """An informative description of the rule."""
+
+ enabled: bool
+ """Whether the rule should be executed."""
+
+ expression: str
+ """The expression defining which traffic will match the rule."""
+
+ logging: LoggingParam
+ """An object configuring the rule's logging behavior."""
+
+ ref: str
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/set_cache_settings_rule.py b/src/cloudflare/types/rulesets/set_cache_settings_rule.py
new file mode 100644
index 00000000000..caac51356cf
--- /dev/null
+++ b/src/cloudflare/types/rulesets/set_cache_settings_rule.py
@@ -0,0 +1,322 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from pydantic import Field as FieldInfo
+
+from .logging import Logging
+from ..._models import BaseModel
+
+__all__ = [
+ "SetCacheSettingsRule",
+ "ActionParameters",
+ "ActionParametersBrowserTTL",
+ "ActionParametersCacheKey",
+ "ActionParametersCacheKeyCustomKey",
+ "ActionParametersCacheKeyCustomKeyCookie",
+ "ActionParametersCacheKeyCustomKeyHeader",
+ "ActionParametersCacheKeyCustomKeyHost",
+ "ActionParametersCacheKeyCustomKeyQueryString",
+ "ActionParametersCacheKeyCustomKeyQueryStringExclude",
+ "ActionParametersCacheKeyCustomKeyQueryStringInclude",
+ "ActionParametersCacheKeyCustomKeyUser",
+ "ActionParametersCacheReserve",
+ "ActionParametersEdgeTTL",
+ "ActionParametersEdgeTTLStatusCodeTTL",
+ "ActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
+ "ActionParametersServeStale",
+]
+
+
+class ActionParametersBrowserTTL(BaseModel):
+ mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
+ """Determines which browser ttl mode to use."""
+
+ default: Optional[int] = None
+ """The TTL (in seconds) if you choose override_origin mode."""
+
+
+class ActionParametersCacheKeyCustomKeyCookie(BaseModel):
+ check_presence: Optional[List[str]] = None
+ """Checks for the presence of these cookie names.
+
+ The presence of these cookies is used in building the cache key.
+ """
+
+ include: Optional[List[str]] = None
+ """Include these cookies' names and their values."""
+
+
+class ActionParametersCacheKeyCustomKeyHeader(BaseModel):
+ check_presence: Optional[List[str]] = None
+ """Checks for the presence of these header names.
+
+ The presence of these headers is used in building the cache key.
+ """
+
+ exclude_origin: Optional[bool] = None
+ """Whether or not to include the origin header.
+
+ A value of true will exclude the origin header in the cache key.
+ """
+
+ include: Optional[List[str]] = None
+ """Include these headers' names and their values."""
+
+
+class ActionParametersCacheKeyCustomKeyHost(BaseModel):
+ resolved: Optional[bool] = None
+ """Use the resolved host in the cache key.
+
+ A value of true will use the resolved host, while a value or false will use the
+ original host.
+ """
+
+
+class ActionParametersCacheKeyCustomKeyQueryStringExclude(BaseModel):
+ all: Optional[bool] = None
+ """Exclude all query string parameters from use in building the cache key."""
+
+ rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
+ """A list of query string parameters NOT used to build the cache key.
+
+ All parameters present in the request but missing in this list will be used to
+ build the cache key.
+ """
+
+
+class ActionParametersCacheKeyCustomKeyQueryStringInclude(BaseModel):
+ all: Optional[bool] = None
+ """Use all query string parameters in the cache key."""
+
+ rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
+ """A list of query string parameters used to build the cache key."""
+
+
+class ActionParametersCacheKeyCustomKeyQueryString(BaseModel):
+ exclude: Optional[ActionParametersCacheKeyCustomKeyQueryStringExclude] = None
+ """
+ build the cache key using all query string parameters EXCECPT these excluded
+ parameters
+ """
+
+ include: Optional[ActionParametersCacheKeyCustomKeyQueryStringInclude] = None
+ """
+ build the cache key using a list of query string parameters that ARE in the
+ request.
+ """
+
+
+class ActionParametersCacheKeyCustomKeyUser(BaseModel):
+ device_type: Optional[bool] = None
+ """Use the user agent's device type in the cache key."""
+
+ geo: Optional[bool] = None
+ """Use the user agents's country in the cache key."""
+
+ lang: Optional[bool] = None
+ """Use the user agent's language in the cache key."""
+
+
+class ActionParametersCacheKeyCustomKey(BaseModel):
+ cookie: Optional[ActionParametersCacheKeyCustomKeyCookie] = None
+ """The cookies to include in building the cache key."""
+
+ header: Optional[ActionParametersCacheKeyCustomKeyHeader] = None
+ """The header names and values to include in building the cache key."""
+
+ host: Optional[ActionParametersCacheKeyCustomKeyHost] = None
+ """Whether to use the original host or the resolved host in the cache key."""
+
+ query_string: Optional[ActionParametersCacheKeyCustomKeyQueryString] = None
+ """
+ Use the presence or absence of parameters in the query string to build the cache
+ key.
+ """
+
+ user: Optional[ActionParametersCacheKeyCustomKeyUser] = None
+ """Characteristics of the request user agent used in building the cache key."""
+
+
+class ActionParametersCacheKey(BaseModel):
+ cache_by_device_type: Optional[bool] = None
+ """Separate cached content based on the visitor’s device type"""
+
+ cache_deception_armor: Optional[bool] = None
+ """
+ Protect from web cache deception attacks while allowing static assets to be
+ cached
+ """
+
+ custom_key: Optional[ActionParametersCacheKeyCustomKey] = None
+ """
+ Customize which components of the request are included or excluded from the
+ cache key.
+ """
+
+ ignore_query_strings_order: Optional[bool] = None
+ """
+ Treat requests with the same query parameters the same, regardless of the order
+ those query parameters are in. A value of true ignores the query strings' order.
+ """
+
+
+class ActionParametersCacheReserve(BaseModel):
+ eligible: bool
+ """Determines whether cache reserve is enabled.
+
+ If this is true and a request meets eligibility criteria, Cloudflare will write
+ the resource to cache reserve.
+ """
+
+ min_file_size: int
+ """The minimum file size eligible for store in cache reserve."""
+
+
+class ActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(BaseModel):
+ from_: int = FieldInfo(alias="from")
+ """response status code lower bound"""
+
+ to: int
+ """response status code upper bound"""
+
+
+class ActionParametersEdgeTTLStatusCodeTTL(BaseModel):
+ value: int
+ """Time to cache a response (in seconds).
+
+ A value of 0 is equivalent to setting the Cache-Control header with the value
+ "no-cache". A value of -1 is equivalent to setting Cache-Control header with the
+ value of "no-store".
+ """
+
+ status_code_range: Optional[ActionParametersEdgeTTLStatusCodeTTLStatusCodeRange] = None
+ """The range of status codes used to apply the selected mode."""
+
+ status_code_value: Optional[int] = None
+ """Set the ttl for responses with this specific status code"""
+
+
+class ActionParametersEdgeTTL(BaseModel):
+ default: int
+ """The TTL (in seconds) if you choose override_origin mode."""
+
+ mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
+ """edge ttl options"""
+
+ status_code_ttl: List[ActionParametersEdgeTTLStatusCodeTTL]
+ """List of single status codes, or status code ranges to apply the selected mode"""
+
+
+class ActionParametersServeStale(BaseModel):
+ disable_stale_while_updating: bool
+ """Defines whether Cloudflare should serve stale content while updating.
+
+ If true, Cloudflare will not serve stale content while getting the latest
+ content from the origin.
+ """
+
+
+class ActionParameters(BaseModel):
+ additional_cacheable_ports: Optional[List[int]] = None
+ """List of additional ports that caching can be enabled on."""
+
+ browser_ttl: Optional[ActionParametersBrowserTTL] = None
+ """Specify how long client browsers should cache the response.
+
+ Cloudflare cache purge will not purge content cached on client browsers, so high
+ browser TTLs may lead to stale content.
+ """
+
+ cache: Optional[bool] = None
+ """Mark whether the request’s response from origin is eligible for caching.
+
+ Caching itself will still depend on the cache-control header and your other
+ caching configurations.
+ """
+
+ cache_key: Optional[ActionParametersCacheKey] = None
+ """
+ Define which components of the request are included or excluded from the cache
+ key Cloudflare uses to store the response in cache.
+ """
+
+ cache_reserve: Optional[ActionParametersCacheReserve] = None
+ """
+ Mark whether the request's response from origin is eligible for Cache Reserve
+ (requires a Cache Reserve add-on plan).
+ """
+
+ edge_ttl: Optional[ActionParametersEdgeTTL] = None
+ """
+ TTL (Time to Live) specifies the maximum time to cache a resource in the
+ Cloudflare edge network.
+ """
+
+ origin_cache_control: Optional[bool] = None
+ """When enabled, Cloudflare will aim to strictly adhere to RFC 7234."""
+
+ origin_error_page_passthru: Optional[bool] = None
+ """Generate Cloudflare error pages from issues sent from the origin server.
+
+ When on, error pages will trigger for issues from the origin
+ """
+
+ read_timeout: Optional[int] = None
+ """
+ Define a timeout value between two successive read operations to your origin
+ server. Historically, the timeout value between two read options from Cloudflare
+ to an origin server is 100 seconds. If you are attempting to reduce HTTP 524
+ errors because of timeouts from an origin server, try increasing this timeout
+ value.
+ """
+
+ respect_strong_etags: Optional[bool] = None
+ """
+ Specify whether or not Cloudflare should respect strong ETag (entity tag)
+ headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
+ """
+
+ serve_stale: Optional[ActionParametersServeStale] = None
+ """
+ Define if Cloudflare should serve stale content while getting the latest content
+ from the origin. If on, Cloudflare will not serve stale content while getting
+ the latest content from the origin.
+ """
+
+
+class SetCacheSettingsRule(BaseModel):
+ last_updated: datetime
+ """The timestamp of when the rule was last modified."""
+
+ version: str
+ """The version of the rule."""
+
+ id: Optional[str] = None
+ """The unique ID of the rule."""
+
+ action: Optional[Literal["set_cache_settings"]] = None
+ """The action to perform when the rule matches."""
+
+ action_parameters: Optional[ActionParameters] = None
+ """The parameters configuring the rule's action."""
+
+ categories: Optional[List[str]] = None
+ """The categories of the rule."""
+
+ description: Optional[str] = None
+ """An informative description of the rule."""
+
+ enabled: Optional[bool] = None
+ """Whether the rule should be executed."""
+
+ expression: Optional[str] = None
+ """The expression defining which traffic will match the rule."""
+
+ logging: Optional[Logging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/set_cache_settings_rule_param.py b/src/cloudflare/types/rulesets/set_cache_settings_rule_param.py
new file mode 100644
index 00000000000..cc507f4b01f
--- /dev/null
+++ b/src/cloudflare/types/rulesets/set_cache_settings_rule_param.py
@@ -0,0 +1,319 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import List, Iterable
+from typing_extensions import Literal, Required, TypedDict
+
+from .logging_param import LoggingParam
+
+__all__ = [
+ "SetCacheSettingsRuleParam",
+ "ActionParameters",
+ "ActionParametersBrowserTTL",
+ "ActionParametersCacheKey",
+ "ActionParametersCacheKeyCustomKey",
+ "ActionParametersCacheKeyCustomKeyCookie",
+ "ActionParametersCacheKeyCustomKeyHeader",
+ "ActionParametersCacheKeyCustomKeyHost",
+ "ActionParametersCacheKeyCustomKeyQueryString",
+ "ActionParametersCacheKeyCustomKeyQueryStringExclude",
+ "ActionParametersCacheKeyCustomKeyQueryStringInclude",
+ "ActionParametersCacheKeyCustomKeyUser",
+ "ActionParametersCacheReserve",
+ "ActionParametersEdgeTTL",
+ "ActionParametersEdgeTTLStatusCodeTTL",
+ "ActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
+ "ActionParametersServeStale",
+]
+
+
+class ActionParametersBrowserTTL(TypedDict, total=False):
+ mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]]
+ """Determines which browser ttl mode to use."""
+
+ default: int
+ """The TTL (in seconds) if you choose override_origin mode."""
+
+
+class ActionParametersCacheKeyCustomKeyCookie(TypedDict, total=False):
+ check_presence: List[str]
+ """Checks for the presence of these cookie names.
+
+ The presence of these cookies is used in building the cache key.
+ """
+
+ include: List[str]
+ """Include these cookies' names and their values."""
+
+
+class ActionParametersCacheKeyCustomKeyHeader(TypedDict, total=False):
+ check_presence: List[str]
+ """Checks for the presence of these header names.
+
+ The presence of these headers is used in building the cache key.
+ """
+
+ exclude_origin: bool
+ """Whether or not to include the origin header.
+
+ A value of true will exclude the origin header in the cache key.
+ """
+
+ include: List[str]
+ """Include these headers' names and their values."""
+
+
+class ActionParametersCacheKeyCustomKeyHost(TypedDict, total=False):
+ resolved: bool
+ """Use the resolved host in the cache key.
+
+ A value of true will use the resolved host, while a value or false will use the
+ original host.
+ """
+
+
+class ActionParametersCacheKeyCustomKeyQueryStringExclude(TypedDict, total=False):
+ all: bool
+ """Exclude all query string parameters from use in building the cache key."""
+
+ list: List[str]
+ """A list of query string parameters NOT used to build the cache key.
+
+ All parameters present in the request but missing in this list will be used to
+ build the cache key.
+ """
+
+
+class ActionParametersCacheKeyCustomKeyQueryStringInclude(TypedDict, total=False):
+ all: bool
+ """Use all query string parameters in the cache key."""
+
+ list: List[str]
+ """A list of query string parameters used to build the cache key."""
+
+
+class ActionParametersCacheKeyCustomKeyQueryString(TypedDict, total=False):
+ exclude: ActionParametersCacheKeyCustomKeyQueryStringExclude
+ """
+ build the cache key using all query string parameters EXCECPT these excluded
+ parameters
+ """
+
+ include: ActionParametersCacheKeyCustomKeyQueryStringInclude
+ """
+ build the cache key using a list of query string parameters that ARE in the
+ request.
+ """
+
+
+class ActionParametersCacheKeyCustomKeyUser(TypedDict, total=False):
+ device_type: bool
+ """Use the user agent's device type in the cache key."""
+
+ geo: bool
+ """Use the user agents's country in the cache key."""
+
+ lang: bool
+ """Use the user agent's language in the cache key."""
+
+
+class ActionParametersCacheKeyCustomKey(TypedDict, total=False):
+ cookie: ActionParametersCacheKeyCustomKeyCookie
+ """The cookies to include in building the cache key."""
+
+ header: ActionParametersCacheKeyCustomKeyHeader
+ """The header names and values to include in building the cache key."""
+
+ host: ActionParametersCacheKeyCustomKeyHost
+ """Whether to use the original host or the resolved host in the cache key."""
+
+ query_string: ActionParametersCacheKeyCustomKeyQueryString
+ """
+ Use the presence or absence of parameters in the query string to build the cache
+ key.
+ """
+
+ user: ActionParametersCacheKeyCustomKeyUser
+ """Characteristics of the request user agent used in building the cache key."""
+
+
+class ActionParametersCacheKey(TypedDict, total=False):
+ cache_by_device_type: bool
+ """Separate cached content based on the visitor’s device type"""
+
+ cache_deception_armor: bool
+ """
+ Protect from web cache deception attacks while allowing static assets to be
+ cached
+ """
+
+ custom_key: ActionParametersCacheKeyCustomKey
+ """
+ Customize which components of the request are included or excluded from the
+ cache key.
+ """
+
+ ignore_query_strings_order: bool
+ """
+ Treat requests with the same query parameters the same, regardless of the order
+ those query parameters are in. A value of true ignores the query strings' order.
+ """
+
+
+class ActionParametersCacheReserve(TypedDict, total=False):
+ eligible: Required[bool]
+ """Determines whether cache reserve is enabled.
+
+ If this is true and a request meets eligibility criteria, Cloudflare will write
+ the resource to cache reserve.
+ """
+
+ min_file_size: Required[int]
+ """The minimum file size eligible for store in cache reserve."""
+
+
+_ActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords = TypedDict(
+ "_ActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords",
+ {
+ "from": int,
+ },
+ total=False,
+)
+
+
+class ActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(
+ _ActionParametersEdgeTTLStatusCodeTTLStatusCodeRangeReservedKeywords, total=False
+):
+ to: Required[int]
+ """response status code upper bound"""
+
+
+class ActionParametersEdgeTTLStatusCodeTTL(TypedDict, total=False):
+ value: Required[int]
+ """Time to cache a response (in seconds).
+
+ A value of 0 is equivalent to setting the Cache-Control header with the value
+ "no-cache". A value of -1 is equivalent to setting Cache-Control header with the
+ value of "no-store".
+ """
+
+ status_code_range: ActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
+ """The range of status codes used to apply the selected mode."""
+
+ status_code_value: int
+ """Set the ttl for responses with this specific status code"""
+
+
+class ActionParametersEdgeTTL(TypedDict, total=False):
+ default: Required[int]
+ """The TTL (in seconds) if you choose override_origin mode."""
+
+ mode: Required[Literal["respect_origin", "bypass_by_default", "override_origin"]]
+ """edge ttl options"""
+
+ status_code_ttl: Required[Iterable[ActionParametersEdgeTTLStatusCodeTTL]]
+ """List of single status codes, or status code ranges to apply the selected mode"""
+
+
+class ActionParametersServeStale(TypedDict, total=False):
+ disable_stale_while_updating: Required[bool]
+ """Defines whether Cloudflare should serve stale content while updating.
+
+ If true, Cloudflare will not serve stale content while getting the latest
+ content from the origin.
+ """
+
+
+class ActionParameters(TypedDict, total=False):
+ additional_cacheable_ports: Iterable[int]
+ """List of additional ports that caching can be enabled on."""
+
+ browser_ttl: ActionParametersBrowserTTL
+ """Specify how long client browsers should cache the response.
+
+ Cloudflare cache purge will not purge content cached on client browsers, so high
+ browser TTLs may lead to stale content.
+ """
+
+ cache: bool
+ """Mark whether the request’s response from origin is eligible for caching.
+
+ Caching itself will still depend on the cache-control header and your other
+ caching configurations.
+ """
+
+ cache_key: ActionParametersCacheKey
+ """
+ Define which components of the request are included or excluded from the cache
+ key Cloudflare uses to store the response in cache.
+ """
+
+ cache_reserve: ActionParametersCacheReserve
+ """
+ Mark whether the request's response from origin is eligible for Cache Reserve
+ (requires a Cache Reserve add-on plan).
+ """
+
+ edge_ttl: ActionParametersEdgeTTL
+ """
+ TTL (Time to Live) specifies the maximum time to cache a resource in the
+ Cloudflare edge network.
+ """
+
+ origin_cache_control: bool
+ """When enabled, Cloudflare will aim to strictly adhere to RFC 7234."""
+
+ origin_error_page_passthru: bool
+ """Generate Cloudflare error pages from issues sent from the origin server.
+
+ When on, error pages will trigger for issues from the origin
+ """
+
+ read_timeout: int
+ """
+ Define a timeout value between two successive read operations to your origin
+ server. Historically, the timeout value between two read options from Cloudflare
+ to an origin server is 100 seconds. If you are attempting to reduce HTTP 524
+ errors because of timeouts from an origin server, try increasing this timeout
+ value.
+ """
+
+ respect_strong_etags: bool
+ """
+ Specify whether or not Cloudflare should respect strong ETag (entity tag)
+ headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
+ """
+
+ serve_stale: ActionParametersServeStale
+ """
+ Define if Cloudflare should serve stale content while getting the latest content
+ from the origin. If on, Cloudflare will not serve stale content while getting
+ the latest content from the origin.
+ """
+
+
+class SetCacheSettingsRuleParam(TypedDict, total=False):
+ id: str
+ """The unique ID of the rule."""
+
+ action: Literal["set_cache_settings"]
+ """The action to perform when the rule matches."""
+
+ action_parameters: ActionParameters
+ """The parameters configuring the rule's action."""
+
+ description: str
+ """An informative description of the rule."""
+
+ enabled: bool
+ """Whether the rule should be executed."""
+
+ expression: str
+ """The expression defining which traffic will match the rule."""
+
+ logging: LoggingParam
+ """An object configuring the rule's logging behavior."""
+
+ ref: str
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/set_config_rule.py b/src/cloudflare/types/rulesets/set_config_rule.py
new file mode 100644
index 00000000000..8d135f95608
--- /dev/null
+++ b/src/cloudflare/types/rulesets/set_config_rule.py
@@ -0,0 +1,103 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .logging import Logging
+from ..._models import BaseModel
+
+__all__ = ["SetConfigRule", "ActionParameters", "ActionParametersAutominify"]
+
+
+class ActionParametersAutominify(BaseModel):
+ css: Optional[bool] = None
+ """Minify CSS files."""
+
+ html: Optional[bool] = None
+ """Minify HTML files."""
+
+ js: Optional[bool] = None
+ """Minify JS files."""
+
+
+class ActionParameters(BaseModel):
+ automatic_https_rewrites: Optional[bool] = None
+ """Turn on or off Automatic HTTPS Rewrites."""
+
+ autominify: Optional[ActionParametersAutominify] = None
+ """Select which file extensions to minify automatically."""
+
+ bic: Optional[bool] = None
+ """Turn on or off Browser Integrity Check."""
+
+ disable_apps: Optional[bool] = None
+ """Turn off all active Cloudflare Apps."""
+
+ disable_zaraz: Optional[bool] = None
+ """Turn off Zaraz."""
+
+ email_obfuscation: Optional[bool] = None
+ """Turn on or off Email Obfuscation."""
+
+ hotlink_protection: Optional[bool] = None
+ """Turn on or off the Hotlink Protection."""
+
+ mirage: Optional[bool] = None
+ """Turn on or off Mirage."""
+
+ opportunistic_encryption: Optional[bool] = None
+ """Turn on or off Opportunistic Encryption."""
+
+ polish: Optional[Literal["off", "lossless", "lossy"]] = None
+ """Configure the Polish level."""
+
+ rocket_loader: Optional[bool] = None
+ """Turn on or off Rocket Loader"""
+
+ security_level: Optional[Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]] = None
+ """Configure the Security Level."""
+
+ server_side_excludes: Optional[bool] = None
+ """Turn on or off Server Side Excludes."""
+
+ ssl: Optional[Literal["off", "flexible", "full", "strict", "origin_pull"]] = None
+ """Configure the SSL level."""
+
+ sxg: Optional[bool] = None
+ """Turn on or off Signed Exchanges (SXG)."""
+
+
+class SetConfigRule(BaseModel):
+ last_updated: datetime
+ """The timestamp of when the rule was last modified."""
+
+ version: str
+ """The version of the rule."""
+
+ id: Optional[str] = None
+ """The unique ID of the rule."""
+
+ action: Optional[Literal["set_config"]] = None
+ """The action to perform when the rule matches."""
+
+ action_parameters: Optional[ActionParameters] = None
+ """The parameters configuring the rule's action."""
+
+ categories: Optional[List[str]] = None
+ """The categories of the rule."""
+
+ description: Optional[str] = None
+ """An informative description of the rule."""
+
+ enabled: Optional[bool] = None
+ """Whether the rule should be executed."""
+
+ expression: Optional[str] = None
+ """The expression defining which traffic will match the rule."""
+
+ logging: Optional[Logging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/set_config_rule_param.py b/src/cloudflare/types/rulesets/set_config_rule_param.py
new file mode 100644
index 00000000000..e90a1670126
--- /dev/null
+++ b/src/cloudflare/types/rulesets/set_config_rule_param.py
@@ -0,0 +1,93 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, TypedDict
+
+from .logging_param import LoggingParam
+
+__all__ = ["SetConfigRuleParam", "ActionParameters", "ActionParametersAutominify"]
+
+
+class ActionParametersAutominify(TypedDict, total=False):
+ css: bool
+ """Minify CSS files."""
+
+ html: bool
+ """Minify HTML files."""
+
+ js: bool
+ """Minify JS files."""
+
+
+class ActionParameters(TypedDict, total=False):
+ automatic_https_rewrites: bool
+ """Turn on or off Automatic HTTPS Rewrites."""
+
+ autominify: ActionParametersAutominify
+ """Select which file extensions to minify automatically."""
+
+ bic: bool
+ """Turn on or off Browser Integrity Check."""
+
+ disable_apps: bool
+ """Turn off all active Cloudflare Apps."""
+
+ disable_zaraz: bool
+ """Turn off Zaraz."""
+
+ email_obfuscation: bool
+ """Turn on or off Email Obfuscation."""
+
+ hotlink_protection: bool
+ """Turn on or off the Hotlink Protection."""
+
+ mirage: bool
+ """Turn on or off Mirage."""
+
+ opportunistic_encryption: bool
+ """Turn on or off Opportunistic Encryption."""
+
+ polish: Literal["off", "lossless", "lossy"]
+ """Configure the Polish level."""
+
+ rocket_loader: bool
+ """Turn on or off Rocket Loader"""
+
+ security_level: Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]
+ """Configure the Security Level."""
+
+ server_side_excludes: bool
+ """Turn on or off Server Side Excludes."""
+
+ ssl: Literal["off", "flexible", "full", "strict", "origin_pull"]
+ """Configure the SSL level."""
+
+ sxg: bool
+ """Turn on or off Signed Exchanges (SXG)."""
+
+
+class SetConfigRuleParam(TypedDict, total=False):
+ id: str
+ """The unique ID of the rule."""
+
+ action: Literal["set_config"]
+ """The action to perform when the rule matches."""
+
+ action_parameters: ActionParameters
+ """The parameters configuring the rule's action."""
+
+ description: str
+ """An informative description of the rule."""
+
+ enabled: bool
+ """Whether the rule should be executed."""
+
+ expression: str
+ """The expression defining which traffic will match the rule."""
+
+ logging: LoggingParam
+ """An object configuring the rule's logging behavior."""
+
+ ref: str
+ """The reference of the rule (the rule ID by default)."""
diff --git a/src/cloudflare/types/rulesets/version_get_response.py b/src/cloudflare/types/rulesets/version_get_response.py
index 4098d8c4fcf..a3e03c89cb8 100644
--- a/src/cloudflare/types/rulesets/version_get_response.py
+++ b/src/cloudflare/types/rulesets/version_get_response.py
@@ -1,965 +1,44 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
-from pydantic import Field as FieldInfo
-
-from .logging import Logging
from .log_rule import LogRule
from ..._models import BaseModel
from .skip_rule import SkipRule
from .block_rule import BlockRule
+from .route_rule import RouteRule
+from .score_rule import ScoreRule
from .execute_rule import ExecuteRule
-
-__all__ = [
- "VersionGetResponse",
- "Rule",
- "RuleRulesetsChallengeRule",
- "RuleRulesetsCompressResponseRule",
- "RuleRulesetsCompressResponseRuleActionParameters",
- "RuleRulesetsCompressResponseRuleActionParametersAlgorithm",
- "RuleRulesetsJsChallengeRule",
- "RuleRulesetsManagedChallengeRule",
- "RuleRulesetsRedirectRule",
- "RuleRulesetsRedirectRuleActionParameters",
- "RuleRulesetsRedirectRuleActionParametersFromList",
- "RuleRulesetsRedirectRuleActionParametersFromValue",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURL",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
- "RuleRulesetsRewriteRule",
- "RuleRulesetsRewriteRuleActionParameters",
- "RuleRulesetsRewriteRuleActionParametersHeaders",
- "RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader",
- "RuleRulesetsRewriteRuleActionParametersURI",
- "RuleRulesetsRewriteRuleActionParametersURIPath",
- "RuleRulesetsRewriteRuleActionParametersURIPathStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue",
- "RuleRulesetsRewriteRuleActionParametersURIQuery",
- "RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue",
- "RuleRulesetsRouteRule",
- "RuleRulesetsRouteRuleActionParameters",
- "RuleRulesetsRouteRuleActionParametersOrigin",
- "RuleRulesetsRouteRuleActionParametersSni",
- "RuleRulesetsScoreRule",
- "RuleRulesetsScoreRuleActionParameters",
- "RuleRulesetsServeErrorRule",
- "RuleRulesetsServeErrorRuleActionParameters",
- "RuleRulesetsSetConfigRule",
- "RuleRulesetsSetConfigRuleActionParameters",
- "RuleRulesetsSetConfigRuleActionParametersAutominify",
- "RuleRulesetsSetCacheSettingsRule",
- "RuleRulesetsSetCacheSettingsRuleActionParameters",
- "RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
- "RuleRulesetsSetCacheSettingsRuleActionParametersServeStale",
-]
-
-
-class RuleRulesetsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsCompressResponseRuleActionParametersAlgorithm(BaseModel):
- name: Optional[Literal["none", "auto", "default", "gzip", "brotli"]] = None
- """Name of compression algorithm to enable."""
-
-
-class RuleRulesetsCompressResponseRuleActionParameters(BaseModel):
- algorithms: Optional[List[RuleRulesetsCompressResponseRuleActionParametersAlgorithm]] = None
- """Custom order for compression algorithms."""
-
-
-class RuleRulesetsCompressResponseRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["compress_response"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsCompressResponseRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsJsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["js_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsManagedChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["managed_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromList(BaseModel):
- key: Optional[str] = None
- """Expression that evaluates to the list lookup key."""
-
- name: Optional[str] = None
- """The name of the list to match against."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(BaseModel):
- value: Optional[str] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(BaseModel):
- expression: Optional[str] = None
- """An expression to evaluate to get the URL to redirect the request to."""
-
-
-RuleRulesetsRedirectRuleActionParametersFromValueTargetURL = Union[
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
-]
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValue(BaseModel):
- preserve_query_string: Optional[bool] = None
- """Keep the query string of the original request."""
-
- status_code: Optional[Literal[301, 302, 303, 307, 308]] = None
- """The status code to be used for the redirect."""
-
- target_url: Optional[RuleRulesetsRedirectRuleActionParametersFromValueTargetURL] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParameters(BaseModel):
- from_list: Optional[RuleRulesetsRedirectRuleActionParametersFromList] = None
- """Serve a redirect based on a bulk list lookup."""
-
- from_value: Optional[RuleRulesetsRedirectRuleActionParametersFromValue] = None
- """Serve a redirect based on the request properties."""
-
-
-class RuleRulesetsRedirectRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["redirect"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRedirectRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader(BaseModel):
- operation: Literal["remove"]
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader(BaseModel):
- operation: Literal["set"]
-
- value: str
- """Static value for the header."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader(BaseModel):
- expression: str
- """Expression for the header value."""
-
- operation: Literal["set"]
-
-
-RuleRulesetsRewriteRuleActionParametersHeaders = Union[
- RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIPath = Union[
- RuleRulesetsRewriteRuleActionParametersURIPathStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIQuery = Union[
- RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURI(BaseModel):
- path: Optional[RuleRulesetsRewriteRuleActionParametersURIPath] = None
- """Path portion rewrite."""
-
- query: Optional[RuleRulesetsRewriteRuleActionParametersURIQuery] = None
- """Query portion rewrite."""
-
-
-class RuleRulesetsRewriteRuleActionParameters(BaseModel):
- headers: Optional[Dict[str, RuleRulesetsRewriteRuleActionParametersHeaders]] = None
- """Map of request headers to modify."""
-
- uri: Optional[RuleRulesetsRewriteRuleActionParametersURI] = None
- """URI to rewrite the request to."""
-
-
-class RuleRulesetsRewriteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["rewrite"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRewriteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRouteRuleActionParametersOrigin(BaseModel):
- host: Optional[str] = None
- """Override the resolved hostname."""
-
- port: Optional[float] = None
- """Override the destination port."""
-
-
-class RuleRulesetsRouteRuleActionParametersSni(BaseModel):
- value: str
- """The SNI override."""
-
-
-class RuleRulesetsRouteRuleActionParameters(BaseModel):
- host_header: Optional[str] = None
- """Rewrite the HTTP Host header."""
-
- origin: Optional[RuleRulesetsRouteRuleActionParametersOrigin] = None
- """Override the IP/TCP destination."""
-
- sni: Optional[RuleRulesetsRouteRuleActionParametersSni] = None
- """Override the Server Name Indication (SNI)."""
-
-
-class RuleRulesetsRouteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["route"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRouteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsScoreRuleActionParameters(BaseModel):
- increment: Optional[int] = None
- """
- Increment contains the delta to change the score and can be either positive or
- negative.
- """
-
-
-class RuleRulesetsScoreRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["score"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsScoreRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsServeErrorRuleActionParameters(BaseModel):
- content: Optional[str] = None
- """Error response content."""
-
- content_type: Optional[Literal["application/json", "text/xml", "text/plain", "text/html"]] = None
- """Content-type header to set with the response."""
-
- status_code: Optional[float] = None
- """The status code to use for the error."""
-
-
-class RuleRulesetsServeErrorRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["serve_error"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsServeErrorRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetConfigRuleActionParametersAutominify(BaseModel):
- css: Optional[bool] = None
- """Minify CSS files."""
-
- html: Optional[bool] = None
- """Minify HTML files."""
-
- js: Optional[bool] = None
- """Minify JS files."""
-
-
-class RuleRulesetsSetConfigRuleActionParameters(BaseModel):
- automatic_https_rewrites: Optional[bool] = None
- """Turn on or off Automatic HTTPS Rewrites."""
-
- autominify: Optional[RuleRulesetsSetConfigRuleActionParametersAutominify] = None
- """Select which file extensions to minify automatically."""
-
- bic: Optional[bool] = None
- """Turn on or off Browser Integrity Check."""
-
- disable_apps: Optional[bool] = None
- """Turn off all active Cloudflare Apps."""
-
- disable_zaraz: Optional[bool] = None
- """Turn off Zaraz."""
-
- email_obfuscation: Optional[bool] = None
- """Turn on or off Email Obfuscation."""
-
- hotlink_protection: Optional[bool] = None
- """Turn on or off the Hotlink Protection."""
-
- mirage: Optional[bool] = None
- """Turn on or off Mirage."""
-
- opportunistic_encryption: Optional[bool] = None
- """Turn on or off Opportunistic Encryption."""
-
- polish: Optional[Literal["off", "lossless", "lossy"]] = None
- """Configure the Polish level."""
-
- rocket_loader: Optional[bool] = None
- """Turn on or off Rocket Loader"""
-
- security_level: Optional[Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]] = None
- """Configure the Security Level."""
-
- server_side_excludes: Optional[bool] = None
- """Turn on or off Server Side Excludes."""
-
- ssl: Optional[Literal["off", "flexible", "full", "strict", "origin_pull"]] = None
- """Configure the SSL level."""
-
- sxg: Optional[bool] = None
- """Turn on or off Signed Exchanges (SXG)."""
-
-
-class RuleRulesetsSetConfigRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_config"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetConfigRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL(BaseModel):
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """Determines which browser ttl mode to use."""
-
- default: Optional[int] = None
- """The TTL (in seconds) if you choose override_origin mode."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these cookie names.
-
- The presence of these cookies is used in building the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these cookies' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these header names.
-
- The presence of these headers is used in building the cache key.
- """
-
- exclude_origin: Optional[bool] = None
- """Whether or not to include the origin header.
-
- A value of true will exclude the origin header in the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these headers' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(BaseModel):
- resolved: Optional[bool] = None
- """Use the resolved host in the cache key.
-
- A value of true will use the resolved host, while a value or false will use the
- original host.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(BaseModel):
- all: Optional[bool] = None
- """Exclude all query string parameters from use in building the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters NOT used to build the cache key.
-
- All parameters present in the request but missing in this list will be used to
- build the cache key.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(BaseModel):
- all: Optional[bool] = None
- """Use all query string parameters in the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters used to build the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(BaseModel):
- exclude: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] = None
- """
- build the cache key using all query string parameters EXCECPT these excluded
- parameters
- """
-
- include: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] = None
- """
- build the cache key using a list of query string parameters that ARE in the
- request.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(BaseModel):
- device_type: Optional[bool] = None
- """Use the user agent's device type in the cache key."""
-
- geo: Optional[bool] = None
- """Use the user agents's country in the cache key."""
-
- lang: Optional[bool] = None
- """Use the user agent's language in the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey(BaseModel):
- cookie: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] = None
- """The cookies to include in building the cache key."""
-
- header: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] = None
- """The header names and values to include in building the cache key."""
-
- host: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] = None
- """Whether to use the original host or the resolved host in the cache key."""
-
- query_string: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] = None
- """
- Use the presence or absence of parameters in the query string to build the cache
- key.
- """
-
- user: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] = None
- """Characteristics of the request user agent used in building the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey(BaseModel):
- cache_by_device_type: Optional[bool] = None
- """Separate cached content based on the visitor’s device type"""
-
- cache_deception_armor: Optional[bool] = None
- """
- Protect from web cache deception attacks while allowing static assets to be
- cached
- """
-
- custom_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] = None
- """
- Customize which components of the request are included or excluded from the
- cache key.
- """
-
- ignore_query_strings_order: Optional[bool] = None
- """
- Treat requests with the same query parameters the same, regardless of the order
- those query parameters are in. A value of true ignores the query strings' order.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve(BaseModel):
- eligible: bool
- """Determines whether cache reserve is enabled.
-
- If this is true and a request meets eligibility criteria, Cloudflare will write
- the resource to cache reserve.
- """
-
- min_file_size: int
- """The minimum file size eligible for store in cache reserve."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(BaseModel):
- from_: int = FieldInfo(alias="from")
- """response status code lower bound"""
-
- to: int
- """response status code upper bound"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(BaseModel):
- value: int
- """Time to cache a response (in seconds).
-
- A value of 0 is equivalent to setting the Cache-Control header with the value
- "no-cache". A value of -1 is equivalent to setting Cache-Control header with the
- value of "no-store".
- """
-
- status_code_range: Optional[
- RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
- ] = None
- """The range of status codes used to apply the selected mode."""
-
- status_code_value: Optional[int] = None
- """Set the ttl for responses with this specific status code"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL(BaseModel):
- default: int
- """The TTL (in seconds) if you choose override_origin mode."""
-
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """edge ttl options"""
-
- status_code_ttl: List[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]
- """List of single status codes, or status code ranges to apply the selected mode"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersServeStale(BaseModel):
- disable_stale_while_updating: bool
- """Defines whether Cloudflare should serve stale content while updating.
-
- If true, Cloudflare will not serve stale content while getting the latest
- content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParameters(BaseModel):
- additional_cacheable_ports: Optional[List[int]] = None
- """List of additional ports that caching can be enabled on."""
-
- browser_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] = None
- """Specify how long client browsers should cache the response.
-
- Cloudflare cache purge will not purge content cached on client browsers, so high
- browser TTLs may lead to stale content.
- """
-
- cache: Optional[bool] = None
- """Mark whether the request’s response from origin is eligible for caching.
-
- Caching itself will still depend on the cache-control header and your other
- caching configurations.
- """
-
- cache_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey] = None
- """
- Define which components of the request are included or excluded from the cache
- key Cloudflare uses to store the response in cache.
- """
-
- cache_reserve: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve] = None
- """
- Mark whether the request's response from origin is eligible for Cache Reserve
- (requires a Cache Reserve add-on plan).
- """
-
- edge_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] = None
- """
- TTL (Time to Live) specifies the maximum time to cache a resource in the
- Cloudflare edge network.
- """
-
- origin_cache_control: Optional[bool] = None
- """When enabled, Cloudflare will aim to strictly adhere to RFC 7234."""
-
- origin_error_page_passthru: Optional[bool] = None
- """Generate Cloudflare error pages from issues sent from the origin server.
-
- When on, error pages will trigger for issues from the origin
- """
-
- read_timeout: Optional[int] = None
- """
- Define a timeout value between two successive read operations to your origin
- server. Historically, the timeout value between two read options from Cloudflare
- to an origin server is 100 seconds. If you are attempting to reduce HTTP 524
- errors because of timeouts from an origin server, try increasing this timeout
- value.
- """
-
- respect_strong_etags: Optional[bool] = None
- """
- Specify whether or not Cloudflare should respect strong ETag (entity tag)
- headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
- """
-
- serve_stale: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersServeStale] = None
- """
- Define if Cloudflare should serve stale content while getting the latest content
- from the origin. If on, Cloudflare will not serve stale content while getting
- the latest content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_cache_settings"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetCacheSettingsRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
+from .rewrite_rule import RewriteRule
+from .redirect_rule import RedirectRule
+from .challenge_rule import ChallengeRule
+from .set_config_rule import SetConfigRule
+from .serve_error_rule import ServeErrorRule
+from .js_challenge_rule import JsChallengeRule
+from .compress_response_rule import CompressResponseRule
+from .managed_challenge_rule import ManagedChallengeRule
+from .set_cache_settings_rule import SetCacheSettingsRule
+
+__all__ = ["VersionGetResponse", "Rule"]
Rule = Union[
BlockRule,
- RuleRulesetsChallengeRule,
- RuleRulesetsCompressResponseRule,
+ ChallengeRule,
+ CompressResponseRule,
ExecuteRule,
- RuleRulesetsJsChallengeRule,
+ JsChallengeRule,
LogRule,
- RuleRulesetsManagedChallengeRule,
- RuleRulesetsRedirectRule,
- RuleRulesetsRewriteRule,
- RuleRulesetsRouteRule,
- RuleRulesetsScoreRule,
- RuleRulesetsServeErrorRule,
- RuleRulesetsSetConfigRule,
+ ManagedChallengeRule,
+ RedirectRule,
+ RewriteRule,
+ RouteRule,
+ ScoreRule,
+ ServeErrorRule,
+ SetConfigRule,
SkipRule,
- RuleRulesetsSetCacheSettingsRule,
+ SetCacheSettingsRule,
]
diff --git a/src/cloudflare/types/rulesets/versions/by_tag_get_response.py b/src/cloudflare/types/rulesets/versions/by_tag_get_response.py
index 3b4be3afa64..dcb0495e66e 100644
--- a/src/cloudflare/types/rulesets/versions/by_tag_get_response.py
+++ b/src/cloudflare/types/rulesets/versions/by_tag_get_response.py
@@ -1,965 +1,44 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
-from pydantic import Field as FieldInfo
-
-from ..logging import Logging
from ..log_rule import LogRule
from ...._models import BaseModel
from ..skip_rule import SkipRule
from ..block_rule import BlockRule
+from ..route_rule import RouteRule
+from ..score_rule import ScoreRule
from ..execute_rule import ExecuteRule
-
-__all__ = [
- "ByTagGetResponse",
- "Rule",
- "RuleRulesetsChallengeRule",
- "RuleRulesetsCompressResponseRule",
- "RuleRulesetsCompressResponseRuleActionParameters",
- "RuleRulesetsCompressResponseRuleActionParametersAlgorithm",
- "RuleRulesetsJsChallengeRule",
- "RuleRulesetsManagedChallengeRule",
- "RuleRulesetsRedirectRule",
- "RuleRulesetsRedirectRuleActionParameters",
- "RuleRulesetsRedirectRuleActionParametersFromList",
- "RuleRulesetsRedirectRuleActionParametersFromValue",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURL",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect",
- "RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect",
- "RuleRulesetsRewriteRule",
- "RuleRulesetsRewriteRuleActionParameters",
- "RuleRulesetsRewriteRuleActionParametersHeaders",
- "RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader",
- "RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader",
- "RuleRulesetsRewriteRuleActionParametersURI",
- "RuleRulesetsRewriteRuleActionParametersURIPath",
- "RuleRulesetsRewriteRuleActionParametersURIPathStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue",
- "RuleRulesetsRewriteRuleActionParametersURIQuery",
- "RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue",
- "RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue",
- "RuleRulesetsRouteRule",
- "RuleRulesetsRouteRuleActionParameters",
- "RuleRulesetsRouteRuleActionParametersOrigin",
- "RuleRulesetsRouteRuleActionParametersSni",
- "RuleRulesetsScoreRule",
- "RuleRulesetsScoreRuleActionParameters",
- "RuleRulesetsServeErrorRule",
- "RuleRulesetsServeErrorRuleActionParameters",
- "RuleRulesetsSetConfigRule",
- "RuleRulesetsSetConfigRuleActionParameters",
- "RuleRulesetsSetConfigRuleActionParametersAutominify",
- "RuleRulesetsSetCacheSettingsRule",
- "RuleRulesetsSetCacheSettingsRuleActionParameters",
- "RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser",
- "RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL",
- "RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange",
- "RuleRulesetsSetCacheSettingsRuleActionParametersServeStale",
-]
-
-
-class RuleRulesetsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsCompressResponseRuleActionParametersAlgorithm(BaseModel):
- name: Optional[Literal["none", "auto", "default", "gzip", "brotli"]] = None
- """Name of compression algorithm to enable."""
-
-
-class RuleRulesetsCompressResponseRuleActionParameters(BaseModel):
- algorithms: Optional[List[RuleRulesetsCompressResponseRuleActionParametersAlgorithm]] = None
- """Custom order for compression algorithms."""
-
-
-class RuleRulesetsCompressResponseRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["compress_response"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsCompressResponseRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsJsChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["js_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsManagedChallengeRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["managed_challenge"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[object] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromList(BaseModel):
- key: Optional[str] = None
- """Expression that evaluates to the list lookup key."""
-
- name: Optional[str] = None
- """The name of the list to match against."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect(BaseModel):
- value: Optional[str] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect(BaseModel):
- expression: Optional[str] = None
- """An expression to evaluate to get the URL to redirect the request to."""
-
-
-RuleRulesetsRedirectRuleActionParametersFromValueTargetURL = Union[
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLStaticURLRedirect,
- RuleRulesetsRedirectRuleActionParametersFromValueTargetURLDynamicURLRedirect,
-]
-
-
-class RuleRulesetsRedirectRuleActionParametersFromValue(BaseModel):
- preserve_query_string: Optional[bool] = None
- """Keep the query string of the original request."""
-
- status_code: Optional[Literal[301, 302, 303, 307, 308]] = None
- """The status code to be used for the redirect."""
-
- target_url: Optional[RuleRulesetsRedirectRuleActionParametersFromValueTargetURL] = None
- """The URL to redirect the request to."""
-
-
-class RuleRulesetsRedirectRuleActionParameters(BaseModel):
- from_list: Optional[RuleRulesetsRedirectRuleActionParametersFromList] = None
- """Serve a redirect based on a bulk list lookup."""
-
- from_value: Optional[RuleRulesetsRedirectRuleActionParametersFromValue] = None
- """Serve a redirect based on the request properties."""
-
-
-class RuleRulesetsRedirectRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["redirect"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRedirectRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader(BaseModel):
- operation: Literal["remove"]
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader(BaseModel):
- operation: Literal["set"]
-
- value: str
- """Static value for the header."""
-
-
-class RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader(BaseModel):
- expression: str
- """Expression for the header value."""
-
- operation: Literal["set"]
-
-
-RuleRulesetsRewriteRuleActionParametersHeaders = Union[
- RuleRulesetsRewriteRuleActionParametersHeadersRemoveHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersStaticHeader,
- RuleRulesetsRewriteRuleActionParametersHeadersDynamicHeader,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIPath = Union[
- RuleRulesetsRewriteRuleActionParametersURIPathStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIPathDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue(BaseModel):
- value: str
- """Predefined replacement value."""
-
-
-class RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue(BaseModel):
- expression: str
- """Expression to evaluate for the replacement value."""
-
-
-RuleRulesetsRewriteRuleActionParametersURIQuery = Union[
- RuleRulesetsRewriteRuleActionParametersURIQueryStaticValue,
- RuleRulesetsRewriteRuleActionParametersURIQueryDynamicValue,
-]
-
-
-class RuleRulesetsRewriteRuleActionParametersURI(BaseModel):
- path: Optional[RuleRulesetsRewriteRuleActionParametersURIPath] = None
- """Path portion rewrite."""
-
- query: Optional[RuleRulesetsRewriteRuleActionParametersURIQuery] = None
- """Query portion rewrite."""
-
-
-class RuleRulesetsRewriteRuleActionParameters(BaseModel):
- headers: Optional[Dict[str, RuleRulesetsRewriteRuleActionParametersHeaders]] = None
- """Map of request headers to modify."""
-
- uri: Optional[RuleRulesetsRewriteRuleActionParametersURI] = None
- """URI to rewrite the request to."""
-
-
-class RuleRulesetsRewriteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["rewrite"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRewriteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsRouteRuleActionParametersOrigin(BaseModel):
- host: Optional[str] = None
- """Override the resolved hostname."""
-
- port: Optional[float] = None
- """Override the destination port."""
-
-
-class RuleRulesetsRouteRuleActionParametersSni(BaseModel):
- value: str
- """The SNI override."""
-
-
-class RuleRulesetsRouteRuleActionParameters(BaseModel):
- host_header: Optional[str] = None
- """Rewrite the HTTP Host header."""
-
- origin: Optional[RuleRulesetsRouteRuleActionParametersOrigin] = None
- """Override the IP/TCP destination."""
-
- sni: Optional[RuleRulesetsRouteRuleActionParametersSni] = None
- """Override the Server Name Indication (SNI)."""
-
-
-class RuleRulesetsRouteRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["route"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsRouteRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsScoreRuleActionParameters(BaseModel):
- increment: Optional[int] = None
- """
- Increment contains the delta to change the score and can be either positive or
- negative.
- """
-
-
-class RuleRulesetsScoreRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["score"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsScoreRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsServeErrorRuleActionParameters(BaseModel):
- content: Optional[str] = None
- """Error response content."""
-
- content_type: Optional[Literal["application/json", "text/xml", "text/plain", "text/html"]] = None
- """Content-type header to set with the response."""
-
- status_code: Optional[float] = None
- """The status code to use for the error."""
-
-
-class RuleRulesetsServeErrorRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["serve_error"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsServeErrorRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetConfigRuleActionParametersAutominify(BaseModel):
- css: Optional[bool] = None
- """Minify CSS files."""
-
- html: Optional[bool] = None
- """Minify HTML files."""
-
- js: Optional[bool] = None
- """Minify JS files."""
-
-
-class RuleRulesetsSetConfigRuleActionParameters(BaseModel):
- automatic_https_rewrites: Optional[bool] = None
- """Turn on or off Automatic HTTPS Rewrites."""
-
- autominify: Optional[RuleRulesetsSetConfigRuleActionParametersAutominify] = None
- """Select which file extensions to minify automatically."""
-
- bic: Optional[bool] = None
- """Turn on or off Browser Integrity Check."""
-
- disable_apps: Optional[bool] = None
- """Turn off all active Cloudflare Apps."""
-
- disable_zaraz: Optional[bool] = None
- """Turn off Zaraz."""
-
- email_obfuscation: Optional[bool] = None
- """Turn on or off Email Obfuscation."""
-
- hotlink_protection: Optional[bool] = None
- """Turn on or off the Hotlink Protection."""
-
- mirage: Optional[bool] = None
- """Turn on or off Mirage."""
-
- opportunistic_encryption: Optional[bool] = None
- """Turn on or off Opportunistic Encryption."""
-
- polish: Optional[Literal["off", "lossless", "lossy"]] = None
- """Configure the Polish level."""
-
- rocket_loader: Optional[bool] = None
- """Turn on or off Rocket Loader"""
-
- security_level: Optional[Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]] = None
- """Configure the Security Level."""
-
- server_side_excludes: Optional[bool] = None
- """Turn on or off Server Side Excludes."""
-
- ssl: Optional[Literal["off", "flexible", "full", "strict", "origin_pull"]] = None
- """Configure the SSL level."""
-
- sxg: Optional[bool] = None
- """Turn on or off Signed Exchanges (SXG)."""
-
-
-class RuleRulesetsSetConfigRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_config"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetConfigRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL(BaseModel):
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """Determines which browser ttl mode to use."""
-
- default: Optional[int] = None
- """The TTL (in seconds) if you choose override_origin mode."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these cookie names.
-
- The presence of these cookies is used in building the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these cookies' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader(BaseModel):
- check_presence: Optional[List[str]] = None
- """Checks for the presence of these header names.
-
- The presence of these headers is used in building the cache key.
- """
-
- exclude_origin: Optional[bool] = None
- """Whether or not to include the origin header.
-
- A value of true will exclude the origin header in the cache key.
- """
-
- include: Optional[List[str]] = None
- """Include these headers' names and their values."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost(BaseModel):
- resolved: Optional[bool] = None
- """Use the resolved host in the cache key.
-
- A value of true will use the resolved host, while a value or false will use the
- original host.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude(BaseModel):
- all: Optional[bool] = None
- """Exclude all query string parameters from use in building the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters NOT used to build the cache key.
-
- All parameters present in the request but missing in this list will be used to
- build the cache key.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude(BaseModel):
- all: Optional[bool] = None
- """Use all query string parameters in the cache key."""
-
- rule_list: Optional[List[str]] = FieldInfo(alias="list", default=None)
- """A list of query string parameters used to build the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString(BaseModel):
- exclude: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringExclude] = None
- """
- build the cache key using all query string parameters EXCECPT these excluded
- parameters
- """
-
- include: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryStringInclude] = None
- """
- build the cache key using a list of query string parameters that ARE in the
- request.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser(BaseModel):
- device_type: Optional[bool] = None
- """Use the user agent's device type in the cache key."""
-
- geo: Optional[bool] = None
- """Use the user agents's country in the cache key."""
-
- lang: Optional[bool] = None
- """Use the user agent's language in the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey(BaseModel):
- cookie: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyCookie] = None
- """The cookies to include in building the cache key."""
-
- header: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHeader] = None
- """The header names and values to include in building the cache key."""
-
- host: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyHost] = None
- """Whether to use the original host or the resolved host in the cache key."""
-
- query_string: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyQueryString] = None
- """
- Use the presence or absence of parameters in the query string to build the cache
- key.
- """
-
- user: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKeyUser] = None
- """Characteristics of the request user agent used in building the cache key."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey(BaseModel):
- cache_by_device_type: Optional[bool] = None
- """Separate cached content based on the visitor’s device type"""
-
- cache_deception_armor: Optional[bool] = None
- """
- Protect from web cache deception attacks while allowing static assets to be
- cached
- """
-
- custom_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKeyCustomKey] = None
- """
- Customize which components of the request are included or excluded from the
- cache key.
- """
-
- ignore_query_strings_order: Optional[bool] = None
- """
- Treat requests with the same query parameters the same, regardless of the order
- those query parameters are in. A value of true ignores the query strings' order.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve(BaseModel):
- eligible: bool
- """Determines whether cache reserve is enabled.
-
- If this is true and a request meets eligibility criteria, Cloudflare will write
- the resource to cache reserve.
- """
-
- min_file_size: int
- """The minimum file size eligible for store in cache reserve."""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange(BaseModel):
- from_: int = FieldInfo(alias="from")
- """response status code lower bound"""
-
- to: int
- """response status code upper bound"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL(BaseModel):
- value: int
- """Time to cache a response (in seconds).
-
- A value of 0 is equivalent to setting the Cache-Control header with the value
- "no-cache". A value of -1 is equivalent to setting Cache-Control header with the
- value of "no-store".
- """
-
- status_code_range: Optional[
- RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange
- ] = None
- """The range of status codes used to apply the selected mode."""
-
- status_code_value: Optional[int] = None
- """Set the ttl for responses with this specific status code"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL(BaseModel):
- default: int
- """The TTL (in seconds) if you choose override_origin mode."""
-
- mode: Literal["respect_origin", "bypass_by_default", "override_origin"]
- """edge ttl options"""
-
- status_code_ttl: List[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL]
- """List of single status codes, or status code ranges to apply the selected mode"""
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParametersServeStale(BaseModel):
- disable_stale_while_updating: bool
- """Defines whether Cloudflare should serve stale content while updating.
-
- If true, Cloudflare will not serve stale content while getting the latest
- content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRuleActionParameters(BaseModel):
- additional_cacheable_ports: Optional[List[int]] = None
- """List of additional ports that caching can be enabled on."""
-
- browser_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersBrowserTTL] = None
- """Specify how long client browsers should cache the response.
-
- Cloudflare cache purge will not purge content cached on client browsers, so high
- browser TTLs may lead to stale content.
- """
-
- cache: Optional[bool] = None
- """Mark whether the request’s response from origin is eligible for caching.
-
- Caching itself will still depend on the cache-control header and your other
- caching configurations.
- """
-
- cache_key: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheKey] = None
- """
- Define which components of the request are included or excluded from the cache
- key Cloudflare uses to store the response in cache.
- """
-
- cache_reserve: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersCacheReserve] = None
- """
- Mark whether the request's response from origin is eligible for Cache Reserve
- (requires a Cache Reserve add-on plan).
- """
-
- edge_ttl: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersEdgeTTL] = None
- """
- TTL (Time to Live) specifies the maximum time to cache a resource in the
- Cloudflare edge network.
- """
-
- origin_cache_control: Optional[bool] = None
- """When enabled, Cloudflare will aim to strictly adhere to RFC 7234."""
-
- origin_error_page_passthru: Optional[bool] = None
- """Generate Cloudflare error pages from issues sent from the origin server.
-
- When on, error pages will trigger for issues from the origin
- """
-
- read_timeout: Optional[int] = None
- """
- Define a timeout value between two successive read operations to your origin
- server. Historically, the timeout value between two read options from Cloudflare
- to an origin server is 100 seconds. If you are attempting to reduce HTTP 524
- errors because of timeouts from an origin server, try increasing this timeout
- value.
- """
-
- respect_strong_etags: Optional[bool] = None
- """
- Specify whether or not Cloudflare should respect strong ETag (entity tag)
- headers. When off, Cloudflare converts strong ETag headers to weak ETag headers.
- """
-
- serve_stale: Optional[RuleRulesetsSetCacheSettingsRuleActionParametersServeStale] = None
- """
- Define if Cloudflare should serve stale content while getting the latest content
- from the origin. If on, Cloudflare will not serve stale content while getting
- the latest content from the origin.
- """
-
-
-class RuleRulesetsSetCacheSettingsRule(BaseModel):
- last_updated: datetime
- """The timestamp of when the rule was last modified."""
-
- version: str
- """The version of the rule."""
-
- id: Optional[str] = None
- """The unique ID of the rule."""
-
- action: Optional[Literal["set_cache_settings"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSetCacheSettingsRuleActionParameters] = None
- """The parameters configuring the rule's action."""
-
- categories: Optional[List[str]] = None
- """The categories of the rule."""
-
- description: Optional[str] = None
- """An informative description of the rule."""
-
- enabled: Optional[bool] = None
- """Whether the rule should be executed."""
-
- expression: Optional[str] = None
- """The expression defining which traffic will match the rule."""
-
- logging: Optional[Logging] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
+from ..rewrite_rule import RewriteRule
+from ..redirect_rule import RedirectRule
+from ..challenge_rule import ChallengeRule
+from ..set_config_rule import SetConfigRule
+from ..serve_error_rule import ServeErrorRule
+from ..js_challenge_rule import JsChallengeRule
+from ..compress_response_rule import CompressResponseRule
+from ..managed_challenge_rule import ManagedChallengeRule
+from ..set_cache_settings_rule import SetCacheSettingsRule
+
+__all__ = ["ByTagGetResponse", "Rule"]
Rule = Union[
BlockRule,
- RuleRulesetsChallengeRule,
- RuleRulesetsCompressResponseRule,
+ ChallengeRule,
+ CompressResponseRule,
ExecuteRule,
- RuleRulesetsJsChallengeRule,
+ JsChallengeRule,
LogRule,
- RuleRulesetsManagedChallengeRule,
- RuleRulesetsRedirectRule,
- RuleRulesetsRewriteRule,
- RuleRulesetsRouteRule,
- RuleRulesetsScoreRule,
- RuleRulesetsServeErrorRule,
- RuleRulesetsSetConfigRule,
+ ManagedChallengeRule,
+ RedirectRule,
+ RewriteRule,
+ RouteRule,
+ ScoreRule,
+ ServeErrorRule,
+ SetConfigRule,
SkipRule,
- RuleRulesetsSetCacheSettingsRule,
+ SetCacheSettingsRule,
]
diff --git a/src/cloudflare/types/warp_connector_create_response.py b/src/cloudflare/types/warp_connector_create_response.py
index 6af0fd7e768..dd87278a2aa 100644
--- a/src/cloudflare/types/warp_connector_create_response.py
+++ b/src/cloudflare/types/warp_connector_create_response.py
@@ -1,13 +1,44 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
from .._models import BaseModel
-from .zero_trust import Tunnel, Connection
+from .zero_trust import Tunnel
-__all__ = ["WARPConnectorCreateResponse", "TunnelWARPConnectorTunnel"]
+__all__ = ["WARPConnectorCreateResponse", "TunnelWARPConnectorTunnel", "TunnelWARPConnectorTunnelConnection"]
+
+
+class TunnelWARPConnectorTunnelConnection(BaseModel):
+ id: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
+
+ client_id: Optional[object] = None
+ """UUID of the cloudflared instance."""
+
+ client_version: Optional[str] = None
+ """The cloudflared version used to establish this connection."""
+
+ colo_name: Optional[str] = None
+ """The Cloudflare data center used for this connection."""
+
+ is_pending_reconnect: Optional[bool] = None
+ """
+ Cloudflare continues to track connections for several minutes after they
+ disconnect. This is an optimization to improve latency and reliability of
+ reconnecting. If `true`, the connection has disconnected but is still being
+ tracked. If `false`, the connection is actively serving traffic.
+ """
+
+ opened_at: Optional[datetime] = None
+ """Timestamp of when the connection was established."""
+
+ origin_ip: Optional[str] = None
+ """The public IP address of the host running cloudflared."""
+
+ uuid: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
class TunnelWARPConnectorTunnel(BaseModel):
@@ -17,7 +48,7 @@ class TunnelWARPConnectorTunnel(BaseModel):
account_tag: Optional[str] = None
"""Cloudflare account ID"""
- connections: Optional[Connection] = None
+ connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None
"""The Cloudflare Tunnel connections between your origin and Cloudflare's edge."""
conns_active_at: Optional[datetime] = None
diff --git a/src/cloudflare/types/warp_connector_delete_response.py b/src/cloudflare/types/warp_connector_delete_response.py
index fa3ab386da8..e9343999295 100644
--- a/src/cloudflare/types/warp_connector_delete_response.py
+++ b/src/cloudflare/types/warp_connector_delete_response.py
@@ -1,13 +1,44 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
from .._models import BaseModel
-from .zero_trust import Tunnel, Connection
+from .zero_trust import Tunnel
-__all__ = ["WARPConnectorDeleteResponse", "TunnelWARPConnectorTunnel"]
+__all__ = ["WARPConnectorDeleteResponse", "TunnelWARPConnectorTunnel", "TunnelWARPConnectorTunnelConnection"]
+
+
+class TunnelWARPConnectorTunnelConnection(BaseModel):
+ id: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
+
+ client_id: Optional[object] = None
+ """UUID of the cloudflared instance."""
+
+ client_version: Optional[str] = None
+ """The cloudflared version used to establish this connection."""
+
+ colo_name: Optional[str] = None
+ """The Cloudflare data center used for this connection."""
+
+ is_pending_reconnect: Optional[bool] = None
+ """
+ Cloudflare continues to track connections for several minutes after they
+ disconnect. This is an optimization to improve latency and reliability of
+ reconnecting. If `true`, the connection has disconnected but is still being
+ tracked. If `false`, the connection is actively serving traffic.
+ """
+
+ opened_at: Optional[datetime] = None
+ """Timestamp of when the connection was established."""
+
+ origin_ip: Optional[str] = None
+ """The public IP address of the host running cloudflared."""
+
+ uuid: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
class TunnelWARPConnectorTunnel(BaseModel):
@@ -17,7 +48,7 @@ class TunnelWARPConnectorTunnel(BaseModel):
account_tag: Optional[str] = None
"""Cloudflare account ID"""
- connections: Optional[Connection] = None
+ connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None
"""The Cloudflare Tunnel connections between your origin and Cloudflare's edge."""
conns_active_at: Optional[datetime] = None
diff --git a/src/cloudflare/types/warp_connector_edit_response.py b/src/cloudflare/types/warp_connector_edit_response.py
index cd29bec5094..69103522d3b 100644
--- a/src/cloudflare/types/warp_connector_edit_response.py
+++ b/src/cloudflare/types/warp_connector_edit_response.py
@@ -1,13 +1,44 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
from .._models import BaseModel
-from .zero_trust import Tunnel, Connection
+from .zero_trust import Tunnel
-__all__ = ["WARPConnectorEditResponse", "TunnelWARPConnectorTunnel"]
+__all__ = ["WARPConnectorEditResponse", "TunnelWARPConnectorTunnel", "TunnelWARPConnectorTunnelConnection"]
+
+
+class TunnelWARPConnectorTunnelConnection(BaseModel):
+ id: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
+
+ client_id: Optional[object] = None
+ """UUID of the cloudflared instance."""
+
+ client_version: Optional[str] = None
+ """The cloudflared version used to establish this connection."""
+
+ colo_name: Optional[str] = None
+ """The Cloudflare data center used for this connection."""
+
+ is_pending_reconnect: Optional[bool] = None
+ """
+ Cloudflare continues to track connections for several minutes after they
+ disconnect. This is an optimization to improve latency and reliability of
+ reconnecting. If `true`, the connection has disconnected but is still being
+ tracked. If `false`, the connection is actively serving traffic.
+ """
+
+ opened_at: Optional[datetime] = None
+ """Timestamp of when the connection was established."""
+
+ origin_ip: Optional[str] = None
+ """The public IP address of the host running cloudflared."""
+
+ uuid: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
class TunnelWARPConnectorTunnel(BaseModel):
@@ -17,7 +48,7 @@ class TunnelWARPConnectorTunnel(BaseModel):
account_tag: Optional[str] = None
"""Cloudflare account ID"""
- connections: Optional[Connection] = None
+ connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None
"""The Cloudflare Tunnel connections between your origin and Cloudflare's edge."""
conns_active_at: Optional[datetime] = None
diff --git a/src/cloudflare/types/warp_connector_get_response.py b/src/cloudflare/types/warp_connector_get_response.py
index a8da274c312..4b211bb43e5 100644
--- a/src/cloudflare/types/warp_connector_get_response.py
+++ b/src/cloudflare/types/warp_connector_get_response.py
@@ -1,13 +1,44 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
from .._models import BaseModel
-from .zero_trust import Tunnel, Connection
+from .zero_trust import Tunnel
-__all__ = ["WARPConnectorGetResponse", "TunnelWARPConnectorTunnel"]
+__all__ = ["WARPConnectorGetResponse", "TunnelWARPConnectorTunnel", "TunnelWARPConnectorTunnelConnection"]
+
+
+class TunnelWARPConnectorTunnelConnection(BaseModel):
+ id: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
+
+ client_id: Optional[object] = None
+ """UUID of the cloudflared instance."""
+
+ client_version: Optional[str] = None
+ """The cloudflared version used to establish this connection."""
+
+ colo_name: Optional[str] = None
+ """The Cloudflare data center used for this connection."""
+
+ is_pending_reconnect: Optional[bool] = None
+ """
+ Cloudflare continues to track connections for several minutes after they
+ disconnect. This is an optimization to improve latency and reliability of
+ reconnecting. If `true`, the connection has disconnected but is still being
+ tracked. If `false`, the connection is actively serving traffic.
+ """
+
+ opened_at: Optional[datetime] = None
+ """Timestamp of when the connection was established."""
+
+ origin_ip: Optional[str] = None
+ """The public IP address of the host running cloudflared."""
+
+ uuid: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
class TunnelWARPConnectorTunnel(BaseModel):
@@ -17,7 +48,7 @@ class TunnelWARPConnectorTunnel(BaseModel):
account_tag: Optional[str] = None
"""Cloudflare account ID"""
- connections: Optional[Connection] = None
+ connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None
"""The Cloudflare Tunnel connections between your origin and Cloudflare's edge."""
conns_active_at: Optional[datetime] = None
diff --git a/src/cloudflare/types/warp_connector_list_response.py b/src/cloudflare/types/warp_connector_list_response.py
index 54cd870205e..2c5e33542ca 100644
--- a/src/cloudflare/types/warp_connector_list_response.py
+++ b/src/cloudflare/types/warp_connector_list_response.py
@@ -1,13 +1,44 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
from .._models import BaseModel
-from .zero_trust import Tunnel, Connection
+from .zero_trust import Tunnel
-__all__ = ["WARPConnectorListResponse", "TunnelWARPConnectorTunnel"]
+__all__ = ["WARPConnectorListResponse", "TunnelWARPConnectorTunnel", "TunnelWARPConnectorTunnelConnection"]
+
+
+class TunnelWARPConnectorTunnelConnection(BaseModel):
+ id: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
+
+ client_id: Optional[object] = None
+ """UUID of the cloudflared instance."""
+
+ client_version: Optional[str] = None
+ """The cloudflared version used to establish this connection."""
+
+ colo_name: Optional[str] = None
+ """The Cloudflare data center used for this connection."""
+
+ is_pending_reconnect: Optional[bool] = None
+ """
+ Cloudflare continues to track connections for several minutes after they
+ disconnect. This is an optimization to improve latency and reliability of
+ reconnecting. If `true`, the connection has disconnected but is still being
+ tracked. If `false`, the connection is actively serving traffic.
+ """
+
+ opened_at: Optional[datetime] = None
+ """Timestamp of when the connection was established."""
+
+ origin_ip: Optional[str] = None
+ """The public IP address of the host running cloudflared."""
+
+ uuid: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
class TunnelWARPConnectorTunnel(BaseModel):
@@ -17,7 +48,7 @@ class TunnelWARPConnectorTunnel(BaseModel):
account_tag: Optional[str] = None
"""Cloudflare account ID"""
- connections: Optional[Connection] = None
+ connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None
"""The Cloudflare Tunnel connections between your origin and Cloudflare's edge."""
conns_active_at: Optional[datetime] = None
diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/__init__.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/__init__.py
index f02cfa2e631..0aa7d524060 100644
--- a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/__init__.py
+++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/__init__.py
@@ -2,8 +2,14 @@
from __future__ import annotations
+from .tag_list_response import TagListResponse as TagListResponse
+from .tag_update_params import TagUpdateParams as TagUpdateParams
from .setting_edit_params import SettingEditParams as SettingEditParams
+from .tag_update_response import TagUpdateResponse as TagUpdateResponse
from .binding_get_response import BindingGetResponse as BindingGetResponse
+from .secret_list_response import SecretListResponse as SecretListResponse
+from .secret_update_params import SecretUpdateParams as SecretUpdateParams
from .setting_get_response import SettingGetResponse as SettingGetResponse
from .content_update_params import ContentUpdateParams as ContentUpdateParams
from .setting_edit_response import SettingEditResponse as SettingEditResponse
+from .secret_update_response import SecretUpdateResponse as SecretUpdateResponse
diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_list_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_list_response.py
new file mode 100644
index 00000000000..86ea1859cb1
--- /dev/null
+++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_list_response.py
@@ -0,0 +1,16 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from typing_extensions import Literal
+
+from ......_models import BaseModel
+
+__all__ = ["SecretListResponse"]
+
+
+class SecretListResponse(BaseModel):
+ name: Optional[str] = None
+ """The name of this secret, this is what will be to access it inside the Worker."""
+
+ type: Optional[Literal["secret_text"]] = None
+ """The type of secret to put."""
diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_params.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_params.py
new file mode 100644
index 00000000000..572b6f5e008
--- /dev/null
+++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_params.py
@@ -0,0 +1,24 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, Required, TypedDict
+
+__all__ = ["SecretUpdateParams"]
+
+
+class SecretUpdateParams(TypedDict, total=False):
+ account_id: Required[str]
+ """Identifier"""
+
+ dispatch_namespace: Required[str]
+ """Name of the Workers for Platforms dispatch namespace."""
+
+ name: str
+ """The name of this secret, this is what will be to access it inside the Worker."""
+
+ text: str
+ """The value of the secret."""
+
+ type: Literal["secret_text"]
+ """The type of secret to put."""
diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_response.py
new file mode 100644
index 00000000000..df496e500d8
--- /dev/null
+++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/secret_update_response.py
@@ -0,0 +1,16 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from typing_extensions import Literal
+
+from ......_models import BaseModel
+
+__all__ = ["SecretUpdateResponse"]
+
+
+class SecretUpdateResponse(BaseModel):
+ name: Optional[str] = None
+ """The name of this secret, this is what will be to access it inside the Worker."""
+
+ type: Optional[Literal["secret_text"]] = None
+ """The type of secret to put."""
diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_list_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_list_response.py
new file mode 100644
index 00000000000..f26fb51fb7e
--- /dev/null
+++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_list_response.py
@@ -0,0 +1,6 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+
+__all__ = ["TagListResponse"]
+
+TagListResponse = str
diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_update_params.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_update_params.py
new file mode 100644
index 00000000000..e423cd8440d
--- /dev/null
+++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_update_params.py
@@ -0,0 +1,19 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import List
+from typing_extensions import Required, TypedDict
+
+__all__ = ["TagUpdateParams"]
+
+
+class TagUpdateParams(TypedDict, total=False):
+ account_id: Required[str]
+ """Identifier"""
+
+ dispatch_namespace: Required[str]
+ """Name of the Workers for Platforms dispatch namespace."""
+
+ body: Required[List[str]]
+ """Tags to help you manage your Workers"""
diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_update_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_update_response.py
new file mode 100644
index 00000000000..52678a8e0b8
--- /dev/null
+++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/tag_update_response.py
@@ -0,0 +1,7 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List
+
+__all__ = ["TagUpdateResponse"]
+
+TagUpdateResponse = List[str]
diff --git a/src/cloudflare/types/zero_trust/connection.py b/src/cloudflare/types/zero_trust/connection.py
index 6be1acae57e..9d1f58e7fe1 100644
--- a/src/cloudflare/types/zero_trust/connection.py
+++ b/src/cloudflare/types/zero_trust/connection.py
@@ -1,23 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import List, Optional
-from datetime import datetime
+from typing import Optional
from ..._models import BaseModel
-__all__ = ["Connection", "ConnectionItem"]
+__all__ = ["Connection"]
-class ConnectionItem(BaseModel):
- id: Optional[str] = None
- """UUID of the Cloudflare Tunnel connection."""
-
- client_id: Optional[object] = None
- """UUID of the cloudflared instance."""
-
- client_version: Optional[str] = None
- """The cloudflared version used to establish this connection."""
-
+class Connection(BaseModel):
colo_name: Optional[str] = None
"""The Cloudflare data center used for this connection."""
@@ -29,14 +19,5 @@ class ConnectionItem(BaseModel):
tracked. If `false`, the connection is actively serving traffic.
"""
- opened_at: Optional[datetime] = None
- """Timestamp of when the connection was established."""
-
- origin_ip: Optional[str] = None
- """The public IP address of the host running cloudflared."""
-
uuid: Optional[str] = None
"""UUID of the Cloudflare Tunnel connection."""
-
-
-Connection = List[ConnectionItem]
diff --git a/src/cloudflare/types/zero_trust/tunnel.py b/src/cloudflare/types/zero_trust/tunnel.py
index 349d5e1d3c6..a7c3ca49648 100644
--- a/src/cloudflare/types/zero_trust/tunnel.py
+++ b/src/cloudflare/types/zero_trust/tunnel.py
@@ -1,13 +1,43 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Optional
+from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal
from ..._models import BaseModel
-from .connection import Connection
-__all__ = ["Tunnel"]
+__all__ = ["Tunnel", "Connection"]
+
+
+class Connection(BaseModel):
+ id: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
+
+ client_id: Optional[object] = None
+ """UUID of the cloudflared instance."""
+
+ client_version: Optional[str] = None
+ """The cloudflared version used to establish this connection."""
+
+ colo_name: Optional[str] = None
+ """The Cloudflare data center used for this connection."""
+
+ is_pending_reconnect: Optional[bool] = None
+ """
+ Cloudflare continues to track connections for several minutes after they
+ disconnect. This is an optimization to improve latency and reliability of
+ reconnecting. If `true`, the connection has disconnected but is still being
+ tracked. If `false`, the connection is actively serving traffic.
+ """
+
+ opened_at: Optional[datetime] = None
+ """Timestamp of when the connection was established."""
+
+ origin_ip: Optional[str] = None
+ """The public IP address of the host running cloudflared."""
+
+ uuid: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
class Tunnel(BaseModel):
@@ -17,7 +47,7 @@ class Tunnel(BaseModel):
account_tag: Optional[str] = None
"""Cloudflare account ID"""
- connections: Optional[Connection] = None
+ connections: Optional[List[Connection]] = None
"""The Cloudflare Tunnel connections between your origin and Cloudflare's edge."""
conns_active_at: Optional[datetime] = None
diff --git a/src/cloudflare/types/zero_trust/tunnel_create_response.py b/src/cloudflare/types/zero_trust/tunnel_create_response.py
index c3534bf5635..73f35896d9f 100644
--- a/src/cloudflare/types/zero_trust/tunnel_create_response.py
+++ b/src/cloudflare/types/zero_trust/tunnel_create_response.py
@@ -4,24 +4,9 @@
from datetime import datetime
from ..._models import BaseModel
+from .connection import Connection
-__all__ = ["TunnelCreateResponse", "Connection"]
-
-
-class Connection(BaseModel):
- colo_name: Optional[str] = None
- """The Cloudflare data center used for this connection."""
-
- is_pending_reconnect: Optional[bool] = None
- """
- Cloudflare continues to track connections for several minutes after they
- disconnect. This is an optimization to improve latency and reliability of
- reconnecting. If `true`, the connection has disconnected but is still being
- tracked. If `false`, the connection is actively serving traffic.
- """
-
- uuid: Optional[str] = None
- """UUID of the Cloudflare Tunnel connection."""
+__all__ = ["TunnelCreateResponse"]
class TunnelCreateResponse(BaseModel):
diff --git a/src/cloudflare/types/zero_trust/tunnel_delete_response.py b/src/cloudflare/types/zero_trust/tunnel_delete_response.py
index cb4d1611d6e..0a3106becf0 100644
--- a/src/cloudflare/types/zero_trust/tunnel_delete_response.py
+++ b/src/cloudflare/types/zero_trust/tunnel_delete_response.py
@@ -4,24 +4,9 @@
from datetime import datetime
from ..._models import BaseModel
+from .connection import Connection
-__all__ = ["TunnelDeleteResponse", "Connection"]
-
-
-class Connection(BaseModel):
- colo_name: Optional[str] = None
- """The Cloudflare data center used for this connection."""
-
- is_pending_reconnect: Optional[bool] = None
- """
- Cloudflare continues to track connections for several minutes after they
- disconnect. This is an optimization to improve latency and reliability of
- reconnecting. If `true`, the connection has disconnected but is still being
- tracked. If `false`, the connection is actively serving traffic.
- """
-
- uuid: Optional[str] = None
- """UUID of the Cloudflare Tunnel connection."""
+__all__ = ["TunnelDeleteResponse"]
class TunnelDeleteResponse(BaseModel):
diff --git a/src/cloudflare/types/zero_trust/tunnel_edit_response.py b/src/cloudflare/types/zero_trust/tunnel_edit_response.py
index 4caa7a0e6cf..5e1b6878971 100644
--- a/src/cloudflare/types/zero_trust/tunnel_edit_response.py
+++ b/src/cloudflare/types/zero_trust/tunnel_edit_response.py
@@ -1,14 +1,44 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
from .tunnel import Tunnel
from ..._models import BaseModel
-from .connection import Connection
-__all__ = ["TunnelEditResponse", "TunnelWARPConnectorTunnel"]
+__all__ = ["TunnelEditResponse", "TunnelWARPConnectorTunnel", "TunnelWARPConnectorTunnelConnection"]
+
+
+class TunnelWARPConnectorTunnelConnection(BaseModel):
+ id: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
+
+ client_id: Optional[object] = None
+ """UUID of the cloudflared instance."""
+
+ client_version: Optional[str] = None
+ """The cloudflared version used to establish this connection."""
+
+ colo_name: Optional[str] = None
+ """The Cloudflare data center used for this connection."""
+
+ is_pending_reconnect: Optional[bool] = None
+ """
+ Cloudflare continues to track connections for several minutes after they
+ disconnect. This is an optimization to improve latency and reliability of
+ reconnecting. If `true`, the connection has disconnected but is still being
+ tracked. If `false`, the connection is actively serving traffic.
+ """
+
+ opened_at: Optional[datetime] = None
+ """Timestamp of when the connection was established."""
+
+ origin_ip: Optional[str] = None
+ """The public IP address of the host running cloudflared."""
+
+ uuid: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
class TunnelWARPConnectorTunnel(BaseModel):
@@ -18,7 +48,7 @@ class TunnelWARPConnectorTunnel(BaseModel):
account_tag: Optional[str] = None
"""Cloudflare account ID"""
- connections: Optional[Connection] = None
+ connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None
"""The Cloudflare Tunnel connections between your origin and Cloudflare's edge."""
conns_active_at: Optional[datetime] = None
diff --git a/src/cloudflare/types/zero_trust/tunnel_get_response.py b/src/cloudflare/types/zero_trust/tunnel_get_response.py
index f7abe1db802..8803a86547c 100644
--- a/src/cloudflare/types/zero_trust/tunnel_get_response.py
+++ b/src/cloudflare/types/zero_trust/tunnel_get_response.py
@@ -4,24 +4,9 @@
from datetime import datetime
from ..._models import BaseModel
+from .connection import Connection
-__all__ = ["TunnelGetResponse", "Connection"]
-
-
-class Connection(BaseModel):
- colo_name: Optional[str] = None
- """The Cloudflare data center used for this connection."""
-
- is_pending_reconnect: Optional[bool] = None
- """
- Cloudflare continues to track connections for several minutes after they
- disconnect. This is an optimization to improve latency and reliability of
- reconnecting. If `true`, the connection has disconnected but is still being
- tracked. If `false`, the connection is actively serving traffic.
- """
-
- uuid: Optional[str] = None
- """UUID of the Cloudflare Tunnel connection."""
+__all__ = ["TunnelGetResponse"]
class TunnelGetResponse(BaseModel):
diff --git a/src/cloudflare/types/zero_trust/tunnel_list_response.py b/src/cloudflare/types/zero_trust/tunnel_list_response.py
index d1bc02ff669..97a4689566f 100644
--- a/src/cloudflare/types/zero_trust/tunnel_list_response.py
+++ b/src/cloudflare/types/zero_trust/tunnel_list_response.py
@@ -1,14 +1,44 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Union, Optional
+from typing import List, Union, Optional
from datetime import datetime
from typing_extensions import Literal
from .tunnel import Tunnel
from ..._models import BaseModel
-from .connection import Connection
-__all__ = ["TunnelListResponse", "TunnelWARPConnectorTunnel"]
+__all__ = ["TunnelListResponse", "TunnelWARPConnectorTunnel", "TunnelWARPConnectorTunnelConnection"]
+
+
+class TunnelWARPConnectorTunnelConnection(BaseModel):
+ id: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
+
+ client_id: Optional[object] = None
+ """UUID of the cloudflared instance."""
+
+ client_version: Optional[str] = None
+ """The cloudflared version used to establish this connection."""
+
+ colo_name: Optional[str] = None
+ """The Cloudflare data center used for this connection."""
+
+ is_pending_reconnect: Optional[bool] = None
+ """
+ Cloudflare continues to track connections for several minutes after they
+ disconnect. This is an optimization to improve latency and reliability of
+ reconnecting. If `true`, the connection has disconnected but is still being
+ tracked. If `false`, the connection is actively serving traffic.
+ """
+
+ opened_at: Optional[datetime] = None
+ """Timestamp of when the connection was established."""
+
+ origin_ip: Optional[str] = None
+ """The public IP address of the host running cloudflared."""
+
+ uuid: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
class TunnelWARPConnectorTunnel(BaseModel):
@@ -18,7 +48,7 @@ class TunnelWARPConnectorTunnel(BaseModel):
account_tag: Optional[str] = None
"""Cloudflare account ID"""
- connections: Optional[Connection] = None
+ connections: Optional[List[TunnelWARPConnectorTunnelConnection]] = None
"""The Cloudflare Tunnel connections between your origin and Cloudflare's edge."""
conns_active_at: Optional[datetime] = None
diff --git a/src/cloudflare/types/zero_trust/tunnel_param.py b/src/cloudflare/types/zero_trust/tunnel_param.py
index 6af384596d6..fe4c9a77071 100644
--- a/src/cloudflare/types/zero_trust/tunnel_param.py
+++ b/src/cloudflare/types/zero_trust/tunnel_param.py
@@ -2,21 +2,45 @@
from __future__ import annotations
-from typing import Union
+from typing import Union, Iterable
from datetime import datetime
from typing_extensions import Literal, Annotated, TypedDict
from ..._utils import PropertyInfo
-from .connection import Connection
-__all__ = ["TunnelParam"]
+__all__ = ["TunnelParam", "Connection"]
+
+
+class Connection(TypedDict, total=False):
+ client_id: object
+ """UUID of the cloudflared instance."""
+
+ client_version: str
+ """The cloudflared version used to establish this connection."""
+
+ colo_name: str
+ """The Cloudflare data center used for this connection."""
+
+ is_pending_reconnect: bool
+ """
+ Cloudflare continues to track connections for several minutes after they
+ disconnect. This is an optimization to improve latency and reliability of
+ reconnecting. If `true`, the connection has disconnected but is still being
+ tracked. If `false`, the connection is actively serving traffic.
+ """
+
+ opened_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
+ """Timestamp of when the connection was established."""
+
+ origin_ip: str
+ """The public IP address of the host running cloudflared."""
class TunnelParam(TypedDict, total=False):
account_tag: str
"""Cloudflare account ID"""
- connections: Connection
+ connections: Iterable[Connection]
"""The Cloudflare Tunnel connections between your origin and Cloudflare's edge."""
conns_active_at: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
diff --git a/src/cloudflare/types/zero_trust/tunnels/client.py b/src/cloudflare/types/zero_trust/tunnels/client.py
index fce0f7da0a0..1c18c5ff6f2 100644
--- a/src/cloudflare/types/zero_trust/tunnels/client.py
+++ b/src/cloudflare/types/zero_trust/tunnels/client.py
@@ -4,9 +4,39 @@
from datetime import datetime
from ...._models import BaseModel
-from ..connection import Connection
-__all__ = ["Client"]
+__all__ = ["Client", "Conn"]
+
+
+class Conn(BaseModel):
+ id: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
+
+ client_id: Optional[object] = None
+ """UUID of the cloudflared instance."""
+
+ client_version: Optional[str] = None
+ """The cloudflared version used to establish this connection."""
+
+ colo_name: Optional[str] = None
+ """The Cloudflare data center used for this connection."""
+
+ is_pending_reconnect: Optional[bool] = None
+ """
+ Cloudflare continues to track connections for several minutes after they
+ disconnect. This is an optimization to improve latency and reliability of
+ reconnecting. If `true`, the connection has disconnected but is still being
+ tracked. If `false`, the connection is actively serving traffic.
+ """
+
+ opened_at: Optional[datetime] = None
+ """Timestamp of when the connection was established."""
+
+ origin_ip: Optional[str] = None
+ """The public IP address of the host running cloudflared."""
+
+ uuid: Optional[str] = None
+ """UUID of the Cloudflare Tunnel connection."""
class Client(BaseModel):
@@ -22,7 +52,7 @@ class Client(BaseModel):
Used internally to sync cloudflared with the Zero Trust dashboard.
"""
- conns: Optional[Connection] = None
+ conns: Optional[List[Conn]] = None
"""The Cloudflare Tunnel connections between your origin and Cloudflare's edge."""
features: Optional[List[str]] = None
diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_secrets.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_secrets.py
new file mode 100644
index 00000000000..77350d5c905
--- /dev/null
+++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_secrets.py
@@ -0,0 +1,310 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.pagination import SyncSinglePage, AsyncSinglePage
+from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import (
+ SecretListResponse,
+ SecretUpdateResponse,
+)
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestSecrets:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_update(self, client: Cloudflare) -> None:
+ secret = client.workers_for_platforms.dispatch.namespaces.scripts.secrets.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+ assert_matches_type(SecretUpdateResponse, secret, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_update_with_all_params(self, client: Cloudflare) -> None:
+ secret = client.workers_for_platforms.dispatch.namespaces.scripts.secrets.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ name="MY_SECRET",
+ text="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
+ type="secret_text",
+ )
+ assert_matches_type(SecretUpdateResponse, secret, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_update(self, client: Cloudflare) -> None:
+ response = client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ secret = response.parse()
+ assert_matches_type(SecretUpdateResponse, secret, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_update(self, client: Cloudflare) -> None:
+ with client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_streaming_response.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ secret = response.parse()
+ assert_matches_type(SecretUpdateResponse, secret, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_path_params_update(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.update(
+ "this-is_my_script-01",
+ account_id="",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"):
+ client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.update(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_list(self, client: Cloudflare) -> None:
+ secret = client.workers_for_platforms.dispatch.namespaces.scripts.secrets.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+ assert_matches_type(SyncSinglePage[SecretListResponse], secret, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_list(self, client: Cloudflare) -> None:
+ response = client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ secret = response.parse()
+ assert_matches_type(SyncSinglePage[SecretListResponse], secret, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_list(self, client: Cloudflare) -> None:
+ with client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_streaming_response.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ secret = response.parse()
+ assert_matches_type(SyncSinglePage[SecretListResponse], secret, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_path_params_list(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.list(
+ "this-is_my_script-01",
+ account_id="",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"):
+ client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.list(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+
+
+class TestAsyncSecrets:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_update(self, async_client: AsyncCloudflare) -> None:
+ secret = await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+ assert_matches_type(SecretUpdateResponse, secret, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ secret = await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ name="MY_SECRET",
+ text="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
+ type="secret_text",
+ )
+ assert_matches_type(SecretUpdateResponse, secret, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
+ response = (
+ await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ secret = await response.parse()
+ assert_matches_type(SecretUpdateResponse, secret, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_streaming_response.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ secret = await response.parse()
+ assert_matches_type(SecretUpdateResponse, secret, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.update(
+ "this-is_my_script-01",
+ account_id="",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"):
+ await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.update(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
+ secret = await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+ assert_matches_type(AsyncSinglePage[SecretListResponse], secret, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ secret = await response.parse()
+ assert_matches_type(AsyncSinglePage[SecretListResponse], secret, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_streaming_response.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ secret = await response.parse()
+ assert_matches_type(AsyncSinglePage[SecretListResponse], secret, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.list(
+ "this-is_my_script-01",
+ account_id="",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"):
+ await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ await async_client.workers_for_platforms.dispatch.namespaces.scripts.secrets.with_raw_response.list(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
diff --git a/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_tags.py b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_tags.py
new file mode 100644
index 00000000000..3e7dd4d20e4
--- /dev/null
+++ b/tests/api_resources/workers_for_platforms/dispatch/namespaces/scripts/test_tags.py
@@ -0,0 +1,450 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.pagination import SyncSinglePage, AsyncSinglePage
+from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import (
+ TagListResponse,
+ TagUpdateResponse,
+)
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestTags:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_update(self, client: Cloudflare) -> None:
+ tag = client.workers_for_platforms.dispatch.namespaces.scripts.tags.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ body=["my-tag", "my-tag", "my-tag"],
+ )
+ assert_matches_type(TagUpdateResponse, tag, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_update(self, client: Cloudflare) -> None:
+ response = client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ body=["my-tag", "my-tag", "my-tag"],
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ tag = response.parse()
+ assert_matches_type(TagUpdateResponse, tag, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_update(self, client: Cloudflare) -> None:
+ with client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_streaming_response.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ body=["my-tag", "my-tag", "my-tag"],
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ tag = response.parse()
+ assert_matches_type(TagUpdateResponse, tag, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_path_params_update(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.update(
+ "this-is_my_script-01",
+ account_id="",
+ dispatch_namespace="my-dispatch-namespace",
+ body=["my-tag", "my-tag", "my-tag"],
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"):
+ client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="",
+ body=["my-tag", "my-tag", "my-tag"],
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.update(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ body=["my-tag", "my-tag", "my-tag"],
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_list(self, client: Cloudflare) -> None:
+ tag = client.workers_for_platforms.dispatch.namespaces.scripts.tags.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+ assert_matches_type(SyncSinglePage[TagListResponse], tag, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_list(self, client: Cloudflare) -> None:
+ response = client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ tag = response.parse()
+ assert_matches_type(SyncSinglePage[TagListResponse], tag, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_list(self, client: Cloudflare) -> None:
+ with client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_streaming_response.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ tag = response.parse()
+ assert_matches_type(SyncSinglePage[TagListResponse], tag, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_path_params_list(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.list(
+ "this-is_my_script-01",
+ account_id="",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"):
+ client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.list(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_delete(self, client: Cloudflare) -> None:
+ tag = client.workers_for_platforms.dispatch.namespaces.scripts.tags.delete(
+ "my-tag",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ script_name="this-is_my_script-01",
+ )
+ assert_matches_type(object, tag, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_delete(self, client: Cloudflare) -> None:
+ response = client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete(
+ "my-tag",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ script_name="this-is_my_script-01",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ tag = response.parse()
+ assert_matches_type(object, tag, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_delete(self, client: Cloudflare) -> None:
+ with client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_streaming_response.delete(
+ "my-tag",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ script_name="this-is_my_script-01",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ tag = response.parse()
+ assert_matches_type(object, tag, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_path_params_delete(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete(
+ "my-tag",
+ account_id="",
+ dispatch_namespace="my-dispatch-namespace",
+ script_name="this-is_my_script-01",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"):
+ client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete(
+ "my-tag",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="",
+ script_name="this-is_my_script-01",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete(
+ "my-tag",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ script_name="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `tag` but received ''"):
+ client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ script_name="this-is_my_script-01",
+ )
+
+
+class TestAsyncTags:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_update(self, async_client: AsyncCloudflare) -> None:
+ tag = await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ body=["my-tag", "my-tag", "my-tag"],
+ )
+ assert_matches_type(TagUpdateResponse, tag, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ body=["my-tag", "my-tag", "my-tag"],
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ tag = await response.parse()
+ assert_matches_type(TagUpdateResponse, tag, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_streaming_response.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ body=["my-tag", "my-tag", "my-tag"],
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ tag = await response.parse()
+ assert_matches_type(TagUpdateResponse, tag, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.update(
+ "this-is_my_script-01",
+ account_id="",
+ dispatch_namespace="my-dispatch-namespace",
+ body=["my-tag", "my-tag", "my-tag"],
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"):
+ await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.update(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="",
+ body=["my-tag", "my-tag", "my-tag"],
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.update(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ body=["my-tag", "my-tag", "my-tag"],
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
+ tag = await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+ assert_matches_type(AsyncSinglePage[TagListResponse], tag, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ tag = await response.parse()
+ assert_matches_type(AsyncSinglePage[TagListResponse], tag, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_streaming_response.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ tag = await response.parse()
+ assert_matches_type(AsyncSinglePage[TagListResponse], tag, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.list(
+ "this-is_my_script-01",
+ account_id="",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"):
+ await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.list(
+ "this-is_my_script-01",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.list(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
+ tag = await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.delete(
+ "my-tag",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ script_name="this-is_my_script-01",
+ )
+ assert_matches_type(object, tag, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete(
+ "my-tag",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ script_name="this-is_my_script-01",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ tag = await response.parse()
+ assert_matches_type(object, tag, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_streaming_response.delete(
+ "my-tag",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ script_name="this-is_my_script-01",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ tag = await response.parse()
+ assert_matches_type(object, tag, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete(
+ "my-tag",
+ account_id="",
+ dispatch_namespace="my-dispatch-namespace",
+ script_name="this-is_my_script-01",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `dispatch_namespace` but received ''"):
+ await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete(
+ "my-tag",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="",
+ script_name="this-is_my_script-01",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `script_name` but received ''"):
+ await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete(
+ "my-tag",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ script_name="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `tag` but received ''"):
+ await async_client.workers_for_platforms.dispatch.namespaces.scripts.tags.with_raw_response.delete(
+ "",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ dispatch_namespace="my-dispatch-namespace",
+ script_name="this-is_my_script-01",
+ )