From 5de06e2112980019731ecc51bf6b7a8dd09cfb7b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Apr 2024 09:33:03 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#267) --- .../resources/zones/dns_settings.py | 42 ++++++++++++++++++- src/cloudflare/types/zones/dns_setting.py | 16 +++++++ .../types/zones/dns_setting_edit_params.py | 16 +++++++ .../api_resources/zones/test_dns_settings.py | 6 +++ 4 files changed, 78 insertions(+), 2 deletions(-) diff --git a/src/cloudflare/resources/zones/dns_settings.py b/src/cloudflare/resources/zones/dns_settings.py index 9470be5182c2..671421c98201 100644 --- a/src/cloudflare/resources/zones/dns_settings.py +++ b/src/cloudflare/resources/zones/dns_settings.py @@ -41,7 +41,10 @@ def edit( self, *, zone_id: str, + foundation_dns: bool | NotGiven = NOT_GIVEN, + multi_provider: bool | NotGiven = NOT_GIVEN, nameservers: NameserverParam | NotGiven = NOT_GIVEN, + secondary_overrides: bool | 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, @@ -55,8 +58,17 @@ def edit( 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. + secondary_overrides: Allows a Secondary DNS zone to use (proxied) override records and CNAME + flattening at the zone apex. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -69,7 +81,15 @@ def edit( 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({"nameservers": nameservers}, dns_setting_edit_params.DNSSettingEditParams), + body=maybe_transform( + { + "foundation_dns": foundation_dns, + "multi_provider": multi_provider, + "nameservers": nameservers, + "secondary_overrides": secondary_overrides, + }, + dns_setting_edit_params.DNSSettingEditParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -133,7 +153,10 @@ async def edit( self, *, zone_id: str, + foundation_dns: bool | NotGiven = NOT_GIVEN, + multi_provider: bool | NotGiven = NOT_GIVEN, nameservers: NameserverParam | NotGiven = NOT_GIVEN, + secondary_overrides: bool | 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, @@ -147,8 +170,17 @@ async def edit( 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. + secondary_overrides: Allows a Secondary DNS zone to use (proxied) override records and CNAME + flattening at the zone apex. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -162,7 +194,13 @@ async def edit( return await self._patch( f"/zones/{zone_id}/dns_settings", body=await async_maybe_transform( - {"nameservers": nameservers}, dns_setting_edit_params.DNSSettingEditParams + { + "foundation_dns": foundation_dns, + "multi_provider": multi_provider, + "nameservers": nameservers, + "secondary_overrides": secondary_overrides, + }, + dns_setting_edit_params.DNSSettingEditParams, ), options=make_request_options( extra_headers=extra_headers, diff --git a/src/cloudflare/types/zones/dns_setting.py b/src/cloudflare/types/zones/dns_setting.py index 0d40812fe62e..ea337af7a25c 100644 --- a/src/cloudflare/types/zones/dns_setting.py +++ b/src/cloudflare/types/zones/dns_setting.py @@ -9,7 +9,23 @@ 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. """ + + secondary_overrides: Optional[bool] = None + """ + Allows a Secondary DNS zone to use (proxied) override records and CNAME + flattening at the zone apex. + """ diff --git a/src/cloudflare/types/zones/dns_setting_edit_params.py b/src/cloudflare/types/zones/dns_setting_edit_params.py index b8fc0d32fff0..fa2cdb1dca25 100644 --- a/src/cloudflare/types/zones/dns_setting_edit_params.py +++ b/src/cloudflare/types/zones/dns_setting_edit_params.py @@ -13,7 +13,23 @@ 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. """ + + secondary_overrides: bool + """ + Allows a Secondary DNS zone to use (proxied) override records and CNAME + flattening at the zone apex. + """ diff --git a/tests/api_resources/zones/test_dns_settings.py b/tests/api_resources/zones/test_dns_settings.py index 08e422a0b89c..99cce7c0c8ff 100644 --- a/tests/api_resources/zones/test_dns_settings.py +++ b/tests/api_resources/zones/test_dns_settings.py @@ -30,7 +30,10 @@ def test_method_edit(self, client: Cloudflare) -> None: 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"}, + secondary_overrides=False, ) assert_matches_type(DNSSetting, dns_setting, path=["response"]) @@ -127,7 +130,10 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: 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"}, + secondary_overrides=False, ) assert_matches_type(DNSSetting, dns_setting, path=["response"])