Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): OpenAPI spec update via Stainless API #267

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions src/cloudflare/resources/zones/dns_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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,
Expand Down
16 changes: 16 additions & 0 deletions src/cloudflare/types/zones/dns_setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
16 changes: 16 additions & 0 deletions src/cloudflare/types/zones/dns_setting_edit_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
6 changes: 6 additions & 0 deletions tests/api_resources/zones/test_dns_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])

Expand Down Expand Up @@ -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"])

Expand Down