From 42bd4ada505a093b6a97b2e670f6cf0458eeeb9d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Apr 2024 04:25:54 +0000 Subject: [PATCH] feat(api): update via SDK Studio (#293) --- api.md | 2 -- src/cloudflare/resources/rulesets/phases/phases.py | 7 +++---- src/cloudflare/resources/rulesets/rulesets.py | 11 +++++------ src/cloudflare/types/__init__.py | 2 -- src/cloudflare/types/request_rule_param.py | 13 ------------- src/cloudflare/types/response_rule.py | 11 ----------- src/cloudflare/types/ruleset_create_params.py | 10 +++++++--- src/cloudflare/types/ruleset_create_response.py | 10 ++++++---- src/cloudflare/types/ruleset_get_response.py | 10 ++++++---- src/cloudflare/types/ruleset_update_params.py | 10 +++++++--- src/cloudflare/types/ruleset_update_response.py | 10 ++++++---- src/cloudflare/types/rulesets/phase_get_response.py | 13 +++++++++---- .../types/rulesets/phase_update_params.py | 13 ++++++++++--- .../types/rulesets/phase_update_response.py | 13 +++++++++---- .../types/rulesets/phases/version_get_response.py | 13 +++++++++---- .../types/rulesets/rule_create_response.py | 13 +++++++++---- .../types/rulesets/rule_delete_response.py | 13 +++++++++---- src/cloudflare/types/rulesets/rule_edit_response.py | 13 +++++++++---- .../types/rulesets/version_get_response.py | 13 +++++++++---- .../types/rulesets/versions/by_tag_get_response.py | 13 +++++++++---- 20 files changed, 122 insertions(+), 91 deletions(-) delete mode 100644 src/cloudflare/types/request_rule_param.py delete mode 100644 src/cloudflare/types/response_rule.py diff --git a/api.md b/api.md index 71ac2b37a44b..f4cb8fc108a0 100644 --- a/api.md +++ b/api.md @@ -2995,8 +2995,6 @@ Types: ```python from cloudflare.types import ( - RequestRule, - ResponseRule, Ruleset, RulesetCreateResponse, RulesetUpdateResponse, diff --git a/src/cloudflare/resources/rulesets/phases/phases.py b/src/cloudflare/resources/rulesets/phases/phases.py index ec198b9ee4de..cc59c4d3d6f8 100644 --- a/src/cloudflare/resources/rulesets/phases/phases.py +++ b/src/cloudflare/resources/rulesets/phases/phases.py @@ -2,12 +2,11 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Iterable, cast from typing_extensions import Literal import httpx -from ....types import RequestRuleParam from .versions import ( Versions, AsyncVersions, @@ -79,7 +78,7 @@ def update( "magic_transit_managed", ], *, - rules: RequestRuleParam, + rules: Iterable[phase_update_params.Rule], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, @@ -312,7 +311,7 @@ async def update( "magic_transit_managed", ], *, - rules: RequestRuleParam, + rules: Iterable[phase_update_params.Rule], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, diff --git a/src/cloudflare/resources/rulesets/rulesets.py b/src/cloudflare/resources/rulesets/rulesets.py index 6e1b9f646fb3..e88c1e2317a4 100644 --- a/src/cloudflare/resources/rulesets/rulesets.py +++ b/src/cloudflare/resources/rulesets/rulesets.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Iterable, cast from typing_extensions import Literal import httpx @@ -25,7 +25,6 @@ ) from ...types import ( Ruleset, - RequestRuleParam, RulesetGetResponse, RulesetCreateResponse, RulesetUpdateResponse, @@ -116,7 +115,7 @@ def create( "magic_transit_ids_managed", "magic_transit_managed", ], - rules: RequestRuleParam, + rules: Iterable[ruleset_create_params.Rule], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, @@ -194,7 +193,7 @@ def update( self, ruleset_id: str, *, - rules: RequestRuleParam, + rules: Iterable[ruleset_update_params.Rule], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, @@ -521,7 +520,7 @@ async def create( "magic_transit_ids_managed", "magic_transit_managed", ], - rules: RequestRuleParam, + rules: Iterable[ruleset_create_params.Rule], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, @@ -599,7 +598,7 @@ async def update( self, ruleset_id: str, *, - rules: RequestRuleParam, + rules: Iterable[ruleset_update_params.Rule], account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py index 5b472a37e9a7..383fb401c4e5 100644 --- a/src/cloudflare/types/__init__.py +++ b/src/cloudflare/types/__init__.py @@ -73,7 +73,6 @@ from .queue_created import QueueCreated as QueueCreated from .queue_updated import QueueUpdated as QueueUpdated from .request_model import RequestModel as RequestModel -from .response_rule import ResponseRule as ResponseRule from .edge_ips_param import EdgeIPsParam as EdgeIPsParam from .filter_options import FilterOptions as FilterOptions from .hostname_param import HostnameParam as HostnameParam @@ -117,7 +116,6 @@ from .http_configuration import HTTPConfiguration as HTTPConfiguration from .pcap_create_params import PCAPCreateParams as PCAPCreateParams from .pcap_list_response import PCAPListResponse as PCAPListResponse -from .request_rule_param import RequestRuleParam as RequestRuleParam from .stream_list_params import StreamListParams as StreamListParams from .user_edit_response import UserEditResponse as UserEditResponse from .zone_create_params import ZoneCreateParams as ZoneCreateParams diff --git a/src/cloudflare/types/request_rule_param.py b/src/cloudflare/types/request_rule_param.py deleted file mode 100644 index 13e2bf749084..000000000000 --- a/src/cloudflare/types/request_rule_param.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union - -from .rulesets import LogRuleParam, SkipRuleParam, BlockRuleParam, ExecuteRuleParam - -__all__ = ["RequestRuleParamItem"] - -RequestRuleParamItem = Union[BlockRuleParam, ExecuteRuleParam, LogRuleParam, SkipRuleParam] - -RequestRuleParam = List[RequestRuleParamItem] diff --git a/src/cloudflare/types/response_rule.py b/src/cloudflare/types/response_rule.py deleted file mode 100644 index 1e32a69ac50a..000000000000 --- a/src/cloudflare/types/response_rule.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union - -from .rulesets import LogRule, SkipRule, BlockRule, ExecuteRule - -__all__ = ["ResponseRule", "ResponseRuleItem"] - -ResponseRuleItem = Union[BlockRule, ExecuteRule, LogRule, SkipRule] - -ResponseRule = List[ResponseRuleItem] diff --git a/src/cloudflare/types/ruleset_create_params.py b/src/cloudflare/types/ruleset_create_params.py index 0539d15af080..b2f900106ea7 100644 --- a/src/cloudflare/types/ruleset_create_params.py +++ b/src/cloudflare/types/ruleset_create_params.py @@ -2,11 +2,12 @@ from __future__ import annotations +from typing import Union, Iterable from typing_extensions import Literal, Required, TypedDict -from .request_rule_param import RequestRuleParam +from .rulesets import LogRuleParam, SkipRuleParam, BlockRuleParam, ExecuteRuleParam -__all__ = ["RulesetCreateParams"] +__all__ = ["RulesetCreateParams", "Rule"] class RulesetCreateParams(TypedDict, total=False): @@ -45,7 +46,7 @@ class RulesetCreateParams(TypedDict, total=False): ] """The phase of the ruleset.""" - rules: Required[RequestRuleParam] + rules: Required[Iterable[Rule]] """The list of rules in the ruleset.""" account_id: str @@ -56,3 +57,6 @@ class RulesetCreateParams(TypedDict, total=False): description: str """An informative description of the ruleset.""" + + +Rule = Union[BlockRuleParam, ExecuteRuleParam, LogRuleParam, SkipRuleParam] diff --git a/src/cloudflare/types/ruleset_create_response.py b/src/cloudflare/types/ruleset_create_response.py index 5596ec4592eb..8af27df54457 100644 --- a/src/cloudflare/types/ruleset_create_response.py +++ b/src/cloudflare/types/ruleset_create_response.py @@ -1,13 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Union, Optional from datetime import datetime from typing_extensions import Literal from .._models import BaseModel -from .response_rule import ResponseRule +from .rulesets import LogRule, SkipRule, BlockRule, ExecuteRule -__all__ = ["RulesetCreateResponse"] +__all__ = ["RulesetCreateResponse", "Rule"] + +Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] class RulesetCreateResponse(BaseModel): @@ -50,7 +52,7 @@ class RulesetCreateResponse(BaseModel): ] """The phase of the ruleset.""" - rules: ResponseRule + rules: List[Rule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/ruleset_get_response.py b/src/cloudflare/types/ruleset_get_response.py index 399604f279fe..3ec45ca675e6 100644 --- a/src/cloudflare/types/ruleset_get_response.py +++ b/src/cloudflare/types/ruleset_get_response.py @@ -1,13 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Union, Optional from datetime import datetime from typing_extensions import Literal from .._models import BaseModel -from .response_rule import ResponseRule +from .rulesets import LogRule, SkipRule, BlockRule, ExecuteRule -__all__ = ["RulesetGetResponse"] +__all__ = ["RulesetGetResponse", "Rule"] + +Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] class RulesetGetResponse(BaseModel): @@ -50,7 +52,7 @@ class RulesetGetResponse(BaseModel): ] """The phase of the ruleset.""" - rules: ResponseRule + rules: List[Rule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/ruleset_update_params.py b/src/cloudflare/types/ruleset_update_params.py index 972c66552827..fcb7b5b02985 100644 --- a/src/cloudflare/types/ruleset_update_params.py +++ b/src/cloudflare/types/ruleset_update_params.py @@ -2,15 +2,16 @@ from __future__ import annotations +from typing import Union, Iterable from typing_extensions import Literal, Required, TypedDict -from .request_rule_param import RequestRuleParam +from .rulesets import LogRuleParam, SkipRuleParam, BlockRuleParam, ExecuteRuleParam -__all__ = ["RulesetUpdateParams"] +__all__ = ["RulesetUpdateParams", "Rule"] class RulesetUpdateParams(TypedDict, total=False): - rules: Required[RequestRuleParam] + rules: Required[Iterable[Rule]] """The list of rules in the ruleset.""" account_id: str @@ -54,3 +55,6 @@ class RulesetUpdateParams(TypedDict, total=False): "magic_transit_managed", ] """The phase of the ruleset.""" + + +Rule = Union[BlockRuleParam, ExecuteRuleParam, LogRuleParam, SkipRuleParam] diff --git a/src/cloudflare/types/ruleset_update_response.py b/src/cloudflare/types/ruleset_update_response.py index 72256ec5517a..691bb31e2fd6 100644 --- a/src/cloudflare/types/ruleset_update_response.py +++ b/src/cloudflare/types/ruleset_update_response.py @@ -1,13 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Union, Optional from datetime import datetime from typing_extensions import Literal from .._models import BaseModel -from .response_rule import ResponseRule +from .rulesets import LogRule, SkipRule, BlockRule, ExecuteRule -__all__ = ["RulesetUpdateResponse"] +__all__ = ["RulesetUpdateResponse", "Rule"] + +Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] class RulesetUpdateResponse(BaseModel): @@ -50,7 +52,7 @@ class RulesetUpdateResponse(BaseModel): ] """The phase of the ruleset.""" - rules: ResponseRule + rules: List[Rule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/rulesets/phase_get_response.py b/src/cloudflare/types/rulesets/phase_get_response.py index fca68c0ac869..e509a7cda575 100644 --- a/src/cloudflare/types/rulesets/phase_get_response.py +++ b/src/cloudflare/types/rulesets/phase_get_response.py @@ -1,13 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Union, Optional from datetime import datetime from typing_extensions import Literal +from .log_rule import LogRule from ..._models import BaseModel -from ..response_rule import ResponseRule +from .skip_rule import SkipRule +from .block_rule import BlockRule +from .execute_rule import ExecuteRule -__all__ = ["PhaseGetResponse"] +__all__ = ["PhaseGetResponse", "Rule"] + +Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] class PhaseGetResponse(BaseModel): @@ -50,7 +55,7 @@ class PhaseGetResponse(BaseModel): ] """The phase of the ruleset.""" - rules: ResponseRule + rules: List[Rule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/rulesets/phase_update_params.py b/src/cloudflare/types/rulesets/phase_update_params.py index 6659dc431a65..d3d9f075311b 100644 --- a/src/cloudflare/types/rulesets/phase_update_params.py +++ b/src/cloudflare/types/rulesets/phase_update_params.py @@ -2,15 +2,19 @@ from __future__ import annotations +from typing import Union, Iterable from typing_extensions import Literal, Required, TypedDict -from ..request_rule_param import RequestRuleParam +from .log_rule_param import LogRuleParam +from .skip_rule_param import SkipRuleParam +from .block_rule_param import BlockRuleParam +from .execute_rule_param import ExecuteRuleParam -__all__ = ["PhaseUpdateParams"] +__all__ = ["PhaseUpdateParams", "Rule"] class PhaseUpdateParams(TypedDict, total=False): - rules: Required[RequestRuleParam] + rules: Required[Iterable[Rule]] """The list of rules in the ruleset.""" account_id: str @@ -54,3 +58,6 @@ class PhaseUpdateParams(TypedDict, total=False): "magic_transit_managed", ] """The phase of the ruleset.""" + + +Rule = Union[BlockRuleParam, ExecuteRuleParam, LogRuleParam, SkipRuleParam] diff --git a/src/cloudflare/types/rulesets/phase_update_response.py b/src/cloudflare/types/rulesets/phase_update_response.py index 04262982f88a..0c1cd322a135 100644 --- a/src/cloudflare/types/rulesets/phase_update_response.py +++ b/src/cloudflare/types/rulesets/phase_update_response.py @@ -1,13 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Union, Optional from datetime import datetime from typing_extensions import Literal +from .log_rule import LogRule from ..._models import BaseModel -from ..response_rule import ResponseRule +from .skip_rule import SkipRule +from .block_rule import BlockRule +from .execute_rule import ExecuteRule -__all__ = ["PhaseUpdateResponse"] +__all__ = ["PhaseUpdateResponse", "Rule"] + +Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] class PhaseUpdateResponse(BaseModel): @@ -50,7 +55,7 @@ class PhaseUpdateResponse(BaseModel): ] """The phase of the ruleset.""" - rules: ResponseRule + rules: List[Rule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/rulesets/phases/version_get_response.py b/src/cloudflare/types/rulesets/phases/version_get_response.py index 8885e07997ef..e8f1701d4dda 100644 --- a/src/cloudflare/types/rulesets/phases/version_get_response.py +++ b/src/cloudflare/types/rulesets/phases/version_get_response.py @@ -1,13 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Union, Optional from datetime import datetime from typing_extensions import Literal +from ..log_rule import LogRule from ...._models import BaseModel -from ...response_rule import ResponseRule +from ..skip_rule import SkipRule +from ..block_rule import BlockRule +from ..execute_rule import ExecuteRule -__all__ = ["VersionGetResponse"] +__all__ = ["VersionGetResponse", "Rule"] + +Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] class VersionGetResponse(BaseModel): @@ -50,7 +55,7 @@ class VersionGetResponse(BaseModel): ] """The phase of the ruleset.""" - rules: ResponseRule + rules: List[Rule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/rulesets/rule_create_response.py b/src/cloudflare/types/rulesets/rule_create_response.py index 25aa161f8633..3d96e28a3eaa 100644 --- a/src/cloudflare/types/rulesets/rule_create_response.py +++ b/src/cloudflare/types/rulesets/rule_create_response.py @@ -1,13 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Union, Optional from datetime import datetime from typing_extensions import Literal +from .log_rule import LogRule from ..._models import BaseModel -from ..response_rule import ResponseRule +from .skip_rule import SkipRule +from .block_rule import BlockRule +from .execute_rule import ExecuteRule -__all__ = ["RuleCreateResponse"] +__all__ = ["RuleCreateResponse", "Rule"] + +Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] class RuleCreateResponse(BaseModel): @@ -50,7 +55,7 @@ class RuleCreateResponse(BaseModel): ] """The phase of the ruleset.""" - rules: ResponseRule + rules: List[Rule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/rulesets/rule_delete_response.py b/src/cloudflare/types/rulesets/rule_delete_response.py index d4bc191eef93..9533a139323d 100644 --- a/src/cloudflare/types/rulesets/rule_delete_response.py +++ b/src/cloudflare/types/rulesets/rule_delete_response.py @@ -1,13 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Union, Optional from datetime import datetime from typing_extensions import Literal +from .log_rule import LogRule from ..._models import BaseModel -from ..response_rule import ResponseRule +from .skip_rule import SkipRule +from .block_rule import BlockRule +from .execute_rule import ExecuteRule -__all__ = ["RuleDeleteResponse"] +__all__ = ["RuleDeleteResponse", "Rule"] + +Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] class RuleDeleteResponse(BaseModel): @@ -50,7 +55,7 @@ class RuleDeleteResponse(BaseModel): ] """The phase of the ruleset.""" - rules: ResponseRule + rules: List[Rule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/rulesets/rule_edit_response.py b/src/cloudflare/types/rulesets/rule_edit_response.py index d9a1bb830fc5..d13e37c8643c 100644 --- a/src/cloudflare/types/rulesets/rule_edit_response.py +++ b/src/cloudflare/types/rulesets/rule_edit_response.py @@ -1,13 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Union, Optional from datetime import datetime from typing_extensions import Literal +from .log_rule import LogRule from ..._models import BaseModel -from ..response_rule import ResponseRule +from .skip_rule import SkipRule +from .block_rule import BlockRule +from .execute_rule import ExecuteRule -__all__ = ["RuleEditResponse"] +__all__ = ["RuleEditResponse", "Rule"] + +Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] class RuleEditResponse(BaseModel): @@ -50,7 +55,7 @@ class RuleEditResponse(BaseModel): ] """The phase of the ruleset.""" - rules: ResponseRule + rules: List[Rule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/rulesets/version_get_response.py b/src/cloudflare/types/rulesets/version_get_response.py index 43cb89a110b1..fdd1e094340e 100644 --- a/src/cloudflare/types/rulesets/version_get_response.py +++ b/src/cloudflare/types/rulesets/version_get_response.py @@ -1,13 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Union, Optional from datetime import datetime from typing_extensions import Literal +from .log_rule import LogRule from ..._models import BaseModel -from ..response_rule import ResponseRule +from .skip_rule import SkipRule +from .block_rule import BlockRule +from .execute_rule import ExecuteRule -__all__ = ["VersionGetResponse"] +__all__ = ["VersionGetResponse", "Rule"] + +Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] class VersionGetResponse(BaseModel): @@ -50,7 +55,7 @@ class VersionGetResponse(BaseModel): ] """The phase of the ruleset.""" - rules: ResponseRule + rules: List[Rule] """The list of rules in the ruleset.""" version: str diff --git a/src/cloudflare/types/rulesets/versions/by_tag_get_response.py b/src/cloudflare/types/rulesets/versions/by_tag_get_response.py index 2f3386254fdd..e5d1f322f3a9 100644 --- a/src/cloudflare/types/rulesets/versions/by_tag_get_response.py +++ b/src/cloudflare/types/rulesets/versions/by_tag_get_response.py @@ -1,13 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Union, Optional from datetime import datetime from typing_extensions import Literal +from ..log_rule import LogRule from ...._models import BaseModel -from ...response_rule import ResponseRule +from ..skip_rule import SkipRule +from ..block_rule import BlockRule +from ..execute_rule import ExecuteRule -__all__ = ["ByTagGetResponse"] +__all__ = ["ByTagGetResponse", "Rule"] + +Rule = Union[BlockRule, ExecuteRule, LogRule, SkipRule] class ByTagGetResponse(BaseModel): @@ -50,7 +55,7 @@ class ByTagGetResponse(BaseModel): ] """The phase of the ruleset.""" - rules: ResponseRule + rules: List[Rule] """The list of rules in the ruleset.""" version: str