From a4d1ec1309fa2922f073db91f9acea5d464770b9 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Wed, 20 Nov 2024 18:54:11 +0000 Subject: [PATCH] feat(api): update via SDK Studio --- .stats.yml | 4 +- api.md | 24 +- .../resources/pagerules/__init__.py | 33 + .../resources/{ => pagerules}/pagerules.py | 242 +++- .../resources/pagerules/settings.py | 180 +++ src/cloudflare/types/pagerules/__init__.py | 1 + src/cloudflare/types/pagerules/page_rule.py | 344 +---- .../types/pagerules/pagerule_create_params.py | 340 +---- .../types/pagerules/pagerule_edit_params.py | 340 +---- .../types/pagerules/pagerule_update_params.py | 340 +---- .../types/pagerules/setting_list_response.py | 8 + src/cloudflare/types/zones/__init__.py | 21 - .../types/zones/always_use_https.py | 16 +- .../types/zones/always_use_https_param.py | 15 - .../types/zones/automatic_https_rewrites.py | 16 +- .../zones/automatic_https_rewrites_param.py | 11 - .../types/zones/browser_cache_ttl.py | 46 +- .../types/zones/browser_cache_ttl_param.py | 18 - src/cloudflare/types/zones/browser_check.py | 17 +- .../types/zones/browser_check_param.py | 18 - src/cloudflare/types/zones/cache_level.py | 23 +- .../types/zones/cache_level_param.py | 24 - .../types/zones/development_mode.py | 23 +- .../types/zones/development_mode_param.py | 11 - .../types/zones/email_obfuscation.py | 18 +- .../types/zones/email_obfuscation_param.py | 15 - .../types/zones/hotlink_protection.py | 16 +- .../types/zones/hotlink_protection_param.py | 11 - src/cloudflare/types/zones/ip_geolocation.py | 21 +- .../types/zones/ip_geolocation_param.py | 22 - src/cloudflare/types/zones/mirage.py | 22 +- src/cloudflare/types/zones/mirage_param.py | 23 - .../types/zones/opportunistic_encryption.py | 22 +- .../zones/opportunistic_encryption_param.py | 23 - .../zones/origin_error_page_pass_thru.py | 21 +- .../origin_error_page_pass_thru_param.py | 22 - src/cloudflare/types/zones/polish.py | 22 +- src/cloudflare/types/zones/polish_param.py | 19 - .../types/zones/response_buffering.py | 18 +- .../types/zones/response_buffering_param.py | 19 - src/cloudflare/types/zones/rocket_loader.py | 18 +- .../types/zones/rocket_loader_param.py | 15 - src/cloudflare/types/zones/security_level.py | 17 +- .../types/zones/security_level_param.py | 14 - .../types/zones/server_side_excludes.py | 16 +- .../types/zones/server_side_excludes_param.py | 11 - .../types/zones/setting_edit_params.py | 132 +- .../types/zones/setting_edit_response.py | 483 +------ .../types/zones/setting_get_response.py | 483 +------ .../zones/sort_query_string_for_cache.py | 23 +- .../sort_query_string_for_cache_param.py | 22 - src/cloudflare/types/zones/ssl.py | 21 +- src/cloudflare/types/zones/ssl_param.py | 22 - .../types/zones/true_client_ip_header.py | 22 +- .../zones/true_client_ip_header_param.py | 19 - src/cloudflare/types/zones/waf.py | 22 +- src/cloudflare/types/zones/waf_param.py | 23 - tests/api_resources/pagerules/__init__.py | 1 + .../api_resources/pagerules/test_settings.py | 98 ++ tests/api_resources/test_pagerules.py | 1218 +++++++++-------- 60 files changed, 1672 insertions(+), 3437 deletions(-) create mode 100644 src/cloudflare/resources/pagerules/__init__.py rename src/cloudflare/resources/{ => pagerules}/pagerules.py (78%) create mode 100644 src/cloudflare/resources/pagerules/settings.py create mode 100644 src/cloudflare/types/pagerules/setting_list_response.py delete mode 100644 src/cloudflare/types/zones/always_use_https_param.py delete mode 100644 src/cloudflare/types/zones/automatic_https_rewrites_param.py delete mode 100644 src/cloudflare/types/zones/browser_cache_ttl_param.py delete mode 100644 src/cloudflare/types/zones/browser_check_param.py delete mode 100644 src/cloudflare/types/zones/cache_level_param.py delete mode 100644 src/cloudflare/types/zones/development_mode_param.py delete mode 100644 src/cloudflare/types/zones/email_obfuscation_param.py delete mode 100644 src/cloudflare/types/zones/hotlink_protection_param.py delete mode 100644 src/cloudflare/types/zones/ip_geolocation_param.py delete mode 100644 src/cloudflare/types/zones/mirage_param.py delete mode 100644 src/cloudflare/types/zones/opportunistic_encryption_param.py delete mode 100644 src/cloudflare/types/zones/origin_error_page_pass_thru_param.py delete mode 100644 src/cloudflare/types/zones/polish_param.py delete mode 100644 src/cloudflare/types/zones/response_buffering_param.py delete mode 100644 src/cloudflare/types/zones/rocket_loader_param.py delete mode 100644 src/cloudflare/types/zones/security_level_param.py delete mode 100644 src/cloudflare/types/zones/server_side_excludes_param.py delete mode 100644 src/cloudflare/types/zones/sort_query_string_for_cache_param.py delete mode 100644 src/cloudflare/types/zones/ssl_param.py delete mode 100644 src/cloudflare/types/zones/true_client_ip_header_param.py delete mode 100644 src/cloudflare/types/zones/waf_param.py create mode 100644 tests/api_resources/pagerules/__init__.py create mode 100644 tests/api_resources/pagerules/test_settings.py diff --git a/.stats.yml b/.stats.yml index f104a2802ba..96071d514cc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1407 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-e1b0a84e75d7d2eb973ab4f14ecab9f77bd39c49ebc14fdd54066e72aa43a5be.yml +configured_endpoints: 1408 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-9482a52799bf82c48325ec6462f86b2c70ade8214816411c9b104620ac94f73e.yml diff --git a/api.md b/api.md index 847c6166c78..44c5e2d0fdc 100644 --- a/api.md +++ b/api.md @@ -1856,12 +1856,24 @@ from cloudflare.types.pagerules import ( Methods: -- client.pagerules.create(\*, zone_id, \*\*params) -> Optional -- client.pagerules.update(pagerule_id, \*, zone_id, \*\*params) -> Optional -- client.pagerules.list(\*, zone_id, \*\*params) -> Optional -- client.pagerules.delete(pagerule_id, \*, zone_id) -> Optional -- client.pagerules.edit(pagerule_id, \*, zone_id, \*\*params) -> Optional -- client.pagerules.get(pagerule_id, \*, zone_id) -> Optional +- client.pagerules.create(\*, zone_id, \*\*params) -> Optional +- client.pagerules.update(pagerule_id, \*, zone_id, \*\*params) -> Optional +- client.pagerules.list(\*, zone_id, \*\*params) -> Optional +- client.pagerules.delete(pagerule_id, \*, zone_id) -> Optional +- client.pagerules.edit(pagerule_id, \*, zone_id, \*\*params) -> Optional +- client.pagerules.get(pagerule_id, \*, zone_id) -> Optional + +## Settings + +Types: + +```python +from cloudflare.types.pagerules import SettingListResponse +``` + +Methods: + +- client.pagerules.settings.list(\*, zone_id) -> Optional # RateLimits diff --git a/src/cloudflare/resources/pagerules/__init__.py b/src/cloudflare/resources/pagerules/__init__.py new file mode 100644 index 00000000000..d1c6434816b --- /dev/null +++ b/src/cloudflare/resources/pagerules/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .settings import ( + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, +) +from .pagerules import ( + PagerulesResource, + AsyncPagerulesResource, + PagerulesResourceWithRawResponse, + AsyncPagerulesResourceWithRawResponse, + PagerulesResourceWithStreamingResponse, + AsyncPagerulesResourceWithStreamingResponse, +) + +__all__ = [ + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", + "PagerulesResource", + "AsyncPagerulesResource", + "PagerulesResourceWithRawResponse", + "AsyncPagerulesResourceWithRawResponse", + "PagerulesResourceWithStreamingResponse", + "AsyncPagerulesResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/pagerules.py b/src/cloudflare/resources/pagerules/pagerules.py similarity index 78% rename from src/cloudflare/resources/pagerules.py rename to src/cloudflare/resources/pagerules/pagerules.py index 3297f84978a..7bfa3204cfe 100644 --- a/src/cloudflare/resources/pagerules.py +++ b/src/cloudflare/resources/pagerules/pagerules.py @@ -2,36 +2,54 @@ from __future__ import annotations +import typing_extensions from typing import Type, Iterable, Optional, cast from typing_extensions import Literal import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import ( maybe_transform, async_maybe_transform, ) -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( +from .settings import ( + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, +) +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from .._wrappers import ResultWrapper -from .._base_client import make_request_options -from ..types.pagerules import pagerule_edit_params, pagerule_list_params, pagerule_create_params, pagerule_update_params -from ..types.pagerules.page_rule import PageRule -from ..types.pagerules.target_param import TargetParam -from ..types.pagerules.pagerule_list_response import PageruleListResponse -from ..types.pagerules.pagerule_delete_response import PageruleDeleteResponse +from ..._wrappers import ResultWrapper +from ..._base_client import make_request_options +from ...types.pagerules import ( + pagerule_edit_params, + pagerule_list_params, + pagerule_create_params, + pagerule_update_params, +) +from ...types.pagerules.page_rule import PageRule +from ...types.pagerules.target_param import TargetParam +from ...types.pagerules.pagerule_list_response import PageruleListResponse +from ...types.pagerules.pagerule_delete_response import PageruleDeleteResponse __all__ = ["PagerulesResource", "AsyncPagerulesResource"] class PagerulesResource(SyncAPIResource): + @cached_property + def settings(self) -> SettingsResource: + return SettingsResource(self._client) + @cached_property def with_raw_response(self) -> PagerulesResourceWithRawResponse: """ @@ -51,6 +69,9 @@ def with_streaming_response(self) -> PagerulesResourceWithStreamingResponse: """ return PagerulesResourceWithStreamingResponse(self) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) def create( self, *, @@ -116,6 +137,9 @@ def create( cast_to=cast(Type[Optional[PageRule]], ResultWrapper[PageRule]), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) def update( self, pagerule_id: str, @@ -188,6 +212,9 @@ def update( cast_to=cast(Type[Optional[PageRule]], ResultWrapper[PageRule]), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) def list( self, *, @@ -249,6 +276,9 @@ def list( cast_to=cast(Type[Optional[PageruleListResponse]], ResultWrapper[PageruleListResponse]), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) def delete( self, pagerule_id: str, @@ -293,6 +323,9 @@ def delete( cast_to=cast(Type[Optional[PageruleDeleteResponse]], ResultWrapper[PageruleDeleteResponse]), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) def edit( self, pagerule_id: str, @@ -363,6 +396,9 @@ def edit( cast_to=cast(Type[Optional[PageRule]], ResultWrapper[PageRule]), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) def get( self, pagerule_id: str, @@ -409,6 +445,10 @@ def get( class AsyncPagerulesResource(AsyncAPIResource): + @cached_property + def settings(self) -> AsyncSettingsResource: + return AsyncSettingsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncPagerulesResourceWithRawResponse: """ @@ -428,6 +468,9 @@ def with_streaming_response(self) -> AsyncPagerulesResourceWithStreamingResponse """ return AsyncPagerulesResourceWithStreamingResponse(self) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) async def create( self, *, @@ -493,6 +536,9 @@ async def create( cast_to=cast(Type[Optional[PageRule]], ResultWrapper[PageRule]), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) async def update( self, pagerule_id: str, @@ -565,6 +611,9 @@ async def update( cast_to=cast(Type[Optional[PageRule]], ResultWrapper[PageRule]), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) async def list( self, *, @@ -626,6 +675,9 @@ async def list( cast_to=cast(Type[Optional[PageruleListResponse]], ResultWrapper[PageruleListResponse]), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) async def delete( self, pagerule_id: str, @@ -670,6 +722,9 @@ async def delete( cast_to=cast(Type[Optional[PageruleDeleteResponse]], ResultWrapper[PageruleDeleteResponse]), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) async def edit( self, pagerule_id: str, @@ -740,6 +795,9 @@ async def edit( cast_to=cast(Type[Optional[PageRule]], ResultWrapper[PageRule]), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) async def get( self, pagerule_id: str, @@ -789,93 +847,157 @@ class PagerulesResourceWithRawResponse: def __init__(self, pagerules: PagerulesResource) -> None: self._pagerules = pagerules - self.create = to_raw_response_wrapper( - pagerules.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + pagerules.create # pyright: ignore[reportDeprecated], + ) ) - self.update = to_raw_response_wrapper( - pagerules.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + pagerules.update # pyright: ignore[reportDeprecated], + ) ) - self.list = to_raw_response_wrapper( - pagerules.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + pagerules.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_raw_response_wrapper( - pagerules.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + pagerules.delete # pyright: ignore[reportDeprecated], + ) ) - self.edit = to_raw_response_wrapper( - pagerules.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + pagerules.edit # pyright: ignore[reportDeprecated], + ) ) - self.get = to_raw_response_wrapper( - pagerules.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + pagerules.get # pyright: ignore[reportDeprecated], + ) ) + @cached_property + def settings(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self._pagerules.settings) + class AsyncPagerulesResourceWithRawResponse: def __init__(self, pagerules: AsyncPagerulesResource) -> None: self._pagerules = pagerules - self.create = async_to_raw_response_wrapper( - pagerules.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + pagerules.create # pyright: ignore[reportDeprecated], + ) ) - self.update = async_to_raw_response_wrapper( - pagerules.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + pagerules.update # pyright: ignore[reportDeprecated], + ) ) - self.list = async_to_raw_response_wrapper( - pagerules.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + pagerules.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_raw_response_wrapper( - pagerules.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + pagerules.delete # pyright: ignore[reportDeprecated], + ) ) - self.edit = async_to_raw_response_wrapper( - pagerules.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + pagerules.edit # pyright: ignore[reportDeprecated], + ) ) - self.get = async_to_raw_response_wrapper( - pagerules.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + pagerules.get # pyright: ignore[reportDeprecated], + ) ) + @cached_property + def settings(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self._pagerules.settings) + class PagerulesResourceWithStreamingResponse: def __init__(self, pagerules: PagerulesResource) -> None: self._pagerules = pagerules - self.create = to_streamed_response_wrapper( - pagerules.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + pagerules.create # pyright: ignore[reportDeprecated], + ) ) - self.update = to_streamed_response_wrapper( - pagerules.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + pagerules.update # pyright: ignore[reportDeprecated], + ) ) - self.list = to_streamed_response_wrapper( - pagerules.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + pagerules.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_streamed_response_wrapper( - pagerules.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + pagerules.delete # pyright: ignore[reportDeprecated], + ) ) - self.edit = to_streamed_response_wrapper( - pagerules.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + pagerules.edit # pyright: ignore[reportDeprecated], + ) ) - self.get = to_streamed_response_wrapper( - pagerules.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + pagerules.get # pyright: ignore[reportDeprecated], + ) ) + @cached_property + def settings(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self._pagerules.settings) + class AsyncPagerulesResourceWithStreamingResponse: def __init__(self, pagerules: AsyncPagerulesResource) -> None: self._pagerules = pagerules - self.create = async_to_streamed_response_wrapper( - pagerules.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + pagerules.create # pyright: ignore[reportDeprecated], + ) ) - self.update = async_to_streamed_response_wrapper( - pagerules.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + pagerules.update # pyright: ignore[reportDeprecated], + ) ) - self.list = async_to_streamed_response_wrapper( - pagerules.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + pagerules.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_streamed_response_wrapper( - pagerules.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + pagerules.delete # pyright: ignore[reportDeprecated], + ) ) - self.edit = async_to_streamed_response_wrapper( - pagerules.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + pagerules.edit # pyright: ignore[reportDeprecated], + ) ) - self.get = async_to_streamed_response_wrapper( - pagerules.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + pagerules.get # pyright: ignore[reportDeprecated], + ) ) + + @cached_property + def settings(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self._pagerules.settings) diff --git a/src/cloudflare/resources/pagerules/settings.py b/src/cloudflare/resources/pagerules/settings.py new file mode 100644 index 00000000000..bd598cff9db --- /dev/null +++ b/src/cloudflare/resources/pagerules/settings.py @@ -0,0 +1,180 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Type, Optional, cast + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._wrappers import ResultWrapper +from ..._base_client import make_request_options +from ...types.pagerules.setting_list_response import SettingListResponse + +__all__ = ["SettingsResource", "AsyncSettingsResource"] + + +class SettingsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SettingsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return SettingsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return SettingsResourceWithStreamingResponse(self) + + def list( + self, + *, + zone_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[SettingListResponse]: + """ + Returns a list of settings (and their details) that Page Rules can apply to + matching requests. + + Args: + zone_id: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return self._get( + f"/zones/{zone_id}/pagerules/settings", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[SettingListResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[SettingListResponse]], ResultWrapper[SettingListResponse]), + ) + + +class AsyncSettingsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncSettingsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncSettingsResourceWithStreamingResponse(self) + + async def list( + self, + *, + zone_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[SettingListResponse]: + """ + Returns a list of settings (and their details) that Page Rules can apply to + matching requests. + + Args: + zone_id: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return await self._get( + f"/zones/{zone_id}/pagerules/settings", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[SettingListResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[SettingListResponse]], ResultWrapper[SettingListResponse]), + ) + + +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: + self._settings = settings + + self.list = to_raw_response_wrapper( + settings.list, + ) + + +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: + self._settings = settings + + self.list = async_to_raw_response_wrapper( + settings.list, + ) + + +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: + self._settings = settings + + self.list = to_streamed_response_wrapper( + settings.list, + ) + + +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: + self._settings = settings + + self.list = async_to_streamed_response_wrapper( + settings.list, + ) diff --git a/src/cloudflare/types/pagerules/__init__.py b/src/cloudflare/types/pagerules/__init__.py index a023afa9b37..067b2828771 100644 --- a/src/cloudflare/types/pagerules/__init__.py +++ b/src/cloudflare/types/pagerules/__init__.py @@ -7,6 +7,7 @@ from .target_param import TargetParam as TargetParam from .pagerule_edit_params import PageruleEditParams as PageruleEditParams from .pagerule_list_params import PageruleListParams as PageruleListParams +from .setting_list_response import SettingListResponse as SettingListResponse from .pagerule_create_params import PageruleCreateParams as PageruleCreateParams from .pagerule_list_response import PageruleListResponse as PageruleListResponse from .pagerule_update_params import PageruleUpdateParams as PageruleUpdateParams diff --git a/src/cloudflare/types/pagerules/page_rule.py b/src/cloudflare/types/pagerules/page_rule.py index a8d30133f49..198378298e6 100644 --- a/src/cloudflare/types/pagerules/page_rule.py +++ b/src/cloudflare/types/pagerules/page_rule.py @@ -1,261 +1,16 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import List, Optional from datetime import datetime -from typing_extensions import Literal, Annotated, TypeAlias +from typing_extensions import Literal from .target import Target -from ..._utils import PropertyInfo from ..._models import BaseModel -from ..zones.ssl import SSL -from ..zones.waf import WAF -from ..zones.mirage import Mirage -from ..zones.polish import Polish -from ..zones.cache_level import CacheLevel -from ..zones.browser_check import BrowserCheck -from ..zones.rocket_loader import RocketLoader -from ..zones.ip_geolocation import IPGeolocation -from ..zones.security_level import SecurityLevel -from ..zones.always_use_https import AlwaysUseHTTPS -from ..zones.development_mode import DevelopmentMode -from ..zones.browser_cache_ttl import BrowserCacheTTL -from ..zones.email_obfuscation import EmailObfuscation -from ..zones.hotlink_protection import HotlinkProtection -from ..zones.response_buffering import ResponseBuffering -from ..zones.server_side_excludes import ServerSideExcludes -from ..zones.true_client_ip_header import TrueClientIPHeader -from ..zones.automatic_https_rewrites import AutomaticHTTPSRewrites -from ..zones.opportunistic_encryption import OpportunisticEncryption -from ..zones.origin_error_page_pass_thru import OriginErrorPagePassThru -from ..zones.sort_query_string_for_cache import SortQueryStringForCache -__all__ = [ - "PageRule", - "Action", - "ActionBypassCacheOnCookie", - "ActionCacheByDeviceType", - "ActionCacheDeceptionArmor", - "ActionCacheKey", - "ActionCacheKeyValue", - "ActionCacheKeyValueCookie", - "ActionCacheKeyValueHeader", - "ActionCacheKeyValueHost", - "ActionCacheKeyValueQueryString", - "ActionCacheKeyValueUser", - "ActionCacheKeyFields", - "ActionCacheOnCookie", - "ActionCacheTTLByStatus", - "ActionDDoSProtection", - "ActionDisableApps", - "ActionDisablePerformance", - "ActionDisableSecurity", - "ActionDisableZaraz", - "ActionEdgeCacheTTL", - "ActionExplicitCacheControl", - "ActionForwardingURL", - "ActionForwardingURLValue", - "ActionHostHeaderOverride", - "ActionMinify", - "ActionPurgeByPageRule", - "ActionResolveOverride", - "ActionResolveOverrideValue", - "ActionRespectStrongEtag", -] +__all__ = ["PageRule", "Action", "ActionValue"] -class ActionBypassCacheOnCookie(BaseModel): - id: Optional[Literal["bypass_cache_on_cookie"]] = None - """ - Bypass cache and fetch resources from the origin server if a regular expression - matches against a cookie name present in the request. - """ - - value: Optional[str] = None - """The regular expression to use for matching cookie names in the request. - - Refer to - [Bypass Cache on Cookie setting](https://developers.cloudflare.com/rules/page-rules/reference/additional-reference/#bypass-cache-on-cookie-setting) - to learn about limited regular expression support. - """ - - -class ActionCacheByDeviceType(BaseModel): - id: Optional[Literal["cache_by_device_type"]] = None - """Separate cached content based on the visitor's device type.""" - - value: Optional[Literal["on", "off"]] = None - """The status of Cache By Device Type.""" - - -class ActionCacheDeceptionArmor(BaseModel): - id: Optional[Literal["cache_deception_armor"]] = None - """ - Protect from web cache deception attacks while still allowing static assets to - be cached. This setting verifies that the URL's extension matches the returned - `Content-Type`. - """ - - value: Optional[Literal["on", "off"]] = None - """The status of Cache Deception Armor.""" - - -class ActionCacheKeyValueCookie(BaseModel): - check_presence: Optional[List[str]] = None - """ - A list of cookies to check for the presence of, without including their actual - values. - """ - - include: Optional[List[str]] = None - """A list of cookies to include.""" - - -class ActionCacheKeyValueHeader(BaseModel): - check_presence: Optional[List[str]] = None - """ - A list of headers to check for the presence of, without including their actual - values. - """ - - exclude: Optional[List[str]] = None - """A list of headers to ignore.""" - - include: Optional[List[str]] = None - """A list of headers to include.""" - - -class ActionCacheKeyValueHost(BaseModel): - resolved: Optional[bool] = None - """Whether to include the Host header in the HTTP request sent to the origin.""" - - -class ActionCacheKeyValueQueryString(BaseModel): - exclude: Union[Literal["*"], List[str], None] = None - """Ignore all query string parameters.""" - - include: Union[Literal["*"], List[str], None] = None - """Include all query string parameters.""" - - -class ActionCacheKeyValueUser(BaseModel): - device_type: Optional[bool] = None - """ - Classifies a request as `mobile`, `desktop`, or `tablet` based on the User - Agent. - """ - - geo: Optional[bool] = None - """Includes the client's country, derived from the IP address.""" - - lang: Optional[bool] = None - """ - Includes the first language code contained in the `Accept-Language` header sent - by the client. - """ - - -class ActionCacheKeyValue(BaseModel): - cookie: Optional[ActionCacheKeyValueCookie] = None - """Controls which cookies appear in the Cache Key.""" - - header: Optional[ActionCacheKeyValueHeader] = None - """Controls which headers go into the Cache Key. - - Exactly one of `include` or `exclude` is expected. - """ - - host: Optional[ActionCacheKeyValueHost] = None - """Determines which host header to include in the Cache Key.""" - - query_string: Optional[ActionCacheKeyValueQueryString] = None - """Controls which URL query string parameters go into the Cache Key. - - Exactly one of `include` or `exclude` is expected. - """ - - user: Optional[ActionCacheKeyValueUser] = None - """Feature fields to add features about the end-user (client) into the Cache Key.""" - - -class ActionCacheKey(BaseModel): - id: Optional[Literal["cache_key"]] = None - """ - Control specifically what variables to include when deciding which resources to - cache. This allows customers to determine what to cache based on something other - than just the URL. - """ - - value: Optional[ActionCacheKeyValue] = None - - -class ActionCacheKeyFields(BaseModel): - id: Optional[Literal["cache_key_fields"]] = None - - -class ActionCacheOnCookie(BaseModel): - id: Optional[Literal["cache_on_cookie"]] = None - - -class ActionCacheTTLByStatus(BaseModel): - id: Optional[Literal["cache_ttl_by_status"]] = None - - -class ActionDDoSProtection(BaseModel): - id: Optional[Literal["ddos_protection"]] = None - - -class ActionDisableApps(BaseModel): - id: Optional[Literal["disable_apps"]] = None - """ - Turn off all active - [Cloudflare Apps](https://developers.cloudflare.com/support/more-dashboard-apps/cloudflare-apps/) - (deprecated). - """ - - -class ActionDisablePerformance(BaseModel): - id: Optional[Literal["disable_performance"]] = None - """ - Turn off - [Rocket Loader](https://developers.cloudflare.com/speed/optimization/content/rocket-loader/), - [Mirage](https://developers.cloudflare.com/speed/optimization/images/mirage/), - and [Polish](https://developers.cloudflare.com/images/polish/). - """ - - -class ActionDisableSecurity(BaseModel): - id: Optional[Literal["disable_security"]] = None - """ - Turn off - [Email Obfuscation](https://developers.cloudflare.com/waf/tools/scrape-shield/email-address-obfuscation/), - [Rate Limiting (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-rate-limiting/), - [Scrape Shield](https://developers.cloudflare.com/waf/tools/scrape-shield/), - [URL (Zone) Lockdown](https://developers.cloudflare.com/waf/tools/zone-lockdown/), - and - [WAF managed rules (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-waf-managed-rules/). - """ - - -class ActionDisableZaraz(BaseModel): - id: Optional[Literal["disable_zaraz"]] = None - """Turn off [Zaraz](https://developers.cloudflare.com/zaraz/).""" - - -class ActionEdgeCacheTTL(BaseModel): - id: Optional[Literal["edge_cache_ttl"]] = None - """Specify how long to cache a resource in the Cloudflare global network. - - _Edge Cache TTL_ is not visible in response headers. - """ - - value: Optional[int] = None - - -class ActionExplicitCacheControl(BaseModel): - id: Optional[Literal["explicit_cache_control"]] = None - - -class ActionForwardingURLValue(BaseModel): +class ActionValue(BaseModel): status_code: Optional[Literal[301, 302]] = None """The status code to use for the URL redirect. @@ -269,7 +24,7 @@ class ActionForwardingURLValue(BaseModel): """ -class ActionForwardingURL(BaseModel): +class Action(BaseModel): id: Optional[Literal["forwarding_url"]] = None """Redirects one URL to another using an `HTTP 301/302` redirect. @@ -277,94 +32,7 @@ class ActionForwardingURL(BaseModel): [Wildcard matching and referencing](https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/). """ - value: Optional[ActionForwardingURLValue] = None - - -class ActionHostHeaderOverride(BaseModel): - id: Optional[Literal["host_header_override"]] = None - """Apply a specific host header.""" - - value: Optional[str] = None - """The hostname to use in the `Host` header""" - - -class ActionMinify(BaseModel): - id: Optional[Literal["minify"]] = None - - -class ActionPurgeByPageRule(BaseModel): - id: Optional[Literal["purge_by_page_rule"]] = None - - -class ActionResolveOverrideValue(BaseModel): - value: Optional[str] = None - """The origin address you want to override with.""" - - -class ActionResolveOverride(BaseModel): - id: Optional[Literal["resolve_override"]] = None - """Change the origin address to the value specified in this setting.""" - - value: Optional[ActionResolveOverrideValue] = None - - -class ActionRespectStrongEtag(BaseModel): - id: Optional[Literal["respect_strong_etag"]] = None - """ - Turn on or off byte-for-byte equivalency checks between the Cloudflare cache and - the origin server. - """ - - value: Optional[Literal["on", "off"]] = None - """The status of Respect Strong ETags""" - - -Action: TypeAlias = Annotated[ - Union[ - AlwaysUseHTTPS, - AutomaticHTTPSRewrites, - BrowserCacheTTL, - BrowserCheck, - ActionBypassCacheOnCookie, - ActionCacheByDeviceType, - ActionCacheDeceptionArmor, - ActionCacheKey, - ActionCacheKeyFields, - CacheLevel, - ActionCacheOnCookie, - ActionCacheTTLByStatus, - ActionDDoSProtection, - DevelopmentMode, - ActionDisableApps, - ActionDisablePerformance, - ActionDisableSecurity, - ActionDisableZaraz, - ActionEdgeCacheTTL, - EmailObfuscation, - ActionExplicitCacheControl, - ActionForwardingURL, - ActionHostHeaderOverride, - HotlinkProtection, - IPGeolocation, - ActionMinify, - Mirage, - OpportunisticEncryption, - OriginErrorPagePassThru, - Polish, - ActionPurgeByPageRule, - ActionResolveOverride, - ActionRespectStrongEtag, - ResponseBuffering, - RocketLoader, - SecurityLevel, - ServerSideExcludes, - SortQueryStringForCache, - SSL, - TrueClientIPHeader, - WAF, - ], - PropertyInfo(discriminator="id"), -] + value: Optional[ActionValue] = None class PageRule(BaseModel): diff --git a/src/cloudflare/types/pagerules/pagerule_create_params.py b/src/cloudflare/types/pagerules/pagerule_create_params.py index 805b38d7e00..1a554231d3a 100644 --- a/src/cloudflare/types/pagerules/pagerule_create_params.py +++ b/src/cloudflare/types/pagerules/pagerule_create_params.py @@ -2,64 +2,12 @@ from __future__ import annotations -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, TypeAlias, TypedDict +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict from .target_param import TargetParam -from ..zones.ssl_param import SSLParam -from ..zones.waf_param import WAFParam -from ..zones.mirage_param import MirageParam -from ..zones.polish_param import PolishParam -from ..zones.cache_level_param import CacheLevelParam -from ..zones.browser_check_param import BrowserCheckParam -from ..zones.rocket_loader_param import RocketLoaderParam -from ..zones.ip_geolocation_param import IPGeolocationParam -from ..zones.security_level_param import SecurityLevelParam -from ..zones.always_use_https_param import AlwaysUseHTTPSParam -from ..zones.development_mode_param import DevelopmentModeParam -from ..zones.browser_cache_ttl_param import BrowserCacheTTLParam -from ..zones.email_obfuscation_param import EmailObfuscationParam -from ..zones.hotlink_protection_param import HotlinkProtectionParam -from ..zones.response_buffering_param import ResponseBufferingParam -from ..zones.server_side_excludes_param import ServerSideExcludesParam -from ..zones.true_client_ip_header_param import TrueClientIPHeaderParam -from ..zones.automatic_https_rewrites_param import AutomaticHTTPSRewritesParam -from ..zones.opportunistic_encryption_param import OpportunisticEncryptionParam -from ..zones.origin_error_page_pass_thru_param import OriginErrorPagePassThruParam -from ..zones.sort_query_string_for_cache_param import SortQueryStringForCacheParam -__all__ = [ - "PageruleCreateParams", - "Action", - "ActionBypassCacheOnCookie", - "ActionCacheByDeviceType", - "ActionCacheDeceptionArmor", - "ActionCacheKey", - "ActionCacheKeyValue", - "ActionCacheKeyValueCookie", - "ActionCacheKeyValueHeader", - "ActionCacheKeyValueHost", - "ActionCacheKeyValueQueryString", - "ActionCacheKeyValueUser", - "ActionCacheKeyFields", - "ActionCacheOnCookie", - "ActionCacheTTLByStatus", - "ActionDDoSProtection", - "ActionDisableApps", - "ActionDisablePerformance", - "ActionDisableSecurity", - "ActionDisableZaraz", - "ActionEdgeCacheTTL", - "ActionExplicitCacheControl", - "ActionForwardingURL", - "ActionForwardingURLValue", - "ActionHostHeaderOverride", - "ActionMinify", - "ActionPurgeByPageRule", - "ActionResolveOverride", - "ActionResolveOverrideValue", - "ActionRespectStrongEtag", -] +__all__ = ["PageruleCreateParams", "Action", "ActionValue"] class PageruleCreateParams(TypedDict, total=False): @@ -88,199 +36,7 @@ class PageruleCreateParams(TypedDict, total=False): """The status of the Page Rule.""" -class ActionBypassCacheOnCookie(TypedDict, total=False): - id: Literal["bypass_cache_on_cookie"] - """ - Bypass cache and fetch resources from the origin server if a regular expression - matches against a cookie name present in the request. - """ - - value: str - """The regular expression to use for matching cookie names in the request. - - Refer to - [Bypass Cache on Cookie setting](https://developers.cloudflare.com/rules/page-rules/reference/additional-reference/#bypass-cache-on-cookie-setting) - to learn about limited regular expression support. - """ - - -class ActionCacheByDeviceType(TypedDict, total=False): - id: Literal["cache_by_device_type"] - """Separate cached content based on the visitor's device type.""" - - value: Literal["on", "off"] - """The status of Cache By Device Type.""" - - -class ActionCacheDeceptionArmor(TypedDict, total=False): - id: Literal["cache_deception_armor"] - """ - Protect from web cache deception attacks while still allowing static assets to - be cached. This setting verifies that the URL's extension matches the returned - `Content-Type`. - """ - - value: Literal["on", "off"] - """The status of Cache Deception Armor.""" - - -class ActionCacheKeyValueCookie(TypedDict, total=False): - check_presence: List[str] - """ - A list of cookies to check for the presence of, without including their actual - values. - """ - - include: List[str] - """A list of cookies to include.""" - - -class ActionCacheKeyValueHeader(TypedDict, total=False): - check_presence: List[str] - """ - A list of headers to check for the presence of, without including their actual - values. - """ - - exclude: List[str] - """A list of headers to ignore.""" - - include: List[str] - """A list of headers to include.""" - - -class ActionCacheKeyValueHost(TypedDict, total=False): - resolved: bool - """Whether to include the Host header in the HTTP request sent to the origin.""" - - -class ActionCacheKeyValueQueryString(TypedDict, total=False): - exclude: Union[Literal["*"], List[str]] - """Ignore all query string parameters.""" - - include: Union[Literal["*"], List[str]] - """Include all query string parameters.""" - - -class ActionCacheKeyValueUser(TypedDict, total=False): - device_type: bool - """ - Classifies a request as `mobile`, `desktop`, or `tablet` based on the User - Agent. - """ - - geo: bool - """Includes the client's country, derived from the IP address.""" - - lang: bool - """ - Includes the first language code contained in the `Accept-Language` header sent - by the client. - """ - - -class ActionCacheKeyValue(TypedDict, total=False): - cookie: ActionCacheKeyValueCookie - """Controls which cookies appear in the Cache Key.""" - - header: ActionCacheKeyValueHeader - """Controls which headers go into the Cache Key. - - Exactly one of `include` or `exclude` is expected. - """ - - host: ActionCacheKeyValueHost - """Determines which host header to include in the Cache Key.""" - - query_string: ActionCacheKeyValueQueryString - """Controls which URL query string parameters go into the Cache Key. - - Exactly one of `include` or `exclude` is expected. - """ - - user: ActionCacheKeyValueUser - """Feature fields to add features about the end-user (client) into the Cache Key.""" - - -class ActionCacheKey(TypedDict, total=False): - id: Literal["cache_key"] - """ - Control specifically what variables to include when deciding which resources to - cache. This allows customers to determine what to cache based on something other - than just the URL. - """ - - value: ActionCacheKeyValue - - -class ActionCacheKeyFields(TypedDict, total=False): - id: Literal["cache_key_fields"] - - -class ActionCacheOnCookie(TypedDict, total=False): - id: Literal["cache_on_cookie"] - - -class ActionCacheTTLByStatus(TypedDict, total=False): - id: Literal["cache_ttl_by_status"] - - -class ActionDDoSProtection(TypedDict, total=False): - id: Literal["ddos_protection"] - - -class ActionDisableApps(TypedDict, total=False): - id: Literal["disable_apps"] - """ - Turn off all active - [Cloudflare Apps](https://developers.cloudflare.com/support/more-dashboard-apps/cloudflare-apps/) - (deprecated). - """ - - -class ActionDisablePerformance(TypedDict, total=False): - id: Literal["disable_performance"] - """ - Turn off - [Rocket Loader](https://developers.cloudflare.com/speed/optimization/content/rocket-loader/), - [Mirage](https://developers.cloudflare.com/speed/optimization/images/mirage/), - and [Polish](https://developers.cloudflare.com/images/polish/). - """ - - -class ActionDisableSecurity(TypedDict, total=False): - id: Literal["disable_security"] - """ - Turn off - [Email Obfuscation](https://developers.cloudflare.com/waf/tools/scrape-shield/email-address-obfuscation/), - [Rate Limiting (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-rate-limiting/), - [Scrape Shield](https://developers.cloudflare.com/waf/tools/scrape-shield/), - [URL (Zone) Lockdown](https://developers.cloudflare.com/waf/tools/zone-lockdown/), - and - [WAF managed rules (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-waf-managed-rules/). - """ - - -class ActionDisableZaraz(TypedDict, total=False): - id: Literal["disable_zaraz"] - """Turn off [Zaraz](https://developers.cloudflare.com/zaraz/).""" - - -class ActionEdgeCacheTTL(TypedDict, total=False): - id: Literal["edge_cache_ttl"] - """Specify how long to cache a resource in the Cloudflare global network. - - _Edge Cache TTL_ is not visible in response headers. - """ - - value: int - - -class ActionExplicitCacheControl(TypedDict, total=False): - id: Literal["explicit_cache_control"] - - -class ActionForwardingURLValue(TypedDict, total=False): +class ActionValue(TypedDict, total=False): status_code: Literal[301, 302] """The status code to use for the URL redirect. @@ -294,7 +50,7 @@ class ActionForwardingURLValue(TypedDict, total=False): """ -class ActionForwardingURL(TypedDict, total=False): +class Action(TypedDict, total=False): id: Literal["forwarding_url"] """Redirects one URL to another using an `HTTP 301/302` redirect. @@ -302,88 +58,4 @@ class ActionForwardingURL(TypedDict, total=False): [Wildcard matching and referencing](https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/). """ - value: ActionForwardingURLValue - - -class ActionHostHeaderOverride(TypedDict, total=False): - id: Literal["host_header_override"] - """Apply a specific host header.""" - - value: str - """The hostname to use in the `Host` header""" - - -class ActionMinify(TypedDict, total=False): - id: Literal["minify"] - - -class ActionPurgeByPageRule(TypedDict, total=False): - id: Literal["purge_by_page_rule"] - - -class ActionResolveOverrideValue(TypedDict, total=False): - value: str - """The origin address you want to override with.""" - - -class ActionResolveOverride(TypedDict, total=False): - id: Literal["resolve_override"] - """Change the origin address to the value specified in this setting.""" - - value: ActionResolveOverrideValue - - -class ActionRespectStrongEtag(TypedDict, total=False): - id: Literal["respect_strong_etag"] - """ - Turn on or off byte-for-byte equivalency checks between the Cloudflare cache and - the origin server. - """ - - value: Literal["on", "off"] - """The status of Respect Strong ETags""" - - -Action: TypeAlias = Union[ - AlwaysUseHTTPSParam, - AutomaticHTTPSRewritesParam, - BrowserCacheTTLParam, - BrowserCheckParam, - ActionBypassCacheOnCookie, - ActionCacheByDeviceType, - ActionCacheDeceptionArmor, - ActionCacheKey, - ActionCacheKeyFields, - CacheLevelParam, - ActionCacheOnCookie, - ActionCacheTTLByStatus, - ActionDDoSProtection, - DevelopmentModeParam, - ActionDisableApps, - ActionDisablePerformance, - ActionDisableSecurity, - ActionDisableZaraz, - ActionEdgeCacheTTL, - EmailObfuscationParam, - ActionExplicitCacheControl, - ActionForwardingURL, - ActionHostHeaderOverride, - HotlinkProtectionParam, - IPGeolocationParam, - ActionMinify, - MirageParam, - OpportunisticEncryptionParam, - OriginErrorPagePassThruParam, - PolishParam, - ActionPurgeByPageRule, - ActionResolveOverride, - ActionRespectStrongEtag, - ResponseBufferingParam, - RocketLoaderParam, - SecurityLevelParam, - ServerSideExcludesParam, - SortQueryStringForCacheParam, - SSLParam, - TrueClientIPHeaderParam, - WAFParam, -] + value: ActionValue diff --git a/src/cloudflare/types/pagerules/pagerule_edit_params.py b/src/cloudflare/types/pagerules/pagerule_edit_params.py index e7efd955291..e785a2c36c0 100644 --- a/src/cloudflare/types/pagerules/pagerule_edit_params.py +++ b/src/cloudflare/types/pagerules/pagerule_edit_params.py @@ -2,64 +2,12 @@ from __future__ import annotations -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, TypeAlias, TypedDict +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict from .target_param import TargetParam -from ..zones.ssl_param import SSLParam -from ..zones.waf_param import WAFParam -from ..zones.mirage_param import MirageParam -from ..zones.polish_param import PolishParam -from ..zones.cache_level_param import CacheLevelParam -from ..zones.browser_check_param import BrowserCheckParam -from ..zones.rocket_loader_param import RocketLoaderParam -from ..zones.ip_geolocation_param import IPGeolocationParam -from ..zones.security_level_param import SecurityLevelParam -from ..zones.always_use_https_param import AlwaysUseHTTPSParam -from ..zones.development_mode_param import DevelopmentModeParam -from ..zones.browser_cache_ttl_param import BrowserCacheTTLParam -from ..zones.email_obfuscation_param import EmailObfuscationParam -from ..zones.hotlink_protection_param import HotlinkProtectionParam -from ..zones.response_buffering_param import ResponseBufferingParam -from ..zones.server_side_excludes_param import ServerSideExcludesParam -from ..zones.true_client_ip_header_param import TrueClientIPHeaderParam -from ..zones.automatic_https_rewrites_param import AutomaticHTTPSRewritesParam -from ..zones.opportunistic_encryption_param import OpportunisticEncryptionParam -from ..zones.origin_error_page_pass_thru_param import OriginErrorPagePassThruParam -from ..zones.sort_query_string_for_cache_param import SortQueryStringForCacheParam -__all__ = [ - "PageruleEditParams", - "Action", - "ActionBypassCacheOnCookie", - "ActionCacheByDeviceType", - "ActionCacheDeceptionArmor", - "ActionCacheKey", - "ActionCacheKeyValue", - "ActionCacheKeyValueCookie", - "ActionCacheKeyValueHeader", - "ActionCacheKeyValueHost", - "ActionCacheKeyValueQueryString", - "ActionCacheKeyValueUser", - "ActionCacheKeyFields", - "ActionCacheOnCookie", - "ActionCacheTTLByStatus", - "ActionDDoSProtection", - "ActionDisableApps", - "ActionDisablePerformance", - "ActionDisableSecurity", - "ActionDisableZaraz", - "ActionEdgeCacheTTL", - "ActionExplicitCacheControl", - "ActionForwardingURL", - "ActionForwardingURLValue", - "ActionHostHeaderOverride", - "ActionMinify", - "ActionPurgeByPageRule", - "ActionResolveOverride", - "ActionResolveOverrideValue", - "ActionRespectStrongEtag", -] +__all__ = ["PageruleEditParams", "Action", "ActionValue"] class PageruleEditParams(TypedDict, total=False): @@ -88,199 +36,7 @@ class PageruleEditParams(TypedDict, total=False): """The rule targets to evaluate on each request.""" -class ActionBypassCacheOnCookie(TypedDict, total=False): - id: Literal["bypass_cache_on_cookie"] - """ - Bypass cache and fetch resources from the origin server if a regular expression - matches against a cookie name present in the request. - """ - - value: str - """The regular expression to use for matching cookie names in the request. - - Refer to - [Bypass Cache on Cookie setting](https://developers.cloudflare.com/rules/page-rules/reference/additional-reference/#bypass-cache-on-cookie-setting) - to learn about limited regular expression support. - """ - - -class ActionCacheByDeviceType(TypedDict, total=False): - id: Literal["cache_by_device_type"] - """Separate cached content based on the visitor's device type.""" - - value: Literal["on", "off"] - """The status of Cache By Device Type.""" - - -class ActionCacheDeceptionArmor(TypedDict, total=False): - id: Literal["cache_deception_armor"] - """ - Protect from web cache deception attacks while still allowing static assets to - be cached. This setting verifies that the URL's extension matches the returned - `Content-Type`. - """ - - value: Literal["on", "off"] - """The status of Cache Deception Armor.""" - - -class ActionCacheKeyValueCookie(TypedDict, total=False): - check_presence: List[str] - """ - A list of cookies to check for the presence of, without including their actual - values. - """ - - include: List[str] - """A list of cookies to include.""" - - -class ActionCacheKeyValueHeader(TypedDict, total=False): - check_presence: List[str] - """ - A list of headers to check for the presence of, without including their actual - values. - """ - - exclude: List[str] - """A list of headers to ignore.""" - - include: List[str] - """A list of headers to include.""" - - -class ActionCacheKeyValueHost(TypedDict, total=False): - resolved: bool - """Whether to include the Host header in the HTTP request sent to the origin.""" - - -class ActionCacheKeyValueQueryString(TypedDict, total=False): - exclude: Union[Literal["*"], List[str]] - """Ignore all query string parameters.""" - - include: Union[Literal["*"], List[str]] - """Include all query string parameters.""" - - -class ActionCacheKeyValueUser(TypedDict, total=False): - device_type: bool - """ - Classifies a request as `mobile`, `desktop`, or `tablet` based on the User - Agent. - """ - - geo: bool - """Includes the client's country, derived from the IP address.""" - - lang: bool - """ - Includes the first language code contained in the `Accept-Language` header sent - by the client. - """ - - -class ActionCacheKeyValue(TypedDict, total=False): - cookie: ActionCacheKeyValueCookie - """Controls which cookies appear in the Cache Key.""" - - header: ActionCacheKeyValueHeader - """Controls which headers go into the Cache Key. - - Exactly one of `include` or `exclude` is expected. - """ - - host: ActionCacheKeyValueHost - """Determines which host header to include in the Cache Key.""" - - query_string: ActionCacheKeyValueQueryString - """Controls which URL query string parameters go into the Cache Key. - - Exactly one of `include` or `exclude` is expected. - """ - - user: ActionCacheKeyValueUser - """Feature fields to add features about the end-user (client) into the Cache Key.""" - - -class ActionCacheKey(TypedDict, total=False): - id: Literal["cache_key"] - """ - Control specifically what variables to include when deciding which resources to - cache. This allows customers to determine what to cache based on something other - than just the URL. - """ - - value: ActionCacheKeyValue - - -class ActionCacheKeyFields(TypedDict, total=False): - id: Literal["cache_key_fields"] - - -class ActionCacheOnCookie(TypedDict, total=False): - id: Literal["cache_on_cookie"] - - -class ActionCacheTTLByStatus(TypedDict, total=False): - id: Literal["cache_ttl_by_status"] - - -class ActionDDoSProtection(TypedDict, total=False): - id: Literal["ddos_protection"] - - -class ActionDisableApps(TypedDict, total=False): - id: Literal["disable_apps"] - """ - Turn off all active - [Cloudflare Apps](https://developers.cloudflare.com/support/more-dashboard-apps/cloudflare-apps/) - (deprecated). - """ - - -class ActionDisablePerformance(TypedDict, total=False): - id: Literal["disable_performance"] - """ - Turn off - [Rocket Loader](https://developers.cloudflare.com/speed/optimization/content/rocket-loader/), - [Mirage](https://developers.cloudflare.com/speed/optimization/images/mirage/), - and [Polish](https://developers.cloudflare.com/images/polish/). - """ - - -class ActionDisableSecurity(TypedDict, total=False): - id: Literal["disable_security"] - """ - Turn off - [Email Obfuscation](https://developers.cloudflare.com/waf/tools/scrape-shield/email-address-obfuscation/), - [Rate Limiting (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-rate-limiting/), - [Scrape Shield](https://developers.cloudflare.com/waf/tools/scrape-shield/), - [URL (Zone) Lockdown](https://developers.cloudflare.com/waf/tools/zone-lockdown/), - and - [WAF managed rules (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-waf-managed-rules/). - """ - - -class ActionDisableZaraz(TypedDict, total=False): - id: Literal["disable_zaraz"] - """Turn off [Zaraz](https://developers.cloudflare.com/zaraz/).""" - - -class ActionEdgeCacheTTL(TypedDict, total=False): - id: Literal["edge_cache_ttl"] - """Specify how long to cache a resource in the Cloudflare global network. - - _Edge Cache TTL_ is not visible in response headers. - """ - - value: int - - -class ActionExplicitCacheControl(TypedDict, total=False): - id: Literal["explicit_cache_control"] - - -class ActionForwardingURLValue(TypedDict, total=False): +class ActionValue(TypedDict, total=False): status_code: Literal[301, 302] """The status code to use for the URL redirect. @@ -294,7 +50,7 @@ class ActionForwardingURLValue(TypedDict, total=False): """ -class ActionForwardingURL(TypedDict, total=False): +class Action(TypedDict, total=False): id: Literal["forwarding_url"] """Redirects one URL to another using an `HTTP 301/302` redirect. @@ -302,88 +58,4 @@ class ActionForwardingURL(TypedDict, total=False): [Wildcard matching and referencing](https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/). """ - value: ActionForwardingURLValue - - -class ActionHostHeaderOverride(TypedDict, total=False): - id: Literal["host_header_override"] - """Apply a specific host header.""" - - value: str - """The hostname to use in the `Host` header""" - - -class ActionMinify(TypedDict, total=False): - id: Literal["minify"] - - -class ActionPurgeByPageRule(TypedDict, total=False): - id: Literal["purge_by_page_rule"] - - -class ActionResolveOverrideValue(TypedDict, total=False): - value: str - """The origin address you want to override with.""" - - -class ActionResolveOverride(TypedDict, total=False): - id: Literal["resolve_override"] - """Change the origin address to the value specified in this setting.""" - - value: ActionResolveOverrideValue - - -class ActionRespectStrongEtag(TypedDict, total=False): - id: Literal["respect_strong_etag"] - """ - Turn on or off byte-for-byte equivalency checks between the Cloudflare cache and - the origin server. - """ - - value: Literal["on", "off"] - """The status of Respect Strong ETags""" - - -Action: TypeAlias = Union[ - AlwaysUseHTTPSParam, - AutomaticHTTPSRewritesParam, - BrowserCacheTTLParam, - BrowserCheckParam, - ActionBypassCacheOnCookie, - ActionCacheByDeviceType, - ActionCacheDeceptionArmor, - ActionCacheKey, - ActionCacheKeyFields, - CacheLevelParam, - ActionCacheOnCookie, - ActionCacheTTLByStatus, - ActionDDoSProtection, - DevelopmentModeParam, - ActionDisableApps, - ActionDisablePerformance, - ActionDisableSecurity, - ActionDisableZaraz, - ActionEdgeCacheTTL, - EmailObfuscationParam, - ActionExplicitCacheControl, - ActionForwardingURL, - ActionHostHeaderOverride, - HotlinkProtectionParam, - IPGeolocationParam, - ActionMinify, - MirageParam, - OpportunisticEncryptionParam, - OriginErrorPagePassThruParam, - PolishParam, - ActionPurgeByPageRule, - ActionResolveOverride, - ActionRespectStrongEtag, - ResponseBufferingParam, - RocketLoaderParam, - SecurityLevelParam, - ServerSideExcludesParam, - SortQueryStringForCacheParam, - SSLParam, - TrueClientIPHeaderParam, - WAFParam, -] + value: ActionValue diff --git a/src/cloudflare/types/pagerules/pagerule_update_params.py b/src/cloudflare/types/pagerules/pagerule_update_params.py index 5177c102917..88e80a5b5a7 100644 --- a/src/cloudflare/types/pagerules/pagerule_update_params.py +++ b/src/cloudflare/types/pagerules/pagerule_update_params.py @@ -2,64 +2,12 @@ from __future__ import annotations -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, TypeAlias, TypedDict +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict from .target_param import TargetParam -from ..zones.ssl_param import SSLParam -from ..zones.waf_param import WAFParam -from ..zones.mirage_param import MirageParam -from ..zones.polish_param import PolishParam -from ..zones.cache_level_param import CacheLevelParam -from ..zones.browser_check_param import BrowserCheckParam -from ..zones.rocket_loader_param import RocketLoaderParam -from ..zones.ip_geolocation_param import IPGeolocationParam -from ..zones.security_level_param import SecurityLevelParam -from ..zones.always_use_https_param import AlwaysUseHTTPSParam -from ..zones.development_mode_param import DevelopmentModeParam -from ..zones.browser_cache_ttl_param import BrowserCacheTTLParam -from ..zones.email_obfuscation_param import EmailObfuscationParam -from ..zones.hotlink_protection_param import HotlinkProtectionParam -from ..zones.response_buffering_param import ResponseBufferingParam -from ..zones.server_side_excludes_param import ServerSideExcludesParam -from ..zones.true_client_ip_header_param import TrueClientIPHeaderParam -from ..zones.automatic_https_rewrites_param import AutomaticHTTPSRewritesParam -from ..zones.opportunistic_encryption_param import OpportunisticEncryptionParam -from ..zones.origin_error_page_pass_thru_param import OriginErrorPagePassThruParam -from ..zones.sort_query_string_for_cache_param import SortQueryStringForCacheParam -__all__ = [ - "PageruleUpdateParams", - "Action", - "ActionBypassCacheOnCookie", - "ActionCacheByDeviceType", - "ActionCacheDeceptionArmor", - "ActionCacheKey", - "ActionCacheKeyValue", - "ActionCacheKeyValueCookie", - "ActionCacheKeyValueHeader", - "ActionCacheKeyValueHost", - "ActionCacheKeyValueQueryString", - "ActionCacheKeyValueUser", - "ActionCacheKeyFields", - "ActionCacheOnCookie", - "ActionCacheTTLByStatus", - "ActionDDoSProtection", - "ActionDisableApps", - "ActionDisablePerformance", - "ActionDisableSecurity", - "ActionDisableZaraz", - "ActionEdgeCacheTTL", - "ActionExplicitCacheControl", - "ActionForwardingURL", - "ActionForwardingURLValue", - "ActionHostHeaderOverride", - "ActionMinify", - "ActionPurgeByPageRule", - "ActionResolveOverride", - "ActionResolveOverrideValue", - "ActionRespectStrongEtag", -] +__all__ = ["PageruleUpdateParams", "Action", "ActionValue"] class PageruleUpdateParams(TypedDict, total=False): @@ -88,199 +36,7 @@ class PageruleUpdateParams(TypedDict, total=False): """The status of the Page Rule.""" -class ActionBypassCacheOnCookie(TypedDict, total=False): - id: Literal["bypass_cache_on_cookie"] - """ - Bypass cache and fetch resources from the origin server if a regular expression - matches against a cookie name present in the request. - """ - - value: str - """The regular expression to use for matching cookie names in the request. - - Refer to - [Bypass Cache on Cookie setting](https://developers.cloudflare.com/rules/page-rules/reference/additional-reference/#bypass-cache-on-cookie-setting) - to learn about limited regular expression support. - """ - - -class ActionCacheByDeviceType(TypedDict, total=False): - id: Literal["cache_by_device_type"] - """Separate cached content based on the visitor's device type.""" - - value: Literal["on", "off"] - """The status of Cache By Device Type.""" - - -class ActionCacheDeceptionArmor(TypedDict, total=False): - id: Literal["cache_deception_armor"] - """ - Protect from web cache deception attacks while still allowing static assets to - be cached. This setting verifies that the URL's extension matches the returned - `Content-Type`. - """ - - value: Literal["on", "off"] - """The status of Cache Deception Armor.""" - - -class ActionCacheKeyValueCookie(TypedDict, total=False): - check_presence: List[str] - """ - A list of cookies to check for the presence of, without including their actual - values. - """ - - include: List[str] - """A list of cookies to include.""" - - -class ActionCacheKeyValueHeader(TypedDict, total=False): - check_presence: List[str] - """ - A list of headers to check for the presence of, without including their actual - values. - """ - - exclude: List[str] - """A list of headers to ignore.""" - - include: List[str] - """A list of headers to include.""" - - -class ActionCacheKeyValueHost(TypedDict, total=False): - resolved: bool - """Whether to include the Host header in the HTTP request sent to the origin.""" - - -class ActionCacheKeyValueQueryString(TypedDict, total=False): - exclude: Union[Literal["*"], List[str]] - """Ignore all query string parameters.""" - - include: Union[Literal["*"], List[str]] - """Include all query string parameters.""" - - -class ActionCacheKeyValueUser(TypedDict, total=False): - device_type: bool - """ - Classifies a request as `mobile`, `desktop`, or `tablet` based on the User - Agent. - """ - - geo: bool - """Includes the client's country, derived from the IP address.""" - - lang: bool - """ - Includes the first language code contained in the `Accept-Language` header sent - by the client. - """ - - -class ActionCacheKeyValue(TypedDict, total=False): - cookie: ActionCacheKeyValueCookie - """Controls which cookies appear in the Cache Key.""" - - header: ActionCacheKeyValueHeader - """Controls which headers go into the Cache Key. - - Exactly one of `include` or `exclude` is expected. - """ - - host: ActionCacheKeyValueHost - """Determines which host header to include in the Cache Key.""" - - query_string: ActionCacheKeyValueQueryString - """Controls which URL query string parameters go into the Cache Key. - - Exactly one of `include` or `exclude` is expected. - """ - - user: ActionCacheKeyValueUser - """Feature fields to add features about the end-user (client) into the Cache Key.""" - - -class ActionCacheKey(TypedDict, total=False): - id: Literal["cache_key"] - """ - Control specifically what variables to include when deciding which resources to - cache. This allows customers to determine what to cache based on something other - than just the URL. - """ - - value: ActionCacheKeyValue - - -class ActionCacheKeyFields(TypedDict, total=False): - id: Literal["cache_key_fields"] - - -class ActionCacheOnCookie(TypedDict, total=False): - id: Literal["cache_on_cookie"] - - -class ActionCacheTTLByStatus(TypedDict, total=False): - id: Literal["cache_ttl_by_status"] - - -class ActionDDoSProtection(TypedDict, total=False): - id: Literal["ddos_protection"] - - -class ActionDisableApps(TypedDict, total=False): - id: Literal["disable_apps"] - """ - Turn off all active - [Cloudflare Apps](https://developers.cloudflare.com/support/more-dashboard-apps/cloudflare-apps/) - (deprecated). - """ - - -class ActionDisablePerformance(TypedDict, total=False): - id: Literal["disable_performance"] - """ - Turn off - [Rocket Loader](https://developers.cloudflare.com/speed/optimization/content/rocket-loader/), - [Mirage](https://developers.cloudflare.com/speed/optimization/images/mirage/), - and [Polish](https://developers.cloudflare.com/images/polish/). - """ - - -class ActionDisableSecurity(TypedDict, total=False): - id: Literal["disable_security"] - """ - Turn off - [Email Obfuscation](https://developers.cloudflare.com/waf/tools/scrape-shield/email-address-obfuscation/), - [Rate Limiting (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-rate-limiting/), - [Scrape Shield](https://developers.cloudflare.com/waf/tools/scrape-shield/), - [URL (Zone) Lockdown](https://developers.cloudflare.com/waf/tools/zone-lockdown/), - and - [WAF managed rules (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-waf-managed-rules/). - """ - - -class ActionDisableZaraz(TypedDict, total=False): - id: Literal["disable_zaraz"] - """Turn off [Zaraz](https://developers.cloudflare.com/zaraz/).""" - - -class ActionEdgeCacheTTL(TypedDict, total=False): - id: Literal["edge_cache_ttl"] - """Specify how long to cache a resource in the Cloudflare global network. - - _Edge Cache TTL_ is not visible in response headers. - """ - - value: int - - -class ActionExplicitCacheControl(TypedDict, total=False): - id: Literal["explicit_cache_control"] - - -class ActionForwardingURLValue(TypedDict, total=False): +class ActionValue(TypedDict, total=False): status_code: Literal[301, 302] """The status code to use for the URL redirect. @@ -294,7 +50,7 @@ class ActionForwardingURLValue(TypedDict, total=False): """ -class ActionForwardingURL(TypedDict, total=False): +class Action(TypedDict, total=False): id: Literal["forwarding_url"] """Redirects one URL to another using an `HTTP 301/302` redirect. @@ -302,88 +58,4 @@ class ActionForwardingURL(TypedDict, total=False): [Wildcard matching and referencing](https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/). """ - value: ActionForwardingURLValue - - -class ActionHostHeaderOverride(TypedDict, total=False): - id: Literal["host_header_override"] - """Apply a specific host header.""" - - value: str - """The hostname to use in the `Host` header""" - - -class ActionMinify(TypedDict, total=False): - id: Literal["minify"] - - -class ActionPurgeByPageRule(TypedDict, total=False): - id: Literal["purge_by_page_rule"] - - -class ActionResolveOverrideValue(TypedDict, total=False): - value: str - """The origin address you want to override with.""" - - -class ActionResolveOverride(TypedDict, total=False): - id: Literal["resolve_override"] - """Change the origin address to the value specified in this setting.""" - - value: ActionResolveOverrideValue - - -class ActionRespectStrongEtag(TypedDict, total=False): - id: Literal["respect_strong_etag"] - """ - Turn on or off byte-for-byte equivalency checks between the Cloudflare cache and - the origin server. - """ - - value: Literal["on", "off"] - """The status of Respect Strong ETags""" - - -Action: TypeAlias = Union[ - AlwaysUseHTTPSParam, - AutomaticHTTPSRewritesParam, - BrowserCacheTTLParam, - BrowserCheckParam, - ActionBypassCacheOnCookie, - ActionCacheByDeviceType, - ActionCacheDeceptionArmor, - ActionCacheKey, - ActionCacheKeyFields, - CacheLevelParam, - ActionCacheOnCookie, - ActionCacheTTLByStatus, - ActionDDoSProtection, - DevelopmentModeParam, - ActionDisableApps, - ActionDisablePerformance, - ActionDisableSecurity, - ActionDisableZaraz, - ActionEdgeCacheTTL, - EmailObfuscationParam, - ActionExplicitCacheControl, - ActionForwardingURL, - ActionHostHeaderOverride, - HotlinkProtectionParam, - IPGeolocationParam, - ActionMinify, - MirageParam, - OpportunisticEncryptionParam, - OriginErrorPagePassThruParam, - PolishParam, - ActionPurgeByPageRule, - ActionResolveOverride, - ActionRespectStrongEtag, - ResponseBufferingParam, - RocketLoaderParam, - SecurityLevelParam, - ServerSideExcludesParam, - SortQueryStringForCacheParam, - SSLParam, - TrueClientIPHeaderParam, - WAFParam, -] + value: ActionValue diff --git a/src/cloudflare/types/pagerules/setting_list_response.py b/src/cloudflare/types/pagerules/setting_list_response.py new file mode 100644 index 00000000000..69e8c454a09 --- /dev/null +++ b/src/cloudflare/types/pagerules/setting_list_response.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +__all__ = ["SettingListResponse"] + +SettingListResponse: TypeAlias = List[object] diff --git a/src/cloudflare/types/zones/__init__.py b/src/cloudflare/types/zones/__init__.py index 656aeb26d5b..b8e90f5ed1f 100644 --- a/src/cloudflare/types/zones/__init__.py +++ b/src/cloudflare/types/zones/__init__.py @@ -17,15 +17,11 @@ from .ciphers import Ciphers as Ciphers from .tls_1_3 import TLS1_3 as TLS1_3 from .zero_rtt import ZeroRTT as ZeroRTT -from .ssl_param import SSLParam as SSLParam -from .waf_param import WAFParam as WAFParam from .websocket import Websocket as Websocket from .zone_hold import ZoneHold as ZoneHold from .cache_level import CacheLevel as CacheLevel from .early_hints import EarlyHints as EarlyHints from .pseudo_ipv4 import PseudoIPV4 as PseudoIPV4 -from .mirage_param import MirageParam as MirageParam -from .polish_param import PolishParam as PolishParam from .advanced_ddos import AdvancedDDoS as AdvancedDDoS from .always_online import AlwaysOnline as AlwaysOnline from .browser_check import BrowserCheck as BrowserCheck @@ -45,7 +41,6 @@ from .zone_edit_params import ZoneEditParams as ZoneEditParams from .zone_list_params import ZoneListParams as ZoneListParams from .browser_cache_ttl import BrowserCacheTTL as BrowserCacheTTL -from .cache_level_param import CacheLevelParam as CacheLevelParam from .email_obfuscation import EmailObfuscation as EmailObfuscation from .h2_prioritization import H2Prioritization as H2Prioritization from .hold_create_params import HoldCreateParams as HoldCreateParams @@ -55,45 +50,29 @@ from .response_buffering import ResponseBuffering as ResponseBuffering from .zone_create_params import ZoneCreateParams as ZoneCreateParams from .available_rate_plan import AvailableRatePlan as AvailableRatePlan -from .browser_check_param import BrowserCheckParam as BrowserCheckParam from .opportunistic_onion import OpportunisticOnion as OpportunisticOnion -from .rocket_loader_param import RocketLoaderParam as RocketLoaderParam from .setting_edit_params import SettingEditParams as SettingEditParams -from .ip_geolocation_param import IPGeolocationParam as IPGeolocationParam -from .security_level_param import SecurityLevelParam as SecurityLevelParam from .server_side_excludes import ServerSideExcludes as ServerSideExcludes from .setting_get_response import SettingGetResponse as SettingGetResponse from .zone_delete_response import ZoneDeleteResponse as ZoneDeleteResponse from .setting_edit_response import SettingEditResponse as SettingEditResponse from .true_client_ip_header import TrueClientIPHeader as TrueClientIPHeader -from .always_use_https_param import AlwaysUseHTTPSParam as AlwaysUseHTTPSParam -from .development_mode_param import DevelopmentModeParam as DevelopmentModeParam from .rate_plan_get_response import RatePlanGetResponse as RatePlanGetResponse -from .browser_cache_ttl_param import BrowserCacheTTLParam as BrowserCacheTTLParam -from .email_obfuscation_param import EmailObfuscationParam as EmailObfuscationParam from .origin_max_http_version import OriginMaxHTTPVersion as OriginMaxHTTPVersion from .automatic_https_rewrites import AutomaticHTTPSRewrites as AutomaticHTTPSRewrites -from .hotlink_protection_param import HotlinkProtectionParam as HotlinkProtectionParam from .opportunistic_encryption import OpportunisticEncryption as OpportunisticEncryption -from .response_buffering_param import ResponseBufferingParam as ResponseBufferingParam from .subscription_get_response import SubscriptionGetResponse as SubscriptionGetResponse -from .server_side_excludes_param import ServerSideExcludesParam as ServerSideExcludesParam from .subscription_create_params import SubscriptionCreateParams as SubscriptionCreateParams from .subscription_update_params import SubscriptionUpdateParams as SubscriptionUpdateParams from .origin_error_page_pass_thru import OriginErrorPagePassThru as OriginErrorPagePassThru from .sort_query_string_for_cache import SortQueryStringForCache as SortQueryStringForCache -from .true_client_ip_header_param import TrueClientIPHeaderParam as TrueClientIPHeaderParam from .subscription_create_response import SubscriptionCreateResponse as SubscriptionCreateResponse from .subscription_update_response import SubscriptionUpdateResponse as SubscriptionUpdateResponse -from .automatic_https_rewrites_param import AutomaticHTTPSRewritesParam as AutomaticHTTPSRewritesParam from .custom_nameserver_get_response import CustomNameserverGetResponse as CustomNameserverGetResponse -from .opportunistic_encryption_param import OpportunisticEncryptionParam as OpportunisticEncryptionParam from .automatic_platform_optimization import AutomaticPlatformOptimization as AutomaticPlatformOptimization from .custom_nameserver_update_params import CustomNameserverUpdateParams as CustomNameserverUpdateParams from .activation_check_trigger_response import ActivationCheckTriggerResponse as ActivationCheckTriggerResponse from .custom_nameserver_update_response import CustomNameserverUpdateResponse as CustomNameserverUpdateResponse -from .origin_error_page_pass_thru_param import OriginErrorPagePassThruParam as OriginErrorPagePassThruParam -from .sort_query_string_for_cache_param import SortQueryStringForCacheParam as SortQueryStringForCacheParam from .automatic_platform_optimization_param import ( AutomaticPlatformOptimizationParam as AutomaticPlatformOptimizationParam, ) diff --git a/src/cloudflare/types/zones/always_use_https.py b/src/cloudflare/types/zones/always_use_https.py index 5adb357001b..78f176711aa 100644 --- a/src/cloudflare/types/zones/always_use_https.py +++ b/src/cloudflare/types/zones/always_use_https.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel @@ -9,8 +10,17 @@ class AlwaysUseHTTPS(BaseModel): - id: Optional[Literal["always_use_https"]] = None + id: Literal["always_use_https"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None """ - If enabled, any ` http://`` URL is converted to `https://` through a 301 - redirect. + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/always_use_https_param.py b/src/cloudflare/types/zones/always_use_https_param.py deleted file mode 100644 index 9853d49bf7d..00000000000 --- a/src/cloudflare/types/zones/always_use_https_param.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["AlwaysUseHTTPSParam"] - - -class AlwaysUseHTTPSParam(TypedDict, total=False): - id: Literal["always_use_https"] - """ - If enabled, any ` http://`` URL is converted to `https://` through a 301 - redirect. - """ diff --git a/src/cloudflare/types/zones/automatic_https_rewrites.py b/src/cloudflare/types/zones/automatic_https_rewrites.py index 9ca12b86aa3..ced7a3e50f5 100644 --- a/src/cloudflare/types/zones/automatic_https_rewrites.py +++ b/src/cloudflare/types/zones/automatic_https_rewrites.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel @@ -9,4 +10,17 @@ class AutomaticHTTPSRewrites(BaseModel): - id: Optional[Literal["automatic_https_rewrites"]] = None + id: Literal["automatic_https_rewrites"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/automatic_https_rewrites_param.py b/src/cloudflare/types/zones/automatic_https_rewrites_param.py deleted file mode 100644 index 2435ed975b2..00000000000 --- a/src/cloudflare/types/zones/automatic_https_rewrites_param.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["AutomaticHTTPSRewritesParam"] - - -class AutomaticHTTPSRewritesParam(TypedDict, total=False): - id: Literal["automatic_https_rewrites"] diff --git a/src/cloudflare/types/zones/browser_cache_ttl.py b/src/cloudflare/types/zones/browser_cache_ttl.py index 35d15b7fabf..77393c400dc 100644 --- a/src/cloudflare/types/zones/browser_cache_ttl.py +++ b/src/cloudflare/types/zones/browser_cache_ttl.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel @@ -9,11 +10,46 @@ class BrowserCacheTTL(BaseModel): - id: Optional[Literal["browser_cache_ttl"]] = None - """Control how long resources cached by client browsers remain valid.""" + id: Literal["browser_cache_ttl"] + """ID of the zone setting.""" - value: Optional[int] = None - """The number of seconds to cache resources for. + value: Literal[ + 0, + 30, + 60, + 120, + 300, + 1200, + 1800, + 3600, + 7200, + 10800, + 14400, + 18000, + 28800, + 43200, + 57600, + 72000, + 86400, + 172800, + 259200, + 345600, + 432000, + 691200, + 1382400, + 2073600, + 2678400, + 5356800, + 16070400, + 31536000, + ] + """Current value of the zone setting.""" - The API prohibits setting this to 0 for non-Enterprise domains. + editable: Optional[Literal[True, False]] = None """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/browser_cache_ttl_param.py b/src/cloudflare/types/zones/browser_cache_ttl_param.py deleted file mode 100644 index acf9e43b4ec..00000000000 --- a/src/cloudflare/types/zones/browser_cache_ttl_param.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["BrowserCacheTTLParam"] - - -class BrowserCacheTTLParam(TypedDict, total=False): - id: Literal["browser_cache_ttl"] - """Control how long resources cached by client browsers remain valid.""" - - value: int - """The number of seconds to cache resources for. - - The API prohibits setting this to 0 for non-Enterprise domains. - """ diff --git a/src/cloudflare/types/zones/browser_check.py b/src/cloudflare/types/zones/browser_check.py index 79c5d1e6a8b..9de5013bcaa 100644 --- a/src/cloudflare/types/zones/browser_check.py +++ b/src/cloudflare/types/zones/browser_check.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel @@ -9,11 +10,17 @@ class BrowserCheck(BaseModel): - id: Optional[Literal["browser_check"]] = None + id: Literal["browser_check"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None """ - Inspect the visitor's browser for headers commonly associated with spammers and - certain bots. + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). """ - value: Optional[Literal["on", "off"]] = None - """The status of Browser Integrity Check.""" + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/browser_check_param.py b/src/cloudflare/types/zones/browser_check_param.py deleted file mode 100644 index ffe14ebb557..00000000000 --- a/src/cloudflare/types/zones/browser_check_param.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["BrowserCheckParam"] - - -class BrowserCheckParam(TypedDict, total=False): - id: Literal["browser_check"] - """ - Inspect the visitor's browser for headers commonly associated with spammers and - certain bots. - """ - - value: Literal["on", "off"] - """The status of Browser Integrity Check.""" diff --git a/src/cloudflare/types/zones/cache_level.py b/src/cloudflare/types/zones/cache_level.py index 06e02c2fb2d..7aaf4433499 100644 --- a/src/cloudflare/types/zones/cache_level.py +++ b/src/cloudflare/types/zones/cache_level.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel @@ -9,17 +10,17 @@ class CacheLevel(BaseModel): - id: Optional[Literal["cache_level"]] = None - """Apply custom caching based on the option selected.""" + id: Literal["cache_level"] + """ID of the zone setting.""" - value: Optional[Literal["bypass", "basic", "simplified", "aggressive", "cache_everything"]] = None + value: Literal["aggressive", "basic", "simplified"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None """ - - `bypass`: Cloudflare does not cache. - - `basic`: Delivers resources from cache when there is no query string. - - `simplified`: Delivers the same resource to everyone independent of the query - string. - - `aggressive`: Caches all static content that has a query string. - - `cache_everything`: Treats all content as static and caches all file types - beyond the - [Cloudflare default cached content](https://developers.cloudflare.com/cache/concepts/default-cache-behavior/#default-cached-file-extensions). + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/cache_level_param.py b/src/cloudflare/types/zones/cache_level_param.py deleted file mode 100644 index daa1406ae4b..00000000000 --- a/src/cloudflare/types/zones/cache_level_param.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["CacheLevelParam"] - - -class CacheLevelParam(TypedDict, total=False): - id: Literal["cache_level"] - """Apply custom caching based on the option selected.""" - - value: Literal["bypass", "basic", "simplified", "aggressive", "cache_everything"] - """ - - `bypass`: Cloudflare does not cache. - - `basic`: Delivers resources from cache when there is no query string. - - `simplified`: Delivers the same resource to everyone independent of the query - string. - - `aggressive`: Caches all static content that has a query string. - - `cache_everything`: Treats all content as static and caches all file types - beyond the - [Cloudflare default cached content](https://developers.cloudflare.com/cache/concepts/default-cache-behavior/#default-cached-file-extensions). - """ diff --git a/src/cloudflare/types/zones/development_mode.py b/src/cloudflare/types/zones/development_mode.py index f529e46ab04..06c81d58b5f 100644 --- a/src/cloudflare/types/zones/development_mode.py +++ b/src/cloudflare/types/zones/development_mode.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel @@ -9,4 +10,24 @@ class DevelopmentMode(BaseModel): - id: Optional[Literal["development_mode"]] = None + id: Literal["development_mode"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" + + time_remaining: Optional[float] = None + """ + Value of the zone setting. Notes: The interval (in seconds) from when + development mode expires (positive integer) or last expired (negative integer) + for the domain. If development mode has never been enabled, this value is false. + """ diff --git a/src/cloudflare/types/zones/development_mode_param.py b/src/cloudflare/types/zones/development_mode_param.py deleted file mode 100644 index 83e95df5c1c..00000000000 --- a/src/cloudflare/types/zones/development_mode_param.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["DevelopmentModeParam"] - - -class DevelopmentModeParam(TypedDict, total=False): - id: Literal["development_mode"] diff --git a/src/cloudflare/types/zones/email_obfuscation.py b/src/cloudflare/types/zones/email_obfuscation.py index 07ff01d4431..37ecaca46de 100644 --- a/src/cloudflare/types/zones/email_obfuscation.py +++ b/src/cloudflare/types/zones/email_obfuscation.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel @@ -9,8 +10,17 @@ class EmailObfuscation(BaseModel): - id: Optional[Literal["email_obfuscation"]] = None - """Turn on or off **Email Obfuscation**.""" + id: Literal["email_obfuscation"] + """ID of the zone setting.""" - value: Optional[Literal["on", "off"]] = None - """The status of Email Obfuscation.""" + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/email_obfuscation_param.py b/src/cloudflare/types/zones/email_obfuscation_param.py deleted file mode 100644 index e983e18c207..00000000000 --- a/src/cloudflare/types/zones/email_obfuscation_param.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["EmailObfuscationParam"] - - -class EmailObfuscationParam(TypedDict, total=False): - id: Literal["email_obfuscation"] - """Turn on or off **Email Obfuscation**.""" - - value: Literal["on", "off"] - """The status of Email Obfuscation.""" diff --git a/src/cloudflare/types/zones/hotlink_protection.py b/src/cloudflare/types/zones/hotlink_protection.py index 54e60d05aab..45d990193de 100644 --- a/src/cloudflare/types/zones/hotlink_protection.py +++ b/src/cloudflare/types/zones/hotlink_protection.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel @@ -9,4 +10,17 @@ class HotlinkProtection(BaseModel): - id: Optional[Literal["hotlink_protection"]] = None + id: Literal["hotlink_protection"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/hotlink_protection_param.py b/src/cloudflare/types/zones/hotlink_protection_param.py deleted file mode 100644 index cffd76c7102..00000000000 --- a/src/cloudflare/types/zones/hotlink_protection_param.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["HotlinkProtectionParam"] - - -class HotlinkProtectionParam(TypedDict, total=False): - id: Literal["hotlink_protection"] diff --git a/src/cloudflare/types/zones/ip_geolocation.py b/src/cloudflare/types/zones/ip_geolocation.py index 058549a5597..0c378a4acc9 100644 --- a/src/cloudflare/types/zones/ip_geolocation.py +++ b/src/cloudflare/types/zones/ip_geolocation.py @@ -1,23 +1,26 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["IPGeolocation", "Value"] +__all__ = ["IPGeolocation"] -class Value(BaseModel): - value: Optional[Literal["on", "off"]] = None - """The status of adding the IP Geolocation Header.""" +class IPGeolocation(BaseModel): + id: Literal["ip_geolocation"] + """ID of the zone setting.""" + value: Literal["on", "off"] + """Current value of the zone setting.""" -class IPGeolocation(BaseModel): - id: Optional[Literal["ip_geolocation"]] = None + editable: Optional[Literal[True, False]] = None """ - Cloudflare adds a CF-IPCountry HTTP header containing the country code that - corresponds to the visitor. + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). """ - value: Optional[Value] = None + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/ip_geolocation_param.py b/src/cloudflare/types/zones/ip_geolocation_param.py deleted file mode 100644 index 66cfd4f605e..00000000000 --- a/src/cloudflare/types/zones/ip_geolocation_param.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["IPGeolocationParam", "Value"] - - -class Value(TypedDict, total=False): - value: Literal["on", "off"] - """The status of adding the IP Geolocation Header.""" - - -class IPGeolocationParam(TypedDict, total=False): - id: Literal["ip_geolocation"] - """ - Cloudflare adds a CF-IPCountry HTTP header containing the country code that - corresponds to the visitor. - """ - - value: Value diff --git a/src/cloudflare/types/zones/mirage.py b/src/cloudflare/types/zones/mirage.py index 51f593c6dea..4679cc48ebb 100644 --- a/src/cloudflare/types/zones/mirage.py +++ b/src/cloudflare/types/zones/mirage.py @@ -1,24 +1,26 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["Mirage", "Value"] +__all__ = ["Mirage"] -class Value(BaseModel): - value: Optional[Literal["on", "off"]] = None - """The status of Mirage.""" +class Mirage(BaseModel): + id: Literal["mirage"] + """ID of the zone setting.""" + value: Literal["on", "off"] + """Current value of the zone setting.""" -class Mirage(BaseModel): - id: Optional[Literal["mirage"]] = None + editable: Optional[Literal[True, False]] = None """ - Cloudflare Mirage reduces bandwidth used by images in mobile browsers. It can - accelerate loading of image-heavy websites on very slow mobile connections and - HTTP/1. + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). """ - value: Optional[Value] = None + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/mirage_param.py b/src/cloudflare/types/zones/mirage_param.py deleted file mode 100644 index f9614642524..00000000000 --- a/src/cloudflare/types/zones/mirage_param.py +++ /dev/null @@ -1,23 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["MirageParam", "Value"] - - -class Value(TypedDict, total=False): - value: Literal["on", "off"] - """The status of Mirage.""" - - -class MirageParam(TypedDict, total=False): - id: Literal["mirage"] - """ - Cloudflare Mirage reduces bandwidth used by images in mobile browsers. It can - accelerate loading of image-heavy websites on very slow mobile connections and - HTTP/1. - """ - - value: Value diff --git a/src/cloudflare/types/zones/opportunistic_encryption.py b/src/cloudflare/types/zones/opportunistic_encryption.py index fb1d5f99bb4..7ab0d1e8275 100644 --- a/src/cloudflare/types/zones/opportunistic_encryption.py +++ b/src/cloudflare/types/zones/opportunistic_encryption.py @@ -1,24 +1,26 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["OpportunisticEncryption", "Value"] +__all__ = ["OpportunisticEncryption"] -class Value(BaseModel): - value: Optional[Literal["on", "off"]] = None - """The status of Opportunistic Encryption.""" +class OpportunisticEncryption(BaseModel): + id: Literal["opportunistic_encryption"] + """ID of the zone setting.""" + value: Literal["on", "off"] + """Current value of the zone setting.""" -class OpportunisticEncryption(BaseModel): - id: Optional[Literal["opportunistic_encryption"]] = None + editable: Optional[Literal[True, False]] = None """ - Opportunistic Encryption allows browsers to access HTTP URIs over an encrypted - TLS channel. It's not a substitute for HTTPS, but provides additional security - for otherwise vulnerable requests. + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). """ - value: Optional[Value] = None + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/opportunistic_encryption_param.py b/src/cloudflare/types/zones/opportunistic_encryption_param.py deleted file mode 100644 index 389ee32da9c..00000000000 --- a/src/cloudflare/types/zones/opportunistic_encryption_param.py +++ /dev/null @@ -1,23 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["OpportunisticEncryptionParam", "Value"] - - -class Value(TypedDict, total=False): - value: Literal["on", "off"] - """The status of Opportunistic Encryption.""" - - -class OpportunisticEncryptionParam(TypedDict, total=False): - id: Literal["opportunistic_encryption"] - """ - Opportunistic Encryption allows browsers to access HTTP URIs over an encrypted - TLS channel. It's not a substitute for HTTPS, but provides additional security - for otherwise vulnerable requests. - """ - - value: Value diff --git a/src/cloudflare/types/zones/origin_error_page_pass_thru.py b/src/cloudflare/types/zones/origin_error_page_pass_thru.py index 66f907452ef..24cd47f546b 100644 --- a/src/cloudflare/types/zones/origin_error_page_pass_thru.py +++ b/src/cloudflare/types/zones/origin_error_page_pass_thru.py @@ -1,23 +1,26 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["OriginErrorPagePassThru", "Value"] +__all__ = ["OriginErrorPagePassThru"] -class Value(BaseModel): - value: Optional[Literal["on", "off"]] = None - """The status of Origin Error Page Passthru.""" +class OriginErrorPagePassThru(BaseModel): + id: Literal["origin_error_page_pass_thru"] + """ID of the zone setting.""" + value: Literal["on", "off"] + """Current value of the zone setting.""" -class OriginErrorPagePassThru(BaseModel): - id: Optional[Literal["origin_error_page_pass_thru"]] = None + editable: Optional[Literal[True, False]] = None """ - Turn on or off Cloudflare error pages generated from issues sent from the origin - server. If enabled, this setting triggers error pages issued by the origin. + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). """ - value: Optional[Value] = None + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/origin_error_page_pass_thru_param.py b/src/cloudflare/types/zones/origin_error_page_pass_thru_param.py deleted file mode 100644 index d423939e37a..00000000000 --- a/src/cloudflare/types/zones/origin_error_page_pass_thru_param.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["OriginErrorPagePassThruParam", "Value"] - - -class Value(TypedDict, total=False): - value: Literal["on", "off"] - """The status of Origin Error Page Passthru.""" - - -class OriginErrorPagePassThruParam(TypedDict, total=False): - id: Literal["origin_error_page_pass_thru"] - """ - Turn on or off Cloudflare error pages generated from issues sent from the origin - server. If enabled, this setting triggers error pages issued by the origin. - """ - - value: Value diff --git a/src/cloudflare/types/zones/polish.py b/src/cloudflare/types/zones/polish.py index 46687b3e389..c75f4c9c129 100644 --- a/src/cloudflare/types/zones/polish.py +++ b/src/cloudflare/types/zones/polish.py @@ -1,20 +1,26 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["Polish", "Value"] +__all__ = ["Polish"] -class Value(BaseModel): - value: Optional[Literal["off", "lossless", "lossy"]] = None - """The level of Polish you want applied to your origin.""" +class Polish(BaseModel): + id: Literal["polish"] + """ID of the zone setting.""" + value: Literal["off", "lossless", "lossy"] + """Current value of the zone setting.""" -class Polish(BaseModel): - id: Optional[Literal["polish"]] = None - """Apply options from the Polish feature of the Cloudflare Speed app.""" + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ - value: Optional[Value] = None + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/polish_param.py b/src/cloudflare/types/zones/polish_param.py deleted file mode 100644 index a24804b5132..00000000000 --- a/src/cloudflare/types/zones/polish_param.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["PolishParam", "Value"] - - -class Value(TypedDict, total=False): - value: Literal["off", "lossless", "lossy"] - """The level of Polish you want applied to your origin.""" - - -class PolishParam(TypedDict, total=False): - id: Literal["polish"] - """Apply options from the Polish feature of the Cloudflare Speed app.""" - - value: Value diff --git a/src/cloudflare/types/zones/response_buffering.py b/src/cloudflare/types/zones/response_buffering.py index 840d27c0b0b..cee36587e1a 100644 --- a/src/cloudflare/types/zones/response_buffering.py +++ b/src/cloudflare/types/zones/response_buffering.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel @@ -9,12 +10,17 @@ class ResponseBuffering(BaseModel): - id: Optional[Literal["response_buffering"]] = None + id: Literal["response_buffering"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None """ - Turn on or off whether Cloudflare should wait for an entire file from the origin - server before forwarding it to the site visitor. By default, Cloudflare sends - packets to the client as they arrive from the origin server. + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). """ - value: Optional[Literal["on", "off"]] = None - """The status of Response Buffering""" + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/response_buffering_param.py b/src/cloudflare/types/zones/response_buffering_param.py deleted file mode 100644 index b144afd1917..00000000000 --- a/src/cloudflare/types/zones/response_buffering_param.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["ResponseBufferingParam"] - - -class ResponseBufferingParam(TypedDict, total=False): - id: Literal["response_buffering"] - """ - Turn on or off whether Cloudflare should wait for an entire file from the origin - server before forwarding it to the site visitor. By default, Cloudflare sends - packets to the client as they arrive from the origin server. - """ - - value: Literal["on", "off"] - """The status of Response Buffering""" diff --git a/src/cloudflare/types/zones/rocket_loader.py b/src/cloudflare/types/zones/rocket_loader.py index 4ca3fff374a..1fcbbd08bea 100644 --- a/src/cloudflare/types/zones/rocket_loader.py +++ b/src/cloudflare/types/zones/rocket_loader.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel @@ -9,8 +10,17 @@ class RocketLoader(BaseModel): - id: Optional[Literal["rocket_loader"]] = None - """Turn on or off Rocket Loader in the Cloudflare Speed app.""" + id: Literal["rocket_loader"] + """ID of the zone setting.""" - value: Optional[Literal["on", "off"]] = None - """The status of Rocket Loader""" + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/rocket_loader_param.py b/src/cloudflare/types/zones/rocket_loader_param.py deleted file mode 100644 index 385afbda75f..00000000000 --- a/src/cloudflare/types/zones/rocket_loader_param.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["RocketLoaderParam"] - - -class RocketLoaderParam(TypedDict, total=False): - id: Literal["rocket_loader"] - """Turn on or off Rocket Loader in the Cloudflare Speed app.""" - - value: Literal["on", "off"] - """The status of Rocket Loader""" diff --git a/src/cloudflare/types/zones/security_level.py b/src/cloudflare/types/zones/security_level.py index 0adbeedbaaf..93dfddc12ef 100644 --- a/src/cloudflare/types/zones/security_level.py +++ b/src/cloudflare/types/zones/security_level.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel @@ -9,7 +10,17 @@ class SecurityLevel(BaseModel): - id: Optional[Literal["security_level"]] = None - """Control options for the **Security Level** feature from the **Security** app.""" + id: Literal["security_level"] + """ID of the zone setting.""" - value: Optional[Literal["off", "essentially_off", "low", "medium", "high", "under_attack"]] = None + value: Literal["off", "essentially_off", "low", "medium", "high", "under_attack"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/security_level_param.py b/src/cloudflare/types/zones/security_level_param.py deleted file mode 100644 index ce4d8a4e0aa..00000000000 --- a/src/cloudflare/types/zones/security_level_param.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["SecurityLevelParam"] - - -class SecurityLevelParam(TypedDict, total=False): - id: Literal["security_level"] - """Control options for the **Security Level** feature from the **Security** app.""" - - value: Literal["off", "essentially_off", "low", "medium", "high", "under_attack"] diff --git a/src/cloudflare/types/zones/server_side_excludes.py b/src/cloudflare/types/zones/server_side_excludes.py index 22a52497396..2630a01b631 100644 --- a/src/cloudflare/types/zones/server_side_excludes.py +++ b/src/cloudflare/types/zones/server_side_excludes.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel @@ -9,4 +10,17 @@ class ServerSideExcludes(BaseModel): - id: Optional[Literal["server_side_exclude"]] = None + id: Literal["server_side_exclude"] + """ID of the zone setting.""" + + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ + + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/server_side_excludes_param.py b/src/cloudflare/types/zones/server_side_excludes_param.py deleted file mode 100644 index 1b0b716b61a..00000000000 --- a/src/cloudflare/types/zones/server_side_excludes_param.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["ServerSideExcludesParam"] - - -class ServerSideExcludesParam(TypedDict, total=False): - id: Literal["server_side_exclude"] diff --git a/src/cloudflare/types/zones/setting_edit_params.py b/src/cloudflare/types/zones/setting_edit_params.py index c8225843385..d42008fcbf6 100644 --- a/src/cloudflare/types/zones/setting_edit_params.py +++ b/src/cloudflare/types/zones/setting_edit_params.py @@ -12,57 +12,57 @@ "ZeroRTT", "AdvancedDDoS", "AlwaysOnline", - "ZonesSchemasAlwaysUseHTTPS", - "ZonesSchemasAutomaticHTTPSRewrites", + "AlwaysUseHTTPS", + "AutomaticHTTPSRewrites", "Brotli", - "ZonesSchemasBrowserCacheTTL", - "ZonesSchemasBrowserCheck", - "ZonesSchemasCacheLevel", + "BrowserCacheTTL", + "BrowserCheck", + "CacheLevel", "ChallengeTTL", "Ciphers", "ZonesCNAMEFlattening", - "ZonesSchemasDevelopmentMode", + "DevelopmentMode", "EarlyHints", - "ZonesSchemasEdgeCacheTTL", - "ZonesSchemasEmailObfuscation", + "ZonesEdgeCacheTTL", + "EmailObfuscation", "H2Prioritization", - "ZonesSchemasHotlinkProtection", + "HotlinkProtection", "HTTP2", "HTTP3", "ImageResizing", - "ZonesSchemasIPGeolocation", + "IPGeolocation", "IPV6", "ZonesMaxUpload", "MinTLSVersion", - "ZonesSchemasMirage", + "Mirage", "NEL", "NELValue", - "ZonesSchemasOpportunisticEncryption", + "OpportunisticEncryption", "OpportunisticOnion", "OrangeToOrange", - "ZonesSchemasOriginErrorPagePassThru", - "ZonesSchemasPolish", + "OriginErrorPagePassThru", + "Polish", "PrefetchPreload", "ProxyReadTimeout", "PseudoIPV4", "ZonesReplaceInsecureJS", - "ZonesSchemasResponseBuffering", - "ZonesSchemasRocketLoader", + "ResponseBuffering", + "RocketLoader", "ZonesSchemasAutomaticPlatformOptimization", "SecurityHeaders", "SecurityHeadersValue", "SecurityHeadersValueStrictTransportSecurity", - "ZonesSchemasSecurityLevel", - "ZonesSchemasServerSideExclude", + "SecurityLevel", + "ServerSideExcludes", "ZonesSha1Support", - "ZonesSchemasSortQueryStringForCache", - "ZonesSchemasSSL", + "SortQueryStringForCache", + "SSL", "SSLRecommender", "ZonesTLS1_2Only", "TLS1_3", "TLSClientAuth", - "ZonesSchemasTrueClientIPHeader", - "ZonesSchemasWAF", + "TrueClientIPHeader", + "WAF", "WebP", "Websocket", ] @@ -101,7 +101,7 @@ class AlwaysOnline(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasAlwaysUseHTTPS(TypedDict, total=False): +class AlwaysUseHTTPS(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -112,7 +112,7 @@ class ZonesSchemasAlwaysUseHTTPS(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasAutomaticHTTPSRewrites(TypedDict, total=False): +class AutomaticHTTPSRewrites(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -134,7 +134,7 @@ class Brotli(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasBrowserCacheTTL(TypedDict, total=False): +class BrowserCacheTTL(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -176,7 +176,7 @@ class ZonesSchemasBrowserCacheTTL(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasBrowserCheck(TypedDict, total=False): +class BrowserCheck(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -187,7 +187,7 @@ class ZonesSchemasBrowserCheck(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasCacheLevel(TypedDict, total=False): +class CacheLevel(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -233,7 +233,7 @@ class ZonesCNAMEFlattening(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasDevelopmentMode(TypedDict, total=False): +class DevelopmentMode(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -255,7 +255,7 @@ class EarlyHints(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasEdgeCacheTTL(TypedDict, total=False): +class ZonesEdgeCacheTTL(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -290,7 +290,7 @@ class ZonesSchemasEdgeCacheTTL(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasEmailObfuscation(TypedDict, total=False): +class EmailObfuscation(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -312,7 +312,7 @@ class H2Prioritization(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasHotlinkProtection(TypedDict, total=False): +class HotlinkProtection(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -356,7 +356,7 @@ class ImageResizing(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasIPGeolocation(TypedDict, total=False): +class IPGeolocation(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -400,7 +400,7 @@ class MinTLSVersion(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasMirage(TypedDict, total=False): +class Mirage(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -426,7 +426,7 @@ class NELValue(TypedDict, total=False): enabled: bool -class ZonesSchemasOpportunisticEncryption(TypedDict, total=False): +class OpportunisticEncryption(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -459,7 +459,7 @@ class OrangeToOrange(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasOriginErrorPagePassThru(TypedDict, total=False): +class OriginErrorPagePassThru(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -470,7 +470,7 @@ class ZonesSchemasOriginErrorPagePassThru(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasPolish(TypedDict, total=False): +class Polish(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -525,7 +525,7 @@ class ZonesReplaceInsecureJS(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasResponseBuffering(TypedDict, total=False): +class ResponseBuffering(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -536,7 +536,7 @@ class ZonesSchemasResponseBuffering(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasRocketLoader(TypedDict, total=False): +class RocketLoader(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -591,7 +591,7 @@ class SecurityHeadersValue(TypedDict, total=False): """Strict Transport Security.""" -class ZonesSchemasSecurityLevel(TypedDict, total=False): +class SecurityLevel(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -602,7 +602,7 @@ class ZonesSchemasSecurityLevel(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasServerSideExclude(TypedDict, total=False): +class ServerSideExcludes(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -624,7 +624,7 @@ class ZonesSha1Support(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasSortQueryStringForCache(TypedDict, total=False): +class SortQueryStringForCache(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -635,7 +635,7 @@ class ZonesSchemasSortQueryStringForCache(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasSSL(TypedDict, total=False): +class SSL(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -690,7 +690,7 @@ class TLSClientAuth(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasTrueClientIPHeader(TypedDict, total=False): +class TrueClientIPHeader(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -701,7 +701,7 @@ class ZonesSchemasTrueClientIPHeader(TypedDict, total=False): """Current value of the zone setting.""" -class ZonesSchemasWAF(TypedDict, total=False): +class WAF(TypedDict, total=False): zone_id: Required[str] """Identifier""" @@ -738,54 +738,54 @@ class Websocket(TypedDict, total=False): ZeroRTT, AdvancedDDoS, AlwaysOnline, - ZonesSchemasAlwaysUseHTTPS, - ZonesSchemasAutomaticHTTPSRewrites, + AlwaysUseHTTPS, + AutomaticHTTPSRewrites, Brotli, - ZonesSchemasBrowserCacheTTL, - ZonesSchemasBrowserCheck, - ZonesSchemasCacheLevel, + BrowserCacheTTL, + BrowserCheck, + CacheLevel, ChallengeTTL, Ciphers, ZonesCNAMEFlattening, - ZonesSchemasDevelopmentMode, + DevelopmentMode, EarlyHints, - ZonesSchemasEdgeCacheTTL, - ZonesSchemasEmailObfuscation, + ZonesEdgeCacheTTL, + EmailObfuscation, H2Prioritization, - ZonesSchemasHotlinkProtection, + HotlinkProtection, HTTP2, HTTP3, ImageResizing, - ZonesSchemasIPGeolocation, + IPGeolocation, IPV6, ZonesMaxUpload, MinTLSVersion, - ZonesSchemasMirage, + Mirage, NEL, - ZonesSchemasOpportunisticEncryption, + OpportunisticEncryption, OpportunisticOnion, OrangeToOrange, - ZonesSchemasOriginErrorPagePassThru, - ZonesSchemasPolish, + OriginErrorPagePassThru, + Polish, PrefetchPreload, ProxyReadTimeout, PseudoIPV4, ZonesReplaceInsecureJS, - ZonesSchemasResponseBuffering, - ZonesSchemasRocketLoader, + ResponseBuffering, + RocketLoader, ZonesSchemasAutomaticPlatformOptimization, SecurityHeaders, - ZonesSchemasSecurityLevel, - ZonesSchemasServerSideExclude, + SecurityLevel, + ServerSideExcludes, ZonesSha1Support, - ZonesSchemasSortQueryStringForCache, - ZonesSchemasSSL, + SortQueryStringForCache, + SSL, SSLRecommender, ZonesTLS1_2Only, TLS1_3, TLSClientAuth, - ZonesSchemasTrueClientIPHeader, - ZonesSchemasWAF, + TrueClientIPHeader, + WAF, WebP, Websocket, ] diff --git a/src/cloudflare/types/zones/setting_edit_response.py b/src/cloudflare/types/zones/setting_edit_response.py index 06b20495575..974838573d0 100644 --- a/src/cloudflare/types/zones/setting_edit_response.py +++ b/src/cloudflare/types/zones/setting_edit_response.py @@ -5,180 +5,66 @@ from typing_extensions import Literal, TypeAlias from .nel import NEL +from .ssl import SSL +from .waf import WAF from .ipv6 import IPV6 from .webp import WebP from .http2 import HTTP2 from .http3 import HTTP3 from .brotli import Brotli +from .mirage import Mirage +from .polish import Polish from .ciphers import Ciphers from .tls_1_3 import TLS1_3 from .zero_rtt import ZeroRTT from ..._models import BaseModel from .websocket import Websocket +from .cache_level import CacheLevel from .early_hints import EarlyHints from .pseudo_ipv4 import PseudoIPV4 from .advanced_ddos import AdvancedDDoS from .always_online import AlwaysOnline +from .browser_check import BrowserCheck from .challenge_ttl import ChallengeTTL +from .rocket_loader import RocketLoader from .image_resizing import ImageResizing +from .ip_geolocation import IPGeolocation +from .security_level import SecurityLevel from .min_tls_version import MinTLSVersion from .ssl_recommender import SSLRecommender from .tls_client_auth import TLSClientAuth +from .always_use_https import AlwaysUseHTTPS +from .development_mode import DevelopmentMode from .orange_to_orange import OrangeToOrange from .prefetch_preload import PrefetchPreload from .security_headers import SecurityHeaders +from .browser_cache_ttl import BrowserCacheTTL +from .email_obfuscation import EmailObfuscation from .h2_prioritization import H2Prioritization +from .hotlink_protection import HotlinkProtection from .proxy_read_timeout import ProxyReadTimeout +from .response_buffering import ResponseBuffering from .opportunistic_onion import OpportunisticOnion +from .server_side_excludes import ServerSideExcludes +from .true_client_ip_header import TrueClientIPHeader +from .automatic_https_rewrites import AutomaticHTTPSRewrites +from .opportunistic_encryption import OpportunisticEncryption +from .origin_error_page_pass_thru import OriginErrorPagePassThru +from .sort_query_string_for_cache import SortQueryStringForCache from .automatic_platform_optimization import AutomaticPlatformOptimization __all__ = [ "SettingEditResponse", - "ZonesSchemasAlwaysUseHTTPS", - "ZonesSchemasAutomaticHTTPSRewrites", - "ZonesSchemasBrowserCacheTTL", - "ZonesSchemasBrowserCheck", - "ZonesSchemasCacheLevel", "ZonesCNAMEFlattening", - "ZonesSchemasDevelopmentMode", - "ZonesSchemasEdgeCacheTTL", - "ZonesSchemasEmailObfuscation", - "ZonesSchemasHotlinkProtection", - "ZonesSchemasIPGeolocation", + "ZonesEdgeCacheTTL", "ZonesMaxUpload", - "ZonesSchemasMirage", - "ZonesSchemasOpportunisticEncryption", - "ZonesSchemasOriginErrorPagePassThru", - "ZonesSchemasPolish", "ZonesReplaceInsecureJS", - "ZonesSchemasResponseBuffering", - "ZonesSchemasRocketLoader", "ZonesSchemasAutomaticPlatformOptimization", - "ZonesSchemasSecurityLevel", - "ZonesSchemasServerSideExclude", "ZonesSha1Support", - "ZonesSchemasSortQueryStringForCache", - "ZonesSchemasSSL", "ZonesTLS1_2Only", - "ZonesSchemasTrueClientIPHeader", - "ZonesSchemasWAF", ] -class ZonesSchemasAlwaysUseHTTPS(BaseModel): - id: Literal["always_use_https"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasAutomaticHTTPSRewrites(BaseModel): - id: Literal["automatic_https_rewrites"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasBrowserCacheTTL(BaseModel): - id: Literal["browser_cache_ttl"] - """ID of the zone setting.""" - - value: Literal[ - 0, - 30, - 60, - 120, - 300, - 1200, - 1800, - 3600, - 7200, - 10800, - 14400, - 18000, - 28800, - 43200, - 57600, - 72000, - 86400, - 172800, - 259200, - 345600, - 432000, - 691200, - 1382400, - 2073600, - 2678400, - 5356800, - 16070400, - 31536000, - ] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasBrowserCheck(BaseModel): - id: Literal["browser_check"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasCacheLevel(BaseModel): - id: Literal["cache_level"] - """ID of the zone setting.""" - - value: Literal["aggressive", "basic", "simplified"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - class ZonesCNAMEFlattening(BaseModel): id: Literal["cname_flattening"] """How to flatten the cname destination.""" @@ -196,31 +82,7 @@ class ZonesCNAMEFlattening(BaseModel): """last time this setting was modified.""" -class ZonesSchemasDevelopmentMode(BaseModel): - id: Literal["development_mode"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - time_remaining: Optional[float] = None - """ - Value of the zone setting. Notes: The interval (in seconds) from when - development mode expires (positive integer) or last expired (negative integer) - for the domain. If development mode has never been enabled, this value is false. - """ - - -class ZonesSchemasEdgeCacheTTL(BaseModel): +class ZonesEdgeCacheTTL(BaseModel): id: Literal["edge_cache_ttl"] """ID of the zone setting.""" @@ -259,57 +121,6 @@ class ZonesSchemasEdgeCacheTTL(BaseModel): """last time this setting was modified.""" -class ZonesSchemasEmailObfuscation(BaseModel): - id: Literal["email_obfuscation"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasHotlinkProtection(BaseModel): - id: Literal["hotlink_protection"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasIPGeolocation(BaseModel): - id: Literal["ip_geolocation"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - class ZonesMaxUpload(BaseModel): id: Literal["max_upload"] """identifier of the zone setting.""" @@ -327,74 +138,6 @@ class ZonesMaxUpload(BaseModel): """last time this setting was modified.""" -class ZonesSchemasMirage(BaseModel): - id: Literal["mirage"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasOpportunisticEncryption(BaseModel): - id: Literal["opportunistic_encryption"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasOriginErrorPagePassThru(BaseModel): - id: Literal["origin_error_page_pass_thru"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasPolish(BaseModel): - id: Literal["polish"] - """ID of the zone setting.""" - - value: Literal["off", "lossless", "lossy"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - class ZonesReplaceInsecureJS(BaseModel): id: Literal["replace_insecure_js"] """ID of the zone setting.""" @@ -412,40 +155,6 @@ class ZonesReplaceInsecureJS(BaseModel): """last time this setting was modified.""" -class ZonesSchemasResponseBuffering(BaseModel): - id: Literal["response_buffering"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasRocketLoader(BaseModel): - id: Literal["rocket_loader"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - class ZonesSchemasAutomaticPlatformOptimization(BaseModel): id: Literal["automatic_platform_optimization"] """ID of the zone setting.""" @@ -463,40 +172,6 @@ class ZonesSchemasAutomaticPlatformOptimization(BaseModel): """last time this setting was modified.""" -class ZonesSchemasSecurityLevel(BaseModel): - id: Literal["security_level"] - """ID of the zone setting.""" - - value: Literal["off", "essentially_off", "low", "medium", "high", "under_attack"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasServerSideExclude(BaseModel): - id: Literal["server_side_exclude"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - class ZonesSha1Support(BaseModel): id: Literal["sha1_support"] """Zone setting identifier.""" @@ -514,40 +189,6 @@ class ZonesSha1Support(BaseModel): """last time this setting was modified.""" -class ZonesSchemasSortQueryStringForCache(BaseModel): - id: Literal["sort_query_string_for_cache"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasSSL(BaseModel): - id: Literal["ssl"] - """ID of the zone setting.""" - - value: Literal["off", "flexible", "full", "strict"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - class ZonesTLS1_2Only(BaseModel): id: Literal["tls_1_2_only"] """Zone setting identifier.""" @@ -565,92 +206,58 @@ class ZonesTLS1_2Only(BaseModel): """last time this setting was modified.""" -class ZonesSchemasTrueClientIPHeader(BaseModel): - id: Literal["true_client_ip_header"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasWAF(BaseModel): - id: Literal["waf"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - SettingEditResponse: TypeAlias = Union[ ZeroRTT, AdvancedDDoS, AlwaysOnline, - ZonesSchemasAlwaysUseHTTPS, - ZonesSchemasAutomaticHTTPSRewrites, + AlwaysUseHTTPS, + AutomaticHTTPSRewrites, Brotli, - ZonesSchemasBrowserCacheTTL, - ZonesSchemasBrowserCheck, - ZonesSchemasCacheLevel, + BrowserCacheTTL, + BrowserCheck, + CacheLevel, ChallengeTTL, Ciphers, ZonesCNAMEFlattening, - ZonesSchemasDevelopmentMode, + DevelopmentMode, EarlyHints, - ZonesSchemasEdgeCacheTTL, - ZonesSchemasEmailObfuscation, + ZonesEdgeCacheTTL, + EmailObfuscation, H2Prioritization, - ZonesSchemasHotlinkProtection, + HotlinkProtection, HTTP2, HTTP3, ImageResizing, - ZonesSchemasIPGeolocation, + IPGeolocation, IPV6, ZonesMaxUpload, MinTLSVersion, - ZonesSchemasMirage, + Mirage, NEL, - ZonesSchemasOpportunisticEncryption, + OpportunisticEncryption, OpportunisticOnion, OrangeToOrange, - ZonesSchemasOriginErrorPagePassThru, - ZonesSchemasPolish, + OriginErrorPagePassThru, + Polish, PrefetchPreload, ProxyReadTimeout, PseudoIPV4, ZonesReplaceInsecureJS, - ZonesSchemasResponseBuffering, - ZonesSchemasRocketLoader, + ResponseBuffering, + RocketLoader, ZonesSchemasAutomaticPlatformOptimization, SecurityHeaders, - ZonesSchemasSecurityLevel, - ZonesSchemasServerSideExclude, + SecurityLevel, + ServerSideExcludes, ZonesSha1Support, - ZonesSchemasSortQueryStringForCache, - ZonesSchemasSSL, + SortQueryStringForCache, + SSL, SSLRecommender, ZonesTLS1_2Only, TLS1_3, TLSClientAuth, - ZonesSchemasTrueClientIPHeader, - ZonesSchemasWAF, + TrueClientIPHeader, + WAF, WebP, Websocket, ] diff --git a/src/cloudflare/types/zones/setting_get_response.py b/src/cloudflare/types/zones/setting_get_response.py index b6f4930c618..f7550d15ce9 100644 --- a/src/cloudflare/types/zones/setting_get_response.py +++ b/src/cloudflare/types/zones/setting_get_response.py @@ -5,180 +5,66 @@ from typing_extensions import Literal, TypeAlias from .nel import NEL +from .ssl import SSL +from .waf import WAF from .ipv6 import IPV6 from .webp import WebP from .http2 import HTTP2 from .http3 import HTTP3 from .brotli import Brotli +from .mirage import Mirage +from .polish import Polish from .ciphers import Ciphers from .tls_1_3 import TLS1_3 from .zero_rtt import ZeroRTT from ..._models import BaseModel from .websocket import Websocket +from .cache_level import CacheLevel from .early_hints import EarlyHints from .pseudo_ipv4 import PseudoIPV4 from .advanced_ddos import AdvancedDDoS from .always_online import AlwaysOnline +from .browser_check import BrowserCheck from .challenge_ttl import ChallengeTTL +from .rocket_loader import RocketLoader from .image_resizing import ImageResizing +from .ip_geolocation import IPGeolocation +from .security_level import SecurityLevel from .min_tls_version import MinTLSVersion from .ssl_recommender import SSLRecommender from .tls_client_auth import TLSClientAuth +from .always_use_https import AlwaysUseHTTPS +from .development_mode import DevelopmentMode from .orange_to_orange import OrangeToOrange from .prefetch_preload import PrefetchPreload from .security_headers import SecurityHeaders +from .browser_cache_ttl import BrowserCacheTTL +from .email_obfuscation import EmailObfuscation from .h2_prioritization import H2Prioritization +from .hotlink_protection import HotlinkProtection from .proxy_read_timeout import ProxyReadTimeout +from .response_buffering import ResponseBuffering from .opportunistic_onion import OpportunisticOnion +from .server_side_excludes import ServerSideExcludes +from .true_client_ip_header import TrueClientIPHeader +from .automatic_https_rewrites import AutomaticHTTPSRewrites +from .opportunistic_encryption import OpportunisticEncryption +from .origin_error_page_pass_thru import OriginErrorPagePassThru +from .sort_query_string_for_cache import SortQueryStringForCache from .automatic_platform_optimization import AutomaticPlatformOptimization __all__ = [ "SettingGetResponse", - "ZonesSchemasAlwaysUseHTTPS", - "ZonesSchemasAutomaticHTTPSRewrites", - "ZonesSchemasBrowserCacheTTL", - "ZonesSchemasBrowserCheck", - "ZonesSchemasCacheLevel", "ZonesCNAMEFlattening", - "ZonesSchemasDevelopmentMode", - "ZonesSchemasEdgeCacheTTL", - "ZonesSchemasEmailObfuscation", - "ZonesSchemasHotlinkProtection", - "ZonesSchemasIPGeolocation", + "ZonesEdgeCacheTTL", "ZonesMaxUpload", - "ZonesSchemasMirage", - "ZonesSchemasOpportunisticEncryption", - "ZonesSchemasOriginErrorPagePassThru", - "ZonesSchemasPolish", "ZonesReplaceInsecureJS", - "ZonesSchemasResponseBuffering", - "ZonesSchemasRocketLoader", "ZonesSchemasAutomaticPlatformOptimization", - "ZonesSchemasSecurityLevel", - "ZonesSchemasServerSideExclude", "ZonesSha1Support", - "ZonesSchemasSortQueryStringForCache", - "ZonesSchemasSSL", "ZonesTLS1_2Only", - "ZonesSchemasTrueClientIPHeader", - "ZonesSchemasWAF", ] -class ZonesSchemasAlwaysUseHTTPS(BaseModel): - id: Literal["always_use_https"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasAutomaticHTTPSRewrites(BaseModel): - id: Literal["automatic_https_rewrites"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasBrowserCacheTTL(BaseModel): - id: Literal["browser_cache_ttl"] - """ID of the zone setting.""" - - value: Literal[ - 0, - 30, - 60, - 120, - 300, - 1200, - 1800, - 3600, - 7200, - 10800, - 14400, - 18000, - 28800, - 43200, - 57600, - 72000, - 86400, - 172800, - 259200, - 345600, - 432000, - 691200, - 1382400, - 2073600, - 2678400, - 5356800, - 16070400, - 31536000, - ] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasBrowserCheck(BaseModel): - id: Literal["browser_check"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasCacheLevel(BaseModel): - id: Literal["cache_level"] - """ID of the zone setting.""" - - value: Literal["aggressive", "basic", "simplified"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - class ZonesCNAMEFlattening(BaseModel): id: Literal["cname_flattening"] """How to flatten the cname destination.""" @@ -196,31 +82,7 @@ class ZonesCNAMEFlattening(BaseModel): """last time this setting was modified.""" -class ZonesSchemasDevelopmentMode(BaseModel): - id: Literal["development_mode"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - time_remaining: Optional[float] = None - """ - Value of the zone setting. Notes: The interval (in seconds) from when - development mode expires (positive integer) or last expired (negative integer) - for the domain. If development mode has never been enabled, this value is false. - """ - - -class ZonesSchemasEdgeCacheTTL(BaseModel): +class ZonesEdgeCacheTTL(BaseModel): id: Literal["edge_cache_ttl"] """ID of the zone setting.""" @@ -259,57 +121,6 @@ class ZonesSchemasEdgeCacheTTL(BaseModel): """last time this setting was modified.""" -class ZonesSchemasEmailObfuscation(BaseModel): - id: Literal["email_obfuscation"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasHotlinkProtection(BaseModel): - id: Literal["hotlink_protection"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasIPGeolocation(BaseModel): - id: Literal["ip_geolocation"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - class ZonesMaxUpload(BaseModel): id: Literal["max_upload"] """identifier of the zone setting.""" @@ -327,74 +138,6 @@ class ZonesMaxUpload(BaseModel): """last time this setting was modified.""" -class ZonesSchemasMirage(BaseModel): - id: Literal["mirage"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasOpportunisticEncryption(BaseModel): - id: Literal["opportunistic_encryption"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasOriginErrorPagePassThru(BaseModel): - id: Literal["origin_error_page_pass_thru"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasPolish(BaseModel): - id: Literal["polish"] - """ID of the zone setting.""" - - value: Literal["off", "lossless", "lossy"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - class ZonesReplaceInsecureJS(BaseModel): id: Literal["replace_insecure_js"] """ID of the zone setting.""" @@ -412,40 +155,6 @@ class ZonesReplaceInsecureJS(BaseModel): """last time this setting was modified.""" -class ZonesSchemasResponseBuffering(BaseModel): - id: Literal["response_buffering"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasRocketLoader(BaseModel): - id: Literal["rocket_loader"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - class ZonesSchemasAutomaticPlatformOptimization(BaseModel): id: Literal["automatic_platform_optimization"] """ID of the zone setting.""" @@ -463,40 +172,6 @@ class ZonesSchemasAutomaticPlatformOptimization(BaseModel): """last time this setting was modified.""" -class ZonesSchemasSecurityLevel(BaseModel): - id: Literal["security_level"] - """ID of the zone setting.""" - - value: Literal["off", "essentially_off", "low", "medium", "high", "under_attack"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasServerSideExclude(BaseModel): - id: Literal["server_side_exclude"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - class ZonesSha1Support(BaseModel): id: Literal["sha1_support"] """Zone setting identifier.""" @@ -514,40 +189,6 @@ class ZonesSha1Support(BaseModel): """last time this setting was modified.""" -class ZonesSchemasSortQueryStringForCache(BaseModel): - id: Literal["sort_query_string_for_cache"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasSSL(BaseModel): - id: Literal["ssl"] - """ID of the zone setting.""" - - value: Literal["off", "flexible", "full", "strict"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - class ZonesTLS1_2Only(BaseModel): id: Literal["tls_1_2_only"] """Zone setting identifier.""" @@ -565,92 +206,58 @@ class ZonesTLS1_2Only(BaseModel): """last time this setting was modified.""" -class ZonesSchemasTrueClientIPHeader(BaseModel): - id: Literal["true_client_ip_header"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - -class ZonesSchemasWAF(BaseModel): - id: Literal["waf"] - """ID of the zone setting.""" - - value: Literal["on", "off"] - """Current value of the zone setting.""" - - editable: Optional[Literal[True, False]] = None - """ - Whether or not this setting can be modified for this zone (based on your - Cloudflare plan level). - """ - - modified_on: Optional[datetime] = None - """last time this setting was modified.""" - - SettingGetResponse: TypeAlias = Union[ ZeroRTT, AdvancedDDoS, AlwaysOnline, - ZonesSchemasAlwaysUseHTTPS, - ZonesSchemasAutomaticHTTPSRewrites, + AlwaysUseHTTPS, + AutomaticHTTPSRewrites, Brotli, - ZonesSchemasBrowserCacheTTL, - ZonesSchemasBrowserCheck, - ZonesSchemasCacheLevel, + BrowserCacheTTL, + BrowserCheck, + CacheLevel, ChallengeTTL, Ciphers, ZonesCNAMEFlattening, - ZonesSchemasDevelopmentMode, + DevelopmentMode, EarlyHints, - ZonesSchemasEdgeCacheTTL, - ZonesSchemasEmailObfuscation, + ZonesEdgeCacheTTL, + EmailObfuscation, H2Prioritization, - ZonesSchemasHotlinkProtection, + HotlinkProtection, HTTP2, HTTP3, ImageResizing, - ZonesSchemasIPGeolocation, + IPGeolocation, IPV6, ZonesMaxUpload, MinTLSVersion, - ZonesSchemasMirage, + Mirage, NEL, - ZonesSchemasOpportunisticEncryption, + OpportunisticEncryption, OpportunisticOnion, OrangeToOrange, - ZonesSchemasOriginErrorPagePassThru, - ZonesSchemasPolish, + OriginErrorPagePassThru, + Polish, PrefetchPreload, ProxyReadTimeout, PseudoIPV4, ZonesReplaceInsecureJS, - ZonesSchemasResponseBuffering, - ZonesSchemasRocketLoader, + ResponseBuffering, + RocketLoader, ZonesSchemasAutomaticPlatformOptimization, SecurityHeaders, - ZonesSchemasSecurityLevel, - ZonesSchemasServerSideExclude, + SecurityLevel, + ServerSideExcludes, ZonesSha1Support, - ZonesSchemasSortQueryStringForCache, - ZonesSchemasSSL, + SortQueryStringForCache, + SSL, SSLRecommender, ZonesTLS1_2Only, TLS1_3, TLSClientAuth, - ZonesSchemasTrueClientIPHeader, - ZonesSchemasWAF, + TrueClientIPHeader, + WAF, WebP, Websocket, ] diff --git a/src/cloudflare/types/zones/sort_query_string_for_cache.py b/src/cloudflare/types/zones/sort_query_string_for_cache.py index 859d57fdc89..ca2fea8aaac 100644 --- a/src/cloudflare/types/zones/sort_query_string_for_cache.py +++ b/src/cloudflare/types/zones/sort_query_string_for_cache.py @@ -1,23 +1,26 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["SortQueryStringForCache", "Value"] - - -class Value(BaseModel): - value: Optional[Literal["on", "off"]] = None - """The status of Query String Sort""" +__all__ = ["SortQueryStringForCache"] class SortQueryStringForCache(BaseModel): - id: Optional[Literal["sort_query_string_for_cache"]] = None - """Turn on or off the reordering of query strings. + id: Literal["sort_query_string_for_cache"] + """ID of the zone setting.""" - When query strings have the same structure, caching improves. + value: Literal["on", "off"] + """Current value of the zone setting.""" + + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). """ - value: Optional[Value] = None + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/sort_query_string_for_cache_param.py b/src/cloudflare/types/zones/sort_query_string_for_cache_param.py deleted file mode 100644 index e859871e639..00000000000 --- a/src/cloudflare/types/zones/sort_query_string_for_cache_param.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["SortQueryStringForCacheParam", "Value"] - - -class Value(TypedDict, total=False): - value: Literal["on", "off"] - """The status of Query String Sort""" - - -class SortQueryStringForCacheParam(TypedDict, total=False): - id: Literal["sort_query_string_for_cache"] - """Turn on or off the reordering of query strings. - - When query strings have the same structure, caching improves. - """ - - value: Value diff --git a/src/cloudflare/types/zones/ssl.py b/src/cloudflare/types/zones/ssl.py index 61fbed293d0..720c4eaa01b 100644 --- a/src/cloudflare/types/zones/ssl.py +++ b/src/cloudflare/types/zones/ssl.py @@ -1,23 +1,26 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["SSL", "Value"] +__all__ = ["SSL"] -class Value(BaseModel): - value: Optional[Literal["off", "flexible", "full", "strict", "origin_pull"]] = None - """The encryption mode that Cloudflare uses to connect to your origin server.""" +class SSL(BaseModel): + id: Literal["ssl"] + """ID of the zone setting.""" + value: Literal["off", "flexible", "full", "strict"] + """Current value of the zone setting.""" -class SSL(BaseModel): - id: Optional[Literal["ssl"]] = None + editable: Optional[Literal[True, False]] = None """ - Control options for the SSL feature of the Edge Certificates tab in the - Cloudflare SSL/TLS app. + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). """ - value: Optional[Value] = None + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/ssl_param.py b/src/cloudflare/types/zones/ssl_param.py deleted file mode 100644 index 41455617b98..00000000000 --- a/src/cloudflare/types/zones/ssl_param.py +++ /dev/null @@ -1,22 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["SSLParam", "Value"] - - -class Value(TypedDict, total=False): - value: Literal["off", "flexible", "full", "strict", "origin_pull"] - """The encryption mode that Cloudflare uses to connect to your origin server.""" - - -class SSLParam(TypedDict, total=False): - id: Literal["ssl"] - """ - Control options for the SSL feature of the Edge Certificates tab in the - Cloudflare SSL/TLS app. - """ - - value: Value diff --git a/src/cloudflare/types/zones/true_client_ip_header.py b/src/cloudflare/types/zones/true_client_ip_header.py index 203b23235c7..c81c57535bf 100644 --- a/src/cloudflare/types/zones/true_client_ip_header.py +++ b/src/cloudflare/types/zones/true_client_ip_header.py @@ -1,20 +1,26 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["TrueClientIPHeader", "Value"] +__all__ = ["TrueClientIPHeader"] -class Value(BaseModel): - value: Optional[Literal["on", "off"]] = None - """The status of True Client IP Header.""" +class TrueClientIPHeader(BaseModel): + id: Literal["true_client_ip_header"] + """ID of the zone setting.""" + value: Literal["on", "off"] + """Current value of the zone setting.""" -class TrueClientIPHeader(BaseModel): - id: Optional[Literal["true_client_ip_header"]] = None - """Turn on or off the True-Client-IP Header feature of the Cloudflare Network app.""" + editable: Optional[Literal[True, False]] = None + """ + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). + """ - value: Optional[Value] = None + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/true_client_ip_header_param.py b/src/cloudflare/types/zones/true_client_ip_header_param.py deleted file mode 100644 index e7508a5b53a..00000000000 --- a/src/cloudflare/types/zones/true_client_ip_header_param.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["TrueClientIPHeaderParam", "Value"] - - -class Value(TypedDict, total=False): - value: Literal["on", "off"] - """The status of True Client IP Header.""" - - -class TrueClientIPHeaderParam(TypedDict, total=False): - id: Literal["true_client_ip_header"] - """Turn on or off the True-Client-IP Header feature of the Cloudflare Network app.""" - - value: Value diff --git a/src/cloudflare/types/zones/waf.py b/src/cloudflare/types/zones/waf.py index 898cbdfee90..d5f4c0d363d 100644 --- a/src/cloudflare/types/zones/waf.py +++ b/src/cloudflare/types/zones/waf.py @@ -1,24 +1,26 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["WAF", "Value"] +__all__ = ["WAF"] -class Value(BaseModel): - value: Optional[Literal["on", "off"]] = None - """The status of WAF managed rules (previous version).""" +class WAF(BaseModel): + id: Literal["waf"] + """ID of the zone setting.""" + value: Literal["on", "off"] + """Current value of the zone setting.""" -class WAF(BaseModel): - id: Optional[Literal["waf"]] = None + editable: Optional[Literal[True, False]] = None """ - Turn on or off - [WAF managed rules (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-waf-managed-rules/). - You cannot enable or disable individual WAF managed rules via Page Rules. + Whether or not this setting can be modified for this zone (based on your + Cloudflare plan level). """ - value: Optional[Value] = None + modified_on: Optional[datetime] = None + """last time this setting was modified.""" diff --git a/src/cloudflare/types/zones/waf_param.py b/src/cloudflare/types/zones/waf_param.py deleted file mode 100644 index 8cefb453562..00000000000 --- a/src/cloudflare/types/zones/waf_param.py +++ /dev/null @@ -1,23 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["WAFParam", "Value"] - - -class Value(TypedDict, total=False): - value: Literal["on", "off"] - """The status of WAF managed rules (previous version).""" - - -class WAFParam(TypedDict, total=False): - id: Literal["waf"] - """ - Turn on or off - [WAF managed rules (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-waf-managed-rules/). - You cannot enable or disable individual WAF managed rules via Page Rules. - """ - - value: Value diff --git a/tests/api_resources/pagerules/__init__.py b/tests/api_resources/pagerules/__init__.py new file mode 100644 index 00000000000..fd8019a9a1a --- /dev/null +++ b/tests/api_resources/pagerules/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/pagerules/test_settings.py b/tests/api_resources/pagerules/test_settings.py new file mode 100644 index 00000000000..06b7aa3a064 --- /dev/null +++ b/tests/api_resources/pagerules/test_settings.py @@ -0,0 +1,98 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.types.pagerules import SettingListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSettings: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + setting = client.pagerules.settings.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[SettingListResponse], setting, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.pagerules.settings.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = response.parse() + assert_matches_type(Optional[SettingListResponse], setting, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.pagerules.settings.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = response.parse() + assert_matches_type(Optional[SettingListResponse], setting, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.pagerules.settings.with_raw_response.list( + zone_id="", + ) + + +class TestAsyncSettings: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + setting = await async_client.pagerules.settings.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[SettingListResponse], setting, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.pagerules.settings.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = await response.parse() + assert_matches_type(Optional[SettingListResponse], setting, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.pagerules.settings.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = await response.parse() + assert_matches_type(Optional[SettingListResponse], setting, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.pagerules.settings.with_raw_response.list( + zone_id="", + ) diff --git a/tests/api_resources/test_pagerules.py b/tests/api_resources/test_pagerules.py index 68a6822ba59..7759cea316d 100644 --- a/tests/api_resources/test_pagerules.py +++ b/tests/api_resources/test_pagerules.py @@ -15,6 +15,8 @@ PageruleDeleteResponse, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,60 +25,68 @@ class TestPagerules: @parametrize def test_method_create(self, client: Cloudflare) -> None: - pagerule = client.pagerules.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[{}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: - pagerule = client.pagerules.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[ - { - "id": "browser_check", - "value": "on", - } - ], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - priority=0, - status="active", - ) + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[ + { + "id": "forwarding_url", + "value": { + "status_code": 301, + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, + } + ], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + priority=0, + status="active", + ) + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.pagerules.with_raw_response.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) + with pytest.warns(DeprecationWarning): + response = client.pagerules.with_raw_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[{}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -85,32 +95,52 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.pagerules.with_streaming_response.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pagerule = response.parse() - assert_matches_type(Optional[PageRule], pagerule, path=["response"]) + with pytest.warns(DeprecationWarning): + with client.pagerules.with_streaming_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[{}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pagerule = response.parse() + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.pagerules.with_raw_response.create( - zone_id="", + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.pagerules.with_raw_response.create( + zone_id="", + actions=[{}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) + + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.update( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[{}], targets=[ { @@ -123,101 +153,44 @@ def test_path_params_create(self, client: Cloudflare) -> None: ], ) - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - pagerule = client.pagerules.update( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) assert_matches_type(Optional[PageRule], pagerule, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: - pagerule = client.pagerules.update( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[ - { - "id": "browser_check", - "value": "on", - } - ], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - priority=0, - status="active", - ) - assert_matches_type(Optional[PageRule], pagerule, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.pagerules.with_raw_response.update( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.update( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[ + { + "id": "forwarding_url", + "value": { + "status_code": 301, + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, + } + ], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + priority=0, + status="active", + ) - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pagerule = response.parse() assert_matches_type(Optional[PageRule], pagerule, path=["response"]) @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.pagerules.with_streaming_response.update( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pagerule = response.parse() - assert_matches_type(Optional[PageRule], pagerule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - 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.pagerules.with_raw_response.update( + def test_raw_response_update(self, client: Cloudflare) -> None: + with pytest.warns(DeprecationWarning): + response = client.pagerules.with_raw_response.update( pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[{}], targets=[ { @@ -230,9 +203,16 @@ def test_path_params_update(self, client: Cloudflare) -> None: ], ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): - client.pagerules.with_raw_response.update( - pagerule_id="", + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pagerule = response.parse() + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with pytest.warns(DeprecationWarning): + with client.pagerules.with_streaming_response.update( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[{}], targets=[ @@ -244,31 +224,78 @@ def test_path_params_update(self, client: Cloudflare) -> None: "target": "url", } ], - ) + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pagerule = response.parse() + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.pagerules.with_raw_response.update( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + actions=[{}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): + client.pagerules.with_raw_response.update( + pagerule_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[{}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) @parametrize def test_method_list(self, client: Cloudflare) -> None: - pagerule = client.pagerules.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[PageruleListResponse], pagerule, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: - pagerule = client.pagerules.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - direction="asc", - match="any", - order="status", - status="active", - ) + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + direction="asc", + match="any", + order="status", + status="active", + ) + assert_matches_type(Optional[PageruleListResponse], pagerule, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.pagerules.with_raw_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = client.pagerules.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -277,38 +304,43 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.pagerules.with_streaming_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.pagerules.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pagerule = response.parse() - assert_matches_type(Optional[PageruleListResponse], pagerule, path=["response"]) + pagerule = response.parse() + assert_matches_type(Optional[PageruleListResponse], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.pagerules.with_raw_response.list( - zone_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.pagerules.with_raw_response.list( + zone_id="", + ) @parametrize def test_method_delete(self, client: Cloudflare) -> None: - pagerule = client.pagerules.delete( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.delete( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[PageruleDeleteResponse], pagerule, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.pagerules.with_raw_response.delete( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = client.pagerules.with_raw_response.delete( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -317,71 +349,81 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.pagerules.with_streaming_response.delete( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.pagerules.with_streaming_response.delete( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pagerule = response.parse() - assert_matches_type(Optional[PageruleDeleteResponse], pagerule, path=["response"]) + pagerule = response.parse() + assert_matches_type(Optional[PageruleDeleteResponse], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.pagerules.with_raw_response.delete( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.pagerules.with_raw_response.delete( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): - client.pagerules.with_raw_response.delete( - pagerule_id="", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): + client.pagerules.with_raw_response.delete( + pagerule_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) @parametrize def test_method_edit(self, client: Cloudflare) -> None: - pagerule = client.pagerules.edit( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.edit( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) @parametrize def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - pagerule = client.pagerules.edit( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[ - { - "id": "browser_check", - "value": "on", - } - ], - priority=0, - status="active", - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.edit( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[ + { + "id": "forwarding_url", + "value": { + "status_code": 301, + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, + } + ], + priority=0, + status="active", + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.pagerules.with_raw_response.edit( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = client.pagerules.with_raw_response.edit( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -390,46 +432,51 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.pagerules.with_streaming_response.edit( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.pagerules.with_streaming_response.edit( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pagerule = response.parse() - assert_matches_type(Optional[PageRule], pagerule, path=["response"]) + pagerule = response.parse() + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.pagerules.with_raw_response.edit( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.pagerules.with_raw_response.edit( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): - client.pagerules.with_raw_response.edit( - pagerule_id="", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): + client.pagerules.with_raw_response.edit( + pagerule_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) @parametrize def test_method_get(self, client: Cloudflare) -> None: - pagerule = client.pagerules.get( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.get( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.pagerules.with_raw_response.get( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = client.pagerules.with_raw_response.get( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -438,31 +485,33 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.pagerules.with_streaming_response.get( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.pagerules.with_streaming_response.get( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pagerule = response.parse() - assert_matches_type(Optional[PageRule], pagerule, path=["response"]) + pagerule = response.parse() + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.pagerules.with_raw_response.get( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.pagerules.with_raw_response.get( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): - client.pagerules.with_raw_response.get( - pagerule_id="", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): + client.pagerules.with_raw_response.get( + pagerule_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) class TestAsyncPagerules: @@ -470,60 +519,68 @@ class TestAsyncPagerules: @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[{}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[ - { - "id": "browser_check", - "value": "on", - } - ], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - priority=0, - status="active", - ) + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[ + { + "id": "forwarding_url", + "value": { + "status_code": 301, + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, + } + ], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + priority=0, + status="active", + ) + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.pagerules.with_raw_response.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) + with pytest.warns(DeprecationWarning): + response = await async_client.pagerules.with_raw_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[{}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -532,32 +589,52 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.pagerules.with_streaming_response.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pagerule = await response.parse() - assert_matches_type(Optional[PageRule], pagerule, path=["response"]) + with pytest.warns(DeprecationWarning): + async with async_client.pagerules.with_streaming_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[{}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pagerule = await response.parse() + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.pagerules.with_raw_response.create( - zone_id="", + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.pagerules.with_raw_response.create( + zone_id="", + actions=[{}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) + + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.update( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[{}], targets=[ { @@ -570,101 +647,44 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: ], ) - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.update( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) assert_matches_type(Optional[PageRule], pagerule, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.update( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[ - { - "id": "browser_check", - "value": "on", - } - ], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - priority=0, - status="active", - ) - assert_matches_type(Optional[PageRule], pagerule, path=["response"]) - - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.pagerules.with_raw_response.update( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.update( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[ + { + "id": "forwarding_url", + "value": { + "status_code": 301, + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, + } + ], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + priority=0, + status="active", + ) - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pagerule = await response.parse() assert_matches_type(Optional[PageRule], pagerule, path=["response"]) @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.pagerules.with_streaming_response.update( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pagerule = await response.parse() - assert_matches_type(Optional[PageRule], pagerule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - 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.pagerules.with_raw_response.update( + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + with pytest.warns(DeprecationWarning): + response = await async_client.pagerules.with_raw_response.update( pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[{}], targets=[ { @@ -677,9 +697,16 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: ], ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): - await async_client.pagerules.with_raw_response.update( - pagerule_id="", + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pagerule = await response.parse() + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + with pytest.warns(DeprecationWarning): + async with async_client.pagerules.with_streaming_response.update( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[{}], targets=[ @@ -691,31 +718,78 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: "target": "url", } ], - ) + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pagerule = await response.parse() + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.pagerules.with_raw_response.update( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + actions=[{}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): + await async_client.pagerules.with_raw_response.update( + pagerule_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[{}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[PageruleListResponse], pagerule, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - direction="asc", - match="any", - order="status", - status="active", - ) + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + direction="asc", + match="any", + order="status", + status="active", + ) + assert_matches_type(Optional[PageruleListResponse], pagerule, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.pagerules.with_raw_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.pagerules.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -724,38 +798,43 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: - async with async_client.pagerules.with_streaming_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.pagerules.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pagerule = await response.parse() - assert_matches_type(Optional[PageruleListResponse], pagerule, path=["response"]) + pagerule = await response.parse() + assert_matches_type(Optional[PageruleListResponse], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.pagerules.with_raw_response.list( - zone_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.pagerules.with_raw_response.list( + zone_id="", + ) @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.delete( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.delete( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[PageruleDeleteResponse], pagerule, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.pagerules.with_raw_response.delete( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.pagerules.with_raw_response.delete( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -764,71 +843,81 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.pagerules.with_streaming_response.delete( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.pagerules.with_streaming_response.delete( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pagerule = await response.parse() - assert_matches_type(Optional[PageruleDeleteResponse], pagerule, path=["response"]) + pagerule = await response.parse() + assert_matches_type(Optional[PageruleDeleteResponse], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.pagerules.with_raw_response.delete( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.pagerules.with_raw_response.delete( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): - await async_client.pagerules.with_raw_response.delete( - pagerule_id="", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): + await async_client.pagerules.with_raw_response.delete( + pagerule_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.edit( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.edit( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) @parametrize async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.edit( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[ - { - "id": "browser_check", - "value": "on", - } - ], - priority=0, - status="active", - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.edit( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[ + { + "id": "forwarding_url", + "value": { + "status_code": 301, + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, + } + ], + priority=0, + status="active", + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.pagerules.with_raw_response.edit( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.pagerules.with_raw_response.edit( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -837,46 +926,51 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.pagerules.with_streaming_response.edit( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.pagerules.with_streaming_response.edit( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pagerule = await response.parse() - assert_matches_type(Optional[PageRule], pagerule, path=["response"]) + pagerule = await response.parse() + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.pagerules.with_raw_response.edit( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.pagerules.with_raw_response.edit( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): - await async_client.pagerules.with_raw_response.edit( - pagerule_id="", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): + await async_client.pagerules.with_raw_response.edit( + pagerule_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.get( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.get( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.pagerules.with_raw_response.get( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.pagerules.with_raw_response.get( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -885,28 +979,30 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.pagerules.with_streaming_response.get( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.pagerules.with_streaming_response.get( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pagerule = await response.parse() - assert_matches_type(Optional[PageRule], pagerule, path=["response"]) + pagerule = await response.parse() + assert_matches_type(Optional[PageRule], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.pagerules.with_raw_response.get( - pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): - await async_client.pagerules.with_raw_response.get( - pagerule_id="", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.pagerules.with_raw_response.get( + pagerule_id="023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): + await async_client.pagerules.with_raw_response.get( + pagerule_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + )