diff --git a/api.md b/api.md
index 479c140dede1..e31f710a2b7c 100644
--- a/api.md
+++ b/api.md
@@ -3070,64 +3070,87 @@ Methods:
Types:
```python
-from cloudflare.types import Ruleset, RulesetListResponse
+from cloudflare.types import (
+ RulesetCreateResponse,
+ RulesetUpdateResponse,
+ RulesetListResponse,
+ RulesetGetResponse,
+)
```
Methods:
-- client.rulesets.create(\*, account_id, zone_id, \*\*params) -> Ruleset
-- client.rulesets.update(ruleset_id, \*, account_id, zone_id, \*\*params) -> Ruleset
+- 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.delete(ruleset_id, \*, account_id, zone_id) -> None
-- client.rulesets.get(ruleset_id, \*, account_id, zone_id) -> Ruleset
+- client.rulesets.get(ruleset_id, \*, account_id, zone_id) -> RulesetGetResponse
## Phases
+Types:
+
+```python
+from cloudflare.types.rulesets import PhaseUpdateResponse, PhaseGetResponse
+```
+
Methods:
-- client.rulesets.phases.update(ruleset_phase, \*, account_id, zone_id, \*\*params) -> Ruleset
-- client.rulesets.phases.get(ruleset_phase, \*, account_id, zone_id) -> Ruleset
+- client.rulesets.phases.update(ruleset_phase, \*, account_id, zone_id, \*\*params) -> PhaseUpdateResponse
+- client.rulesets.phases.get(ruleset_phase, \*, account_id, zone_id) -> PhaseGetResponse
### Versions
Types:
```python
-from cloudflare.types.rulesets.phases import VersionListResponse
+from cloudflare.types.rulesets.phases import VersionListResponse, VersionGetResponse
```
Methods:
- client.rulesets.phases.versions.list(ruleset_phase, \*, account_id, zone_id) -> SyncSinglePage[VersionListResponse]
-- client.rulesets.phases.versions.get(ruleset_version, \*, ruleset_phase, account_id, zone_id) -> Ruleset
+- client.rulesets.phases.versions.get(ruleset_version, \*, ruleset_phase, account_id, zone_id) -> VersionGetResponse
## Rules
+Types:
+
+```python
+from cloudflare.types.rulesets import RuleCreateResponse, RuleDeleteResponse, RuleEditResponse
+```
+
Methods:
-- client.rulesets.rules.create(ruleset_id, \*, account_id, zone_id, \*\*params) -> Ruleset
-- client.rulesets.rules.delete(rule_id, \*, ruleset_id, account_id, zone_id) -> Ruleset
-- client.rulesets.rules.edit(rule_id, \*, ruleset_id, account_id, zone_id, \*\*params) -> Ruleset
+- client.rulesets.rules.create(ruleset_id, \*, account_id, zone_id, \*\*params) -> RuleCreateResponse
+- client.rulesets.rules.delete(rule_id, \*, ruleset_id, account_id, zone_id) -> RuleDeleteResponse
+- client.rulesets.rules.edit(rule_id, \*, ruleset_id, account_id, zone_id, \*\*params) -> RuleEditResponse
## Versions
Types:
```python
-from cloudflare.types.rulesets import VersionListResponse
+from cloudflare.types.rulesets import VersionListResponse, VersionGetResponse
```
Methods:
- client.rulesets.versions.list(ruleset_id, \*, account_id, zone_id) -> SyncSinglePage[VersionListResponse]
- 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) -> Ruleset
+- client.rulesets.versions.get(ruleset_version, \*, ruleset_id, account_id, zone_id) -> VersionGetResponse
### ByTag
+Types:
+
+```python
+from cloudflare.types.rulesets.versions import ByTagGetResponse
+```
+
Methods:
-- client.rulesets.versions.by_tag.get(rule_tag, \*, account_id, ruleset_id, ruleset_version) -> Ruleset
+- client.rulesets.versions.by_tag.get(rule_tag, \*, account_id, ruleset_id, ruleset_version) -> ByTagGetResponse
# URLNormalization
diff --git a/src/cloudflare/resources/rulesets/phases/phases.py b/src/cloudflare/resources/rulesets/phases/phases.py
index f1098a71bff1..cc59c4d3d6f8 100644
--- a/src/cloudflare/resources/rulesets/phases/phases.py
+++ b/src/cloudflare/resources/rulesets/phases/phases.py
@@ -7,7 +7,6 @@
import httpx
-from ....types import Ruleset
from .versions import (
Versions,
AsyncVersions,
@@ -33,7 +32,7 @@
from ...._base_client import (
make_request_options,
)
-from ....types.rulesets import phase_update_params
+from ....types.rulesets import PhaseGetResponse, PhaseUpdateResponse, phase_update_params
__all__ = ["Phases", "AsyncPhases"]
@@ -79,7 +78,6 @@ def update(
"magic_transit_managed",
],
*,
- id: str,
rules: Iterable[phase_update_params.Rule],
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
@@ -118,15 +116,13 @@ def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> PhaseUpdateResponse:
"""
Updates an account or zone entry point ruleset, creating a new version.
Args:
ruleset_phase: The phase of the ruleset.
- id: The unique ID of the ruleset.
-
rules: The list of rules in the ruleset.
account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
@@ -170,7 +166,6 @@ def update(
f"/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint",
body=maybe_transform(
{
- "id": id,
"rules": rules,
"description": description,
"kind": kind,
@@ -186,7 +181,7 @@ def update(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[PhaseUpdateResponse], ResultWrapper[PhaseUpdateResponse]),
)
def get(
@@ -225,7 +220,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> PhaseGetResponse:
"""
Fetches the latest version of the account or zone entry point ruleset for a
given phase.
@@ -271,7 +266,7 @@ def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[PhaseGetResponse], ResultWrapper[PhaseGetResponse]),
)
@@ -316,7 +311,6 @@ async def update(
"magic_transit_managed",
],
*,
- id: str,
rules: Iterable[phase_update_params.Rule],
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
@@ -355,15 +349,13 @@ async def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> PhaseUpdateResponse:
"""
Updates an account or zone entry point ruleset, creating a new version.
Args:
ruleset_phase: The phase of the ruleset.
- id: The unique ID of the ruleset.
-
rules: The list of rules in the ruleset.
account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
@@ -407,7 +399,6 @@ async def update(
f"/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint",
body=await async_maybe_transform(
{
- "id": id,
"rules": rules,
"description": description,
"kind": kind,
@@ -423,7 +414,7 @@ async def update(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[PhaseUpdateResponse], ResultWrapper[PhaseUpdateResponse]),
)
async def get(
@@ -462,7 +453,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> PhaseGetResponse:
"""
Fetches the latest version of the account or zone entry point ruleset for a
given phase.
@@ -508,7 +499,7 @@ async def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[PhaseGetResponse], ResultWrapper[PhaseGetResponse]),
)
diff --git a/src/cloudflare/resources/rulesets/phases/versions.py b/src/cloudflare/resources/rulesets/phases/versions.py
index 6dbbb398f8c7..ad6fc7cb5455 100644
--- a/src/cloudflare/resources/rulesets/phases/versions.py
+++ b/src/cloudflare/resources/rulesets/phases/versions.py
@@ -7,7 +7,6 @@
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
@@ -23,7 +22,7 @@
AsyncPaginator,
make_request_options,
)
-from ....types.rulesets.phases import VersionListResponse
+from ....types.rulesets.phases import VersionGetResponse, VersionListResponse
__all__ = ["Versions", "AsyncVersions"]
@@ -155,7 +154,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> VersionGetResponse:
"""
Fetches a specific version of an account or zone entry point ruleset.
@@ -204,7 +203,7 @@ def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[VersionGetResponse], ResultWrapper[VersionGetResponse]),
)
@@ -335,7 +334,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> VersionGetResponse:
"""
Fetches a specific version of an account or zone entry point ruleset.
@@ -384,7 +383,7 @@ async def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[VersionGetResponse], ResultWrapper[VersionGetResponse]),
)
diff --git a/src/cloudflare/resources/rulesets/rules.py b/src/cloudflare/resources/rulesets/rules.py
index d9135563a66c..9e2f16abaaeb 100644
--- a/src/cloudflare/resources/rulesets/rules.py
+++ b/src/cloudflare/resources/rulesets/rules.py
@@ -7,7 +7,6 @@
import httpx
-from ...types import Ruleset
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._utils import (
required_args,
@@ -26,7 +25,13 @@
from ..._base_client import (
make_request_options,
)
-from ...types.rulesets import rule_edit_params, rule_create_params
+from ...types.rulesets import (
+ RuleEditResponse,
+ RuleCreateResponse,
+ RuleDeleteResponse,
+ rule_edit_params,
+ rule_create_params,
+)
__all__ = ["Rules", "AsyncRules"]
@@ -61,7 +66,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleCreateResponse:
"""Adds a new rule to an account or zone ruleset.
The rule will be added to the end
@@ -121,7 +126,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleCreateResponse:
"""Adds a new rule to an account or zone ruleset.
The rule will be added to the end
@@ -181,7 +186,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleCreateResponse:
"""Adds a new rule to an account or zone ruleset.
The rule will be added to the end
@@ -241,7 +246,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleCreateResponse:
"""Adds a new rule to an account or zone ruleset.
The rule will be added to the end
@@ -304,7 +309,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleCreateResponse:
if not ruleset_id:
raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}")
if not account_id:
@@ -344,7 +349,7 @@ def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[RuleCreateResponse], ResultWrapper[RuleCreateResponse]),
)
def delete(
@@ -360,7 +365,7 @@ def delete(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleDeleteResponse:
"""
Deletes an existing rule from an account or zone ruleset.
@@ -409,7 +414,7 @@ def delete(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[RuleDeleteResponse], ResultWrapper[RuleDeleteResponse]),
)
@overload
@@ -434,7 +439,7 @@ def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleEditResponse:
"""
Updates an existing rule in an account or zone ruleset.
@@ -495,7 +500,7 @@ def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleEditResponse:
"""
Updates an existing rule in an account or zone ruleset.
@@ -556,7 +561,7 @@ def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleEditResponse:
"""
Updates an existing rule in an account or zone ruleset.
@@ -617,7 +622,7 @@ def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleEditResponse:
"""
Updates an existing rule in an account or zone ruleset.
@@ -682,7 +687,7 @@ def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleEditResponse:
if not ruleset_id:
raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}")
if not rule_id:
@@ -724,7 +729,7 @@ def edit(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[RuleEditResponse], ResultWrapper[RuleEditResponse]),
)
@@ -758,7 +763,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleCreateResponse:
"""Adds a new rule to an account or zone ruleset.
The rule will be added to the end
@@ -818,7 +823,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleCreateResponse:
"""Adds a new rule to an account or zone ruleset.
The rule will be added to the end
@@ -878,7 +883,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleCreateResponse:
"""Adds a new rule to an account or zone ruleset.
The rule will be added to the end
@@ -938,7 +943,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleCreateResponse:
"""Adds a new rule to an account or zone ruleset.
The rule will be added to the end
@@ -1001,7 +1006,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleCreateResponse:
if not ruleset_id:
raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}")
if not account_id:
@@ -1041,7 +1046,7 @@ async def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[RuleCreateResponse], ResultWrapper[RuleCreateResponse]),
)
async def delete(
@@ -1057,7 +1062,7 @@ async def delete(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleDeleteResponse:
"""
Deletes an existing rule from an account or zone ruleset.
@@ -1106,7 +1111,7 @@ async def delete(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[RuleDeleteResponse], ResultWrapper[RuleDeleteResponse]),
)
@overload
@@ -1131,7 +1136,7 @@ async def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleEditResponse:
"""
Updates an existing rule in an account or zone ruleset.
@@ -1192,7 +1197,7 @@ async def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleEditResponse:
"""
Updates an existing rule in an account or zone ruleset.
@@ -1253,7 +1258,7 @@ async def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleEditResponse:
"""
Updates an existing rule in an account or zone ruleset.
@@ -1314,7 +1319,7 @@ async def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleEditResponse:
"""
Updates an existing rule in an account or zone ruleset.
@@ -1379,7 +1384,7 @@ async def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RuleEditResponse:
if not ruleset_id:
raise ValueError(f"Expected a non-empty value for `ruleset_id` but received {ruleset_id!r}")
if not rule_id:
@@ -1421,7 +1426,7 @@ async def edit(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[RuleEditResponse], ResultWrapper[RuleEditResponse]),
)
diff --git a/src/cloudflare/resources/rulesets/rulesets.py b/src/cloudflare/resources/rulesets/rulesets.py
index f57071173b46..c8a59a3ff07b 100644
--- a/src/cloudflare/resources/rulesets/rulesets.py
+++ b/src/cloudflare/resources/rulesets/rulesets.py
@@ -23,7 +23,14 @@
PhasesWithStreamingResponse,
AsyncPhasesWithStreamingResponse,
)
-from ...types import Ruleset, RulesetListResponse, ruleset_create_params, ruleset_update_params
+from ...types import (
+ RulesetGetResponse,
+ RulesetListResponse,
+ RulesetCreateResponse,
+ RulesetUpdateResponse,
+ ruleset_create_params,
+ ruleset_update_params,
+)
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
from ..._utils import (
maybe_transform,
@@ -118,7 +125,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RulesetCreateResponse:
"""
Creates a ruleset.
@@ -179,14 +186,13 @@ def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[RulesetCreateResponse], ResultWrapper[RulesetCreateResponse]),
)
def update(
self,
ruleset_id: str,
*,
- id: str,
rules: Iterable[ruleset_update_params.Rule],
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
@@ -225,15 +231,13 @@ def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RulesetUpdateResponse:
"""
Updates an account or zone ruleset, creating a new version.
Args:
ruleset_id: The unique ID of the ruleset.
- id: The unique ID of the ruleset.
-
rules: The list of rules in the ruleset.
account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
@@ -277,7 +281,6 @@ def update(
f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}",
body=maybe_transform(
{
- "id": id,
"rules": rules,
"description": description,
"kind": kind,
@@ -293,7 +296,7 @@ def update(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[RulesetUpdateResponse], ResultWrapper[RulesetUpdateResponse]),
)
def list(
@@ -417,7 +420,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RulesetGetResponse:
"""
Fetches the latest version of an account or zone ruleset.
@@ -462,7 +465,7 @@ def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[RulesetGetResponse], ResultWrapper[RulesetGetResponse]),
)
@@ -527,7 +530,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RulesetCreateResponse:
"""
Creates a ruleset.
@@ -588,14 +591,13 @@ async def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[RulesetCreateResponse], ResultWrapper[RulesetCreateResponse]),
)
async def update(
self,
ruleset_id: str,
*,
- id: str,
rules: Iterable[ruleset_update_params.Rule],
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
@@ -634,15 +636,13 @@ async def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RulesetUpdateResponse:
"""
Updates an account or zone ruleset, creating a new version.
Args:
ruleset_id: The unique ID of the ruleset.
- id: The unique ID of the ruleset.
-
rules: The list of rules in the ruleset.
account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
@@ -686,7 +686,6 @@ async def update(
f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}",
body=await async_maybe_transform(
{
- "id": id,
"rules": rules,
"description": description,
"kind": kind,
@@ -702,7 +701,7 @@ async def update(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[RulesetUpdateResponse], ResultWrapper[RulesetUpdateResponse]),
)
def list(
@@ -826,7 +825,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> RulesetGetResponse:
"""
Fetches the latest version of an account or zone ruleset.
@@ -871,7 +870,7 @@ async def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[RulesetGetResponse], ResultWrapper[RulesetGetResponse]),
)
diff --git a/src/cloudflare/resources/rulesets/versions/by_tag.py b/src/cloudflare/resources/rulesets/versions/by_tag.py
index 227d92f4b377..9e444df59345 100644
--- a/src/cloudflare/resources/rulesets/versions/by_tag.py
+++ b/src/cloudflare/resources/rulesets/versions/by_tag.py
@@ -6,7 +6,6 @@
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
@@ -20,6 +19,7 @@
from ...._base_client import (
make_request_options,
)
+from ....types.rulesets.versions import ByTagGetResponse
__all__ = ["ByTag", "AsyncByTag"]
@@ -46,7 +46,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> ByTagGetResponse:
"""
Fetches the rules of a managed account ruleset version for a given tag.
@@ -84,7 +84,7 @@ def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[ByTagGetResponse], ResultWrapper[ByTagGetResponse]),
)
@@ -110,7 +110,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> ByTagGetResponse:
"""
Fetches the rules of a managed account ruleset version for a given tag.
@@ -148,7 +148,7 @@ async def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[ByTagGetResponse], ResultWrapper[ByTagGetResponse]),
)
diff --git a/src/cloudflare/resources/rulesets/versions/versions.py b/src/cloudflare/resources/rulesets/versions/versions.py
index 70590d820222..284a7cc4b389 100644
--- a/src/cloudflare/resources/rulesets/versions/versions.py
+++ b/src/cloudflare/resources/rulesets/versions/versions.py
@@ -14,7 +14,6 @@
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
@@ -30,7 +29,7 @@
AsyncPaginator,
make_request_options,
)
-from ....types.rulesets import VersionListResponse
+from ....types.rulesets import VersionGetResponse, VersionListResponse
__all__ = ["Versions", "AsyncVersions"]
@@ -180,7 +179,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> VersionGetResponse:
"""
Fetches a specific version of an account or zone ruleset.
@@ -229,7 +228,7 @@ def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[VersionGetResponse], ResultWrapper[VersionGetResponse]),
)
@@ -378,7 +377,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Ruleset:
+ ) -> VersionGetResponse:
"""
Fetches a specific version of an account or zone ruleset.
@@ -427,7 +426,7 @@ async def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Ruleset], ResultWrapper[Ruleset]),
+ cast_to=cast(Type[VersionGetResponse], ResultWrapper[VersionGetResponse]),
)
diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py
index 9d99cc14a2a1..5ce6fda8715c 100644
--- a/src/cloudflare/types/__init__.py
+++ b/src/cloudflare/types/__init__.py
@@ -7,7 +7,6 @@
from .dnssec import DNSSEC as DNSSEC
from .shared import ErrorData as ErrorData
from .account import Account as Account
-from .ruleset import Ruleset as Ruleset
from .snippet import Snippet as Snippet
from .calls_app import CallsApp as CallsApp
from .membership import Membership as Membership
@@ -56,6 +55,7 @@
from .pagerule_edit_params import PageruleEditParams as PageruleEditParams
from .pagerule_list_params import PageruleListParams as PageruleListParams
from .pcap_create_response import PCAPCreateResponse as PCAPCreateResponse
+from .ruleset_get_response import RulesetGetResponse as RulesetGetResponse
from .zone_delete_response import ZoneDeleteResponse as ZoneDeleteResponse
from .account_update_params import AccountUpdateParams as AccountUpdateParams
from .audit_log_list_params import AuditLogListParams as AuditLogListParams
@@ -87,6 +87,8 @@
from .membership_get_response import MembershipGetResponse as MembershipGetResponse
from .mtls_certificate_update import MTLSCertificateUpdate as MTLSCertificateUpdate
from .rate_limit_get_response import RateLimitGetResponse as RateLimitGetResponse
+from .ruleset_create_response import RulesetCreateResponse as RulesetCreateResponse
+from .ruleset_update_response import RulesetUpdateResponse as RulesetUpdateResponse
from .snippet_delete_response import SnippetDeleteResponse as SnippetDeleteResponse
from .url_scanner_scan_params import URLScannerScanParams as URLScannerScanParams
from .membership_update_params import MembershipUpdateParams as MembershipUpdateParams
diff --git a/src/cloudflare/types/ruleset_create_response.py b/src/cloudflare/types/ruleset_create_response.py
new file mode 100644
index 000000000000..94bbc5b1382d
--- /dev/null
+++ b/src/cloudflare/types/ruleset_create_response.py
@@ -0,0 +1,393 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, List, Union, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = [
+ "RulesetCreateResponse",
+ "Rule",
+ "RuleRulesetsBlockRule",
+ "RuleRulesetsBlockRuleActionParameters",
+ "RuleRulesetsBlockRuleActionParametersResponse",
+ "RuleRulesetsBlockRuleLogging",
+ "RuleRulesetsExecuteRule",
+ "RuleRulesetsExecuteRuleActionParameters",
+ "RuleRulesetsExecuteRuleActionParametersMatchedData",
+ "RuleRulesetsExecuteRuleActionParametersOverrides",
+ "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
+ "RuleRulesetsExecuteRuleActionParametersOverridesRule",
+ "RuleRulesetsExecuteRuleLogging",
+ "RuleRulesetsLogRule",
+ "RuleRulesetsLogRuleLogging",
+ "RuleRulesetsSkipRule",
+ "RuleRulesetsSkipRuleActionParameters",
+ "RuleRulesetsSkipRuleLogging",
+]
+
+
+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 RuleRulesetsBlockRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsBlockRuleLogging] = 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 RuleRulesetsExecuteRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsExecuteRuleLogging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
+
+
+class RuleRulesetsLogRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsLogRuleLogging] = 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 RuleRulesetsSkipRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsSkipRuleLogging] = 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]
+
+
+class RulesetCreateResponse(BaseModel):
+ id: str
+ """The unique ID of the ruleset."""
+
+ kind: Literal["managed", "custom", "root", "zone"]
+ """The kind of the ruleset."""
+
+ last_updated: datetime
+ """The timestamp of when the ruleset was last modified."""
+
+ 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."""
+
+ rules: List[Rule]
+ """The list of rules in the ruleset."""
+
+ version: str
+ """The version of the ruleset."""
+
+ description: Optional[str] = None
+ """An informative description of the ruleset."""
diff --git a/src/cloudflare/types/ruleset.py b/src/cloudflare/types/ruleset_get_response.py
similarity index 99%
rename from src/cloudflare/types/ruleset.py
rename to src/cloudflare/types/ruleset_get_response.py
index 5bc71c6f377d..4a2f5a59ce89 100644
--- a/src/cloudflare/types/ruleset.py
+++ b/src/cloudflare/types/ruleset_get_response.py
@@ -7,7 +7,7 @@
from .._models import BaseModel
__all__ = [
- "Ruleset",
+ "RulesetGetResponse",
"Rule",
"RuleRulesetsBlockRule",
"RuleRulesetsBlockRuleActionParameters",
@@ -343,7 +343,7 @@ class RuleRulesetsSkipRule(BaseModel):
Rule = Union[RuleRulesetsBlockRule, RuleRulesetsExecuteRule, RuleRulesetsLogRule, RuleRulesetsSkipRule]
-class Ruleset(BaseModel):
+class RulesetGetResponse(BaseModel):
id: str
"""The unique ID of the ruleset."""
diff --git a/src/cloudflare/types/ruleset_update_params.py b/src/cloudflare/types/ruleset_update_params.py
index e77ba1d1bca8..2d24b569df07 100644
--- a/src/cloudflare/types/ruleset_update_params.py
+++ b/src/cloudflare/types/ruleset_update_params.py
@@ -28,9 +28,6 @@
class RulesetUpdateParams(TypedDict, total=False):
- id: Required[str]
- """The unique ID of the ruleset."""
-
rules: Required[Iterable[Rule]]
"""The list of rules in the ruleset."""
diff --git a/src/cloudflare/types/ruleset_update_response.py b/src/cloudflare/types/ruleset_update_response.py
new file mode 100644
index 000000000000..98e79a070872
--- /dev/null
+++ b/src/cloudflare/types/ruleset_update_response.py
@@ -0,0 +1,393 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, List, Union, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = [
+ "RulesetUpdateResponse",
+ "Rule",
+ "RuleRulesetsBlockRule",
+ "RuleRulesetsBlockRuleActionParameters",
+ "RuleRulesetsBlockRuleActionParametersResponse",
+ "RuleRulesetsBlockRuleLogging",
+ "RuleRulesetsExecuteRule",
+ "RuleRulesetsExecuteRuleActionParameters",
+ "RuleRulesetsExecuteRuleActionParametersMatchedData",
+ "RuleRulesetsExecuteRuleActionParametersOverrides",
+ "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
+ "RuleRulesetsExecuteRuleActionParametersOverridesRule",
+ "RuleRulesetsExecuteRuleLogging",
+ "RuleRulesetsLogRule",
+ "RuleRulesetsLogRuleLogging",
+ "RuleRulesetsSkipRule",
+ "RuleRulesetsSkipRuleActionParameters",
+ "RuleRulesetsSkipRuleLogging",
+]
+
+
+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 RuleRulesetsBlockRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsBlockRuleLogging] = 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 RuleRulesetsExecuteRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsExecuteRuleLogging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
+
+
+class RuleRulesetsLogRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsLogRuleLogging] = 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 RuleRulesetsSkipRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsSkipRuleLogging] = 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]
+
+
+class RulesetUpdateResponse(BaseModel):
+ id: str
+ """The unique ID of the ruleset."""
+
+ kind: Literal["managed", "custom", "root", "zone"]
+ """The kind of the ruleset."""
+
+ last_updated: datetime
+ """The timestamp of when the ruleset was last modified."""
+
+ 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."""
+
+ rules: List[Rule]
+ """The list of rules in the ruleset."""
+
+ version: str
+ """The version of the ruleset."""
+
+ description: Optional[str] = None
+ """An informative description of the ruleset."""
diff --git a/src/cloudflare/types/rulesets/__init__.py b/src/cloudflare/types/rulesets/__init__.py
index f493d78c72b4..9f2e2de00d35 100644
--- a/src/cloudflare/types/rulesets/__init__.py
+++ b/src/cloudflare/types/rulesets/__init__.py
@@ -3,6 +3,12 @@
from __future__ import annotations
from .rule_edit_params import RuleEditParams as RuleEditParams
+from .phase_get_response import PhaseGetResponse as PhaseGetResponse
from .rule_create_params import RuleCreateParams as RuleCreateParams
+from .rule_edit_response import RuleEditResponse as RuleEditResponse
from .phase_update_params import PhaseUpdateParams as PhaseUpdateParams
+from .rule_create_response import RuleCreateResponse as RuleCreateResponse
+from .rule_delete_response import RuleDeleteResponse as RuleDeleteResponse
+from .version_get_response import VersionGetResponse as VersionGetResponse
+from .phase_update_response import PhaseUpdateResponse as PhaseUpdateResponse
from .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
new file mode 100644
index 000000000000..65dff1b0698c
--- /dev/null
+++ b/src/cloudflare/types/rulesets/phase_get_response.py
@@ -0,0 +1,393 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, List, Union, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ..._models import BaseModel
+
+__all__ = [
+ "PhaseGetResponse",
+ "Rule",
+ "RuleRulesetsBlockRule",
+ "RuleRulesetsBlockRuleActionParameters",
+ "RuleRulesetsBlockRuleActionParametersResponse",
+ "RuleRulesetsBlockRuleLogging",
+ "RuleRulesetsExecuteRule",
+ "RuleRulesetsExecuteRuleActionParameters",
+ "RuleRulesetsExecuteRuleActionParametersMatchedData",
+ "RuleRulesetsExecuteRuleActionParametersOverrides",
+ "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
+ "RuleRulesetsExecuteRuleActionParametersOverridesRule",
+ "RuleRulesetsExecuteRuleLogging",
+ "RuleRulesetsLogRule",
+ "RuleRulesetsLogRuleLogging",
+ "RuleRulesetsSkipRule",
+ "RuleRulesetsSkipRuleActionParameters",
+ "RuleRulesetsSkipRuleLogging",
+]
+
+
+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 RuleRulesetsBlockRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsBlockRuleLogging] = 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 RuleRulesetsExecuteRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsExecuteRuleLogging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
+
+
+class RuleRulesetsLogRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsLogRuleLogging] = 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 RuleRulesetsSkipRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsSkipRuleLogging] = 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]
+
+
+class PhaseGetResponse(BaseModel):
+ id: str
+ """The unique ID of the ruleset."""
+
+ kind: Literal["managed", "custom", "root", "zone"]
+ """The kind of the ruleset."""
+
+ last_updated: datetime
+ """The timestamp of when the ruleset was last modified."""
+
+ 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."""
+
+ rules: List[Rule]
+ """The list of rules in the ruleset."""
+
+ version: str
+ """The version of the ruleset."""
+
+ description: Optional[str] = None
+ """An informative description of the ruleset."""
diff --git a/src/cloudflare/types/rulesets/phase_update_params.py b/src/cloudflare/types/rulesets/phase_update_params.py
index 478f38a9f163..a5a40297b504 100644
--- a/src/cloudflare/types/rulesets/phase_update_params.py
+++ b/src/cloudflare/types/rulesets/phase_update_params.py
@@ -28,9 +28,6 @@
class PhaseUpdateParams(TypedDict, total=False):
- id: Required[str]
- """The unique ID of the ruleset."""
-
rules: Required[Iterable[Rule]]
"""The list of rules in the ruleset."""
diff --git a/src/cloudflare/types/rulesets/phase_update_response.py b/src/cloudflare/types/rulesets/phase_update_response.py
new file mode 100644
index 000000000000..7d379b726af7
--- /dev/null
+++ b/src/cloudflare/types/rulesets/phase_update_response.py
@@ -0,0 +1,393 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, List, Union, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ..._models import BaseModel
+
+__all__ = [
+ "PhaseUpdateResponse",
+ "Rule",
+ "RuleRulesetsBlockRule",
+ "RuleRulesetsBlockRuleActionParameters",
+ "RuleRulesetsBlockRuleActionParametersResponse",
+ "RuleRulesetsBlockRuleLogging",
+ "RuleRulesetsExecuteRule",
+ "RuleRulesetsExecuteRuleActionParameters",
+ "RuleRulesetsExecuteRuleActionParametersMatchedData",
+ "RuleRulesetsExecuteRuleActionParametersOverrides",
+ "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
+ "RuleRulesetsExecuteRuleActionParametersOverridesRule",
+ "RuleRulesetsExecuteRuleLogging",
+ "RuleRulesetsLogRule",
+ "RuleRulesetsLogRuleLogging",
+ "RuleRulesetsSkipRule",
+ "RuleRulesetsSkipRuleActionParameters",
+ "RuleRulesetsSkipRuleLogging",
+]
+
+
+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 RuleRulesetsBlockRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsBlockRuleLogging] = 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 RuleRulesetsExecuteRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsExecuteRuleLogging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
+
+
+class RuleRulesetsLogRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsLogRuleLogging] = 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 RuleRulesetsSkipRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsSkipRuleLogging] = 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]
+
+
+class PhaseUpdateResponse(BaseModel):
+ id: str
+ """The unique ID of the ruleset."""
+
+ kind: Literal["managed", "custom", "root", "zone"]
+ """The kind of the ruleset."""
+
+ last_updated: datetime
+ """The timestamp of when the ruleset was last modified."""
+
+ 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."""
+
+ rules: List[Rule]
+ """The list of rules in the ruleset."""
+
+ version: str
+ """The version of the ruleset."""
+
+ description: Optional[str] = None
+ """An informative description of the ruleset."""
diff --git a/src/cloudflare/types/rulesets/phases/__init__.py b/src/cloudflare/types/rulesets/phases/__init__.py
index 6164c34d4c85..5a719b3e523b 100644
--- a/src/cloudflare/types/rulesets/phases/__init__.py
+++ b/src/cloudflare/types/rulesets/phases/__init__.py
@@ -2,4 +2,5 @@
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
new file mode 100644
index 000000000000..9255b7f1b92d
--- /dev/null
+++ b/src/cloudflare/types/rulesets/phases/version_get_response.py
@@ -0,0 +1,393 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, List, Union, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ...._models import BaseModel
+
+__all__ = [
+ "VersionGetResponse",
+ "Rule",
+ "RuleRulesetsBlockRule",
+ "RuleRulesetsBlockRuleActionParameters",
+ "RuleRulesetsBlockRuleActionParametersResponse",
+ "RuleRulesetsBlockRuleLogging",
+ "RuleRulesetsExecuteRule",
+ "RuleRulesetsExecuteRuleActionParameters",
+ "RuleRulesetsExecuteRuleActionParametersMatchedData",
+ "RuleRulesetsExecuteRuleActionParametersOverrides",
+ "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
+ "RuleRulesetsExecuteRuleActionParametersOverridesRule",
+ "RuleRulesetsExecuteRuleLogging",
+ "RuleRulesetsLogRule",
+ "RuleRulesetsLogRuleLogging",
+ "RuleRulesetsSkipRule",
+ "RuleRulesetsSkipRuleActionParameters",
+ "RuleRulesetsSkipRuleLogging",
+]
+
+
+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 RuleRulesetsBlockRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsBlockRuleLogging] = 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 RuleRulesetsExecuteRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsExecuteRuleLogging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
+
+
+class RuleRulesetsLogRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsLogRuleLogging] = 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 RuleRulesetsSkipRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsSkipRuleLogging] = 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]
+
+
+class VersionGetResponse(BaseModel):
+ id: str
+ """The unique ID of the ruleset."""
+
+ kind: Literal["managed", "custom", "root", "zone"]
+ """The kind of the ruleset."""
+
+ last_updated: datetime
+ """The timestamp of when the ruleset was last modified."""
+
+ 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."""
+
+ rules: List[Rule]
+ """The list of rules in the ruleset."""
+
+ version: str
+ """The version of the ruleset."""
+
+ description: Optional[str] = None
+ """An informative description of the ruleset."""
diff --git a/src/cloudflare/types/rulesets/rule_create_response.py b/src/cloudflare/types/rulesets/rule_create_response.py
new file mode 100644
index 000000000000..b5229bf4d40d
--- /dev/null
+++ b/src/cloudflare/types/rulesets/rule_create_response.py
@@ -0,0 +1,393 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, List, Union, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ..._models import BaseModel
+
+__all__ = [
+ "RuleCreateResponse",
+ "Rule",
+ "RuleRulesetsBlockRule",
+ "RuleRulesetsBlockRuleActionParameters",
+ "RuleRulesetsBlockRuleActionParametersResponse",
+ "RuleRulesetsBlockRuleLogging",
+ "RuleRulesetsExecuteRule",
+ "RuleRulesetsExecuteRuleActionParameters",
+ "RuleRulesetsExecuteRuleActionParametersMatchedData",
+ "RuleRulesetsExecuteRuleActionParametersOverrides",
+ "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
+ "RuleRulesetsExecuteRuleActionParametersOverridesRule",
+ "RuleRulesetsExecuteRuleLogging",
+ "RuleRulesetsLogRule",
+ "RuleRulesetsLogRuleLogging",
+ "RuleRulesetsSkipRule",
+ "RuleRulesetsSkipRuleActionParameters",
+ "RuleRulesetsSkipRuleLogging",
+]
+
+
+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 RuleRulesetsBlockRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsBlockRuleLogging] = 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 RuleRulesetsExecuteRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsExecuteRuleLogging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
+
+
+class RuleRulesetsLogRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsLogRuleLogging] = 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 RuleRulesetsSkipRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsSkipRuleLogging] = 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]
+
+
+class RuleCreateResponse(BaseModel):
+ id: str
+ """The unique ID of the ruleset."""
+
+ kind: Literal["managed", "custom", "root", "zone"]
+ """The kind of the ruleset."""
+
+ last_updated: datetime
+ """The timestamp of when the ruleset was last modified."""
+
+ 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."""
+
+ rules: List[Rule]
+ """The list of rules in the ruleset."""
+
+ version: str
+ """The version of the ruleset."""
+
+ description: Optional[str] = None
+ """An informative description of the ruleset."""
diff --git a/src/cloudflare/types/rulesets/rule_delete_response.py b/src/cloudflare/types/rulesets/rule_delete_response.py
new file mode 100644
index 000000000000..005278d1989b
--- /dev/null
+++ b/src/cloudflare/types/rulesets/rule_delete_response.py
@@ -0,0 +1,393 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, List, Union, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ..._models import BaseModel
+
+__all__ = [
+ "RuleDeleteResponse",
+ "Rule",
+ "RuleRulesetsBlockRule",
+ "RuleRulesetsBlockRuleActionParameters",
+ "RuleRulesetsBlockRuleActionParametersResponse",
+ "RuleRulesetsBlockRuleLogging",
+ "RuleRulesetsExecuteRule",
+ "RuleRulesetsExecuteRuleActionParameters",
+ "RuleRulesetsExecuteRuleActionParametersMatchedData",
+ "RuleRulesetsExecuteRuleActionParametersOverrides",
+ "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
+ "RuleRulesetsExecuteRuleActionParametersOverridesRule",
+ "RuleRulesetsExecuteRuleLogging",
+ "RuleRulesetsLogRule",
+ "RuleRulesetsLogRuleLogging",
+ "RuleRulesetsSkipRule",
+ "RuleRulesetsSkipRuleActionParameters",
+ "RuleRulesetsSkipRuleLogging",
+]
+
+
+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 RuleRulesetsBlockRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsBlockRuleLogging] = 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 RuleRulesetsExecuteRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsExecuteRuleLogging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
+
+
+class RuleRulesetsLogRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsLogRuleLogging] = 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 RuleRulesetsSkipRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsSkipRuleLogging] = 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]
+
+
+class RuleDeleteResponse(BaseModel):
+ id: str
+ """The unique ID of the ruleset."""
+
+ kind: Literal["managed", "custom", "root", "zone"]
+ """The kind of the ruleset."""
+
+ last_updated: datetime
+ """The timestamp of when the ruleset was last modified."""
+
+ 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."""
+
+ rules: List[Rule]
+ """The list of rules in the ruleset."""
+
+ version: str
+ """The version of the ruleset."""
+
+ description: Optional[str] = None
+ """An informative description of the ruleset."""
diff --git a/src/cloudflare/types/rulesets/rule_edit_response.py b/src/cloudflare/types/rulesets/rule_edit_response.py
new file mode 100644
index 000000000000..0bc4d960a69e
--- /dev/null
+++ b/src/cloudflare/types/rulesets/rule_edit_response.py
@@ -0,0 +1,393 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, List, Union, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ..._models import BaseModel
+
+__all__ = [
+ "RuleEditResponse",
+ "Rule",
+ "RuleRulesetsBlockRule",
+ "RuleRulesetsBlockRuleActionParameters",
+ "RuleRulesetsBlockRuleActionParametersResponse",
+ "RuleRulesetsBlockRuleLogging",
+ "RuleRulesetsExecuteRule",
+ "RuleRulesetsExecuteRuleActionParameters",
+ "RuleRulesetsExecuteRuleActionParametersMatchedData",
+ "RuleRulesetsExecuteRuleActionParametersOverrides",
+ "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
+ "RuleRulesetsExecuteRuleActionParametersOverridesRule",
+ "RuleRulesetsExecuteRuleLogging",
+ "RuleRulesetsLogRule",
+ "RuleRulesetsLogRuleLogging",
+ "RuleRulesetsSkipRule",
+ "RuleRulesetsSkipRuleActionParameters",
+ "RuleRulesetsSkipRuleLogging",
+]
+
+
+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 RuleRulesetsBlockRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsBlockRuleLogging] = 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 RuleRulesetsExecuteRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsExecuteRuleLogging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
+
+
+class RuleRulesetsLogRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsLogRuleLogging] = 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 RuleRulesetsSkipRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsSkipRuleLogging] = 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]
+
+
+class RuleEditResponse(BaseModel):
+ id: str
+ """The unique ID of the ruleset."""
+
+ kind: Literal["managed", "custom", "root", "zone"]
+ """The kind of the ruleset."""
+
+ last_updated: datetime
+ """The timestamp of when the ruleset was last modified."""
+
+ 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."""
+
+ rules: List[Rule]
+ """The list of rules in the ruleset."""
+
+ version: str
+ """The version of the ruleset."""
+
+ description: Optional[str] = None
+ """An informative description of the ruleset."""
diff --git a/src/cloudflare/types/rulesets/version_get_response.py b/src/cloudflare/types/rulesets/version_get_response.py
new file mode 100644
index 000000000000..66b232547ca8
--- /dev/null
+++ b/src/cloudflare/types/rulesets/version_get_response.py
@@ -0,0 +1,393 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, List, Union, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ..._models import BaseModel
+
+__all__ = [
+ "VersionGetResponse",
+ "Rule",
+ "RuleRulesetsBlockRule",
+ "RuleRulesetsBlockRuleActionParameters",
+ "RuleRulesetsBlockRuleActionParametersResponse",
+ "RuleRulesetsBlockRuleLogging",
+ "RuleRulesetsExecuteRule",
+ "RuleRulesetsExecuteRuleActionParameters",
+ "RuleRulesetsExecuteRuleActionParametersMatchedData",
+ "RuleRulesetsExecuteRuleActionParametersOverrides",
+ "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
+ "RuleRulesetsExecuteRuleActionParametersOverridesRule",
+ "RuleRulesetsExecuteRuleLogging",
+ "RuleRulesetsLogRule",
+ "RuleRulesetsLogRuleLogging",
+ "RuleRulesetsSkipRule",
+ "RuleRulesetsSkipRuleActionParameters",
+ "RuleRulesetsSkipRuleLogging",
+]
+
+
+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 RuleRulesetsBlockRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsBlockRuleLogging] = 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 RuleRulesetsExecuteRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsExecuteRuleLogging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
+
+
+class RuleRulesetsLogRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsLogRuleLogging] = 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 RuleRulesetsSkipRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsSkipRuleLogging] = 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]
+
+
+class VersionGetResponse(BaseModel):
+ id: str
+ """The unique ID of the ruleset."""
+
+ kind: Literal["managed", "custom", "root", "zone"]
+ """The kind of the ruleset."""
+
+ last_updated: datetime
+ """The timestamp of when the ruleset was last modified."""
+
+ 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."""
+
+ rules: List[Rule]
+ """The list of rules in the ruleset."""
+
+ version: str
+ """The version of the ruleset."""
+
+ description: Optional[str] = None
+ """An informative description of the ruleset."""
diff --git a/src/cloudflare/types/rulesets/versions/__init__.py b/src/cloudflare/types/rulesets/versions/__init__.py
index f8ee8b14b1c9..eedd7781951e 100644
--- a/src/cloudflare/types/rulesets/versions/__init__.py
+++ b/src/cloudflare/types/rulesets/versions/__init__.py
@@ -1,3 +1,5 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from __future__ import annotations
+
+from .by_tag_get_response import ByTagGetResponse as ByTagGetResponse
diff --git a/src/cloudflare/types/rulesets/versions/by_tag_get_response.py b/src/cloudflare/types/rulesets/versions/by_tag_get_response.py
new file mode 100644
index 000000000000..1f926df94eb8
--- /dev/null
+++ b/src/cloudflare/types/rulesets/versions/by_tag_get_response.py
@@ -0,0 +1,393 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, List, Union, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ...._models import BaseModel
+
+__all__ = [
+ "ByTagGetResponse",
+ "Rule",
+ "RuleRulesetsBlockRule",
+ "RuleRulesetsBlockRuleActionParameters",
+ "RuleRulesetsBlockRuleActionParametersResponse",
+ "RuleRulesetsBlockRuleLogging",
+ "RuleRulesetsExecuteRule",
+ "RuleRulesetsExecuteRuleActionParameters",
+ "RuleRulesetsExecuteRuleActionParametersMatchedData",
+ "RuleRulesetsExecuteRuleActionParametersOverrides",
+ "RuleRulesetsExecuteRuleActionParametersOverridesCategory",
+ "RuleRulesetsExecuteRuleActionParametersOverridesRule",
+ "RuleRulesetsExecuteRuleLogging",
+ "RuleRulesetsLogRule",
+ "RuleRulesetsLogRuleLogging",
+ "RuleRulesetsSkipRule",
+ "RuleRulesetsSkipRuleActionParameters",
+ "RuleRulesetsSkipRuleLogging",
+]
+
+
+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 RuleRulesetsBlockRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsBlockRuleLogging] = 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 RuleRulesetsExecuteRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsExecuteRuleLogging] = None
+ """An object configuring the rule's logging behavior."""
+
+ ref: Optional[str] = None
+ """The reference of the rule (the rule ID by default)."""
+
+
+class RuleRulesetsLogRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsLogRuleLogging] = 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 RuleRulesetsSkipRuleLogging(BaseModel):
+ enabled: bool
+ """Whether to generate a log when the rule matches."""
+
+
+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[RuleRulesetsSkipRuleLogging] = 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]
+
+
+class ByTagGetResponse(BaseModel):
+ id: str
+ """The unique ID of the ruleset."""
+
+ kind: Literal["managed", "custom", "root", "zone"]
+ """The kind of the ruleset."""
+
+ last_updated: datetime
+ """The timestamp of when the ruleset was last modified."""
+
+ 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."""
+
+ rules: List[Rule]
+ """The list of rules in the ruleset."""
+
+ version: str
+ """The version of the ruleset."""
+
+ description: Optional[str] = None
+ """An informative description of the ruleset."""
diff --git a/tests/api_resources/rulesets/phases/test_versions.py b/tests/api_resources/rulesets/phases/test_versions.py
index 621104eb9da5..30cf0c1c956c 100644
--- a/tests/api_resources/rulesets/phases/test_versions.py
+++ b/tests/api_resources/rulesets/phases/test_versions.py
@@ -9,9 +9,8 @@
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 VersionListResponse
+from cloudflare.types.rulesets.phases import VersionGetResponse, VersionListResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -95,7 +94,7 @@ def test_method_get(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, version, path=["response"])
+ assert_matches_type(VersionGetResponse, version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -106,7 +105,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, version, path=["response"])
+ assert_matches_type(VersionGetResponse, version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -121,7 +120,7 @@ def test_raw_response_get(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(Ruleset, version, path=["response"])
+ assert_matches_type(VersionGetResponse, version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -136,7 +135,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = response.parse()
- assert_matches_type(Ruleset, version, path=["response"])
+ assert_matches_type(VersionGetResponse, version, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -247,7 +246,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, version, path=["response"])
+ assert_matches_type(VersionGetResponse, version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -258,7 +257,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, version, path=["response"])
+ assert_matches_type(VersionGetResponse, version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -273,7 +272,7 @@ async def test_raw_response_get(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(Ruleset, version, path=["response"])
+ assert_matches_type(VersionGetResponse, version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -288,7 +287,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = await response.parse()
- assert_matches_type(Ruleset, version, path=["response"])
+ assert_matches_type(VersionGetResponse, version, path=["response"])
assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/rulesets/test_phases.py b/tests/api_resources/rulesets/test_phases.py
index 114168a5d5e5..63fb6253667c 100644
--- a/tests/api_resources/rulesets/test_phases.py
+++ b/tests/api_resources/rulesets/test_phases.py
@@ -9,7 +9,7 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
-from cloudflare.types import Ruleset
+from cloudflare.types.rulesets import PhaseGetResponse, PhaseUpdateResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -22,19 +22,17 @@ class TestPhases:
def test_method_update(self, client: Cloudflare) -> None:
phase = client.rulesets.phases.update(
"http_request_firewall_custom",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, phase, path=["response"])
+ assert_matches_type(PhaseUpdateResponse, phase, path=["response"])
@pytest.mark.skip()
@parametrize
def test_method_update_with_all_params(self, client: Cloudflare) -> None:
phase = client.rulesets.phases.update(
"http_request_firewall_custom",
- id="2f2feab2026849078ba485f918791bdc",
rules=[
{
"action": "block",
@@ -92,14 +90,13 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None:
name="My ruleset",
phase="http_request_firewall_custom",
)
- assert_matches_type(Ruleset, phase, path=["response"])
+ assert_matches_type(PhaseUpdateResponse, phase, path=["response"])
@pytest.mark.skip()
@parametrize
def test_raw_response_update(self, client: Cloudflare) -> None:
response = client.rulesets.phases.with_raw_response.update(
"http_request_firewall_custom",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="string",
@@ -108,14 +105,13 @@ def test_raw_response_update(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
phase = response.parse()
- assert_matches_type(Ruleset, phase, path=["response"])
+ assert_matches_type(PhaseUpdateResponse, phase, path=["response"])
@pytest.mark.skip()
@parametrize
def test_streaming_response_update(self, client: Cloudflare) -> None:
with client.rulesets.phases.with_streaming_response.update(
"http_request_firewall_custom",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="string",
@@ -124,7 +120,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
phase = response.parse()
- assert_matches_type(Ruleset, phase, path=["response"])
+ assert_matches_type(PhaseUpdateResponse, phase, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -134,7 +130,6 @@ def test_path_params_update(self, client: Cloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
client.rulesets.phases.with_raw_response.update(
"http_request_firewall_custom",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="",
zone_id="string",
@@ -143,7 +138,6 @@ def test_path_params_update(self, client: Cloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
client.rulesets.phases.with_raw_response.update(
"http_request_firewall_custom",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="",
@@ -157,7 +151,7 @@ def test_method_get(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, phase, path=["response"])
+ assert_matches_type(PhaseGetResponse, phase, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -167,7 +161,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, phase, path=["response"])
+ assert_matches_type(PhaseGetResponse, phase, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -181,7 +175,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
phase = response.parse()
- assert_matches_type(Ruleset, phase, path=["response"])
+ assert_matches_type(PhaseGetResponse, phase, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -195,7 +189,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
phase = response.parse()
- assert_matches_type(Ruleset, phase, path=["response"])
+ assert_matches_type(PhaseGetResponse, phase, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -225,19 +219,17 @@ class TestAsyncPhases:
async def test_method_update(self, async_client: AsyncCloudflare) -> None:
phase = await async_client.rulesets.phases.update(
"http_request_firewall_custom",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, phase, path=["response"])
+ assert_matches_type(PhaseUpdateResponse, phase, path=["response"])
@pytest.mark.skip()
@parametrize
async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
phase = await async_client.rulesets.phases.update(
"http_request_firewall_custom",
- id="2f2feab2026849078ba485f918791bdc",
rules=[
{
"action": "block",
@@ -295,14 +287,13 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare
name="My ruleset",
phase="http_request_firewall_custom",
)
- assert_matches_type(Ruleset, phase, path=["response"])
+ assert_matches_type(PhaseUpdateResponse, phase, path=["response"])
@pytest.mark.skip()
@parametrize
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
response = await async_client.rulesets.phases.with_raw_response.update(
"http_request_firewall_custom",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="string",
@@ -311,14 +302,13 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
phase = await response.parse()
- assert_matches_type(Ruleset, phase, path=["response"])
+ assert_matches_type(PhaseUpdateResponse, phase, path=["response"])
@pytest.mark.skip()
@parametrize
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
async with async_client.rulesets.phases.with_streaming_response.update(
"http_request_firewall_custom",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="string",
@@ -327,7 +317,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
phase = await response.parse()
- assert_matches_type(Ruleset, phase, path=["response"])
+ assert_matches_type(PhaseUpdateResponse, phase, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -337,7 +327,6 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
await async_client.rulesets.phases.with_raw_response.update(
"http_request_firewall_custom",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="",
zone_id="string",
@@ -346,7 +335,6 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
await async_client.rulesets.phases.with_raw_response.update(
"http_request_firewall_custom",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="",
@@ -360,7 +348,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, phase, path=["response"])
+ assert_matches_type(PhaseGetResponse, phase, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -370,7 +358,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, phase, path=["response"])
+ assert_matches_type(PhaseGetResponse, phase, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -384,7 +372,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
phase = await response.parse()
- assert_matches_type(Ruleset, phase, path=["response"])
+ assert_matches_type(PhaseGetResponse, phase, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -398,7 +386,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
phase = await response.parse()
- assert_matches_type(Ruleset, phase, path=["response"])
+ assert_matches_type(PhaseGetResponse, phase, path=["response"])
assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/rulesets/test_rules.py b/tests/api_resources/rulesets/test_rules.py
index b508825c0276..2bc480b2c7ba 100644
--- a/tests/api_resources/rulesets/test_rules.py
+++ b/tests/api_resources/rulesets/test_rules.py
@@ -9,7 +9,11 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
-from cloudflare.types import Ruleset
+from cloudflare.types.rulesets import (
+ RuleEditResponse,
+ RuleCreateResponse,
+ RuleDeleteResponse,
+)
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -25,7 +29,7 @@ def test_method_create_overload_1(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -49,7 +53,7 @@ def test_method_create_with_all_params_overload_1(self, client: Cloudflare) -> N
logging={"enabled": True},
ref="my_ref",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -63,7 +67,7 @@ def test_raw_response_create_overload_1(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -77,7 +81,7 @@ def test_streaming_response_create_overload_1(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -113,7 +117,7 @@ def test_method_create_overload_2(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -156,7 +160,7 @@ def test_method_create_with_all_params_overload_2(self, client: Cloudflare) -> N
logging={"enabled": True},
ref="my_ref",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -170,7 +174,7 @@ def test_raw_response_create_overload_2(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -184,7 +188,7 @@ def test_streaming_response_create_overload_2(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -220,7 +224,7 @@ def test_method_create_overload_3(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -238,7 +242,7 @@ def test_method_create_with_all_params_overload_3(self, client: Cloudflare) -> N
logging={"enabled": True},
ref="my_ref",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -252,7 +256,7 @@ def test_raw_response_create_overload_3(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -266,7 +270,7 @@ def test_streaming_response_create_overload_3(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -302,7 +306,7 @@ def test_method_create_overload_4(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -326,7 +330,7 @@ def test_method_create_with_all_params_overload_4(self, client: Cloudflare) -> N
logging={"enabled": True},
ref="my_ref",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -340,7 +344,7 @@ def test_raw_response_create_overload_4(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -354,7 +358,7 @@ def test_streaming_response_create_overload_4(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -391,7 +395,7 @@ def test_method_delete(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleDeleteResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -402,7 +406,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleDeleteResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -417,7 +421,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleDeleteResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -432,7 +436,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleDeleteResponse, rule, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -480,7 +484,7 @@ def test_method_edit_overload_1(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -505,7 +509,7 @@ def test_method_edit_with_all_params_overload_1(self, client: Cloudflare) -> Non
logging={"enabled": True},
ref="my_ref",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -520,7 +524,7 @@ def test_raw_response_edit_overload_1(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -535,7 +539,7 @@ def test_streaming_response_edit_overload_1(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -583,7 +587,7 @@ def test_method_edit_overload_2(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -627,7 +631,7 @@ def test_method_edit_with_all_params_overload_2(self, client: Cloudflare) -> Non
logging={"enabled": True},
ref="my_ref",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -642,7 +646,7 @@ def test_raw_response_edit_overload_2(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -657,7 +661,7 @@ def test_streaming_response_edit_overload_2(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -705,7 +709,7 @@ def test_method_edit_overload_3(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -724,7 +728,7 @@ def test_method_edit_with_all_params_overload_3(self, client: Cloudflare) -> Non
logging={"enabled": True},
ref="my_ref",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -739,7 +743,7 @@ def test_raw_response_edit_overload_3(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -754,7 +758,7 @@ def test_streaming_response_edit_overload_3(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -802,7 +806,7 @@ def test_method_edit_overload_4(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -827,7 +831,7 @@ def test_method_edit_with_all_params_overload_4(self, client: Cloudflare) -> Non
logging={"enabled": True},
ref="my_ref",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -842,7 +846,7 @@ def test_raw_response_edit_overload_4(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -857,7 +861,7 @@ def test_streaming_response_edit_overload_4(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -908,7 +912,7 @@ async def test_method_create_overload_1(self, async_client: AsyncCloudflare) ->
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -932,7 +936,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn
logging={"enabled": True},
ref="my_ref",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -946,7 +950,7 @@ async def test_raw_response_create_overload_1(self, async_client: AsyncCloudflar
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -960,7 +964,7 @@ async def test_streaming_response_create_overload_1(self, async_client: AsyncClo
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -996,7 +1000,7 @@ async def test_method_create_overload_2(self, async_client: AsyncCloudflare) ->
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1039,7 +1043,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn
logging={"enabled": True},
ref="my_ref",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1053,7 +1057,7 @@ async def test_raw_response_create_overload_2(self, async_client: AsyncCloudflar
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1067,7 +1071,7 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncClo
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -1103,7 +1107,7 @@ async def test_method_create_overload_3(self, async_client: AsyncCloudflare) ->
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1121,7 +1125,7 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn
logging={"enabled": True},
ref="my_ref",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1135,7 +1139,7 @@ async def test_raw_response_create_overload_3(self, async_client: AsyncCloudflar
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1149,7 +1153,7 @@ async def test_streaming_response_create_overload_3(self, async_client: AsyncClo
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -1185,7 +1189,7 @@ async def test_method_create_overload_4(self, async_client: AsyncCloudflare) ->
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1209,7 +1213,7 @@ async def test_method_create_with_all_params_overload_4(self, async_client: Asyn
logging={"enabled": True},
ref="my_ref",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1223,7 +1227,7 @@ async def test_raw_response_create_overload_4(self, async_client: AsyncCloudflar
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1237,7 +1241,7 @@ async def test_streaming_response_create_overload_4(self, async_client: AsyncClo
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleCreateResponse, rule, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -1274,7 +1278,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleDeleteResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1285,7 +1289,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleDeleteResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1300,7 +1304,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleDeleteResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1315,7 +1319,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleDeleteResponse, rule, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -1363,7 +1367,7 @@ async def test_method_edit_overload_1(self, async_client: AsyncCloudflare) -> No
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1388,7 +1392,7 @@ async def test_method_edit_with_all_params_overload_1(self, async_client: AsyncC
logging={"enabled": True},
ref="my_ref",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1403,7 +1407,7 @@ async def test_raw_response_edit_overload_1(self, async_client: AsyncCloudflare)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1418,7 +1422,7 @@ async def test_streaming_response_edit_overload_1(self, async_client: AsyncCloud
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -1466,7 +1470,7 @@ async def test_method_edit_overload_2(self, async_client: AsyncCloudflare) -> No
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1510,7 +1514,7 @@ async def test_method_edit_with_all_params_overload_2(self, async_client: AsyncC
logging={"enabled": True},
ref="my_ref",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1525,7 +1529,7 @@ async def test_raw_response_edit_overload_2(self, async_client: AsyncCloudflare)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1540,7 +1544,7 @@ async def test_streaming_response_edit_overload_2(self, async_client: AsyncCloud
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -1588,7 +1592,7 @@ async def test_method_edit_overload_3(self, async_client: AsyncCloudflare) -> No
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1607,7 +1611,7 @@ async def test_method_edit_with_all_params_overload_3(self, async_client: AsyncC
logging={"enabled": True},
ref="my_ref",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1622,7 +1626,7 @@ async def test_raw_response_edit_overload_3(self, async_client: AsyncCloudflare)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1637,7 +1641,7 @@ async def test_streaming_response_edit_overload_3(self, async_client: AsyncCloud
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -1685,7 +1689,7 @@ async def test_method_edit_overload_4(self, async_client: AsyncCloudflare) -> No
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1710,7 +1714,7 @@ async def test_method_edit_with_all_params_overload_4(self, async_client: AsyncC
logging={"enabled": True},
ref="my_ref",
)
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1725,7 +1729,7 @@ async def test_raw_response_edit_overload_4(self, async_client: AsyncCloudflare)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -1740,7 +1744,7 @@ async def test_streaming_response_edit_overload_4(self, async_client: AsyncCloud
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
rule = await response.parse()
- assert_matches_type(Ruleset, rule, path=["response"])
+ assert_matches_type(RuleEditResponse, rule, 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 59d53feb980a..4a13069254fb 100644
--- a/tests/api_resources/rulesets/test_versions.py
+++ b/tests/api_resources/rulesets/test_versions.py
@@ -9,9 +9,8 @@
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 VersionListResponse
+from cloudflare.types.rulesets import VersionGetResponse, VersionListResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -191,7 +190,7 @@ def test_method_get(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, version, path=["response"])
+ assert_matches_type(VersionGetResponse, version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -202,7 +201,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, version, path=["response"])
+ assert_matches_type(VersionGetResponse, version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -217,7 +216,7 @@ def test_raw_response_get(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(Ruleset, version, path=["response"])
+ assert_matches_type(VersionGetResponse, version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -232,7 +231,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = response.parse()
- assert_matches_type(Ruleset, version, path=["response"])
+ assert_matches_type(VersionGetResponse, version, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -447,7 +446,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, version, path=["response"])
+ assert_matches_type(VersionGetResponse, version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -458,7 +457,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, version, path=["response"])
+ assert_matches_type(VersionGetResponse, version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -473,7 +472,7 @@ async def test_raw_response_get(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(Ruleset, version, path=["response"])
+ assert_matches_type(VersionGetResponse, version, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -488,7 +487,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
version = await response.parse()
- assert_matches_type(Ruleset, version, path=["response"])
+ assert_matches_type(VersionGetResponse, version, path=["response"])
assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/rulesets/versions/test_by_tag.py b/tests/api_resources/rulesets/versions/test_by_tag.py
index e3632bf63149..cc093ff35781 100644
--- a/tests/api_resources/rulesets/versions/test_by_tag.py
+++ b/tests/api_resources/rulesets/versions/test_by_tag.py
@@ -9,7 +9,7 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
-from cloudflare.types import Ruleset
+from cloudflare.types.rulesets.versions import ByTagGetResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -26,7 +26,7 @@ def test_method_get(self, client: Cloudflare) -> None:
ruleset_id="2f2feab2026849078ba485f918791bdc",
ruleset_version="1",
)
- assert_matches_type(Ruleset, by_tag, path=["response"])
+ assert_matches_type(ByTagGetResponse, by_tag, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -41,7 +41,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
by_tag = response.parse()
- assert_matches_type(Ruleset, by_tag, path=["response"])
+ assert_matches_type(ByTagGetResponse, by_tag, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -56,7 +56,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
by_tag = response.parse()
- assert_matches_type(Ruleset, by_tag, path=["response"])
+ assert_matches_type(ByTagGetResponse, by_tag, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -108,7 +108,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
ruleset_id="2f2feab2026849078ba485f918791bdc",
ruleset_version="1",
)
- assert_matches_type(Ruleset, by_tag, path=["response"])
+ assert_matches_type(ByTagGetResponse, by_tag, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -123,7 +123,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
by_tag = await response.parse()
- assert_matches_type(Ruleset, by_tag, path=["response"])
+ assert_matches_type(ByTagGetResponse, by_tag, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -138,7 +138,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
by_tag = await response.parse()
- assert_matches_type(Ruleset, by_tag, path=["response"])
+ assert_matches_type(ByTagGetResponse, by_tag, 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 285259542bfa..cf80d2a183c8 100644
--- a/tests/api_resources/test_rulesets.py
+++ b/tests/api_resources/test_rulesets.py
@@ -9,7 +9,12 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
-from cloudflare.types import Ruleset, RulesetListResponse
+from cloudflare.types import (
+ RulesetGetResponse,
+ RulesetListResponse,
+ RulesetCreateResponse,
+ RulesetUpdateResponse,
+)
from cloudflare.pagination import SyncSinglePage, AsyncSinglePage
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -29,7 +34,7 @@ def test_method_create(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetCreateResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -92,7 +97,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
zone_id="string",
description="My ruleset to execute managed rulesets",
)
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetCreateResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -109,7 +114,7 @@ def test_raw_response_create(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(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetCreateResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -126,7 +131,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
ruleset = response.parse()
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetCreateResponse, ruleset, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -158,19 +163,17 @@ def test_path_params_create(self, client: Cloudflare) -> None:
def test_method_update(self, client: Cloudflare) -> None:
ruleset = client.rulesets.update(
"2f2feab2026849078ba485f918791bdc",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetUpdateResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
def test_method_update_with_all_params(self, client: Cloudflare) -> None:
ruleset = client.rulesets.update(
"2f2feab2026849078ba485f918791bdc",
- id="2f2feab2026849078ba485f918791bdc",
rules=[
{
"action": "block",
@@ -228,14 +231,13 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None:
name="My ruleset",
phase="http_request_firewall_custom",
)
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetUpdateResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
def test_raw_response_update(self, client: Cloudflare) -> None:
response = client.rulesets.with_raw_response.update(
"2f2feab2026849078ba485f918791bdc",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="string",
@@ -244,14 +246,13 @@ def test_raw_response_update(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(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetUpdateResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
def test_streaming_response_update(self, client: Cloudflare) -> None:
with client.rulesets.with_streaming_response.update(
"2f2feab2026849078ba485f918791bdc",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="string",
@@ -260,7 +261,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
ruleset = response.parse()
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetUpdateResponse, ruleset, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -270,7 +271,6 @@ def test_path_params_update(self, client: Cloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"):
client.rulesets.with_raw_response.update(
"",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="string",
@@ -279,7 +279,6 @@ def test_path_params_update(self, client: Cloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
client.rulesets.with_raw_response.update(
"2f2feab2026849078ba485f918791bdc",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="",
zone_id="string",
@@ -288,7 +287,6 @@ def test_path_params_update(self, client: Cloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
client.rulesets.with_raw_response.update(
"2f2feab2026849078ba485f918791bdc",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="",
@@ -437,7 +435,7 @@ def test_method_get(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetGetResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -447,7 +445,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetGetResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -461,7 +459,7 @@ def test_raw_response_get(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(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetGetResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -475,7 +473,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
ruleset = response.parse()
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetGetResponse, ruleset, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -518,7 +516,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetCreateResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -581,7 +579,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare
zone_id="string",
description="My ruleset to execute managed rulesets",
)
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetCreateResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -598,7 +596,7 @@ async def test_raw_response_create(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(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetCreateResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -615,7 +613,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
ruleset = await response.parse()
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetCreateResponse, ruleset, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -647,19 +645,17 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
async def test_method_update(self, async_client: AsyncCloudflare) -> None:
ruleset = await async_client.rulesets.update(
"2f2feab2026849078ba485f918791bdc",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetUpdateResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
ruleset = await async_client.rulesets.update(
"2f2feab2026849078ba485f918791bdc",
- id="2f2feab2026849078ba485f918791bdc",
rules=[
{
"action": "block",
@@ -717,14 +713,13 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare
name="My ruleset",
phase="http_request_firewall_custom",
)
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetUpdateResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
response = await async_client.rulesets.with_raw_response.update(
"2f2feab2026849078ba485f918791bdc",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="string",
@@ -733,14 +728,13 @@ async def test_raw_response_update(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(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetUpdateResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
async with async_client.rulesets.with_streaming_response.update(
"2f2feab2026849078ba485f918791bdc",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="string",
@@ -749,7 +743,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
ruleset = await response.parse()
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetUpdateResponse, ruleset, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -759,7 +753,6 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `ruleset_id` but received ''"):
await async_client.rulesets.with_raw_response.update(
"",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="string",
@@ -768,7 +761,6 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
await async_client.rulesets.with_raw_response.update(
"2f2feab2026849078ba485f918791bdc",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="",
zone_id="string",
@@ -777,7 +769,6 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
await async_client.rulesets.with_raw_response.update(
"2f2feab2026849078ba485f918791bdc",
- id="2f2feab2026849078ba485f918791bdc",
rules=[{}, {}, {}],
account_id="string",
zone_id="",
@@ -926,7 +917,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetGetResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -936,7 +927,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -
account_id="string",
zone_id="string",
)
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetGetResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -950,7 +941,7 @@ async def test_raw_response_get(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(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetGetResponse, ruleset, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -964,7 +955,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
ruleset = await response.parse()
- assert_matches_type(Ruleset, ruleset, path=["response"])
+ assert_matches_type(RulesetGetResponse, ruleset, path=["response"])
assert cast(Any, response.is_closed) is True