From dbc049d8aaa84a273c78bbc9f00e273d5ec948fa Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 4 Apr 2024 23:37:33 +0000
Subject: [PATCH] feat(api): update via SDK Studio (#227)
---
api.md | 17 +-
.../resources/rulesets/phases/phases.py | 5 +-
.../resources/rulesets/phases/versions.py | 15 +-
src/cloudflare/resources/rulesets/rules.py | 48 +--
src/cloudflare/resources/rulesets/rulesets.py | 23 +-
.../resources/rulesets/versions/versions.py | 15 +-
src/cloudflare/types/__init__.py | 12 +-
src/cloudflare/types/block_rule.py | 61 ++++
src/cloudflare/types/block_rule_param.py | 51 +++
src/cloudflare/types/execute_rule.py | 129 +++++++
src/cloudflare/types/execute_rule_param.py | 120 +++++++
src/cloudflare/types/log_rule.py | 45 +++
src/cloudflare/types/log_rule_param.py | 35 ++
src/cloudflare/types/request_rule.py | 12 +
src/cloudflare/types/request_rule_param.py | 14 +
src/cloudflare/types/ruleset.py | 58 ++++
src/cloudflare/types/ruleset_create_params.py | 278 +--------------
.../types/ruleset_create_response.py | 318 +-----------------
src/cloudflare/types/ruleset_get_response.py | 318 +-----------------
src/cloudflare/types/ruleset_list_response.py | 56 ---
src/cloudflare/types/ruleset_update_params.py | 278 +--------------
.../types/ruleset_update_response.py | 318 +-----------------
src/cloudflare/types/rulesets/__init__.py | 1 -
.../types/rulesets/phase_get_response.py | 318 +-----------------
.../types/rulesets/phase_update_params.py | 278 +--------------
.../types/rulesets/phase_update_response.py | 318 +-----------------
.../types/rulesets/phases/__init__.py | 1 -
.../rulesets/phases/version_get_response.py | 318 +-----------------
.../rulesets/phases/version_list_response.py | 56 ---
.../types/rulesets/rule_create_params.py | 66 ++--
.../types/rulesets/rule_create_response.py | 318 +-----------------
.../types/rulesets/rule_delete_response.py | 318 +-----------------
.../types/rulesets/rule_edit_params.py | 66 ++--
.../types/rulesets/rule_edit_response.py | 318 +-----------------
.../types/rulesets/version_get_response.py | 318 +-----------------
.../types/rulesets/version_list_response.py | 56 ---
.../rulesets/versions/by_tag_get_response.py | 318 +-----------------
src/cloudflare/types/skip_rule.py | 104 ++++++
src/cloudflare/types/skip_rule_param.py | 91 +++++
.../rulesets/phases/test_versions.py | 19 +-
tests/api_resources/rulesets/test_versions.py | 19 +-
tests/api_resources/test_rulesets.py | 18 +-
42 files changed, 948 insertions(+), 4597 deletions(-)
create mode 100644 src/cloudflare/types/block_rule.py
create mode 100644 src/cloudflare/types/block_rule_param.py
create mode 100644 src/cloudflare/types/execute_rule.py
create mode 100644 src/cloudflare/types/execute_rule_param.py
create mode 100644 src/cloudflare/types/log_rule.py
create mode 100644 src/cloudflare/types/log_rule_param.py
create mode 100644 src/cloudflare/types/request_rule.py
create mode 100644 src/cloudflare/types/request_rule_param.py
create mode 100644 src/cloudflare/types/ruleset.py
delete mode 100644 src/cloudflare/types/ruleset_list_response.py
delete mode 100644 src/cloudflare/types/rulesets/phases/version_list_response.py
delete mode 100644 src/cloudflare/types/rulesets/version_list_response.py
create mode 100644 src/cloudflare/types/skip_rule.py
create mode 100644 src/cloudflare/types/skip_rule_param.py
diff --git a/api.md b/api.md
index 68d6c97aa8d..72ba0b0d815 100644
--- a/api.md
+++ b/api.md
@@ -3107,9 +3107,14 @@ Types:
```python
from cloudflare.types import (
+ BlockRule,
+ ExecuteRule,
+ LogRule,
+ RequestRule,
+ Ruleset,
+ SkipRule,
RulesetCreateResponse,
RulesetUpdateResponse,
- RulesetListResponse,
RulesetGetResponse,
)
```
@@ -3118,7 +3123,7 @@ Methods:
- client.rulesets.create(\*, account_id, zone_id, \*\*params) -> RulesetCreateResponse
- client.rulesets.update(ruleset_id, \*, account_id, zone_id, \*\*params) -> RulesetUpdateResponse
-- client.rulesets.list(\*, account_id, zone_id) -> SyncSinglePage[RulesetListResponse]
+- client.rulesets.list(\*, account_id, zone_id) -> SyncSinglePage[Ruleset]
- client.rulesets.delete(ruleset_id, \*, account_id, zone_id) -> None
- client.rulesets.get(ruleset_id, \*, account_id, zone_id) -> RulesetGetResponse
@@ -3140,12 +3145,12 @@ Methods:
Types:
```python
-from cloudflare.types.rulesets.phases import VersionListResponse, VersionGetResponse
+from cloudflare.types.rulesets.phases import VersionGetResponse
```
Methods:
-- client.rulesets.phases.versions.list(ruleset_phase, \*, account_id, zone_id) -> SyncSinglePage[VersionListResponse]
+- client.rulesets.phases.versions.list(ruleset_phase, \*, account_id, zone_id) -> SyncSinglePage[Ruleset]
- client.rulesets.phases.versions.get(ruleset_version, \*, ruleset_phase, account_id, zone_id) -> VersionGetResponse
## Rules
@@ -3167,12 +3172,12 @@ Methods:
Types:
```python
-from cloudflare.types.rulesets import VersionListResponse, VersionGetResponse
+from cloudflare.types.rulesets import VersionGetResponse
```
Methods:
-- client.rulesets.versions.list(ruleset_id, \*, account_id, zone_id) -> SyncSinglePage[VersionListResponse]
+- client.rulesets.versions.list(ruleset_id, \*, account_id, zone_id) -> SyncSinglePage[Ruleset]
- client.rulesets.versions.delete(ruleset_version, \*, ruleset_id, account_id, zone_id) -> None
- client.rulesets.versions.get(ruleset_version, \*, ruleset_id, account_id, zone_id) -> VersionGetResponse
diff --git a/src/cloudflare/resources/rulesets/phases/phases.py b/src/cloudflare/resources/rulesets/phases/phases.py
index cc59c4d3d6f..0900e523671 100644
--- a/src/cloudflare/resources/rulesets/phases/phases.py
+++ b/src/cloudflare/resources/rulesets/phases/phases.py
@@ -7,6 +7,7 @@
import httpx
+from ....types import RequestRuleParam
from .versions import (
Versions,
AsyncVersions,
@@ -78,7 +79,7 @@ def update(
"magic_transit_managed",
],
*,
- rules: Iterable[phase_update_params.Rule],
+ rules: Iterable[RequestRuleParam],
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
@@ -311,7 +312,7 @@ async def update(
"magic_transit_managed",
],
*,
- rules: Iterable[phase_update_params.Rule],
+ rules: Iterable[RequestRuleParam],
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
diff --git a/src/cloudflare/resources/rulesets/phases/versions.py b/src/cloudflare/resources/rulesets/phases/versions.py
index ad6fc7cb545..28c80b837c2 100644
--- a/src/cloudflare/resources/rulesets/phases/versions.py
+++ b/src/cloudflare/resources/rulesets/phases/versions.py
@@ -7,6 +7,7 @@
import httpx
+from ....types import Ruleset
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -22,7 +23,7 @@
AsyncPaginator,
make_request_options,
)
-from ....types.rulesets.phases import VersionGetResponse, VersionListResponse
+from ....types.rulesets.phases import VersionGetResponse
__all__ = ["Versions", "AsyncVersions"]
@@ -72,7 +73,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> SyncSinglePage[VersionListResponse]:
+ ) -> SyncSinglePage[Ruleset]:
"""
Fetches the versions of an account or zone entry point ruleset.
@@ -110,11 +111,11 @@ def list(
account_or_zone_id = zone_id
return self._get_api_list(
f"/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint/versions",
- page=SyncSinglePage[VersionListResponse],
+ page=SyncSinglePage[Ruleset],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- model=VersionListResponse,
+ model=Ruleset,
)
def get(
@@ -252,7 +253,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AsyncPaginator[VersionListResponse, AsyncSinglePage[VersionListResponse]]:
+ ) -> AsyncPaginator[Ruleset, AsyncSinglePage[Ruleset]]:
"""
Fetches the versions of an account or zone entry point ruleset.
@@ -290,11 +291,11 @@ def list(
account_or_zone_id = zone_id
return self._get_api_list(
f"/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint/versions",
- page=AsyncSinglePage[VersionListResponse],
+ page=AsyncSinglePage[Ruleset],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- model=VersionListResponse,
+ model=Ruleset,
)
async def get(
diff --git a/src/cloudflare/resources/rulesets/rules.py b/src/cloudflare/resources/rulesets/rules.py
index d8031bc9a4f..826ab6a3b4c 100644
--- a/src/cloudflare/resources/rulesets/rules.py
+++ b/src/cloudflare/resources/rulesets/rules.py
@@ -55,7 +55,7 @@ def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["block"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsBlockRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.BlockRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -115,7 +115,7 @@ def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["execute"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsExecuteRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.ExecuteRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -235,7 +235,7 @@ def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["skip"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsSkipRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.SkipRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -294,10 +294,10 @@ def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["block"] | Literal["execute"] | Literal["log"] | Literal["skip"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsBlockRuleActionParameters
- | rule_create_params.RulesetsExecuteRuleActionParameters
+ action_parameters: rule_create_params.BlockRuleActionParameters
+ | rule_create_params.ExecuteRuleActionParameters
| object
- | rule_create_params.RulesetsSkipRuleActionParameters
+ | rule_create_params.SkipRuleActionParameters
| NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
@@ -428,7 +428,7 @@ def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["block"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsBlockRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.BlockRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -489,7 +489,7 @@ def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["execute"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsExecuteRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.ExecuteRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -611,7 +611,7 @@ def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["skip"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsSkipRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.SkipRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -672,10 +672,10 @@ def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["block"] | Literal["execute"] | Literal["log"] | Literal["skip"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsBlockRuleActionParameters
- | rule_edit_params.RulesetsExecuteRuleActionParameters
+ action_parameters: rule_edit_params.BlockRuleActionParameters
+ | rule_edit_params.ExecuteRuleActionParameters
| object
- | rule_edit_params.RulesetsSkipRuleActionParameters
+ | rule_edit_params.SkipRuleActionParameters
| NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
@@ -752,7 +752,7 @@ async def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["block"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsBlockRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.BlockRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -812,7 +812,7 @@ async def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["execute"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsExecuteRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.ExecuteRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -932,7 +932,7 @@ async def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["skip"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsSkipRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_create_params.SkipRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -991,10 +991,10 @@ async def create(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["block"] | Literal["execute"] | Literal["log"] | Literal["skip"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_create_params.RulesetsBlockRuleActionParameters
- | rule_create_params.RulesetsExecuteRuleActionParameters
+ action_parameters: rule_create_params.BlockRuleActionParameters
+ | rule_create_params.ExecuteRuleActionParameters
| object
- | rule_create_params.RulesetsSkipRuleActionParameters
+ | rule_create_params.SkipRuleActionParameters
| NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
@@ -1125,7 +1125,7 @@ async def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["block"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsBlockRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.BlockRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -1186,7 +1186,7 @@ async def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["execute"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsExecuteRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.ExecuteRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -1308,7 +1308,7 @@ async def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["skip"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsSkipRuleActionParameters | NotGiven = NOT_GIVEN,
+ action_parameters: rule_edit_params.SkipRuleActionParameters | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
expression: str | NotGiven = NOT_GIVEN,
@@ -1369,10 +1369,10 @@ async def edit(
zone_id: str | NotGiven = NOT_GIVEN,
id: str | NotGiven = NOT_GIVEN,
action: Literal["block"] | Literal["execute"] | Literal["log"] | Literal["skip"] | NotGiven = NOT_GIVEN,
- action_parameters: rule_edit_params.RulesetsBlockRuleActionParameters
- | rule_edit_params.RulesetsExecuteRuleActionParameters
+ action_parameters: rule_edit_params.BlockRuleActionParameters
+ | rule_edit_params.ExecuteRuleActionParameters
| object
- | rule_edit_params.RulesetsSkipRuleActionParameters
+ | rule_edit_params.SkipRuleActionParameters
| NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
enabled: bool | NotGiven = NOT_GIVEN,
diff --git a/src/cloudflare/resources/rulesets/rulesets.py b/src/cloudflare/resources/rulesets/rulesets.py
index c8a59a3ff07..3fcb3c271fd 100644
--- a/src/cloudflare/resources/rulesets/rulesets.py
+++ b/src/cloudflare/resources/rulesets/rulesets.py
@@ -24,8 +24,9 @@
AsyncPhasesWithStreamingResponse,
)
from ...types import (
+ Ruleset,
+ RequestRuleParam,
RulesetGetResponse,
- RulesetListResponse,
RulesetCreateResponse,
RulesetUpdateResponse,
ruleset_create_params,
@@ -115,7 +116,7 @@ def create(
"magic_transit_ids_managed",
"magic_transit_managed",
],
- rules: Iterable[ruleset_create_params.Rule],
+ rules: Iterable[RequestRuleParam],
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
@@ -193,7 +194,7 @@ def update(
self,
ruleset_id: str,
*,
- rules: Iterable[ruleset_update_params.Rule],
+ rules: Iterable[RequestRuleParam],
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
@@ -310,7 +311,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> SyncSinglePage[RulesetListResponse]:
+ ) -> SyncSinglePage[Ruleset]:
"""
Fetches all rulesets.
@@ -344,11 +345,11 @@ def list(
account_or_zone_id = zone_id
return self._get_api_list(
f"/{account_or_zone}/{account_or_zone_id}/rulesets",
- page=SyncSinglePage[RulesetListResponse],
+ page=SyncSinglePage[Ruleset],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- model=RulesetListResponse,
+ model=Ruleset,
)
def delete(
@@ -520,7 +521,7 @@ async def create(
"magic_transit_ids_managed",
"magic_transit_managed",
],
- rules: Iterable[ruleset_create_params.Rule],
+ rules: Iterable[RequestRuleParam],
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
@@ -598,7 +599,7 @@ async def update(
self,
ruleset_id: str,
*,
- rules: Iterable[ruleset_update_params.Rule],
+ rules: Iterable[RequestRuleParam],
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
@@ -715,7 +716,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AsyncPaginator[RulesetListResponse, AsyncSinglePage[RulesetListResponse]]:
+ ) -> AsyncPaginator[Ruleset, AsyncSinglePage[Ruleset]]:
"""
Fetches all rulesets.
@@ -749,11 +750,11 @@ def list(
account_or_zone_id = zone_id
return self._get_api_list(
f"/{account_or_zone}/{account_or_zone_id}/rulesets",
- page=AsyncSinglePage[RulesetListResponse],
+ page=AsyncSinglePage[Ruleset],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- model=RulesetListResponse,
+ model=Ruleset,
)
async def delete(
diff --git a/src/cloudflare/resources/rulesets/versions/versions.py b/src/cloudflare/resources/rulesets/versions/versions.py
index 284a7cc4b38..1971b000bb1 100644
--- a/src/cloudflare/resources/rulesets/versions/versions.py
+++ b/src/cloudflare/resources/rulesets/versions/versions.py
@@ -14,6 +14,7 @@
ByTagWithStreamingResponse,
AsyncByTagWithStreamingResponse,
)
+from ....types import Ruleset
from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -29,7 +30,7 @@
AsyncPaginator,
make_request_options,
)
-from ....types.rulesets import VersionGetResponse, VersionListResponse
+from ....types.rulesets import VersionGetResponse
__all__ = ["Versions", "AsyncVersions"]
@@ -59,7 +60,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> SyncSinglePage[VersionListResponse]:
+ ) -> SyncSinglePage[Ruleset]:
"""
Fetches the versions of an account or zone ruleset.
@@ -97,11 +98,11 @@ def list(
account_or_zone_id = zone_id
return self._get_api_list(
f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/versions",
- page=SyncSinglePage[VersionListResponse],
+ page=SyncSinglePage[Ruleset],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- model=VersionListResponse,
+ model=Ruleset,
)
def delete(
@@ -257,7 +258,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AsyncPaginator[VersionListResponse, AsyncSinglePage[VersionListResponse]]:
+ ) -> AsyncPaginator[Ruleset, AsyncSinglePage[Ruleset]]:
"""
Fetches the versions of an account or zone ruleset.
@@ -295,11 +296,11 @@ def list(
account_or_zone_id = zone_id
return self._get_api_list(
f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/versions",
- page=AsyncSinglePage[VersionListResponse],
+ page=AsyncSinglePage[Ruleset],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- model=VersionListResponse,
+ model=Ruleset,
)
async def delete(
diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py
index 7ea0a3c29d4..befc92cfc81 100644
--- a/src/cloudflare/types/__init__.py
+++ b/src/cloudflare/types/__init__.py
@@ -34,17 +34,26 @@
UnnamedSchemaRefFb1dc8bb871d835b75bd0c2f50bd8572 as UnnamedSchemaRefFb1dc8bb871d835b75bd0c2f50bd8572,
)
from .account import Account as Account
+from .ruleset import Ruleset as Ruleset
from .snippet import Snippet as Snippet
+from .log_rule import LogRule as LogRule
from .calls_app import CallsApp as CallsApp
+from .skip_rule import SkipRule as SkipRule
+from .block_rule import BlockRule as BlockRule
from .membership import Membership as Membership
from .healthcheck import Healthcheck as Healthcheck
from .jdcloud_ips import JDCloudIPs as JDCloudIPs
+from .execute_rule import ExecuteRule as ExecuteRule
+from .request_rule import RequestRule as RequestRule
from .waiting_room import WaitingRoom as WaitingRoom
from .load_balancer import LoadBalancer as LoadBalancer
from .stream_videos import StreamVideos as StreamVideos
from .ip_list_params import IPListParams as IPListParams
+from .log_rule_param import LogRuleParam as LogRuleParam
from .zones_pagerule import ZonesPagerule as ZonesPagerule
from .firewall_filter import FirewallFilter as FirewallFilter
+from .skip_rule_param import SkipRuleParam as SkipRuleParam
+from .block_rule_param import BlockRuleParam as BlockRuleParam
from .ip_list_response import IPListResponse as IPListResponse
from .mtls_certificate import MTLSCertificate as MTLSCertificate
from .user_edit_params import UserEditParams as UserEditParams
@@ -59,10 +68,12 @@
from .client_certificate import ClientCertificate as ClientCertificate
from .custom_certificate import CustomCertificate as CustomCertificate
from .dnssec_edit_params import DNSSECEditParams as DNSSECEditParams
+from .execute_rule_param import ExecuteRuleParam as ExecuteRuleParam
from .filter_list_params import FilterListParams as FilterListParams
from .pcap_create_params import PCAPCreateParams as PCAPCreateParams
from .pcap_list_response import PCAPListResponse as PCAPListResponse
from .queue_get_response import QueueGetResponse as QueueGetResponse
+from .request_rule_param import RequestRuleParam as RequestRuleParam
from .stream_list_params import StreamListParams as StreamListParams
from .zone_create_params import ZoneCreateParams as ZoneCreateParams
from .account_list_params import AccountListParams as AccountListParams
@@ -93,7 +104,6 @@
from .queue_create_response import QueueCreateResponse as QueueCreateResponse
from .queue_update_response import QueueUpdateResponse as QueueUpdateResponse
from .ruleset_create_params import RulesetCreateParams as RulesetCreateParams
-from .ruleset_list_response import RulesetListResponse as RulesetListResponse
from .ruleset_update_params import RulesetUpdateParams as RulesetUpdateParams
from .snippet_update_params import SnippetUpdateParams as SnippetUpdateParams
from .speed_delete_response import SpeedDeleteResponse as SpeedDeleteResponse
diff --git a/src/cloudflare/types/block_rule.py b/src/cloudflare/types/block_rule.py
new file mode 100644
index 00000000000..892d6e2b4f2
--- /dev/null
+++ b/src/cloudflare/types/block_rule.py
@@ -0,0 +1,61 @@
+# 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 .shared import UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
+from .._models import BaseModel
+
+__all__ = ["BlockRule", "ActionParameters", "ActionParametersResponse"]
+
+
+class ActionParametersResponse(BaseModel):
+ content: str
+ """The content to return."""
+
+ content_type: str
+ """The type of the content to return."""
+
+ status_code: int
+ """The status code to return."""
+
+
+class ActionParameters(BaseModel):
+ response: Optional[ActionParametersResponse] = None
+ """The response to show when the block is applied."""
+
+
+class BlockRule(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["block"]] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = 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/block_rule_param.py b/src/cloudflare/types/block_rule_param.py
new file mode 100644
index 00000000000..4aeafe363ae
--- /dev/null
+++ b/src/cloudflare/types/block_rule_param.py
@@ -0,0 +1,51 @@
+# 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 ..types import shared_params
+
+__all__ = ["BlockRuleParam", "ActionParameters", "ActionParametersResponse"]
+
+
+class ActionParametersResponse(TypedDict, total=False):
+ content: Required[str]
+ """The content to return."""
+
+ content_type: Required[str]
+ """The type of the content to return."""
+
+ status_code: Required[int]
+ """The status code to return."""
+
+
+class ActionParameters(TypedDict, total=False):
+ response: ActionParametersResponse
+ """The response to show when the block is applied."""
+
+
+class BlockRuleParam(TypedDict, total=False):
+ id: str
+ """The unique ID of the rule."""
+
+ action: Literal["block"]
+ """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: shared_params.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
+ """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/execute_rule.py b/src/cloudflare/types/execute_rule.py
new file mode 100644
index 00000000000..0ef99597a8f
--- /dev/null
+++ b/src/cloudflare/types/execute_rule.py
@@ -0,0 +1,129 @@
+# 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 .shared import UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
+from .._models import BaseModel
+
+__all__ = [
+ "ExecuteRule",
+ "ActionParameters",
+ "ActionParametersMatchedData",
+ "ActionParametersOverrides",
+ "ActionParametersOverridesCategory",
+ "ActionParametersOverridesRule",
+]
+
+
+class ActionParametersMatchedData(BaseModel):
+ public_key: str
+ """The public key to encrypt matched data logs with."""
+
+
+class ActionParametersOverridesCategory(BaseModel):
+ category: str
+ """The name of the category to override."""
+
+ action: Optional[str] = None
+ """The action to override rules in the category with."""
+
+ enabled: Optional[bool] = None
+ """Whether to enable execution of rules in the category."""
+
+ sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
+ """The sensitivity level to use for rules in the category."""
+
+
+class ActionParametersOverridesRule(BaseModel):
+ id: str
+ """The ID of the rule to override."""
+
+ action: Optional[str] = None
+ """The action to override the rule with."""
+
+ enabled: Optional[bool] = None
+ """Whether to enable execution of the rule."""
+
+ score_threshold: Optional[int] = None
+ """The score threshold to use for the rule."""
+
+ sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
+ """The sensitivity level to use for the rule."""
+
+
+class ActionParametersOverrides(BaseModel):
+ action: Optional[str] = None
+ """An action to override all rules with.
+
+ This option has lower precedence than rule and category overrides.
+ """
+
+ categories: Optional[List[ActionParametersOverridesCategory]] = None
+ """A list of category-level overrides.
+
+ This option has the second-highest precedence after rule-level overrides.
+ """
+
+ enabled: Optional[bool] = None
+ """Whether to enable execution of all rules.
+
+ This option has lower precedence than rule and category overrides.
+ """
+
+ rules: Optional[List[ActionParametersOverridesRule]] = None
+ """A list of rule-level overrides. This option has the highest precedence."""
+
+ sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
+ """A sensitivity level to set for all rules.
+
+ This option has lower precedence than rule and category overrides and is only
+ applicable for DDoS phases.
+ """
+
+
+class ActionParameters(BaseModel):
+ id: str
+ """The ID of the ruleset to execute."""
+
+ matched_data: Optional[ActionParametersMatchedData] = None
+ """The configuration to use for matched data logging."""
+
+ overrides: Optional[ActionParametersOverrides] = None
+ """A set of overrides to apply to the target ruleset."""
+
+
+class ExecuteRule(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["execute"]] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = 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/execute_rule_param.py b/src/cloudflare/types/execute_rule_param.py
new file mode 100644
index 00000000000..fa4d5b253dc
--- /dev/null
+++ b/src/cloudflare/types/execute_rule_param.py
@@ -0,0 +1,120 @@
+# 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, Required, TypedDict
+
+from ..types import shared_params
+
+__all__ = [
+ "ExecuteRuleParam",
+ "ActionParameters",
+ "ActionParametersMatchedData",
+ "ActionParametersOverrides",
+ "ActionParametersOverridesCategory",
+ "ActionParametersOverridesRule",
+]
+
+
+class ActionParametersMatchedData(TypedDict, total=False):
+ public_key: Required[str]
+ """The public key to encrypt matched data logs with."""
+
+
+class ActionParametersOverridesCategory(TypedDict, total=False):
+ category: Required[str]
+ """The name of the category to override."""
+
+ action: str
+ """The action to override rules in the category with."""
+
+ enabled: bool
+ """Whether to enable execution of rules in the category."""
+
+ sensitivity_level: Literal["default", "medium", "low", "eoff"]
+ """The sensitivity level to use for rules in the category."""
+
+
+class ActionParametersOverridesRule(TypedDict, total=False):
+ id: Required[str]
+ """The ID of the rule to override."""
+
+ action: str
+ """The action to override the rule with."""
+
+ enabled: bool
+ """Whether to enable execution of the rule."""
+
+ score_threshold: int
+ """The score threshold to use for the rule."""
+
+ sensitivity_level: Literal["default", "medium", "low", "eoff"]
+ """The sensitivity level to use for the rule."""
+
+
+class ActionParametersOverrides(TypedDict, total=False):
+ action: str
+ """An action to override all rules with.
+
+ This option has lower precedence than rule and category overrides.
+ """
+
+ categories: Iterable[ActionParametersOverridesCategory]
+ """A list of category-level overrides.
+
+ This option has the second-highest precedence after rule-level overrides.
+ """
+
+ enabled: bool
+ """Whether to enable execution of all rules.
+
+ This option has lower precedence than rule and category overrides.
+ """
+
+ rules: Iterable[ActionParametersOverridesRule]
+ """A list of rule-level overrides. This option has the highest precedence."""
+
+ sensitivity_level: Literal["default", "medium", "low", "eoff"]
+ """A sensitivity level to set for all rules.
+
+ This option has lower precedence than rule and category overrides and is only
+ applicable for DDoS phases.
+ """
+
+
+class ActionParameters(TypedDict, total=False):
+ id: Required[str]
+ """The ID of the ruleset to execute."""
+
+ matched_data: ActionParametersMatchedData
+ """The configuration to use for matched data logging."""
+
+ overrides: ActionParametersOverrides
+ """A set of overrides to apply to the target ruleset."""
+
+
+class ExecuteRuleParam(TypedDict, total=False):
+ id: str
+ """The unique ID of the rule."""
+
+ action: Literal["execute"]
+ """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: shared_params.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
+ """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/log_rule.py b/src/cloudflare/types/log_rule.py
new file mode 100644
index 00000000000..b9a76d3dbba
--- /dev/null
+++ b/src/cloudflare/types/log_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 .shared import UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
+from .._models import BaseModel
+
+__all__ = ["LogRule"]
+
+
+class LogRule(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["log"]] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = 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/log_rule_param.py b/src/cloudflare/types/log_rule_param.py
new file mode 100644
index 00000000000..344e1b35a81
--- /dev/null
+++ b/src/cloudflare/types/log_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 ..types import shared_params
+
+__all__ = ["LogRuleParam"]
+
+
+class LogRuleParam(TypedDict, total=False):
+ id: str
+ """The unique ID of the rule."""
+
+ action: Literal["log"]
+ """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: shared_params.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
+ """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/request_rule.py b/src/cloudflare/types/request_rule.py
new file mode 100644
index 00000000000..a71cd7d6034
--- /dev/null
+++ b/src/cloudflare/types/request_rule.py
@@ -0,0 +1,12 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Union
+
+from .log_rule import LogRule
+from .skip_rule import SkipRule
+from .block_rule import BlockRule
+from .execute_rule import ExecuteRule
+
+__all__ = ["RequestRule"]
+
+RequestRule = Union[BlockRule, ExecuteRule, LogRule, SkipRule]
diff --git a/src/cloudflare/types/request_rule_param.py b/src/cloudflare/types/request_rule_param.py
new file mode 100644
index 00000000000..709767e34b6
--- /dev/null
+++ b/src/cloudflare/types/request_rule_param.py
@@ -0,0 +1,14 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Union
+
+from .log_rule_param import LogRuleParam
+from .skip_rule_param import SkipRuleParam
+from .block_rule_param import BlockRuleParam
+from .execute_rule_param import ExecuteRuleParam
+
+__all__ = ["RequestRuleParam"]
+
+RequestRuleParam = Union[BlockRuleParam, ExecuteRuleParam, LogRuleParam, SkipRuleParam]
diff --git a/src/cloudflare/types/ruleset.py b/src/cloudflare/types/ruleset.py
new file mode 100644
index 00000000000..57a0a6765be
--- /dev/null
+++ b/src/cloudflare/types/ruleset.py
@@ -0,0 +1,58 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = ["Ruleset"]
+
+
+class Ruleset(BaseModel):
+ id: str
+ """The unique ID of the ruleset."""
+
+ last_updated: datetime
+ """The timestamp of when the ruleset was last modified."""
+
+ version: str
+ """The version of the ruleset."""
+
+ description: Optional[str] = None
+ """An informative description of the ruleset."""
+
+ kind: Optional[Literal["managed", "custom", "root", "zone"]] = None
+ """The kind of the ruleset."""
+
+ name: Optional[str] = None
+ """The human-readable name of the ruleset."""
+
+ phase: Optional[
+ Literal[
+ "ddos_l4",
+ "ddos_l7",
+ "http_config_settings",
+ "http_custom_errors",
+ "http_log_custom_fields",
+ "http_ratelimit",
+ "http_request_cache_settings",
+ "http_request_dynamic_redirect",
+ "http_request_firewall_custom",
+ "http_request_firewall_managed",
+ "http_request_late_transform",
+ "http_request_origin",
+ "http_request_redirect",
+ "http_request_sanitize",
+ "http_request_sbfm",
+ "http_request_select_configuration",
+ "http_request_transform",
+ "http_response_compression",
+ "http_response_firewall_managed",
+ "http_response_headers_transform",
+ "magic_transit",
+ "magic_transit_ids_managed",
+ "magic_transit_managed",
+ ]
+ ] = None
+ """The phase of the ruleset."""
diff --git a/src/cloudflare/types/ruleset_create_params.py b/src/cloudflare/types/ruleset_create_params.py
index cea7f724ade..27128c076da 100644
--- a/src/cloudflare/types/ruleset_create_params.py
+++ b/src/cloudflare/types/ruleset_create_params.py
@@ -2,27 +2,12 @@
from __future__ import annotations
-from typing import Dict, List, Union, Iterable
+from typing import Iterable
from typing_extensions import Literal, Required, TypedDict
-from ..types import shared_params
+from .request_rule_param import RequestRuleParam
-__all__ = [
- "RulesetCreateParams",
- "Rule",
- "RuleRulesetsBlockRule",
- "RuleRulesetsBlockRuleActionParameters",
- "RuleRulesetsBlockRuleActionParametersResponse",
- "RuleRulesetsExecuteRule",
- "RuleRulesetsExecuteRuleActionParameters",
- "RuleRulesetsExecuteRuleActionParametersMatchedData",
- "RuleRulesetsExecuteRuleActionParametersOverrides",
- "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
- "RuleRulesetsExecuteRuleActionParametersOverridesRule",
- "RuleRulesetsLogRule",
- "RuleRulesetsSkipRule",
- "RuleRulesetsSkipRuleActionParameters",
-]
+__all__ = ["RulesetCreateParams"]
class RulesetCreateParams(TypedDict, total=False):
@@ -61,7 +46,7 @@ class RulesetCreateParams(TypedDict, total=False):
]
"""The phase of the ruleset."""
- rules: Required[Iterable[Rule]]
+ rules: Required[Iterable[RequestRuleParam]]
"""The list of rules in the ruleset."""
account_id: str
@@ -72,258 +57,3 @@ class RulesetCreateParams(TypedDict, total=False):
description: str
"""An informative description of the ruleset."""
-
-
-class RuleRulesetsBlockRuleActionParametersResponse(TypedDict, total=False):
- content: Required[str]
- """The content to return."""
-
- content_type: Required[str]
- """The type of the content to return."""
-
- status_code: Required[int]
- """The status code to return."""
-
-
-class RuleRulesetsBlockRuleActionParameters(TypedDict, total=False):
- response: RuleRulesetsBlockRuleActionParametersResponse
- """The response to show when the block is applied."""
-
-
-class RuleRulesetsBlockRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["block"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsBlockRuleActionParameters
- """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: shared_params.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsExecuteRuleActionParametersMatchedData(TypedDict, total=False):
- public_key: Required[str]
- """The public key to encrypt matched data logs with."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesCategory(TypedDict, total=False):
- category: Required[str]
- """The name of the category to override."""
-
- action: str
- """The action to override rules in the category with."""
-
- enabled: bool
- """Whether to enable execution of rules in the category."""
-
- sensitivity_level: Literal["default", "medium", "low", "eoff"]
- """The sensitivity level to use for rules in the category."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesRule(TypedDict, total=False):
- id: Required[str]
- """The ID of the rule to override."""
-
- action: str
- """The action to override the rule with."""
-
- enabled: bool
- """Whether to enable execution of the rule."""
-
- score_threshold: int
- """The score threshold to use for the rule."""
-
- sensitivity_level: Literal["default", "medium", "low", "eoff"]
- """The sensitivity level to use for the rule."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False):
- action: str
- """An action to override all rules with.
-
- This option has lower precedence than rule and category overrides.
- """
-
- categories: Iterable[RuleRulesetsExecuteRuleActionParametersOverridesCategory]
- """A list of category-level overrides.
-
- This option has the second-highest precedence after rule-level overrides.
- """
-
- enabled: bool
- """Whether to enable execution of all rules.
-
- This option has lower precedence than rule and category overrides.
- """
-
- rules: Iterable[RuleRulesetsExecuteRuleActionParametersOverridesRule]
- """A list of rule-level overrides. This option has the highest precedence."""
-
- sensitivity_level: Literal["default", "medium", "low", "eoff"]
- """A sensitivity level to set for all rules.
-
- This option has lower precedence than rule and category overrides and is only
- applicable for DDoS phases.
- """
-
-
-class RuleRulesetsExecuteRuleActionParameters(TypedDict, total=False):
- id: Required[str]
- """The ID of the ruleset to execute."""
-
- matched_data: RuleRulesetsExecuteRuleActionParametersMatchedData
- """The configuration to use for matched data logging."""
-
- overrides: RuleRulesetsExecuteRuleActionParametersOverrides
- """A set of overrides to apply to the target ruleset."""
-
-
-class RuleRulesetsExecuteRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["execute"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsExecuteRuleActionParameters
- """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: shared_params.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsLogRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["log"]
- """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: shared_params.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSkipRuleActionParameters(TypedDict, total=False):
- phases: List[
- Literal[
- "ddos_l4",
- "ddos_l7",
- "http_config_settings",
- "http_custom_errors",
- "http_log_custom_fields",
- "http_ratelimit",
- "http_request_cache_settings",
- "http_request_dynamic_redirect",
- "http_request_firewall_custom",
- "http_request_firewall_managed",
- "http_request_late_transform",
- "http_request_origin",
- "http_request_redirect",
- "http_request_sanitize",
- "http_request_sbfm",
- "http_request_select_configuration",
- "http_request_transform",
- "http_response_compression",
- "http_response_firewall_managed",
- "http_response_headers_transform",
- "magic_transit",
- "magic_transit_ids_managed",
- "magic_transit_managed",
- ]
- ]
- """A list of phases to skip the execution of.
-
- This option is incompatible with the ruleset and rulesets options.
- """
-
- products: List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]]
- """A list of legacy security products to skip the execution of."""
-
- rules: Dict[str, List[str]]
- """
- A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the
- execution of. This option is incompatible with the ruleset option.
- """
-
- ruleset: Literal["current"]
- """A ruleset to skip the execution of.
-
- This option is incompatible with the rulesets, rules and phases options.
- """
-
- rulesets: List[str]
- """A list of ruleset IDs to skip the execution of.
-
- This option is incompatible with the ruleset and phases options.
- """
-
-
-class RuleRulesetsSkipRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["skip"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsSkipRuleActionParameters
- """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: shared_params.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule]
diff --git a/src/cloudflare/types/ruleset_create_response.py b/src/cloudflare/types/ruleset_create_response.py
index 45c02ec1b65..ec9b42b31f6 100644
--- a/src/cloudflare/types/ruleset_create_response.py
+++ b/src/cloudflare/types/ruleset_create_response.py
@@ -1,323 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal
-from .shared import UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
from .._models import BaseModel
+from .request_rule import RequestRule
-__all__ = [
- "RulesetCreateResponse",
- "Rule",
- "RuleRulesetsBlockRule",
- "RuleRulesetsBlockRuleActionParameters",
- "RuleRulesetsBlockRuleActionParametersResponse",
- "RuleRulesetsExecuteRule",
- "RuleRulesetsExecuteRuleActionParameters",
- "RuleRulesetsExecuteRuleActionParametersMatchedData",
- "RuleRulesetsExecuteRuleActionParametersOverrides",
- "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
- "RuleRulesetsExecuteRuleActionParametersOverridesRule",
- "RuleRulesetsLogRule",
- "RuleRulesetsSkipRule",
- "RuleRulesetsSkipRuleActionParameters",
-]
-
-
-class RuleRulesetsBlockRuleActionParametersResponse(BaseModel):
- content: str
- """The content to return."""
-
- content_type: str
- """The type of the content to return."""
-
- status_code: int
- """The status code to return."""
-
-
-class RuleRulesetsBlockRuleActionParameters(BaseModel):
- response: Optional[RuleRulesetsBlockRuleActionParametersResponse] = None
- """The response to show when the block is applied."""
-
-
-class RuleRulesetsBlockRule(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["block"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsBlockRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsExecuteRuleActionParametersMatchedData(BaseModel):
- public_key: str
- """The public key to encrypt matched data logs with."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesCategory(BaseModel):
- category: str
- """The name of the category to override."""
-
- action: Optional[str] = None
- """The action to override rules in the category with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of rules in the category."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for rules in the category."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesRule(BaseModel):
- id: str
- """The ID of the rule to override."""
-
- action: Optional[str] = None
- """The action to override the rule with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of the rule."""
-
- score_threshold: Optional[int] = None
- """The score threshold to use for the rule."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for the rule."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverrides(BaseModel):
- action: Optional[str] = None
- """An action to override all rules with.
-
- This option has lower precedence than rule and category overrides.
- """
-
- categories: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesCategory]] = None
- """A list of category-level overrides.
-
- This option has the second-highest precedence after rule-level overrides.
- """
-
- enabled: Optional[bool] = None
- """Whether to enable execution of all rules.
-
- This option has lower precedence than rule and category overrides.
- """
-
- rules: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesRule]] = None
- """A list of rule-level overrides. This option has the highest precedence."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """A sensitivity level to set for all rules.
-
- This option has lower precedence than rule and category overrides and is only
- applicable for DDoS phases.
- """
-
-
-class RuleRulesetsExecuteRuleActionParameters(BaseModel):
- id: str
- """The ID of the ruleset to execute."""
-
- matched_data: Optional[RuleRulesetsExecuteRuleActionParametersMatchedData] = None
- """The configuration to use for matched data logging."""
-
- overrides: Optional[RuleRulesetsExecuteRuleActionParametersOverrides] = None
- """A set of overrides to apply to the target ruleset."""
-
-
-class RuleRulesetsExecuteRule(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["execute"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsExecuteRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsLogRule(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["log"]] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSkipRuleActionParameters(BaseModel):
- phases: Optional[
- List[
- Literal[
- "ddos_l4",
- "ddos_l7",
- "http_config_settings",
- "http_custom_errors",
- "http_log_custom_fields",
- "http_ratelimit",
- "http_request_cache_settings",
- "http_request_dynamic_redirect",
- "http_request_firewall_custom",
- "http_request_firewall_managed",
- "http_request_late_transform",
- "http_request_origin",
- "http_request_redirect",
- "http_request_sanitize",
- "http_request_sbfm",
- "http_request_select_configuration",
- "http_request_transform",
- "http_response_compression",
- "http_response_firewall_managed",
- "http_response_headers_transform",
- "magic_transit",
- "magic_transit_ids_managed",
- "magic_transit_managed",
- ]
- ]
- ] = None
- """A list of phases to skip the execution of.
-
- This option is incompatible with the ruleset and rulesets options.
- """
-
- products: Optional[
- List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]]
- ] = None
- """A list of legacy security products to skip the execution of."""
-
- rules: Optional[Dict[str, List[str]]] = None
- """
- A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the
- execution of. This option is incompatible with the ruleset option.
- """
-
- ruleset: Optional[Literal["current"]] = None
- """A ruleset to skip the execution of.
-
- This option is incompatible with the rulesets, rules and phases options.
- """
-
- rulesets: Optional[List[str]] = None
- """A list of ruleset IDs to skip the execution of.
-
- This option is incompatible with the ruleset and phases options.
- """
-
-
-class RuleRulesetsSkipRule(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["skip"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSkipRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule]
+__all__ = ["RulesetCreateResponse"]
class RulesetCreateResponse(BaseModel):
@@ -360,7 +50,7 @@ class RulesetCreateResponse(BaseModel):
]
"""The phase of the ruleset."""
- rules: List[Rule]
+ rules: List[RequestRule]
"""The list of rules in the ruleset."""
version: str
diff --git a/src/cloudflare/types/ruleset_get_response.py b/src/cloudflare/types/ruleset_get_response.py
index 8dd2e94525e..da086d15e8b 100644
--- a/src/cloudflare/types/ruleset_get_response.py
+++ b/src/cloudflare/types/ruleset_get_response.py
@@ -1,323 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal
-from .shared import UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
from .._models import BaseModel
+from .request_rule import RequestRule
-__all__ = [
- "RulesetGetResponse",
- "Rule",
- "RuleRulesetsBlockRule",
- "RuleRulesetsBlockRuleActionParameters",
- "RuleRulesetsBlockRuleActionParametersResponse",
- "RuleRulesetsExecuteRule",
- "RuleRulesetsExecuteRuleActionParameters",
- "RuleRulesetsExecuteRuleActionParametersMatchedData",
- "RuleRulesetsExecuteRuleActionParametersOverrides",
- "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
- "RuleRulesetsExecuteRuleActionParametersOverridesRule",
- "RuleRulesetsLogRule",
- "RuleRulesetsSkipRule",
- "RuleRulesetsSkipRuleActionParameters",
-]
-
-
-class RuleRulesetsBlockRuleActionParametersResponse(BaseModel):
- content: str
- """The content to return."""
-
- content_type: str
- """The type of the content to return."""
-
- status_code: int
- """The status code to return."""
-
-
-class RuleRulesetsBlockRuleActionParameters(BaseModel):
- response: Optional[RuleRulesetsBlockRuleActionParametersResponse] = None
- """The response to show when the block is applied."""
-
-
-class RuleRulesetsBlockRule(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["block"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsBlockRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsExecuteRuleActionParametersMatchedData(BaseModel):
- public_key: str
- """The public key to encrypt matched data logs with."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesCategory(BaseModel):
- category: str
- """The name of the category to override."""
-
- action: Optional[str] = None
- """The action to override rules in the category with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of rules in the category."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for rules in the category."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesRule(BaseModel):
- id: str
- """The ID of the rule to override."""
-
- action: Optional[str] = None
- """The action to override the rule with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of the rule."""
-
- score_threshold: Optional[int] = None
- """The score threshold to use for the rule."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for the rule."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverrides(BaseModel):
- action: Optional[str] = None
- """An action to override all rules with.
-
- This option has lower precedence than rule and category overrides.
- """
-
- categories: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesCategory]] = None
- """A list of category-level overrides.
-
- This option has the second-highest precedence after rule-level overrides.
- """
-
- enabled: Optional[bool] = None
- """Whether to enable execution of all rules.
-
- This option has lower precedence than rule and category overrides.
- """
-
- rules: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesRule]] = None
- """A list of rule-level overrides. This option has the highest precedence."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """A sensitivity level to set for all rules.
-
- This option has lower precedence than rule and category overrides and is only
- applicable for DDoS phases.
- """
-
-
-class RuleRulesetsExecuteRuleActionParameters(BaseModel):
- id: str
- """The ID of the ruleset to execute."""
-
- matched_data: Optional[RuleRulesetsExecuteRuleActionParametersMatchedData] = None
- """The configuration to use for matched data logging."""
-
- overrides: Optional[RuleRulesetsExecuteRuleActionParametersOverrides] = None
- """A set of overrides to apply to the target ruleset."""
-
-
-class RuleRulesetsExecuteRule(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["execute"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsExecuteRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsLogRule(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["log"]] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSkipRuleActionParameters(BaseModel):
- phases: Optional[
- List[
- Literal[
- "ddos_l4",
- "ddos_l7",
- "http_config_settings",
- "http_custom_errors",
- "http_log_custom_fields",
- "http_ratelimit",
- "http_request_cache_settings",
- "http_request_dynamic_redirect",
- "http_request_firewall_custom",
- "http_request_firewall_managed",
- "http_request_late_transform",
- "http_request_origin",
- "http_request_redirect",
- "http_request_sanitize",
- "http_request_sbfm",
- "http_request_select_configuration",
- "http_request_transform",
- "http_response_compression",
- "http_response_firewall_managed",
- "http_response_headers_transform",
- "magic_transit",
- "magic_transit_ids_managed",
- "magic_transit_managed",
- ]
- ]
- ] = None
- """A list of phases to skip the execution of.
-
- This option is incompatible with the ruleset and rulesets options.
- """
-
- products: Optional[
- List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]]
- ] = None
- """A list of legacy security products to skip the execution of."""
-
- rules: Optional[Dict[str, List[str]]] = None
- """
- A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the
- execution of. This option is incompatible with the ruleset option.
- """
-
- ruleset: Optional[Literal["current"]] = None
- """A ruleset to skip the execution of.
-
- This option is incompatible with the rulesets, rules and phases options.
- """
-
- rulesets: Optional[List[str]] = None
- """A list of ruleset IDs to skip the execution of.
-
- This option is incompatible with the ruleset and phases options.
- """
-
-
-class RuleRulesetsSkipRule(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["skip"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSkipRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule]
+__all__ = ["RulesetGetResponse"]
class RulesetGetResponse(BaseModel):
@@ -360,7 +50,7 @@ class RulesetGetResponse(BaseModel):
]
"""The phase of the ruleset."""
- rules: List[Rule]
+ rules: List[RequestRule]
"""The list of rules in the ruleset."""
version: str
diff --git a/src/cloudflare/types/ruleset_list_response.py b/src/cloudflare/types/ruleset_list_response.py
deleted file mode 100644
index ef7fb89731e..00000000000
--- a/src/cloudflare/types/ruleset_list_response.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Optional
-from datetime import datetime
-from typing_extensions import Literal
-
-from .._models import BaseModel
-
-__all__ = ["RulesetListResponse"]
-
-
-class RulesetListResponse(BaseModel):
- kind: Literal["managed", "custom", "root", "zone"]
- """The kind of the ruleset."""
-
- name: str
- """The human-readable name of the ruleset."""
-
- phase: Literal[
- "ddos_l4",
- "ddos_l7",
- "http_config_settings",
- "http_custom_errors",
- "http_log_custom_fields",
- "http_ratelimit",
- "http_request_cache_settings",
- "http_request_dynamic_redirect",
- "http_request_firewall_custom",
- "http_request_firewall_managed",
- "http_request_late_transform",
- "http_request_origin",
- "http_request_redirect",
- "http_request_sanitize",
- "http_request_sbfm",
- "http_request_select_configuration",
- "http_request_transform",
- "http_response_compression",
- "http_response_firewall_managed",
- "http_response_headers_transform",
- "magic_transit",
- "magic_transit_ids_managed",
- "magic_transit_managed",
- ]
- """The phase of the ruleset."""
-
- id: Optional[str] = None
- """The unique ID of the ruleset."""
-
- description: Optional[str] = None
- """An informative description of the ruleset."""
-
- last_updated: Optional[datetime] = None
- """The timestamp of when the ruleset was last modified."""
-
- version: Optional[str] = None
- """The version of the ruleset."""
diff --git a/src/cloudflare/types/ruleset_update_params.py b/src/cloudflare/types/ruleset_update_params.py
index 5a623bd2b84..1c0d34cd3e2 100644
--- a/src/cloudflare/types/ruleset_update_params.py
+++ b/src/cloudflare/types/ruleset_update_params.py
@@ -2,31 +2,16 @@
from __future__ import annotations
-from typing import Dict, List, Union, Iterable
+from typing import Iterable
from typing_extensions import Literal, Required, TypedDict
-from ..types import shared_params
+from .request_rule_param import RequestRuleParam
-__all__ = [
- "RulesetUpdateParams",
- "Rule",
- "RuleRulesetsBlockRule",
- "RuleRulesetsBlockRuleActionParameters",
- "RuleRulesetsBlockRuleActionParametersResponse",
- "RuleRulesetsExecuteRule",
- "RuleRulesetsExecuteRuleActionParameters",
- "RuleRulesetsExecuteRuleActionParametersMatchedData",
- "RuleRulesetsExecuteRuleActionParametersOverrides",
- "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
- "RuleRulesetsExecuteRuleActionParametersOverridesRule",
- "RuleRulesetsLogRule",
- "RuleRulesetsSkipRule",
- "RuleRulesetsSkipRuleActionParameters",
-]
+__all__ = ["RulesetUpdateParams"]
class RulesetUpdateParams(TypedDict, total=False):
- rules: Required[Iterable[Rule]]
+ rules: Required[Iterable[RequestRuleParam]]
"""The list of rules in the ruleset."""
account_id: str
@@ -70,258 +55,3 @@ class RulesetUpdateParams(TypedDict, total=False):
"magic_transit_managed",
]
"""The phase of the ruleset."""
-
-
-class RuleRulesetsBlockRuleActionParametersResponse(TypedDict, total=False):
- content: Required[str]
- """The content to return."""
-
- content_type: Required[str]
- """The type of the content to return."""
-
- status_code: Required[int]
- """The status code to return."""
-
-
-class RuleRulesetsBlockRuleActionParameters(TypedDict, total=False):
- response: RuleRulesetsBlockRuleActionParametersResponse
- """The response to show when the block is applied."""
-
-
-class RuleRulesetsBlockRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["block"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsBlockRuleActionParameters
- """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: shared_params.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsExecuteRuleActionParametersMatchedData(TypedDict, total=False):
- public_key: Required[str]
- """The public key to encrypt matched data logs with."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesCategory(TypedDict, total=False):
- category: Required[str]
- """The name of the category to override."""
-
- action: str
- """The action to override rules in the category with."""
-
- enabled: bool
- """Whether to enable execution of rules in the category."""
-
- sensitivity_level: Literal["default", "medium", "low", "eoff"]
- """The sensitivity level to use for rules in the category."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesRule(TypedDict, total=False):
- id: Required[str]
- """The ID of the rule to override."""
-
- action: str
- """The action to override the rule with."""
-
- enabled: bool
- """Whether to enable execution of the rule."""
-
- score_threshold: int
- """The score threshold to use for the rule."""
-
- sensitivity_level: Literal["default", "medium", "low", "eoff"]
- """The sensitivity level to use for the rule."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False):
- action: str
- """An action to override all rules with.
-
- This option has lower precedence than rule and category overrides.
- """
-
- categories: Iterable[RuleRulesetsExecuteRuleActionParametersOverridesCategory]
- """A list of category-level overrides.
-
- This option has the second-highest precedence after rule-level overrides.
- """
-
- enabled: bool
- """Whether to enable execution of all rules.
-
- This option has lower precedence than rule and category overrides.
- """
-
- rules: Iterable[RuleRulesetsExecuteRuleActionParametersOverridesRule]
- """A list of rule-level overrides. This option has the highest precedence."""
-
- sensitivity_level: Literal["default", "medium", "low", "eoff"]
- """A sensitivity level to set for all rules.
-
- This option has lower precedence than rule and category overrides and is only
- applicable for DDoS phases.
- """
-
-
-class RuleRulesetsExecuteRuleActionParameters(TypedDict, total=False):
- id: Required[str]
- """The ID of the ruleset to execute."""
-
- matched_data: RuleRulesetsExecuteRuleActionParametersMatchedData
- """The configuration to use for matched data logging."""
-
- overrides: RuleRulesetsExecuteRuleActionParametersOverrides
- """A set of overrides to apply to the target ruleset."""
-
-
-class RuleRulesetsExecuteRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["execute"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsExecuteRuleActionParameters
- """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: shared_params.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsLogRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["log"]
- """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: shared_params.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSkipRuleActionParameters(TypedDict, total=False):
- phases: List[
- Literal[
- "ddos_l4",
- "ddos_l7",
- "http_config_settings",
- "http_custom_errors",
- "http_log_custom_fields",
- "http_ratelimit",
- "http_request_cache_settings",
- "http_request_dynamic_redirect",
- "http_request_firewall_custom",
- "http_request_firewall_managed",
- "http_request_late_transform",
- "http_request_origin",
- "http_request_redirect",
- "http_request_sanitize",
- "http_request_sbfm",
- "http_request_select_configuration",
- "http_request_transform",
- "http_response_compression",
- "http_response_firewall_managed",
- "http_response_headers_transform",
- "magic_transit",
- "magic_transit_ids_managed",
- "magic_transit_managed",
- ]
- ]
- """A list of phases to skip the execution of.
-
- This option is incompatible with the ruleset and rulesets options.
- """
-
- products: List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]]
- """A list of legacy security products to skip the execution of."""
-
- rules: Dict[str, List[str]]
- """
- A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the
- execution of. This option is incompatible with the ruleset option.
- """
-
- ruleset: Literal["current"]
- """A ruleset to skip the execution of.
-
- This option is incompatible with the rulesets, rules and phases options.
- """
-
- rulesets: List[str]
- """A list of ruleset IDs to skip the execution of.
-
- This option is incompatible with the ruleset and phases options.
- """
-
-
-class RuleRulesetsSkipRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["skip"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsSkipRuleActionParameters
- """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: shared_params.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule]
diff --git a/src/cloudflare/types/ruleset_update_response.py b/src/cloudflare/types/ruleset_update_response.py
index e81480c5118..3ea7e8ca5a2 100644
--- a/src/cloudflare/types/ruleset_update_response.py
+++ b/src/cloudflare/types/ruleset_update_response.py
@@ -1,323 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal
-from .shared import UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
from .._models import BaseModel
+from .request_rule import RequestRule
-__all__ = [
- "RulesetUpdateResponse",
- "Rule",
- "RuleRulesetsBlockRule",
- "RuleRulesetsBlockRuleActionParameters",
- "RuleRulesetsBlockRuleActionParametersResponse",
- "RuleRulesetsExecuteRule",
- "RuleRulesetsExecuteRuleActionParameters",
- "RuleRulesetsExecuteRuleActionParametersMatchedData",
- "RuleRulesetsExecuteRuleActionParametersOverrides",
- "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
- "RuleRulesetsExecuteRuleActionParametersOverridesRule",
- "RuleRulesetsLogRule",
- "RuleRulesetsSkipRule",
- "RuleRulesetsSkipRuleActionParameters",
-]
-
-
-class RuleRulesetsBlockRuleActionParametersResponse(BaseModel):
- content: str
- """The content to return."""
-
- content_type: str
- """The type of the content to return."""
-
- status_code: int
- """The status code to return."""
-
-
-class RuleRulesetsBlockRuleActionParameters(BaseModel):
- response: Optional[RuleRulesetsBlockRuleActionParametersResponse] = None
- """The response to show when the block is applied."""
-
-
-class RuleRulesetsBlockRule(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["block"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsBlockRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsExecuteRuleActionParametersMatchedData(BaseModel):
- public_key: str
- """The public key to encrypt matched data logs with."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesCategory(BaseModel):
- category: str
- """The name of the category to override."""
-
- action: Optional[str] = None
- """The action to override rules in the category with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of rules in the category."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for rules in the category."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesRule(BaseModel):
- id: str
- """The ID of the rule to override."""
-
- action: Optional[str] = None
- """The action to override the rule with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of the rule."""
-
- score_threshold: Optional[int] = None
- """The score threshold to use for the rule."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for the rule."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverrides(BaseModel):
- action: Optional[str] = None
- """An action to override all rules with.
-
- This option has lower precedence than rule and category overrides.
- """
-
- categories: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesCategory]] = None
- """A list of category-level overrides.
-
- This option has the second-highest precedence after rule-level overrides.
- """
-
- enabled: Optional[bool] = None
- """Whether to enable execution of all rules.
-
- This option has lower precedence than rule and category overrides.
- """
-
- rules: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesRule]] = None
- """A list of rule-level overrides. This option has the highest precedence."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """A sensitivity level to set for all rules.
-
- This option has lower precedence than rule and category overrides and is only
- applicable for DDoS phases.
- """
-
-
-class RuleRulesetsExecuteRuleActionParameters(BaseModel):
- id: str
- """The ID of the ruleset to execute."""
-
- matched_data: Optional[RuleRulesetsExecuteRuleActionParametersMatchedData] = None
- """The configuration to use for matched data logging."""
-
- overrides: Optional[RuleRulesetsExecuteRuleActionParametersOverrides] = None
- """A set of overrides to apply to the target ruleset."""
-
-
-class RuleRulesetsExecuteRule(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["execute"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsExecuteRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsLogRule(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["log"]] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSkipRuleActionParameters(BaseModel):
- phases: Optional[
- List[
- Literal[
- "ddos_l4",
- "ddos_l7",
- "http_config_settings",
- "http_custom_errors",
- "http_log_custom_fields",
- "http_ratelimit",
- "http_request_cache_settings",
- "http_request_dynamic_redirect",
- "http_request_firewall_custom",
- "http_request_firewall_managed",
- "http_request_late_transform",
- "http_request_origin",
- "http_request_redirect",
- "http_request_sanitize",
- "http_request_sbfm",
- "http_request_select_configuration",
- "http_request_transform",
- "http_response_compression",
- "http_response_firewall_managed",
- "http_response_headers_transform",
- "magic_transit",
- "magic_transit_ids_managed",
- "magic_transit_managed",
- ]
- ]
- ] = None
- """A list of phases to skip the execution of.
-
- This option is incompatible with the ruleset and rulesets options.
- """
-
- products: Optional[
- List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]]
- ] = None
- """A list of legacy security products to skip the execution of."""
-
- rules: Optional[Dict[str, List[str]]] = None
- """
- A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the
- execution of. This option is incompatible with the ruleset option.
- """
-
- ruleset: Optional[Literal["current"]] = None
- """A ruleset to skip the execution of.
-
- This option is incompatible with the rulesets, rules and phases options.
- """
-
- rulesets: Optional[List[str]] = None
- """A list of ruleset IDs to skip the execution of.
-
- This option is incompatible with the ruleset and phases options.
- """
-
-
-class RuleRulesetsSkipRule(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["skip"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSkipRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule]
+__all__ = ["RulesetUpdateResponse"]
class RulesetUpdateResponse(BaseModel):
@@ -360,7 +50,7 @@ class RulesetUpdateResponse(BaseModel):
]
"""The phase of the ruleset."""
- rules: List[Rule]
+ rules: List[RequestRule]
"""The list of rules in the ruleset."""
version: str
diff --git a/src/cloudflare/types/rulesets/__init__.py b/src/cloudflare/types/rulesets/__init__.py
index 9f2e2de00d3..49da167570f 100644
--- a/src/cloudflare/types/rulesets/__init__.py
+++ b/src/cloudflare/types/rulesets/__init__.py
@@ -11,4 +11,3 @@
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 .version_list_response import VersionListResponse as VersionListResponse
diff --git a/src/cloudflare/types/rulesets/phase_get_response.py b/src/cloudflare/types/rulesets/phase_get_response.py
index cf88a2b387a..b738b3189b0 100644
--- a/src/cloudflare/types/rulesets/phase_get_response.py
+++ b/src/cloudflare/types/rulesets/phase_get_response.py
@@ -1,323 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal
-from ..shared import UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
from ..._models import BaseModel
+from ..request_rule import RequestRule
-__all__ = [
- "PhaseGetResponse",
- "Rule",
- "RuleRulesetsBlockRule",
- "RuleRulesetsBlockRuleActionParameters",
- "RuleRulesetsBlockRuleActionParametersResponse",
- "RuleRulesetsExecuteRule",
- "RuleRulesetsExecuteRuleActionParameters",
- "RuleRulesetsExecuteRuleActionParametersMatchedData",
- "RuleRulesetsExecuteRuleActionParametersOverrides",
- "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
- "RuleRulesetsExecuteRuleActionParametersOverridesRule",
- "RuleRulesetsLogRule",
- "RuleRulesetsSkipRule",
- "RuleRulesetsSkipRuleActionParameters",
-]
-
-
-class RuleRulesetsBlockRuleActionParametersResponse(BaseModel):
- content: str
- """The content to return."""
-
- content_type: str
- """The type of the content to return."""
-
- status_code: int
- """The status code to return."""
-
-
-class RuleRulesetsBlockRuleActionParameters(BaseModel):
- response: Optional[RuleRulesetsBlockRuleActionParametersResponse] = None
- """The response to show when the block is applied."""
-
-
-class RuleRulesetsBlockRule(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["block"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsBlockRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsExecuteRuleActionParametersMatchedData(BaseModel):
- public_key: str
- """The public key to encrypt matched data logs with."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesCategory(BaseModel):
- category: str
- """The name of the category to override."""
-
- action: Optional[str] = None
- """The action to override rules in the category with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of rules in the category."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for rules in the category."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesRule(BaseModel):
- id: str
- """The ID of the rule to override."""
-
- action: Optional[str] = None
- """The action to override the rule with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of the rule."""
-
- score_threshold: Optional[int] = None
- """The score threshold to use for the rule."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for the rule."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverrides(BaseModel):
- action: Optional[str] = None
- """An action to override all rules with.
-
- This option has lower precedence than rule and category overrides.
- """
-
- categories: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesCategory]] = None
- """A list of category-level overrides.
-
- This option has the second-highest precedence after rule-level overrides.
- """
-
- enabled: Optional[bool] = None
- """Whether to enable execution of all rules.
-
- This option has lower precedence than rule and category overrides.
- """
-
- rules: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesRule]] = None
- """A list of rule-level overrides. This option has the highest precedence."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """A sensitivity level to set for all rules.
-
- This option has lower precedence than rule and category overrides and is only
- applicable for DDoS phases.
- """
-
-
-class RuleRulesetsExecuteRuleActionParameters(BaseModel):
- id: str
- """The ID of the ruleset to execute."""
-
- matched_data: Optional[RuleRulesetsExecuteRuleActionParametersMatchedData] = None
- """The configuration to use for matched data logging."""
-
- overrides: Optional[RuleRulesetsExecuteRuleActionParametersOverrides] = None
- """A set of overrides to apply to the target ruleset."""
-
-
-class RuleRulesetsExecuteRule(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["execute"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsExecuteRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsLogRule(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["log"]] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSkipRuleActionParameters(BaseModel):
- phases: Optional[
- List[
- Literal[
- "ddos_l4",
- "ddos_l7",
- "http_config_settings",
- "http_custom_errors",
- "http_log_custom_fields",
- "http_ratelimit",
- "http_request_cache_settings",
- "http_request_dynamic_redirect",
- "http_request_firewall_custom",
- "http_request_firewall_managed",
- "http_request_late_transform",
- "http_request_origin",
- "http_request_redirect",
- "http_request_sanitize",
- "http_request_sbfm",
- "http_request_select_configuration",
- "http_request_transform",
- "http_response_compression",
- "http_response_firewall_managed",
- "http_response_headers_transform",
- "magic_transit",
- "magic_transit_ids_managed",
- "magic_transit_managed",
- ]
- ]
- ] = None
- """A list of phases to skip the execution of.
-
- This option is incompatible with the ruleset and rulesets options.
- """
-
- products: Optional[
- List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]]
- ] = None
- """A list of legacy security products to skip the execution of."""
-
- rules: Optional[Dict[str, List[str]]] = None
- """
- A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the
- execution of. This option is incompatible with the ruleset option.
- """
-
- ruleset: Optional[Literal["current"]] = None
- """A ruleset to skip the execution of.
-
- This option is incompatible with the rulesets, rules and phases options.
- """
-
- rulesets: Optional[List[str]] = None
- """A list of ruleset IDs to skip the execution of.
-
- This option is incompatible with the ruleset and phases options.
- """
-
-
-class RuleRulesetsSkipRule(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["skip"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSkipRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule]
+__all__ = ["PhaseGetResponse"]
class PhaseGetResponse(BaseModel):
@@ -360,7 +50,7 @@ class PhaseGetResponse(BaseModel):
]
"""The phase of the ruleset."""
- rules: List[Rule]
+ rules: List[RequestRule]
"""The list of rules in the ruleset."""
version: str
diff --git a/src/cloudflare/types/rulesets/phase_update_params.py b/src/cloudflare/types/rulesets/phase_update_params.py
index ee0dd31a575..6358187dc13 100644
--- a/src/cloudflare/types/rulesets/phase_update_params.py
+++ b/src/cloudflare/types/rulesets/phase_update_params.py
@@ -2,31 +2,16 @@
from __future__ import annotations
-from typing import Dict, List, Union, Iterable
+from typing import Iterable
from typing_extensions import Literal, Required, TypedDict
-from ...types import shared_params
+from ..request_rule_param import RequestRuleParam
-__all__ = [
- "PhaseUpdateParams",
- "Rule",
- "RuleRulesetsBlockRule",
- "RuleRulesetsBlockRuleActionParameters",
- "RuleRulesetsBlockRuleActionParametersResponse",
- "RuleRulesetsExecuteRule",
- "RuleRulesetsExecuteRuleActionParameters",
- "RuleRulesetsExecuteRuleActionParametersMatchedData",
- "RuleRulesetsExecuteRuleActionParametersOverrides",
- "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
- "RuleRulesetsExecuteRuleActionParametersOverridesRule",
- "RuleRulesetsLogRule",
- "RuleRulesetsSkipRule",
- "RuleRulesetsSkipRuleActionParameters",
-]
+__all__ = ["PhaseUpdateParams"]
class PhaseUpdateParams(TypedDict, total=False):
- rules: Required[Iterable[Rule]]
+ rules: Required[Iterable[RequestRuleParam]]
"""The list of rules in the ruleset."""
account_id: str
@@ -70,258 +55,3 @@ class PhaseUpdateParams(TypedDict, total=False):
"magic_transit_managed",
]
"""The phase of the ruleset."""
-
-
-class RuleRulesetsBlockRuleActionParametersResponse(TypedDict, total=False):
- content: Required[str]
- """The content to return."""
-
- content_type: Required[str]
- """The type of the content to return."""
-
- status_code: Required[int]
- """The status code to return."""
-
-
-class RuleRulesetsBlockRuleActionParameters(TypedDict, total=False):
- response: RuleRulesetsBlockRuleActionParametersResponse
- """The response to show when the block is applied."""
-
-
-class RuleRulesetsBlockRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["block"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsBlockRuleActionParameters
- """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: shared_params.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsExecuteRuleActionParametersMatchedData(TypedDict, total=False):
- public_key: Required[str]
- """The public key to encrypt matched data logs with."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesCategory(TypedDict, total=False):
- category: Required[str]
- """The name of the category to override."""
-
- action: str
- """The action to override rules in the category with."""
-
- enabled: bool
- """Whether to enable execution of rules in the category."""
-
- sensitivity_level: Literal["default", "medium", "low", "eoff"]
- """The sensitivity level to use for rules in the category."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesRule(TypedDict, total=False):
- id: Required[str]
- """The ID of the rule to override."""
-
- action: str
- """The action to override the rule with."""
-
- enabled: bool
- """Whether to enable execution of the rule."""
-
- score_threshold: int
- """The score threshold to use for the rule."""
-
- sensitivity_level: Literal["default", "medium", "low", "eoff"]
- """The sensitivity level to use for the rule."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False):
- action: str
- """An action to override all rules with.
-
- This option has lower precedence than rule and category overrides.
- """
-
- categories: Iterable[RuleRulesetsExecuteRuleActionParametersOverridesCategory]
- """A list of category-level overrides.
-
- This option has the second-highest precedence after rule-level overrides.
- """
-
- enabled: bool
- """Whether to enable execution of all rules.
-
- This option has lower precedence than rule and category overrides.
- """
-
- rules: Iterable[RuleRulesetsExecuteRuleActionParametersOverridesRule]
- """A list of rule-level overrides. This option has the highest precedence."""
-
- sensitivity_level: Literal["default", "medium", "low", "eoff"]
- """A sensitivity level to set for all rules.
-
- This option has lower precedence than rule and category overrides and is only
- applicable for DDoS phases.
- """
-
-
-class RuleRulesetsExecuteRuleActionParameters(TypedDict, total=False):
- id: Required[str]
- """The ID of the ruleset to execute."""
-
- matched_data: RuleRulesetsExecuteRuleActionParametersMatchedData
- """The configuration to use for matched data logging."""
-
- overrides: RuleRulesetsExecuteRuleActionParametersOverrides
- """A set of overrides to apply to the target ruleset."""
-
-
-class RuleRulesetsExecuteRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["execute"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsExecuteRuleActionParameters
- """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: shared_params.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsLogRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["log"]
- """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: shared_params.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSkipRuleActionParameters(TypedDict, total=False):
- phases: List[
- Literal[
- "ddos_l4",
- "ddos_l7",
- "http_config_settings",
- "http_custom_errors",
- "http_log_custom_fields",
- "http_ratelimit",
- "http_request_cache_settings",
- "http_request_dynamic_redirect",
- "http_request_firewall_custom",
- "http_request_firewall_managed",
- "http_request_late_transform",
- "http_request_origin",
- "http_request_redirect",
- "http_request_sanitize",
- "http_request_sbfm",
- "http_request_select_configuration",
- "http_request_transform",
- "http_response_compression",
- "http_response_firewall_managed",
- "http_response_headers_transform",
- "magic_transit",
- "magic_transit_ids_managed",
- "magic_transit_managed",
- ]
- ]
- """A list of phases to skip the execution of.
-
- This option is incompatible with the ruleset and rulesets options.
- """
-
- products: List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]]
- """A list of legacy security products to skip the execution of."""
-
- rules: Dict[str, List[str]]
- """
- A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the
- execution of. This option is incompatible with the ruleset option.
- """
-
- ruleset: Literal["current"]
- """A ruleset to skip the execution of.
-
- This option is incompatible with the rulesets, rules and phases options.
- """
-
- rulesets: List[str]
- """A list of ruleset IDs to skip the execution of.
-
- This option is incompatible with the ruleset and phases options.
- """
-
-
-class RuleRulesetsSkipRule(TypedDict, total=False):
- id: str
- """The unique ID of the rule."""
-
- action: Literal["skip"]
- """The action to perform when the rule matches."""
-
- action_parameters: RuleRulesetsSkipRuleActionParameters
- """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: shared_params.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
- """An object configuring the rule's logging behavior."""
-
- ref: str
- """The reference of the rule (the rule ID by default)."""
-
-
-Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule]
diff --git a/src/cloudflare/types/rulesets/phase_update_response.py b/src/cloudflare/types/rulesets/phase_update_response.py
index dea3c5a4006..24fc312459c 100644
--- a/src/cloudflare/types/rulesets/phase_update_response.py
+++ b/src/cloudflare/types/rulesets/phase_update_response.py
@@ -1,323 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal
-from ..shared import UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
from ..._models import BaseModel
+from ..request_rule import RequestRule
-__all__ = [
- "PhaseUpdateResponse",
- "Rule",
- "RuleRulesetsBlockRule",
- "RuleRulesetsBlockRuleActionParameters",
- "RuleRulesetsBlockRuleActionParametersResponse",
- "RuleRulesetsExecuteRule",
- "RuleRulesetsExecuteRuleActionParameters",
- "RuleRulesetsExecuteRuleActionParametersMatchedData",
- "RuleRulesetsExecuteRuleActionParametersOverrides",
- "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
- "RuleRulesetsExecuteRuleActionParametersOverridesRule",
- "RuleRulesetsLogRule",
- "RuleRulesetsSkipRule",
- "RuleRulesetsSkipRuleActionParameters",
-]
-
-
-class RuleRulesetsBlockRuleActionParametersResponse(BaseModel):
- content: str
- """The content to return."""
-
- content_type: str
- """The type of the content to return."""
-
- status_code: int
- """The status code to return."""
-
-
-class RuleRulesetsBlockRuleActionParameters(BaseModel):
- response: Optional[RuleRulesetsBlockRuleActionParametersResponse] = None
- """The response to show when the block is applied."""
-
-
-class RuleRulesetsBlockRule(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["block"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsBlockRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsExecuteRuleActionParametersMatchedData(BaseModel):
- public_key: str
- """The public key to encrypt matched data logs with."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesCategory(BaseModel):
- category: str
- """The name of the category to override."""
-
- action: Optional[str] = None
- """The action to override rules in the category with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of rules in the category."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for rules in the category."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesRule(BaseModel):
- id: str
- """The ID of the rule to override."""
-
- action: Optional[str] = None
- """The action to override the rule with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of the rule."""
-
- score_threshold: Optional[int] = None
- """The score threshold to use for the rule."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for the rule."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverrides(BaseModel):
- action: Optional[str] = None
- """An action to override all rules with.
-
- This option has lower precedence than rule and category overrides.
- """
-
- categories: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesCategory]] = None
- """A list of category-level overrides.
-
- This option has the second-highest precedence after rule-level overrides.
- """
-
- enabled: Optional[bool] = None
- """Whether to enable execution of all rules.
-
- This option has lower precedence than rule and category overrides.
- """
-
- rules: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesRule]] = None
- """A list of rule-level overrides. This option has the highest precedence."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """A sensitivity level to set for all rules.
-
- This option has lower precedence than rule and category overrides and is only
- applicable for DDoS phases.
- """
-
-
-class RuleRulesetsExecuteRuleActionParameters(BaseModel):
- id: str
- """The ID of the ruleset to execute."""
-
- matched_data: Optional[RuleRulesetsExecuteRuleActionParametersMatchedData] = None
- """The configuration to use for matched data logging."""
-
- overrides: Optional[RuleRulesetsExecuteRuleActionParametersOverrides] = None
- """A set of overrides to apply to the target ruleset."""
-
-
-class RuleRulesetsExecuteRule(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["execute"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsExecuteRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsLogRule(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["log"]] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSkipRuleActionParameters(BaseModel):
- phases: Optional[
- List[
- Literal[
- "ddos_l4",
- "ddos_l7",
- "http_config_settings",
- "http_custom_errors",
- "http_log_custom_fields",
- "http_ratelimit",
- "http_request_cache_settings",
- "http_request_dynamic_redirect",
- "http_request_firewall_custom",
- "http_request_firewall_managed",
- "http_request_late_transform",
- "http_request_origin",
- "http_request_redirect",
- "http_request_sanitize",
- "http_request_sbfm",
- "http_request_select_configuration",
- "http_request_transform",
- "http_response_compression",
- "http_response_firewall_managed",
- "http_response_headers_transform",
- "magic_transit",
- "magic_transit_ids_managed",
- "magic_transit_managed",
- ]
- ]
- ] = None
- """A list of phases to skip the execution of.
-
- This option is incompatible with the ruleset and rulesets options.
- """
-
- products: Optional[
- List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]]
- ] = None
- """A list of legacy security products to skip the execution of."""
-
- rules: Optional[Dict[str, List[str]]] = None
- """
- A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the
- execution of. This option is incompatible with the ruleset option.
- """
-
- ruleset: Optional[Literal["current"]] = None
- """A ruleset to skip the execution of.
-
- This option is incompatible with the rulesets, rules and phases options.
- """
-
- rulesets: Optional[List[str]] = None
- """A list of ruleset IDs to skip the execution of.
-
- This option is incompatible with the ruleset and phases options.
- """
-
-
-class RuleRulesetsSkipRule(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["skip"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSkipRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule]
+__all__ = ["PhaseUpdateResponse"]
class PhaseUpdateResponse(BaseModel):
@@ -360,7 +50,7 @@ class PhaseUpdateResponse(BaseModel):
]
"""The phase of the ruleset."""
- rules: List[Rule]
+ rules: List[RequestRule]
"""The list of rules in the ruleset."""
version: str
diff --git a/src/cloudflare/types/rulesets/phases/__init__.py b/src/cloudflare/types/rulesets/phases/__init__.py
index 5a719b3e523..398f2bd04ad 100644
--- a/src/cloudflare/types/rulesets/phases/__init__.py
+++ b/src/cloudflare/types/rulesets/phases/__init__.py
@@ -3,4 +3,3 @@
from __future__ import annotations
from .version_get_response import VersionGetResponse as VersionGetResponse
-from .version_list_response import VersionListResponse as VersionListResponse
diff --git a/src/cloudflare/types/rulesets/phases/version_get_response.py b/src/cloudflare/types/rulesets/phases/version_get_response.py
index 55f0d62279f..050f070a592 100644
--- a/src/cloudflare/types/rulesets/phases/version_get_response.py
+++ b/src/cloudflare/types/rulesets/phases/version_get_response.py
@@ -1,323 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal
-from ...shared import UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
from ...._models import BaseModel
+from ...request_rule import RequestRule
-__all__ = [
- "VersionGetResponse",
- "Rule",
- "RuleRulesetsBlockRule",
- "RuleRulesetsBlockRuleActionParameters",
- "RuleRulesetsBlockRuleActionParametersResponse",
- "RuleRulesetsExecuteRule",
- "RuleRulesetsExecuteRuleActionParameters",
- "RuleRulesetsExecuteRuleActionParametersMatchedData",
- "RuleRulesetsExecuteRuleActionParametersOverrides",
- "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
- "RuleRulesetsExecuteRuleActionParametersOverridesRule",
- "RuleRulesetsLogRule",
- "RuleRulesetsSkipRule",
- "RuleRulesetsSkipRuleActionParameters",
-]
-
-
-class RuleRulesetsBlockRuleActionParametersResponse(BaseModel):
- content: str
- """The content to return."""
-
- content_type: str
- """The type of the content to return."""
-
- status_code: int
- """The status code to return."""
-
-
-class RuleRulesetsBlockRuleActionParameters(BaseModel):
- response: Optional[RuleRulesetsBlockRuleActionParametersResponse] = None
- """The response to show when the block is applied."""
-
-
-class RuleRulesetsBlockRule(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["block"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsBlockRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsExecuteRuleActionParametersMatchedData(BaseModel):
- public_key: str
- """The public key to encrypt matched data logs with."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesCategory(BaseModel):
- category: str
- """The name of the category to override."""
-
- action: Optional[str] = None
- """The action to override rules in the category with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of rules in the category."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for rules in the category."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesRule(BaseModel):
- id: str
- """The ID of the rule to override."""
-
- action: Optional[str] = None
- """The action to override the rule with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of the rule."""
-
- score_threshold: Optional[int] = None
- """The score threshold to use for the rule."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for the rule."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverrides(BaseModel):
- action: Optional[str] = None
- """An action to override all rules with.
-
- This option has lower precedence than rule and category overrides.
- """
-
- categories: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesCategory]] = None
- """A list of category-level overrides.
-
- This option has the second-highest precedence after rule-level overrides.
- """
-
- enabled: Optional[bool] = None
- """Whether to enable execution of all rules.
-
- This option has lower precedence than rule and category overrides.
- """
-
- rules: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesRule]] = None
- """A list of rule-level overrides. This option has the highest precedence."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """A sensitivity level to set for all rules.
-
- This option has lower precedence than rule and category overrides and is only
- applicable for DDoS phases.
- """
-
-
-class RuleRulesetsExecuteRuleActionParameters(BaseModel):
- id: str
- """The ID of the ruleset to execute."""
-
- matched_data: Optional[RuleRulesetsExecuteRuleActionParametersMatchedData] = None
- """The configuration to use for matched data logging."""
-
- overrides: Optional[RuleRulesetsExecuteRuleActionParametersOverrides] = None
- """A set of overrides to apply to the target ruleset."""
-
-
-class RuleRulesetsExecuteRule(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["execute"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsExecuteRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsLogRule(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["log"]] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSkipRuleActionParameters(BaseModel):
- phases: Optional[
- List[
- Literal[
- "ddos_l4",
- "ddos_l7",
- "http_config_settings",
- "http_custom_errors",
- "http_log_custom_fields",
- "http_ratelimit",
- "http_request_cache_settings",
- "http_request_dynamic_redirect",
- "http_request_firewall_custom",
- "http_request_firewall_managed",
- "http_request_late_transform",
- "http_request_origin",
- "http_request_redirect",
- "http_request_sanitize",
- "http_request_sbfm",
- "http_request_select_configuration",
- "http_request_transform",
- "http_response_compression",
- "http_response_firewall_managed",
- "http_response_headers_transform",
- "magic_transit",
- "magic_transit_ids_managed",
- "magic_transit_managed",
- ]
- ]
- ] = None
- """A list of phases to skip the execution of.
-
- This option is incompatible with the ruleset and rulesets options.
- """
-
- products: Optional[
- List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]]
- ] = None
- """A list of legacy security products to skip the execution of."""
-
- rules: Optional[Dict[str, List[str]]] = None
- """
- A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the
- execution of. This option is incompatible with the ruleset option.
- """
-
- ruleset: Optional[Literal["current"]] = None
- """A ruleset to skip the execution of.
-
- This option is incompatible with the rulesets, rules and phases options.
- """
-
- rulesets: Optional[List[str]] = None
- """A list of ruleset IDs to skip the execution of.
-
- This option is incompatible with the ruleset and phases options.
- """
-
-
-class RuleRulesetsSkipRule(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["skip"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSkipRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule]
+__all__ = ["VersionGetResponse"]
class VersionGetResponse(BaseModel):
@@ -360,7 +50,7 @@ class VersionGetResponse(BaseModel):
]
"""The phase of the ruleset."""
- rules: List[Rule]
+ rules: List[RequestRule]
"""The list of rules in the ruleset."""
version: str
diff --git a/src/cloudflare/types/rulesets/phases/version_list_response.py b/src/cloudflare/types/rulesets/phases/version_list_response.py
deleted file mode 100644
index f91c007c1f9..00000000000
--- a/src/cloudflare/types/rulesets/phases/version_list_response.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Optional
-from datetime import datetime
-from typing_extensions import Literal
-
-from ...._models import BaseModel
-
-__all__ = ["VersionListResponse"]
-
-
-class VersionListResponse(BaseModel):
- kind: Literal["managed", "custom", "root", "zone"]
- """The kind of the ruleset."""
-
- name: str
- """The human-readable name of the ruleset."""
-
- phase: Literal[
- "ddos_l4",
- "ddos_l7",
- "http_config_settings",
- "http_custom_errors",
- "http_log_custom_fields",
- "http_ratelimit",
- "http_request_cache_settings",
- "http_request_dynamic_redirect",
- "http_request_firewall_custom",
- "http_request_firewall_managed",
- "http_request_late_transform",
- "http_request_origin",
- "http_request_redirect",
- "http_request_sanitize",
- "http_request_sbfm",
- "http_request_select_configuration",
- "http_request_transform",
- "http_response_compression",
- "http_response_firewall_managed",
- "http_response_headers_transform",
- "magic_transit",
- "magic_transit_ids_managed",
- "magic_transit_managed",
- ]
- """The phase of the ruleset."""
-
- id: Optional[str] = None
- """The unique ID of the ruleset."""
-
- description: Optional[str] = None
- """An informative description of the ruleset."""
-
- last_updated: Optional[datetime] = None
- """The timestamp of when the ruleset was last modified."""
-
- version: Optional[str] = None
- """The version of the ruleset."""
diff --git a/src/cloudflare/types/rulesets/rule_create_params.py b/src/cloudflare/types/rulesets/rule_create_params.py
index c6fefe04798..f90079b147a 100644
--- a/src/cloudflare/types/rulesets/rule_create_params.py
+++ b/src/cloudflare/types/rulesets/rule_create_params.py
@@ -9,22 +9,22 @@
__all__ = [
"RuleCreateParams",
- "RulesetsBlockRule",
- "RulesetsBlockRuleActionParameters",
- "RulesetsBlockRuleActionParametersResponse",
- "RulesetsExecuteRule",
- "RulesetsExecuteRuleActionParameters",
- "RulesetsExecuteRuleActionParametersMatchedData",
- "RulesetsExecuteRuleActionParametersOverrides",
- "RulesetsExecuteRuleActionParametersOverridesCategory",
- "RulesetsExecuteRuleActionParametersOverridesRule",
- "RulesetsLogRule",
- "RulesetsSkipRule",
- "RulesetsSkipRuleActionParameters",
+ "BlockRule",
+ "BlockRuleActionParameters",
+ "BlockRuleActionParametersResponse",
+ "ExecuteRule",
+ "ExecuteRuleActionParameters",
+ "ExecuteRuleActionParametersMatchedData",
+ "ExecuteRuleActionParametersOverrides",
+ "ExecuteRuleActionParametersOverridesCategory",
+ "ExecuteRuleActionParametersOverridesRule",
+ "LogRule",
+ "SkipRule",
+ "SkipRuleActionParameters",
]
-class RulesetsBlockRule(TypedDict, total=False):
+class BlockRule(TypedDict, total=False):
account_id: str
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
@@ -37,7 +37,7 @@ class RulesetsBlockRule(TypedDict, total=False):
action: Literal["block"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsBlockRuleActionParameters
+ action_parameters: BlockRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -56,7 +56,7 @@ class RulesetsBlockRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsBlockRuleActionParametersResponse(TypedDict, total=False):
+class BlockRuleActionParametersResponse(TypedDict, total=False):
content: Required[str]
"""The content to return."""
@@ -67,12 +67,12 @@ class RulesetsBlockRuleActionParametersResponse(TypedDict, total=False):
"""The status code to return."""
-class RulesetsBlockRuleActionParameters(TypedDict, total=False):
- response: RulesetsBlockRuleActionParametersResponse
+class BlockRuleActionParameters(TypedDict, total=False):
+ response: BlockRuleActionParametersResponse
"""The response to show when the block is applied."""
-class RulesetsExecuteRule(TypedDict, total=False):
+class ExecuteRule(TypedDict, total=False):
account_id: str
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
@@ -85,7 +85,7 @@ class RulesetsExecuteRule(TypedDict, total=False):
action: Literal["execute"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsExecuteRuleActionParameters
+ action_parameters: ExecuteRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -104,12 +104,12 @@ class RulesetsExecuteRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsExecuteRuleActionParametersMatchedData(TypedDict, total=False):
+class ExecuteRuleActionParametersMatchedData(TypedDict, total=False):
public_key: Required[str]
"""The public key to encrypt matched data logs with."""
-class RulesetsExecuteRuleActionParametersOverridesCategory(TypedDict, total=False):
+class ExecuteRuleActionParametersOverridesCategory(TypedDict, total=False):
category: Required[str]
"""The name of the category to override."""
@@ -123,7 +123,7 @@ class RulesetsExecuteRuleActionParametersOverridesCategory(TypedDict, total=Fals
"""The sensitivity level to use for rules in the category."""
-class RulesetsExecuteRuleActionParametersOverridesRule(TypedDict, total=False):
+class ExecuteRuleActionParametersOverridesRule(TypedDict, total=False):
id: Required[str]
"""The ID of the rule to override."""
@@ -140,14 +140,14 @@ class RulesetsExecuteRuleActionParametersOverridesRule(TypedDict, total=False):
"""The sensitivity level to use for the rule."""
-class RulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False):
+class ExecuteRuleActionParametersOverrides(TypedDict, total=False):
action: str
"""An action to override all rules with.
This option has lower precedence than rule and category overrides.
"""
- categories: Iterable[RulesetsExecuteRuleActionParametersOverridesCategory]
+ categories: Iterable[ExecuteRuleActionParametersOverridesCategory]
"""A list of category-level overrides.
This option has the second-highest precedence after rule-level overrides.
@@ -159,7 +159,7 @@ class RulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False):
This option has lower precedence than rule and category overrides.
"""
- rules: Iterable[RulesetsExecuteRuleActionParametersOverridesRule]
+ rules: Iterable[ExecuteRuleActionParametersOverridesRule]
"""A list of rule-level overrides. This option has the highest precedence."""
sensitivity_level: Literal["default", "medium", "low", "eoff"]
@@ -170,18 +170,18 @@ class RulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False):
"""
-class RulesetsExecuteRuleActionParameters(TypedDict, total=False):
+class ExecuteRuleActionParameters(TypedDict, total=False):
id: Required[str]
"""The ID of the ruleset to execute."""
- matched_data: RulesetsExecuteRuleActionParametersMatchedData
+ matched_data: ExecuteRuleActionParametersMatchedData
"""The configuration to use for matched data logging."""
- overrides: RulesetsExecuteRuleActionParametersOverrides
+ overrides: ExecuteRuleActionParametersOverrides
"""A set of overrides to apply to the target ruleset."""
-class RulesetsLogRule(TypedDict, total=False):
+class LogRule(TypedDict, total=False):
account_id: str
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
@@ -213,7 +213,7 @@ class RulesetsLogRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsSkipRule(TypedDict, total=False):
+class SkipRule(TypedDict, total=False):
account_id: str
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
@@ -226,7 +226,7 @@ class RulesetsSkipRule(TypedDict, total=False):
action: Literal["skip"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsSkipRuleActionParameters
+ action_parameters: SkipRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -245,7 +245,7 @@ class RulesetsSkipRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsSkipRuleActionParameters(TypedDict, total=False):
+class SkipRuleActionParameters(TypedDict, total=False):
phases: List[
Literal[
"ddos_l4",
@@ -300,4 +300,4 @@ class RulesetsSkipRuleActionParameters(TypedDict, total=False):
"""
-RuleCreateParams = Union[RulesetsBlockRule, RulesetsExecuteRule, RulesetsLogRule, RulesetsSkipRule]
+RuleCreateParams = Union[BlockRule, ExecuteRule, LogRule, SkipRule]
diff --git a/src/cloudflare/types/rulesets/rule_create_response.py b/src/cloudflare/types/rulesets/rule_create_response.py
index e4c09492459..b554755248f 100644
--- a/src/cloudflare/types/rulesets/rule_create_response.py
+++ b/src/cloudflare/types/rulesets/rule_create_response.py
@@ -1,323 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal
-from ..shared import UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
from ..._models import BaseModel
+from ..request_rule import RequestRule
-__all__ = [
- "RuleCreateResponse",
- "Rule",
- "RuleRulesetsBlockRule",
- "RuleRulesetsBlockRuleActionParameters",
- "RuleRulesetsBlockRuleActionParametersResponse",
- "RuleRulesetsExecuteRule",
- "RuleRulesetsExecuteRuleActionParameters",
- "RuleRulesetsExecuteRuleActionParametersMatchedData",
- "RuleRulesetsExecuteRuleActionParametersOverrides",
- "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
- "RuleRulesetsExecuteRuleActionParametersOverridesRule",
- "RuleRulesetsLogRule",
- "RuleRulesetsSkipRule",
- "RuleRulesetsSkipRuleActionParameters",
-]
-
-
-class RuleRulesetsBlockRuleActionParametersResponse(BaseModel):
- content: str
- """The content to return."""
-
- content_type: str
- """The type of the content to return."""
-
- status_code: int
- """The status code to return."""
-
-
-class RuleRulesetsBlockRuleActionParameters(BaseModel):
- response: Optional[RuleRulesetsBlockRuleActionParametersResponse] = None
- """The response to show when the block is applied."""
-
-
-class RuleRulesetsBlockRule(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["block"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsBlockRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsExecuteRuleActionParametersMatchedData(BaseModel):
- public_key: str
- """The public key to encrypt matched data logs with."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesCategory(BaseModel):
- category: str
- """The name of the category to override."""
-
- action: Optional[str] = None
- """The action to override rules in the category with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of rules in the category."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for rules in the category."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesRule(BaseModel):
- id: str
- """The ID of the rule to override."""
-
- action: Optional[str] = None
- """The action to override the rule with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of the rule."""
-
- score_threshold: Optional[int] = None
- """The score threshold to use for the rule."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for the rule."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverrides(BaseModel):
- action: Optional[str] = None
- """An action to override all rules with.
-
- This option has lower precedence than rule and category overrides.
- """
-
- categories: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesCategory]] = None
- """A list of category-level overrides.
-
- This option has the second-highest precedence after rule-level overrides.
- """
-
- enabled: Optional[bool] = None
- """Whether to enable execution of all rules.
-
- This option has lower precedence than rule and category overrides.
- """
-
- rules: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesRule]] = None
- """A list of rule-level overrides. This option has the highest precedence."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """A sensitivity level to set for all rules.
-
- This option has lower precedence than rule and category overrides and is only
- applicable for DDoS phases.
- """
-
-
-class RuleRulesetsExecuteRuleActionParameters(BaseModel):
- id: str
- """The ID of the ruleset to execute."""
-
- matched_data: Optional[RuleRulesetsExecuteRuleActionParametersMatchedData] = None
- """The configuration to use for matched data logging."""
-
- overrides: Optional[RuleRulesetsExecuteRuleActionParametersOverrides] = None
- """A set of overrides to apply to the target ruleset."""
-
-
-class RuleRulesetsExecuteRule(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["execute"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsExecuteRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsLogRule(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["log"]] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSkipRuleActionParameters(BaseModel):
- phases: Optional[
- List[
- Literal[
- "ddos_l4",
- "ddos_l7",
- "http_config_settings",
- "http_custom_errors",
- "http_log_custom_fields",
- "http_ratelimit",
- "http_request_cache_settings",
- "http_request_dynamic_redirect",
- "http_request_firewall_custom",
- "http_request_firewall_managed",
- "http_request_late_transform",
- "http_request_origin",
- "http_request_redirect",
- "http_request_sanitize",
- "http_request_sbfm",
- "http_request_select_configuration",
- "http_request_transform",
- "http_response_compression",
- "http_response_firewall_managed",
- "http_response_headers_transform",
- "magic_transit",
- "magic_transit_ids_managed",
- "magic_transit_managed",
- ]
- ]
- ] = None
- """A list of phases to skip the execution of.
-
- This option is incompatible with the ruleset and rulesets options.
- """
-
- products: Optional[
- List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]]
- ] = None
- """A list of legacy security products to skip the execution of."""
-
- rules: Optional[Dict[str, List[str]]] = None
- """
- A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the
- execution of. This option is incompatible with the ruleset option.
- """
-
- ruleset: Optional[Literal["current"]] = None
- """A ruleset to skip the execution of.
-
- This option is incompatible with the rulesets, rules and phases options.
- """
-
- rulesets: Optional[List[str]] = None
- """A list of ruleset IDs to skip the execution of.
-
- This option is incompatible with the ruleset and phases options.
- """
-
-
-class RuleRulesetsSkipRule(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["skip"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSkipRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule]
+__all__ = ["RuleCreateResponse"]
class RuleCreateResponse(BaseModel):
@@ -360,7 +50,7 @@ class RuleCreateResponse(BaseModel):
]
"""The phase of the ruleset."""
- rules: List[Rule]
+ rules: List[RequestRule]
"""The list of rules in the ruleset."""
version: str
diff --git a/src/cloudflare/types/rulesets/rule_delete_response.py b/src/cloudflare/types/rulesets/rule_delete_response.py
index 9e3879da2e4..3e1cd2ab850 100644
--- a/src/cloudflare/types/rulesets/rule_delete_response.py
+++ b/src/cloudflare/types/rulesets/rule_delete_response.py
@@ -1,323 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal
-from ..shared import UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
from ..._models import BaseModel
+from ..request_rule import RequestRule
-__all__ = [
- "RuleDeleteResponse",
- "Rule",
- "RuleRulesetsBlockRule",
- "RuleRulesetsBlockRuleActionParameters",
- "RuleRulesetsBlockRuleActionParametersResponse",
- "RuleRulesetsExecuteRule",
- "RuleRulesetsExecuteRuleActionParameters",
- "RuleRulesetsExecuteRuleActionParametersMatchedData",
- "RuleRulesetsExecuteRuleActionParametersOverrides",
- "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
- "RuleRulesetsExecuteRuleActionParametersOverridesRule",
- "RuleRulesetsLogRule",
- "RuleRulesetsSkipRule",
- "RuleRulesetsSkipRuleActionParameters",
-]
-
-
-class RuleRulesetsBlockRuleActionParametersResponse(BaseModel):
- content: str
- """The content to return."""
-
- content_type: str
- """The type of the content to return."""
-
- status_code: int
- """The status code to return."""
-
-
-class RuleRulesetsBlockRuleActionParameters(BaseModel):
- response: Optional[RuleRulesetsBlockRuleActionParametersResponse] = None
- """The response to show when the block is applied."""
-
-
-class RuleRulesetsBlockRule(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["block"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsBlockRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsExecuteRuleActionParametersMatchedData(BaseModel):
- public_key: str
- """The public key to encrypt matched data logs with."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesCategory(BaseModel):
- category: str
- """The name of the category to override."""
-
- action: Optional[str] = None
- """The action to override rules in the category with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of rules in the category."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for rules in the category."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesRule(BaseModel):
- id: str
- """The ID of the rule to override."""
-
- action: Optional[str] = None
- """The action to override the rule with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of the rule."""
-
- score_threshold: Optional[int] = None
- """The score threshold to use for the rule."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for the rule."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverrides(BaseModel):
- action: Optional[str] = None
- """An action to override all rules with.
-
- This option has lower precedence than rule and category overrides.
- """
-
- categories: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesCategory]] = None
- """A list of category-level overrides.
-
- This option has the second-highest precedence after rule-level overrides.
- """
-
- enabled: Optional[bool] = None
- """Whether to enable execution of all rules.
-
- This option has lower precedence than rule and category overrides.
- """
-
- rules: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesRule]] = None
- """A list of rule-level overrides. This option has the highest precedence."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """A sensitivity level to set for all rules.
-
- This option has lower precedence than rule and category overrides and is only
- applicable for DDoS phases.
- """
-
-
-class RuleRulesetsExecuteRuleActionParameters(BaseModel):
- id: str
- """The ID of the ruleset to execute."""
-
- matched_data: Optional[RuleRulesetsExecuteRuleActionParametersMatchedData] = None
- """The configuration to use for matched data logging."""
-
- overrides: Optional[RuleRulesetsExecuteRuleActionParametersOverrides] = None
- """A set of overrides to apply to the target ruleset."""
-
-
-class RuleRulesetsExecuteRule(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["execute"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsExecuteRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsLogRule(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["log"]] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSkipRuleActionParameters(BaseModel):
- phases: Optional[
- List[
- Literal[
- "ddos_l4",
- "ddos_l7",
- "http_config_settings",
- "http_custom_errors",
- "http_log_custom_fields",
- "http_ratelimit",
- "http_request_cache_settings",
- "http_request_dynamic_redirect",
- "http_request_firewall_custom",
- "http_request_firewall_managed",
- "http_request_late_transform",
- "http_request_origin",
- "http_request_redirect",
- "http_request_sanitize",
- "http_request_sbfm",
- "http_request_select_configuration",
- "http_request_transform",
- "http_response_compression",
- "http_response_firewall_managed",
- "http_response_headers_transform",
- "magic_transit",
- "magic_transit_ids_managed",
- "magic_transit_managed",
- ]
- ]
- ] = None
- """A list of phases to skip the execution of.
-
- This option is incompatible with the ruleset and rulesets options.
- """
-
- products: Optional[
- List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]]
- ] = None
- """A list of legacy security products to skip the execution of."""
-
- rules: Optional[Dict[str, List[str]]] = None
- """
- A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the
- execution of. This option is incompatible with the ruleset option.
- """
-
- ruleset: Optional[Literal["current"]] = None
- """A ruleset to skip the execution of.
-
- This option is incompatible with the rulesets, rules and phases options.
- """
-
- rulesets: Optional[List[str]] = None
- """A list of ruleset IDs to skip the execution of.
-
- This option is incompatible with the ruleset and phases options.
- """
-
-
-class RuleRulesetsSkipRule(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["skip"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSkipRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule]
+__all__ = ["RuleDeleteResponse"]
class RuleDeleteResponse(BaseModel):
@@ -360,7 +50,7 @@ class RuleDeleteResponse(BaseModel):
]
"""The phase of the ruleset."""
- rules: List[Rule]
+ rules: List[RequestRule]
"""The list of rules in the ruleset."""
version: str
diff --git a/src/cloudflare/types/rulesets/rule_edit_params.py b/src/cloudflare/types/rulesets/rule_edit_params.py
index 2d951cf7ecf..d8f55fc560d 100644
--- a/src/cloudflare/types/rulesets/rule_edit_params.py
+++ b/src/cloudflare/types/rulesets/rule_edit_params.py
@@ -9,22 +9,22 @@
__all__ = [
"RuleEditParams",
- "RulesetsBlockRule",
- "RulesetsBlockRuleActionParameters",
- "RulesetsBlockRuleActionParametersResponse",
- "RulesetsExecuteRule",
- "RulesetsExecuteRuleActionParameters",
- "RulesetsExecuteRuleActionParametersMatchedData",
- "RulesetsExecuteRuleActionParametersOverrides",
- "RulesetsExecuteRuleActionParametersOverridesCategory",
- "RulesetsExecuteRuleActionParametersOverridesRule",
- "RulesetsLogRule",
- "RulesetsSkipRule",
- "RulesetsSkipRuleActionParameters",
+ "BlockRule",
+ "BlockRuleActionParameters",
+ "BlockRuleActionParametersResponse",
+ "ExecuteRule",
+ "ExecuteRuleActionParameters",
+ "ExecuteRuleActionParametersMatchedData",
+ "ExecuteRuleActionParametersOverrides",
+ "ExecuteRuleActionParametersOverridesCategory",
+ "ExecuteRuleActionParametersOverridesRule",
+ "LogRule",
+ "SkipRule",
+ "SkipRuleActionParameters",
]
-class RulesetsBlockRule(TypedDict, total=False):
+class BlockRule(TypedDict, total=False):
ruleset_id: Required[str]
"""The unique ID of the ruleset."""
@@ -40,7 +40,7 @@ class RulesetsBlockRule(TypedDict, total=False):
action: Literal["block"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsBlockRuleActionParameters
+ action_parameters: BlockRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -59,7 +59,7 @@ class RulesetsBlockRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsBlockRuleActionParametersResponse(TypedDict, total=False):
+class BlockRuleActionParametersResponse(TypedDict, total=False):
content: Required[str]
"""The content to return."""
@@ -70,12 +70,12 @@ class RulesetsBlockRuleActionParametersResponse(TypedDict, total=False):
"""The status code to return."""
-class RulesetsBlockRuleActionParameters(TypedDict, total=False):
- response: RulesetsBlockRuleActionParametersResponse
+class BlockRuleActionParameters(TypedDict, total=False):
+ response: BlockRuleActionParametersResponse
"""The response to show when the block is applied."""
-class RulesetsExecuteRule(TypedDict, total=False):
+class ExecuteRule(TypedDict, total=False):
ruleset_id: Required[str]
"""The unique ID of the ruleset."""
@@ -91,7 +91,7 @@ class RulesetsExecuteRule(TypedDict, total=False):
action: Literal["execute"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsExecuteRuleActionParameters
+ action_parameters: ExecuteRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -110,12 +110,12 @@ class RulesetsExecuteRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsExecuteRuleActionParametersMatchedData(TypedDict, total=False):
+class ExecuteRuleActionParametersMatchedData(TypedDict, total=False):
public_key: Required[str]
"""The public key to encrypt matched data logs with."""
-class RulesetsExecuteRuleActionParametersOverridesCategory(TypedDict, total=False):
+class ExecuteRuleActionParametersOverridesCategory(TypedDict, total=False):
category: Required[str]
"""The name of the category to override."""
@@ -129,7 +129,7 @@ class RulesetsExecuteRuleActionParametersOverridesCategory(TypedDict, total=Fals
"""The sensitivity level to use for rules in the category."""
-class RulesetsExecuteRuleActionParametersOverridesRule(TypedDict, total=False):
+class ExecuteRuleActionParametersOverridesRule(TypedDict, total=False):
id: Required[str]
"""The ID of the rule to override."""
@@ -146,14 +146,14 @@ class RulesetsExecuteRuleActionParametersOverridesRule(TypedDict, total=False):
"""The sensitivity level to use for the rule."""
-class RulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False):
+class ExecuteRuleActionParametersOverrides(TypedDict, total=False):
action: str
"""An action to override all rules with.
This option has lower precedence than rule and category overrides.
"""
- categories: Iterable[RulesetsExecuteRuleActionParametersOverridesCategory]
+ categories: Iterable[ExecuteRuleActionParametersOverridesCategory]
"""A list of category-level overrides.
This option has the second-highest precedence after rule-level overrides.
@@ -165,7 +165,7 @@ class RulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False):
This option has lower precedence than rule and category overrides.
"""
- rules: Iterable[RulesetsExecuteRuleActionParametersOverridesRule]
+ rules: Iterable[ExecuteRuleActionParametersOverridesRule]
"""A list of rule-level overrides. This option has the highest precedence."""
sensitivity_level: Literal["default", "medium", "low", "eoff"]
@@ -176,18 +176,18 @@ class RulesetsExecuteRuleActionParametersOverrides(TypedDict, total=False):
"""
-class RulesetsExecuteRuleActionParameters(TypedDict, total=False):
+class ExecuteRuleActionParameters(TypedDict, total=False):
id: Required[str]
"""The ID of the ruleset to execute."""
- matched_data: RulesetsExecuteRuleActionParametersMatchedData
+ matched_data: ExecuteRuleActionParametersMatchedData
"""The configuration to use for matched data logging."""
- overrides: RulesetsExecuteRuleActionParametersOverrides
+ overrides: ExecuteRuleActionParametersOverrides
"""A set of overrides to apply to the target ruleset."""
-class RulesetsLogRule(TypedDict, total=False):
+class LogRule(TypedDict, total=False):
ruleset_id: Required[str]
"""The unique ID of the ruleset."""
@@ -222,7 +222,7 @@ class RulesetsLogRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsSkipRule(TypedDict, total=False):
+class SkipRule(TypedDict, total=False):
ruleset_id: Required[str]
"""The unique ID of the ruleset."""
@@ -238,7 +238,7 @@ class RulesetsSkipRule(TypedDict, total=False):
action: Literal["skip"]
"""The action to perform when the rule matches."""
- action_parameters: RulesetsSkipRuleActionParameters
+ action_parameters: SkipRuleActionParameters
"""The parameters configuring the rule's action."""
description: str
@@ -257,7 +257,7 @@ class RulesetsSkipRule(TypedDict, total=False):
"""The reference of the rule (the rule ID by default)."""
-class RulesetsSkipRuleActionParameters(TypedDict, total=False):
+class SkipRuleActionParameters(TypedDict, total=False):
phases: List[
Literal[
"ddos_l4",
@@ -312,4 +312,4 @@ class RulesetsSkipRuleActionParameters(TypedDict, total=False):
"""
-RuleEditParams = Union[RulesetsBlockRule, RulesetsExecuteRule, RulesetsLogRule, RulesetsSkipRule]
+RuleEditParams = Union[BlockRule, ExecuteRule, LogRule, SkipRule]
diff --git a/src/cloudflare/types/rulesets/rule_edit_response.py b/src/cloudflare/types/rulesets/rule_edit_response.py
index 79d7e1765f9..a53cec82198 100644
--- a/src/cloudflare/types/rulesets/rule_edit_response.py
+++ b/src/cloudflare/types/rulesets/rule_edit_response.py
@@ -1,323 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal
-from ..shared import UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
from ..._models import BaseModel
+from ..request_rule import RequestRule
-__all__ = [
- "RuleEditResponse",
- "Rule",
- "RuleRulesetsBlockRule",
- "RuleRulesetsBlockRuleActionParameters",
- "RuleRulesetsBlockRuleActionParametersResponse",
- "RuleRulesetsExecuteRule",
- "RuleRulesetsExecuteRuleActionParameters",
- "RuleRulesetsExecuteRuleActionParametersMatchedData",
- "RuleRulesetsExecuteRuleActionParametersOverrides",
- "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
- "RuleRulesetsExecuteRuleActionParametersOverridesRule",
- "RuleRulesetsLogRule",
- "RuleRulesetsSkipRule",
- "RuleRulesetsSkipRuleActionParameters",
-]
-
-
-class RuleRulesetsBlockRuleActionParametersResponse(BaseModel):
- content: str
- """The content to return."""
-
- content_type: str
- """The type of the content to return."""
-
- status_code: int
- """The status code to return."""
-
-
-class RuleRulesetsBlockRuleActionParameters(BaseModel):
- response: Optional[RuleRulesetsBlockRuleActionParametersResponse] = None
- """The response to show when the block is applied."""
-
-
-class RuleRulesetsBlockRule(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["block"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsBlockRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsExecuteRuleActionParametersMatchedData(BaseModel):
- public_key: str
- """The public key to encrypt matched data logs with."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesCategory(BaseModel):
- category: str
- """The name of the category to override."""
-
- action: Optional[str] = None
- """The action to override rules in the category with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of rules in the category."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for rules in the category."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesRule(BaseModel):
- id: str
- """The ID of the rule to override."""
-
- action: Optional[str] = None
- """The action to override the rule with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of the rule."""
-
- score_threshold: Optional[int] = None
- """The score threshold to use for the rule."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for the rule."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverrides(BaseModel):
- action: Optional[str] = None
- """An action to override all rules with.
-
- This option has lower precedence than rule and category overrides.
- """
-
- categories: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesCategory]] = None
- """A list of category-level overrides.
-
- This option has the second-highest precedence after rule-level overrides.
- """
-
- enabled: Optional[bool] = None
- """Whether to enable execution of all rules.
-
- This option has lower precedence than rule and category overrides.
- """
-
- rules: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesRule]] = None
- """A list of rule-level overrides. This option has the highest precedence."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """A sensitivity level to set for all rules.
-
- This option has lower precedence than rule and category overrides and is only
- applicable for DDoS phases.
- """
-
-
-class RuleRulesetsExecuteRuleActionParameters(BaseModel):
- id: str
- """The ID of the ruleset to execute."""
-
- matched_data: Optional[RuleRulesetsExecuteRuleActionParametersMatchedData] = None
- """The configuration to use for matched data logging."""
-
- overrides: Optional[RuleRulesetsExecuteRuleActionParametersOverrides] = None
- """A set of overrides to apply to the target ruleset."""
-
-
-class RuleRulesetsExecuteRule(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["execute"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsExecuteRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsLogRule(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["log"]] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSkipRuleActionParameters(BaseModel):
- phases: Optional[
- List[
- Literal[
- "ddos_l4",
- "ddos_l7",
- "http_config_settings",
- "http_custom_errors",
- "http_log_custom_fields",
- "http_ratelimit",
- "http_request_cache_settings",
- "http_request_dynamic_redirect",
- "http_request_firewall_custom",
- "http_request_firewall_managed",
- "http_request_late_transform",
- "http_request_origin",
- "http_request_redirect",
- "http_request_sanitize",
- "http_request_sbfm",
- "http_request_select_configuration",
- "http_request_transform",
- "http_response_compression",
- "http_response_firewall_managed",
- "http_response_headers_transform",
- "magic_transit",
- "magic_transit_ids_managed",
- "magic_transit_managed",
- ]
- ]
- ] = None
- """A list of phases to skip the execution of.
-
- This option is incompatible with the ruleset and rulesets options.
- """
-
- products: Optional[
- List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]]
- ] = None
- """A list of legacy security products to skip the execution of."""
-
- rules: Optional[Dict[str, List[str]]] = None
- """
- A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the
- execution of. This option is incompatible with the ruleset option.
- """
-
- ruleset: Optional[Literal["current"]] = None
- """A ruleset to skip the execution of.
-
- This option is incompatible with the rulesets, rules and phases options.
- """
-
- rulesets: Optional[List[str]] = None
- """A list of ruleset IDs to skip the execution of.
-
- This option is incompatible with the ruleset and phases options.
- """
-
-
-class RuleRulesetsSkipRule(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["skip"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSkipRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule]
+__all__ = ["RuleEditResponse"]
class RuleEditResponse(BaseModel):
@@ -360,7 +50,7 @@ class RuleEditResponse(BaseModel):
]
"""The phase of the ruleset."""
- rules: List[Rule]
+ rules: List[RequestRule]
"""The list of rules in the ruleset."""
version: str
diff --git a/src/cloudflare/types/rulesets/version_get_response.py b/src/cloudflare/types/rulesets/version_get_response.py
index f4001774338..7761a6fff22 100644
--- a/src/cloudflare/types/rulesets/version_get_response.py
+++ b/src/cloudflare/types/rulesets/version_get_response.py
@@ -1,323 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal
-from ..shared import UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
from ..._models import BaseModel
+from ..request_rule import RequestRule
-__all__ = [
- "VersionGetResponse",
- "Rule",
- "RuleRulesetsBlockRule",
- "RuleRulesetsBlockRuleActionParameters",
- "RuleRulesetsBlockRuleActionParametersResponse",
- "RuleRulesetsExecuteRule",
- "RuleRulesetsExecuteRuleActionParameters",
- "RuleRulesetsExecuteRuleActionParametersMatchedData",
- "RuleRulesetsExecuteRuleActionParametersOverrides",
- "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
- "RuleRulesetsExecuteRuleActionParametersOverridesRule",
- "RuleRulesetsLogRule",
- "RuleRulesetsSkipRule",
- "RuleRulesetsSkipRuleActionParameters",
-]
-
-
-class RuleRulesetsBlockRuleActionParametersResponse(BaseModel):
- content: str
- """The content to return."""
-
- content_type: str
- """The type of the content to return."""
-
- status_code: int
- """The status code to return."""
-
-
-class RuleRulesetsBlockRuleActionParameters(BaseModel):
- response: Optional[RuleRulesetsBlockRuleActionParametersResponse] = None
- """The response to show when the block is applied."""
-
-
-class RuleRulesetsBlockRule(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["block"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsBlockRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsExecuteRuleActionParametersMatchedData(BaseModel):
- public_key: str
- """The public key to encrypt matched data logs with."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesCategory(BaseModel):
- category: str
- """The name of the category to override."""
-
- action: Optional[str] = None
- """The action to override rules in the category with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of rules in the category."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for rules in the category."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesRule(BaseModel):
- id: str
- """The ID of the rule to override."""
-
- action: Optional[str] = None
- """The action to override the rule with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of the rule."""
-
- score_threshold: Optional[int] = None
- """The score threshold to use for the rule."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for the rule."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverrides(BaseModel):
- action: Optional[str] = None
- """An action to override all rules with.
-
- This option has lower precedence than rule and category overrides.
- """
-
- categories: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesCategory]] = None
- """A list of category-level overrides.
-
- This option has the second-highest precedence after rule-level overrides.
- """
-
- enabled: Optional[bool] = None
- """Whether to enable execution of all rules.
-
- This option has lower precedence than rule and category overrides.
- """
-
- rules: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesRule]] = None
- """A list of rule-level overrides. This option has the highest precedence."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """A sensitivity level to set for all rules.
-
- This option has lower precedence than rule and category overrides and is only
- applicable for DDoS phases.
- """
-
-
-class RuleRulesetsExecuteRuleActionParameters(BaseModel):
- id: str
- """The ID of the ruleset to execute."""
-
- matched_data: Optional[RuleRulesetsExecuteRuleActionParametersMatchedData] = None
- """The configuration to use for matched data logging."""
-
- overrides: Optional[RuleRulesetsExecuteRuleActionParametersOverrides] = None
- """A set of overrides to apply to the target ruleset."""
-
-
-class RuleRulesetsExecuteRule(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["execute"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsExecuteRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsLogRule(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["log"]] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSkipRuleActionParameters(BaseModel):
- phases: Optional[
- List[
- Literal[
- "ddos_l4",
- "ddos_l7",
- "http_config_settings",
- "http_custom_errors",
- "http_log_custom_fields",
- "http_ratelimit",
- "http_request_cache_settings",
- "http_request_dynamic_redirect",
- "http_request_firewall_custom",
- "http_request_firewall_managed",
- "http_request_late_transform",
- "http_request_origin",
- "http_request_redirect",
- "http_request_sanitize",
- "http_request_sbfm",
- "http_request_select_configuration",
- "http_request_transform",
- "http_response_compression",
- "http_response_firewall_managed",
- "http_response_headers_transform",
- "magic_transit",
- "magic_transit_ids_managed",
- "magic_transit_managed",
- ]
- ]
- ] = None
- """A list of phases to skip the execution of.
-
- This option is incompatible with the ruleset and rulesets options.
- """
-
- products: Optional[
- List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]]
- ] = None
- """A list of legacy security products to skip the execution of."""
-
- rules: Optional[Dict[str, List[str]]] = None
- """
- A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the
- execution of. This option is incompatible with the ruleset option.
- """
-
- ruleset: Optional[Literal["current"]] = None
- """A ruleset to skip the execution of.
-
- This option is incompatible with the rulesets, rules and phases options.
- """
-
- rulesets: Optional[List[str]] = None
- """A list of ruleset IDs to skip the execution of.
-
- This option is incompatible with the ruleset and phases options.
- """
-
-
-class RuleRulesetsSkipRule(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["skip"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSkipRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule]
+__all__ = ["VersionGetResponse"]
class VersionGetResponse(BaseModel):
@@ -360,7 +50,7 @@ class VersionGetResponse(BaseModel):
]
"""The phase of the ruleset."""
- rules: List[Rule]
+ rules: List[RequestRule]
"""The list of rules in the ruleset."""
version: str
diff --git a/src/cloudflare/types/rulesets/version_list_response.py b/src/cloudflare/types/rulesets/version_list_response.py
deleted file mode 100644
index dd14aeee32a..00000000000
--- a/src/cloudflare/types/rulesets/version_list_response.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Optional
-from datetime import datetime
-from typing_extensions import Literal
-
-from ..._models import BaseModel
-
-__all__ = ["VersionListResponse"]
-
-
-class VersionListResponse(BaseModel):
- kind: Literal["managed", "custom", "root", "zone"]
- """The kind of the ruleset."""
-
- name: str
- """The human-readable name of the ruleset."""
-
- phase: Literal[
- "ddos_l4",
- "ddos_l7",
- "http_config_settings",
- "http_custom_errors",
- "http_log_custom_fields",
- "http_ratelimit",
- "http_request_cache_settings",
- "http_request_dynamic_redirect",
- "http_request_firewall_custom",
- "http_request_firewall_managed",
- "http_request_late_transform",
- "http_request_origin",
- "http_request_redirect",
- "http_request_sanitize",
- "http_request_sbfm",
- "http_request_select_configuration",
- "http_request_transform",
- "http_response_compression",
- "http_response_firewall_managed",
- "http_response_headers_transform",
- "magic_transit",
- "magic_transit_ids_managed",
- "magic_transit_managed",
- ]
- """The phase of the ruleset."""
-
- id: Optional[str] = None
- """The unique ID of the ruleset."""
-
- description: Optional[str] = None
- """An informative description of the ruleset."""
-
- last_updated: Optional[datetime] = None
- """The timestamp of when the ruleset was last modified."""
-
- version: Optional[str] = None
- """The version of the ruleset."""
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 1e8f04fc00a..dbe66c2305e 100644
--- a/src/cloudflare/types/rulesets/versions/by_tag_get_response.py
+++ b/src/cloudflare/types/rulesets/versions/by_tag_get_response.py
@@ -1,323 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Dict, List, Union, Optional
+from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal
-from ...shared import UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
from ...._models import BaseModel
+from ...request_rule import RequestRule
-__all__ = [
- "ByTagGetResponse",
- "Rule",
- "RuleRulesetsBlockRule",
- "RuleRulesetsBlockRuleActionParameters",
- "RuleRulesetsBlockRuleActionParametersResponse",
- "RuleRulesetsExecuteRule",
- "RuleRulesetsExecuteRuleActionParameters",
- "RuleRulesetsExecuteRuleActionParametersMatchedData",
- "RuleRulesetsExecuteRuleActionParametersOverrides",
- "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
- "RuleRulesetsExecuteRuleActionParametersOverridesRule",
- "RuleRulesetsLogRule",
- "RuleRulesetsSkipRule",
- "RuleRulesetsSkipRuleActionParameters",
-]
-
-
-class RuleRulesetsBlockRuleActionParametersResponse(BaseModel):
- content: str
- """The content to return."""
-
- content_type: str
- """The type of the content to return."""
-
- status_code: int
- """The status code to return."""
-
-
-class RuleRulesetsBlockRuleActionParameters(BaseModel):
- response: Optional[RuleRulesetsBlockRuleActionParametersResponse] = None
- """The response to show when the block is applied."""
-
-
-class RuleRulesetsBlockRule(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["block"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsBlockRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsExecuteRuleActionParametersMatchedData(BaseModel):
- public_key: str
- """The public key to encrypt matched data logs with."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesCategory(BaseModel):
- category: str
- """The name of the category to override."""
-
- action: Optional[str] = None
- """The action to override rules in the category with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of rules in the category."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for rules in the category."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverridesRule(BaseModel):
- id: str
- """The ID of the rule to override."""
-
- action: Optional[str] = None
- """The action to override the rule with."""
-
- enabled: Optional[bool] = None
- """Whether to enable execution of the rule."""
-
- score_threshold: Optional[int] = None
- """The score threshold to use for the rule."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """The sensitivity level to use for the rule."""
-
-
-class RuleRulesetsExecuteRuleActionParametersOverrides(BaseModel):
- action: Optional[str] = None
- """An action to override all rules with.
-
- This option has lower precedence than rule and category overrides.
- """
-
- categories: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesCategory]] = None
- """A list of category-level overrides.
-
- This option has the second-highest precedence after rule-level overrides.
- """
-
- enabled: Optional[bool] = None
- """Whether to enable execution of all rules.
-
- This option has lower precedence than rule and category overrides.
- """
-
- rules: Optional[List[RuleRulesetsExecuteRuleActionParametersOverridesRule]] = None
- """A list of rule-level overrides. This option has the highest precedence."""
-
- sensitivity_level: Optional[Literal["default", "medium", "low", "eoff"]] = None
- """A sensitivity level to set for all rules.
-
- This option has lower precedence than rule and category overrides and is only
- applicable for DDoS phases.
- """
-
-
-class RuleRulesetsExecuteRuleActionParameters(BaseModel):
- id: str
- """The ID of the ruleset to execute."""
-
- matched_data: Optional[RuleRulesetsExecuteRuleActionParametersMatchedData] = None
- """The configuration to use for matched data logging."""
-
- overrides: Optional[RuleRulesetsExecuteRuleActionParametersOverrides] = None
- """A set of overrides to apply to the target ruleset."""
-
-
-class RuleRulesetsExecuteRule(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["execute"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsExecuteRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsLogRule(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["log"]] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-class RuleRulesetsSkipRuleActionParameters(BaseModel):
- phases: Optional[
- List[
- Literal[
- "ddos_l4",
- "ddos_l7",
- "http_config_settings",
- "http_custom_errors",
- "http_log_custom_fields",
- "http_ratelimit",
- "http_request_cache_settings",
- "http_request_dynamic_redirect",
- "http_request_firewall_custom",
- "http_request_firewall_managed",
- "http_request_late_transform",
- "http_request_origin",
- "http_request_redirect",
- "http_request_sanitize",
- "http_request_sbfm",
- "http_request_select_configuration",
- "http_request_transform",
- "http_response_compression",
- "http_response_firewall_managed",
- "http_response_headers_transform",
- "magic_transit",
- "magic_transit_ids_managed",
- "magic_transit_managed",
- ]
- ]
- ] = None
- """A list of phases to skip the execution of.
-
- This option is incompatible with the ruleset and rulesets options.
- """
-
- products: Optional[
- List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]]
- ] = None
- """A list of legacy security products to skip the execution of."""
-
- rules: Optional[Dict[str, List[str]]] = None
- """
- A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the
- execution of. This option is incompatible with the ruleset option.
- """
-
- ruleset: Optional[Literal["current"]] = None
- """A ruleset to skip the execution of.
-
- This option is incompatible with the rulesets, rules and phases options.
- """
-
- rulesets: Optional[List[str]] = None
- """A list of ruleset IDs to skip the execution of.
-
- This option is incompatible with the ruleset and phases options.
- """
-
-
-class RuleRulesetsSkipRule(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["skip"]] = None
- """The action to perform when the rule matches."""
-
- action_parameters: Optional[RuleRulesetsSkipRuleActionParameters] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = None
- """An object configuring the rule's logging behavior."""
-
- ref: Optional[str] = None
- """The reference of the rule (the rule ID by default)."""
-
-
-Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule]
+__all__ = ["ByTagGetResponse"]
class ByTagGetResponse(BaseModel):
@@ -360,7 +50,7 @@ class ByTagGetResponse(BaseModel):
]
"""The phase of the ruleset."""
- rules: List[Rule]
+ rules: List[RequestRule]
"""The list of rules in the ruleset."""
version: str
diff --git a/src/cloudflare/types/skip_rule.py b/src/cloudflare/types/skip_rule.py
new file mode 100644
index 00000000000..a5992d766e6
--- /dev/null
+++ b/src/cloudflare/types/skip_rule.py
@@ -0,0 +1,104 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, List, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .shared import UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
+from .._models import BaseModel
+
+__all__ = ["SkipRule", "ActionParameters"]
+
+
+class ActionParameters(BaseModel):
+ phases: Optional[
+ List[
+ Literal[
+ "ddos_l4",
+ "ddos_l7",
+ "http_config_settings",
+ "http_custom_errors",
+ "http_log_custom_fields",
+ "http_ratelimit",
+ "http_request_cache_settings",
+ "http_request_dynamic_redirect",
+ "http_request_firewall_custom",
+ "http_request_firewall_managed",
+ "http_request_late_transform",
+ "http_request_origin",
+ "http_request_redirect",
+ "http_request_sanitize",
+ "http_request_sbfm",
+ "http_request_select_configuration",
+ "http_request_transform",
+ "http_response_compression",
+ "http_response_firewall_managed",
+ "http_response_headers_transform",
+ "magic_transit",
+ "magic_transit_ids_managed",
+ "magic_transit_managed",
+ ]
+ ]
+ ] = None
+ """A list of phases to skip the execution of.
+
+ This option is incompatible with the ruleset and rulesets options.
+ """
+
+ products: Optional[
+ List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]]
+ ] = None
+ """A list of legacy security products to skip the execution of."""
+
+ rules: Optional[Dict[str, List[str]]] = None
+ """
+ A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the
+ execution of. This option is incompatible with the ruleset option.
+ """
+
+ ruleset: Optional[Literal["current"]] = None
+ """A ruleset to skip the execution of.
+
+ This option is incompatible with the rulesets, rules and phases options.
+ """
+
+ rulesets: Optional[List[str]] = None
+ """A list of ruleset IDs to skip the execution of.
+
+ This option is incompatible with the ruleset and phases options.
+ """
+
+
+class SkipRule(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["skip"]] = 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[UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c] = 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/skip_rule_param.py b/src/cloudflare/types/skip_rule_param.py
new file mode 100644
index 00000000000..6e470369cfc
--- /dev/null
+++ b/src/cloudflare/types/skip_rule_param.py
@@ -0,0 +1,91 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Dict, List
+from typing_extensions import Literal, TypedDict
+
+from ..types import shared_params
+
+__all__ = ["SkipRuleParam", "ActionParameters"]
+
+
+class ActionParameters(TypedDict, total=False):
+ phases: List[
+ Literal[
+ "ddos_l4",
+ "ddos_l7",
+ "http_config_settings",
+ "http_custom_errors",
+ "http_log_custom_fields",
+ "http_ratelimit",
+ "http_request_cache_settings",
+ "http_request_dynamic_redirect",
+ "http_request_firewall_custom",
+ "http_request_firewall_managed",
+ "http_request_late_transform",
+ "http_request_origin",
+ "http_request_redirect",
+ "http_request_sanitize",
+ "http_request_sbfm",
+ "http_request_select_configuration",
+ "http_request_transform",
+ "http_response_compression",
+ "http_response_firewall_managed",
+ "http_response_headers_transform",
+ "magic_transit",
+ "magic_transit_ids_managed",
+ "magic_transit_managed",
+ ]
+ ]
+ """A list of phases to skip the execution of.
+
+ This option is incompatible with the ruleset and rulesets options.
+ """
+
+ products: List[Literal["bic", "hot", "rateLimit", "securityLevel", "uaBlock", "waf", "zoneLockdown"]]
+ """A list of legacy security products to skip the execution of."""
+
+ rules: Dict[str, List[str]]
+ """
+ A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the
+ execution of. This option is incompatible with the ruleset option.
+ """
+
+ ruleset: Literal["current"]
+ """A ruleset to skip the execution of.
+
+ This option is incompatible with the rulesets, rules and phases options.
+ """
+
+ rulesets: List[str]
+ """A list of ruleset IDs to skip the execution of.
+
+ This option is incompatible with the ruleset and phases options.
+ """
+
+
+class SkipRuleParam(TypedDict, total=False):
+ id: str
+ """The unique ID of the rule."""
+
+ action: Literal["skip"]
+ """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: shared_params.UnnamedSchemaRef70f2c6ccd8a405358ac7ef8fc3d6751c
+ """An object configuring the rule's logging behavior."""
+
+ ref: str
+ """The reference of the rule (the rule ID by default)."""
diff --git a/tests/api_resources/rulesets/phases/test_versions.py b/tests/api_resources/rulesets/phases/test_versions.py
index 30cf0c1c956..10a67ea158d 100644
--- a/tests/api_resources/rulesets/phases/test_versions.py
+++ b/tests/api_resources/rulesets/phases/test_versions.py
@@ -9,8 +9,9 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
+from cloudflare.types import Ruleset
from cloudflare.pagination import SyncSinglePage, AsyncSinglePage
-from cloudflare.types.rulesets.phases import VersionGetResponse, VersionListResponse
+from cloudflare.types.rulesets.phases import VersionGetResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -26,7 +27,7 @@ def test_method_list(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"])
+ assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -36,7 +37,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"])
+ assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -50,7 +51,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = response.parse()
- assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"])
+ assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -64,7 +65,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = response.parse()
- assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"])
+ assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -178,7 +179,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"])
+ assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -188,7 +189,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare)
account_id="string",
zone_id="string",
)
- assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"])
+ assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -202,7 +203,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = await response.parse()
- assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"])
+ assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -216,7 +217,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = await response.parse()
- assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"])
+ assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"])
assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/rulesets/test_versions.py b/tests/api_resources/rulesets/test_versions.py
index 4a13069254f..ea9adbc6714 100644
--- a/tests/api_resources/rulesets/test_versions.py
+++ b/tests/api_resources/rulesets/test_versions.py
@@ -9,8 +9,9 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
+from cloudflare.types import Ruleset
from cloudflare.pagination import SyncSinglePage, AsyncSinglePage
-from cloudflare.types.rulesets import VersionGetResponse, VersionListResponse
+from cloudflare.types.rulesets import VersionGetResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -26,7 +27,7 @@ def test_method_list(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"])
+ assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -36,7 +37,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"])
+ assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -50,7 +51,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = response.parse()
- assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"])
+ assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -64,7 +65,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = response.parse()
- assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"])
+ assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -282,7 +283,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"])
+ assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -292,7 +293,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare)
account_id="string",
zone_id="string",
)
- assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"])
+ assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -306,7 +307,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = await response.parse()
- assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"])
+ assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -320,7 +321,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = await response.parse()
- assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"])
+ assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"])
assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/test_rulesets.py b/tests/api_resources/test_rulesets.py
index cf80d2a183c..19e9f3e75d0 100644
--- a/tests/api_resources/test_rulesets.py
+++ b/tests/api_resources/test_rulesets.py
@@ -10,8 +10,8 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
from cloudflare.types import (
+ Ruleset,
RulesetGetResponse,
- RulesetListResponse,
RulesetCreateResponse,
RulesetUpdateResponse,
)
@@ -299,7 +299,7 @@ def test_method_list(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"])
+ assert_matches_type(SyncSinglePage[Ruleset], ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -308,7 +308,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"])
+ assert_matches_type(SyncSinglePage[Ruleset], ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -321,7 +321,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
ruleset = response.parse()
- assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"])
+ assert_matches_type(SyncSinglePage[Ruleset], ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -334,7 +334,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
ruleset = response.parse()
- assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"])
+ assert_matches_type(SyncSinglePage[Ruleset], ruleset, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -781,7 +781,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"])
+ assert_matches_type(AsyncSinglePage[Ruleset], ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -790,7 +790,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare)
account_id="string",
zone_id="string",
)
- assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"])
+ assert_matches_type(AsyncSinglePage[Ruleset], ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -803,7 +803,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
ruleset = await response.parse()
- assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"])
+ assert_matches_type(AsyncSinglePage[Ruleset], ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -816,7 +816,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
ruleset = await response.parse()
- assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"])
+ assert_matches_type(AsyncSinglePage[Ruleset], ruleset, path=["response"])
assert cast(Any, response.is_closed) is True