From 287bb9a3b7f082a2a1203bf53d3d5aab5443332e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 6 Jun 2024 10:00:26 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#840) --- .stats.yml | 4 +- api.md | 5 - src/cloudflare/resources/zones/__init__.py | 14 - .../resources/zones/dns_settings.py | 327 ------------------ src/cloudflare/resources/zones/zones.py | 32 -- src/cloudflare/types/zones/__init__.py | 4 - src/cloudflare/types/zones/dns_setting.py | 76 ---- .../types/zones/dns_setting_edit_params.py | 79 ----- src/cloudflare/types/zones/nameserver.py | 12 - .../types/zones/nameserver_param.py | 12 - .../api_resources/zones/test_dns_settings.py | 218 ------------ 11 files changed, 2 insertions(+), 781 deletions(-) delete mode 100644 src/cloudflare/resources/zones/dns_settings.py delete mode 100644 src/cloudflare/types/zones/dns_setting.py delete mode 100644 src/cloudflare/types/zones/dns_setting_edit_params.py delete mode 100644 src/cloudflare/types/zones/nameserver.py delete mode 100644 src/cloudflare/types/zones/nameserver_param.py delete mode 100644 tests/api_resources/zones/test_dns_settings.py diff --git a/.stats.yml b/.stats.yml index bf9ade0a890..8670b1dd640 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1338 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-0ec270b3c03c21a8d2358f8bf7726d82da5aa7eda902b5df86220f550eac2c2e.yml +configured_endpoints: 1336 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-36b39384f5550979f973317bd71942fbae76ba2d7ee3aa70c7c0af16740916b2.yml diff --git a/api.md b/api.md index 330a480993e..5020de58c34 100644 --- a/api.md +++ b/api.md @@ -310,11 +310,6 @@ Types: from cloudflare.types.zones import DNSSetting, Nameserver ``` -Methods: - -- client.zones.dns_settings.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.dns_settings.get(\*, zone_id) -> Optional - ## Settings ### ZeroRTT diff --git a/src/cloudflare/resources/zones/__init__.py b/src/cloudflare/resources/zones/__init__.py index fe02e52f39d..06e8291ed86 100644 --- a/src/cloudflare/resources/zones/__init__.py +++ b/src/cloudflare/resources/zones/__init__.py @@ -24,14 +24,6 @@ SettingsResourceWithStreamingResponse, AsyncSettingsResourceWithStreamingResponse, ) -from .dns_settings import ( - DNSSettingsResource, - AsyncDNSSettingsResource, - DNSSettingsResourceWithRawResponse, - AsyncDNSSettingsResourceWithRawResponse, - DNSSettingsResourceWithStreamingResponse, - AsyncDNSSettingsResourceWithStreamingResponse, -) from .subscriptions import ( SubscriptionsResource, AsyncSubscriptionsResource, @@ -64,12 +56,6 @@ "AsyncActivationCheckResourceWithRawResponse", "ActivationCheckResourceWithStreamingResponse", "AsyncActivationCheckResourceWithStreamingResponse", - "DNSSettingsResource", - "AsyncDNSSettingsResource", - "DNSSettingsResourceWithRawResponse", - "AsyncDNSSettingsResourceWithRawResponse", - "DNSSettingsResourceWithStreamingResponse", - "AsyncDNSSettingsResourceWithStreamingResponse", "SettingsResource", "AsyncSettingsResource", "SettingsResourceWithRawResponse", diff --git a/src/cloudflare/resources/zones/dns_settings.py b/src/cloudflare/resources/zones/dns_settings.py deleted file mode 100644 index 5460d1f4c9c..00000000000 --- a/src/cloudflare/resources/zones/dns_settings.py +++ /dev/null @@ -1,327 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Optional, cast -from typing_extensions import Literal - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._wrappers import ResultWrapper -from ...types.zones import dns_setting_edit_params -from ..._base_client import ( - make_request_options, -) -from ...types.zones.dns_setting import DNSSetting -from ...types.zones.nameserver_param import NameserverParam - -__all__ = ["DNSSettingsResource", "AsyncDNSSettingsResource"] - - -class DNSSettingsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> DNSSettingsResourceWithRawResponse: - return DNSSettingsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> DNSSettingsResourceWithStreamingResponse: - return DNSSettingsResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - foundation_dns: bool | NotGiven = NOT_GIVEN, - multi_provider: bool | NotGiven = NOT_GIVEN, - nameservers: NameserverParam | NotGiven = NOT_GIVEN, - ns_ttl: float | NotGiven = NOT_GIVEN, - secondary_overrides: bool | NotGiven = NOT_GIVEN, - soa: dns_setting_edit_params.SOA | NotGiven = NOT_GIVEN, - zone_mode: Literal["standard", "cdn_only", "dns_only"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DNSSetting]: - """ - Update DNS settings for a zone - - Args: - zone_id: Identifier - - foundation_dns: Whether to enable Foundation DNS Advanced Nameservers on the zone. - - multi_provider: Whether to enable multi-provider DNS, which causes Cloudflare to activate the - zone even when non-Cloudflare NS records exist, and to respect NS records at the - zone apex during outbound zone transfers. - - nameservers: Settings determining the nameservers through which the zone should be available. - - ns_ttl: The time to live (TTL) of the zone's nameserver (NS) records. - - secondary_overrides: Allows a Secondary DNS zone to use (proxied) override records and CNAME - flattening at the zone apex. - - soa: Components of the zone's SOA record. - - zone_mode: Whether the zone mode is a regular or CDN/DNS only zone. - - 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._patch( - f"/zones/{zone_id}/dns_settings", - body=maybe_transform( - { - "foundation_dns": foundation_dns, - "multi_provider": multi_provider, - "nameservers": nameservers, - "ns_ttl": ns_ttl, - "secondary_overrides": secondary_overrides, - "soa": soa, - "zone_mode": zone_mode, - }, - dns_setting_edit_params.DNSSettingEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DNSSetting]]._unwrapper, - ), - cast_to=cast(Type[Optional[DNSSetting]], ResultWrapper[DNSSetting]), - ) - - def get( - 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[DNSSetting]: - """ - Show DNS settings for a zone - - 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}/dns_settings", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DNSSetting]]._unwrapper, - ), - cast_to=cast(Type[Optional[DNSSetting]], ResultWrapper[DNSSetting]), - ) - - -class AsyncDNSSettingsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncDNSSettingsResourceWithRawResponse: - return AsyncDNSSettingsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncDNSSettingsResourceWithStreamingResponse: - return AsyncDNSSettingsResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - foundation_dns: bool | NotGiven = NOT_GIVEN, - multi_provider: bool | NotGiven = NOT_GIVEN, - nameservers: NameserverParam | NotGiven = NOT_GIVEN, - ns_ttl: float | NotGiven = NOT_GIVEN, - secondary_overrides: bool | NotGiven = NOT_GIVEN, - soa: dns_setting_edit_params.SOA | NotGiven = NOT_GIVEN, - zone_mode: Literal["standard", "cdn_only", "dns_only"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DNSSetting]: - """ - Update DNS settings for a zone - - Args: - zone_id: Identifier - - foundation_dns: Whether to enable Foundation DNS Advanced Nameservers on the zone. - - multi_provider: Whether to enable multi-provider DNS, which causes Cloudflare to activate the - zone even when non-Cloudflare NS records exist, and to respect NS records at the - zone apex during outbound zone transfers. - - nameservers: Settings determining the nameservers through which the zone should be available. - - ns_ttl: The time to live (TTL) of the zone's nameserver (NS) records. - - secondary_overrides: Allows a Secondary DNS zone to use (proxied) override records and CNAME - flattening at the zone apex. - - soa: Components of the zone's SOA record. - - zone_mode: Whether the zone mode is a regular or CDN/DNS only zone. - - 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._patch( - f"/zones/{zone_id}/dns_settings", - body=await async_maybe_transform( - { - "foundation_dns": foundation_dns, - "multi_provider": multi_provider, - "nameservers": nameservers, - "ns_ttl": ns_ttl, - "secondary_overrides": secondary_overrides, - "soa": soa, - "zone_mode": zone_mode, - }, - dns_setting_edit_params.DNSSettingEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DNSSetting]]._unwrapper, - ), - cast_to=cast(Type[Optional[DNSSetting]], ResultWrapper[DNSSetting]), - ) - - async def get( - 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[DNSSetting]: - """ - Show DNS settings for a zone - - 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}/dns_settings", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DNSSetting]]._unwrapper, - ), - cast_to=cast(Type[Optional[DNSSetting]], ResultWrapper[DNSSetting]), - ) - - -class DNSSettingsResourceWithRawResponse: - def __init__(self, dns_settings: DNSSettingsResource) -> None: - self._dns_settings = dns_settings - - self.edit = to_raw_response_wrapper( - dns_settings.edit, - ) - self.get = to_raw_response_wrapper( - dns_settings.get, - ) - - -class AsyncDNSSettingsResourceWithRawResponse: - def __init__(self, dns_settings: AsyncDNSSettingsResource) -> None: - self._dns_settings = dns_settings - - self.edit = async_to_raw_response_wrapper( - dns_settings.edit, - ) - self.get = async_to_raw_response_wrapper( - dns_settings.get, - ) - - -class DNSSettingsResourceWithStreamingResponse: - def __init__(self, dns_settings: DNSSettingsResource) -> None: - self._dns_settings = dns_settings - - self.edit = to_streamed_response_wrapper( - dns_settings.edit, - ) - self.get = to_streamed_response_wrapper( - dns_settings.get, - ) - - -class AsyncDNSSettingsResourceWithStreamingResponse: - def __init__(self, dns_settings: AsyncDNSSettingsResource) -> None: - self._dns_settings = dns_settings - - self.edit = async_to_streamed_response_wrapper( - dns_settings.edit, - ) - self.get = async_to_streamed_response_wrapper( - dns_settings.get, - ) diff --git a/src/cloudflare/resources/zones/zones.py b/src/cloudflare/resources/zones/zones.py index 6256a5db72a..2584b9a48a9 100644 --- a/src/cloudflare/resources/zones/zones.py +++ b/src/cloudflare/resources/zones/zones.py @@ -38,14 +38,6 @@ ) from ..._wrappers import ResultWrapper from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from .dns_settings import ( - DNSSettingsResource, - AsyncDNSSettingsResource, - DNSSettingsResourceWithRawResponse, - AsyncDNSSettingsResourceWithRawResponse, - DNSSettingsResourceWithStreamingResponse, - AsyncDNSSettingsResourceWithStreamingResponse, -) from ...types.zones import zone_edit_params, zone_list_params, zone_create_params from .subscriptions import ( SubscriptionsResource, @@ -88,10 +80,6 @@ class ZonesResource(SyncAPIResource): def activation_check(self) -> ActivationCheckResource: return ActivationCheckResource(self._client) - @cached_property - def dns_settings(self) -> DNSSettingsResource: - return DNSSettingsResource(self._client) - @cached_property def settings(self) -> SettingsResource: return SettingsResource(self._client) @@ -392,10 +380,6 @@ class AsyncZonesResource(AsyncAPIResource): def activation_check(self) -> AsyncActivationCheckResource: return AsyncActivationCheckResource(self._client) - @cached_property - def dns_settings(self) -> AsyncDNSSettingsResource: - return AsyncDNSSettingsResource(self._client) - @cached_property def settings(self) -> AsyncSettingsResource: return AsyncSettingsResource(self._client) @@ -715,10 +699,6 @@ def __init__(self, zones: ZonesResource) -> None: def activation_check(self) -> ActivationCheckResourceWithRawResponse: return ActivationCheckResourceWithRawResponse(self._zones.activation_check) - @cached_property - def dns_settings(self) -> DNSSettingsResourceWithRawResponse: - return DNSSettingsResourceWithRawResponse(self._zones.dns_settings) - @cached_property def settings(self) -> SettingsResourceWithRawResponse: return SettingsResourceWithRawResponse(self._zones.settings) @@ -760,10 +740,6 @@ def __init__(self, zones: AsyncZonesResource) -> None: def activation_check(self) -> AsyncActivationCheckResourceWithRawResponse: return AsyncActivationCheckResourceWithRawResponse(self._zones.activation_check) - @cached_property - def dns_settings(self) -> AsyncDNSSettingsResourceWithRawResponse: - return AsyncDNSSettingsResourceWithRawResponse(self._zones.dns_settings) - @cached_property def settings(self) -> AsyncSettingsResourceWithRawResponse: return AsyncSettingsResourceWithRawResponse(self._zones.settings) @@ -805,10 +781,6 @@ def __init__(self, zones: ZonesResource) -> None: def activation_check(self) -> ActivationCheckResourceWithStreamingResponse: return ActivationCheckResourceWithStreamingResponse(self._zones.activation_check) - @cached_property - def dns_settings(self) -> DNSSettingsResourceWithStreamingResponse: - return DNSSettingsResourceWithStreamingResponse(self._zones.dns_settings) - @cached_property def settings(self) -> SettingsResourceWithStreamingResponse: return SettingsResourceWithStreamingResponse(self._zones.settings) @@ -850,10 +822,6 @@ def __init__(self, zones: AsyncZonesResource) -> None: def activation_check(self) -> AsyncActivationCheckResourceWithStreamingResponse: return AsyncActivationCheckResourceWithStreamingResponse(self._zones.activation_check) - @cached_property - def dns_settings(self) -> AsyncDNSSettingsResourceWithStreamingResponse: - return AsyncDNSSettingsResourceWithStreamingResponse(self._zones.dns_settings) - @cached_property def settings(self) -> AsyncSettingsResourceWithStreamingResponse: return AsyncSettingsResourceWithStreamingResponse(self._zones.settings) diff --git a/src/cloudflare/types/zones/__init__.py b/src/cloudflare/types/zones/__init__.py index 3d3e43049cf..c7b972f4d45 100644 --- a/src/cloudflare/types/zones/__init__.py +++ b/src/cloudflare/types/zones/__init__.py @@ -5,16 +5,12 @@ from .type import Type as Type from .zone import Zone as Zone from .zone_hold import ZoneHold as ZoneHold -from .nameserver import Nameserver as Nameserver -from .dns_setting import DNSSetting as DNSSetting -from .nameserver_param import NameserverParam as NameserverParam from .zone_edit_params import ZoneEditParams as ZoneEditParams from .zone_list_params import ZoneListParams as ZoneListParams from .hold_create_params import HoldCreateParams as HoldCreateParams from .hold_delete_params import HoldDeleteParams as HoldDeleteParams from .zone_create_params import ZoneCreateParams as ZoneCreateParams from .zone_delete_response import ZoneDeleteResponse as ZoneDeleteResponse -from .dns_setting_edit_params import DNSSettingEditParams as DNSSettingEditParams from .subscription_get_response import SubscriptionGetResponse as SubscriptionGetResponse from .subscription_create_params import SubscriptionCreateParams as SubscriptionCreateParams from .subscription_create_response import SubscriptionCreateResponse as SubscriptionCreateResponse diff --git a/src/cloudflare/types/zones/dns_setting.py b/src/cloudflare/types/zones/dns_setting.py deleted file mode 100644 index c96b14afb67..00000000000 --- a/src/cloudflare/types/zones/dns_setting.py +++ /dev/null @@ -1,76 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from ..._models import BaseModel -from .nameserver import Nameserver - -__all__ = ["DNSSetting", "SOA"] - - -class SOA(BaseModel): - expire: float - """ - Time in seconds of being unable to query the primary server after which - secondary servers should stop serving the zone. - """ - - min_ttl: float - """The time to live (TTL) for negative caching of records within the zone.""" - - mname: str - """The primary nameserver, which may be used for outbound zone transfers.""" - - refresh: float - """ - Time in seconds after which secondary servers should re-check the SOA record to - see if the zone has been updated. - """ - - retry: float - """ - Time in seconds after which secondary servers should retry queries after the - primary server was unresponsive. - """ - - rname: str - """ - The email address of the zone administrator, with the first label representing - the local part of the email address. - """ - - ttl: float - """The time to live (TTL) of the SOA record itself.""" - - -class DNSSetting(BaseModel): - foundation_dns: Optional[bool] = None - """Whether to enable Foundation DNS Advanced Nameservers on the zone.""" - - multi_provider: Optional[bool] = None - """ - Whether to enable multi-provider DNS, which causes Cloudflare to activate the - zone even when non-Cloudflare NS records exist, and to respect NS records at the - zone apex during outbound zone transfers. - """ - - nameservers: Optional[Nameserver] = None - """ - Settings determining the nameservers through which the zone should be available. - """ - - ns_ttl: Optional[float] = None - """The time to live (TTL) of the zone's nameserver (NS) records.""" - - secondary_overrides: Optional[bool] = None - """ - Allows a Secondary DNS zone to use (proxied) override records and CNAME - flattening at the zone apex. - """ - - soa: Optional[SOA] = None - """Components of the zone's SOA record.""" - - zone_mode: Optional[Literal["standard", "cdn_only", "dns_only"]] = None - """Whether the zone mode is a regular or CDN/DNS only zone.""" diff --git a/src/cloudflare/types/zones/dns_setting_edit_params.py b/src/cloudflare/types/zones/dns_setting_edit_params.py deleted file mode 100644 index 96739b9404c..00000000000 --- a/src/cloudflare/types/zones/dns_setting_edit_params.py +++ /dev/null @@ -1,79 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -from .nameserver_param import NameserverParam - -__all__ = ["DNSSettingEditParams", "SOA"] - - -class DNSSettingEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - foundation_dns: bool - """Whether to enable Foundation DNS Advanced Nameservers on the zone.""" - - multi_provider: bool - """ - Whether to enable multi-provider DNS, which causes Cloudflare to activate the - zone even when non-Cloudflare NS records exist, and to respect NS records at the - zone apex during outbound zone transfers. - """ - - nameservers: NameserverParam - """ - Settings determining the nameservers through which the zone should be available. - """ - - ns_ttl: float - """The time to live (TTL) of the zone's nameserver (NS) records.""" - - secondary_overrides: bool - """ - Allows a Secondary DNS zone to use (proxied) override records and CNAME - flattening at the zone apex. - """ - - soa: SOA - """Components of the zone's SOA record.""" - - zone_mode: Literal["standard", "cdn_only", "dns_only"] - """Whether the zone mode is a regular or CDN/DNS only zone.""" - - -class SOA(TypedDict, total=False): - expire: Required[float] - """ - Time in seconds of being unable to query the primary server after which - secondary servers should stop serving the zone. - """ - - min_ttl: Required[float] - """The time to live (TTL) for negative caching of records within the zone.""" - - mname: Required[str] - """The primary nameserver, which may be used for outbound zone transfers.""" - - refresh: Required[float] - """ - Time in seconds after which secondary servers should re-check the SOA record to - see if the zone has been updated. - """ - - retry: Required[float] - """ - Time in seconds after which secondary servers should retry queries after the - primary server was unresponsive. - """ - - rname: Required[str] - """ - The email address of the zone administrator, with the first label representing - the local part of the email address. - """ - - ttl: Required[float] - """The time to live (TTL) of the SOA record itself.""" diff --git a/src/cloudflare/types/zones/nameserver.py b/src/cloudflare/types/zones/nameserver.py deleted file mode 100644 index 3076da16fbd..00000000000 --- a/src/cloudflare/types/zones/nameserver.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["Nameserver"] - - -class Nameserver(BaseModel): - type: Literal["cloudflare.standard"] - """Nameserver type""" diff --git a/src/cloudflare/types/zones/nameserver_param.py b/src/cloudflare/types/zones/nameserver_param.py deleted file mode 100644 index 6d73075a2ae..00000000000 --- a/src/cloudflare/types/zones/nameserver_param.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["NameserverParam"] - - -class NameserverParam(TypedDict, total=False): - type: Required[Literal["cloudflare.standard"]] - """Nameserver type""" diff --git a/tests/api_resources/zones/test_dns_settings.py b/tests/api_resources/zones/test_dns_settings.py deleted file mode 100644 index db759678ffa..00000000000 --- a/tests/api_resources/zones/test_dns_settings.py +++ /dev/null @@ -1,218 +0,0 @@ -# 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.zones import DNSSetting - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestDNSSettings: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - dns_setting = client.zones.dns_settings.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - dns_setting = client.zones.dns_settings.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - foundation_dns=False, - multi_provider=False, - nameservers={"type": "cloudflare.standard"}, - ns_ttl=86400, - secondary_overrides=False, - soa={ - "expire": 604800, - "min_ttl": 1800, - "mname": "kristina.ns.cloudflare.com", - "refresh": 10000, - "retry": 2400, - "rname": "admin.example.com", - "ttl": 3600, - }, - zone_mode="dns_only", - ) - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.dns_settings.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dns_setting = response.parse() - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.dns_settings.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - dns_setting = response.parse() - assert_matches_type(Optional[DNSSetting], dns_setting, 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.zones.dns_settings.with_raw_response.edit( - zone_id="", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - dns_setting = client.zones.dns_settings.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.dns_settings.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dns_setting = response.parse() - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.dns_settings.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - dns_setting = response.parse() - assert_matches_type(Optional[DNSSetting], dns_setting, 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.zones.dns_settings.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncDNSSettings: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - dns_setting = await async_client.zones.dns_settings.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - dns_setting = await async_client.zones.dns_settings.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - foundation_dns=False, - multi_provider=False, - nameservers={"type": "cloudflare.standard"}, - ns_ttl=86400, - secondary_overrides=False, - soa={ - "expire": 604800, - "min_ttl": 1800, - "mname": "kristina.ns.cloudflare.com", - "refresh": 10000, - "retry": 2400, - "rname": "admin.example.com", - "ttl": 3600, - }, - zone_mode="dns_only", - ) - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.dns_settings.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dns_setting = await response.parse() - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.dns_settings.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - dns_setting = await response.parse() - assert_matches_type(Optional[DNSSetting], dns_setting, 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.zones.dns_settings.with_raw_response.edit( - zone_id="", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - dns_setting = await async_client.zones.dns_settings.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.dns_settings.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dns_setting = await response.parse() - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.dns_settings.with_streaming_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - dns_setting = await response.parse() - assert_matches_type(Optional[DNSSetting], dns_setting, 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.zones.dns_settings.with_raw_response.get( - zone_id="", - )