Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d8e67ed

Browse files
committedMar 10, 2025·
chore(internal): codegen related update (#2511)
1 parent e981f6b commit d8e67ed

18 files changed

+2003
-2
lines changed
 

‎.stats.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 1567
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-cbb99272da54989b18eb7fb838f75d228fc482ba11f8178a44529002184ed785.yml
1+
configured_endpoints: 1571
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-ce6973d9ffb4160d1590bf265381b7b3cc895123688d710646ee414838002e82.yml

‎api.md

+26
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,32 @@ Types:
11341134
from cloudflare.types.dns import DNSSetting
11351135
```
11361136

1137+
### Zone
1138+
1139+
Types:
1140+
1141+
```python
1142+
from cloudflare.types.dns.settings import ZoneEditResponse, ZoneGetResponse
1143+
```
1144+
1145+
Methods:
1146+
1147+
- <code title="patch /zones/{zone_id}/dns_settings">client.dns.settings.zone.<a href="./src/cloudflare/resources/dns/settings/zone.py">edit</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/dns/settings/zone_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/dns/settings/zone_edit_response.py">Optional[ZoneEditResponse]</a></code>
1148+
- <code title="get /zones/{zone_id}/dns_settings">client.dns.settings.zone.<a href="./src/cloudflare/resources/dns/settings/zone.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/dns/settings/zone_get_response.py">Optional[ZoneGetResponse]</a></code>
1149+
1150+
### Account
1151+
1152+
Types:
1153+
1154+
```python
1155+
from cloudflare.types.dns.settings import AccountEditResponse, AccountGetResponse
1156+
```
1157+
1158+
Methods:
1159+
1160+
- <code title="patch /accounts/{account_id}/dns_settings">client.dns.settings.account.<a href="./src/cloudflare/resources/dns/settings/account.py">edit</a>(\*, account_id, \*\*<a href="src/cloudflare/types/dns/settings/account_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/dns/settings/account_edit_response.py">Optional[AccountEditResponse]</a></code>
1161+
- <code title="get /accounts/{account_id}/dns_settings">client.dns.settings.account.<a href="./src/cloudflare/resources/dns/settings/account.py">get</a>(\*, account_id) -> <a href="./src/cloudflare/types/dns/settings/account_get_response.py">Optional[AccountGetResponse]</a></code>
1162+
11371163
## Analytics
11381164

11391165
### Reports

‎src/cloudflare/resources/dns/__init__.py

+14
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@
2424
RecordsResourceWithStreamingResponse,
2525
AsyncRecordsResourceWithStreamingResponse,
2626
)
27+
from .settings import (
28+
SettingsResource,
29+
AsyncSettingsResource,
30+
SettingsResourceWithRawResponse,
31+
AsyncSettingsResourceWithRawResponse,
32+
SettingsResourceWithStreamingResponse,
33+
AsyncSettingsResourceWithStreamingResponse,
34+
)
2735
from .analytics import (
2836
AnalyticsResource,
2937
AsyncAnalyticsResource,
@@ -54,6 +62,12 @@
5462
"AsyncRecordsResourceWithRawResponse",
5563
"RecordsResourceWithStreamingResponse",
5664
"AsyncRecordsResourceWithStreamingResponse",
65+
"SettingsResource",
66+
"AsyncSettingsResource",
67+
"SettingsResourceWithRawResponse",
68+
"AsyncSettingsResourceWithRawResponse",
69+
"SettingsResourceWithStreamingResponse",
70+
"AsyncSettingsResourceWithStreamingResponse",
5771
"AnalyticsResource",
5872
"AsyncAnalyticsResource",
5973
"AnalyticsResourceWithRawResponse",

‎src/cloudflare/resources/dns/dns.py

+32
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
)
2121
from ..._compat import cached_property
2222
from ..._resource import SyncAPIResource, AsyncAPIResource
23+
from .settings.settings import (
24+
SettingsResource,
25+
AsyncSettingsResource,
26+
SettingsResourceWithRawResponse,
27+
AsyncSettingsResourceWithRawResponse,
28+
SettingsResourceWithStreamingResponse,
29+
AsyncSettingsResourceWithStreamingResponse,
30+
)
2331
from .analytics.analytics import (
2432
AnalyticsResource,
2533
AsyncAnalyticsResource,
@@ -49,6 +57,10 @@ def dnssec(self) -> DNSSECResource:
4957
def records(self) -> RecordsResource:
5058
return RecordsResource(self._client)
5159

60+
@cached_property
61+
def settings(self) -> SettingsResource:
62+
return SettingsResource(self._client)
63+
5264
@cached_property
5365
def analytics(self) -> AnalyticsResource:
5466
return AnalyticsResource(self._client)
@@ -86,6 +98,10 @@ def dnssec(self) -> AsyncDNSSECResource:
8698
def records(self) -> AsyncRecordsResource:
8799
return AsyncRecordsResource(self._client)
88100

101+
@cached_property
102+
def settings(self) -> AsyncSettingsResource:
103+
return AsyncSettingsResource(self._client)
104+
89105
@cached_property
90106
def analytics(self) -> AsyncAnalyticsResource:
91107
return AsyncAnalyticsResource(self._client)
@@ -126,6 +142,10 @@ def dnssec(self) -> DNSSECResourceWithRawResponse:
126142
def records(self) -> RecordsResourceWithRawResponse:
127143
return RecordsResourceWithRawResponse(self._dns.records)
128144

145+
@cached_property
146+
def settings(self) -> SettingsResourceWithRawResponse:
147+
return SettingsResourceWithRawResponse(self._dns.settings)
148+
129149
@cached_property
130150
def analytics(self) -> AnalyticsResourceWithRawResponse:
131151
return AnalyticsResourceWithRawResponse(self._dns.analytics)
@@ -147,6 +167,10 @@ def dnssec(self) -> AsyncDNSSECResourceWithRawResponse:
147167
def records(self) -> AsyncRecordsResourceWithRawResponse:
148168
return AsyncRecordsResourceWithRawResponse(self._dns.records)
149169

170+
@cached_property
171+
def settings(self) -> AsyncSettingsResourceWithRawResponse:
172+
return AsyncSettingsResourceWithRawResponse(self._dns.settings)
173+
150174
@cached_property
151175
def analytics(self) -> AsyncAnalyticsResourceWithRawResponse:
152176
return AsyncAnalyticsResourceWithRawResponse(self._dns.analytics)
@@ -168,6 +192,10 @@ def dnssec(self) -> DNSSECResourceWithStreamingResponse:
168192
def records(self) -> RecordsResourceWithStreamingResponse:
169193
return RecordsResourceWithStreamingResponse(self._dns.records)
170194

195+
@cached_property
196+
def settings(self) -> SettingsResourceWithStreamingResponse:
197+
return SettingsResourceWithStreamingResponse(self._dns.settings)
198+
171199
@cached_property
172200
def analytics(self) -> AnalyticsResourceWithStreamingResponse:
173201
return AnalyticsResourceWithStreamingResponse(self._dns.analytics)
@@ -189,6 +217,10 @@ def dnssec(self) -> AsyncDNSSECResourceWithStreamingResponse:
189217
def records(self) -> AsyncRecordsResourceWithStreamingResponse:
190218
return AsyncRecordsResourceWithStreamingResponse(self._dns.records)
191219

220+
@cached_property
221+
def settings(self) -> AsyncSettingsResourceWithStreamingResponse:
222+
return AsyncSettingsResourceWithStreamingResponse(self._dns.settings)
223+
192224
@cached_property
193225
def analytics(self) -> AsyncAnalyticsResourceWithStreamingResponse:
194226
return AsyncAnalyticsResourceWithStreamingResponse(self._dns.analytics)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .zone import (
4+
ZoneResource,
5+
AsyncZoneResource,
6+
ZoneResourceWithRawResponse,
7+
AsyncZoneResourceWithRawResponse,
8+
ZoneResourceWithStreamingResponse,
9+
AsyncZoneResourceWithStreamingResponse,
10+
)
11+
from .account import (
12+
AccountResource,
13+
AsyncAccountResource,
14+
AccountResourceWithRawResponse,
15+
AsyncAccountResourceWithRawResponse,
16+
AccountResourceWithStreamingResponse,
17+
AsyncAccountResourceWithStreamingResponse,
18+
)
19+
from .settings import (
20+
SettingsResource,
21+
AsyncSettingsResource,
22+
SettingsResourceWithRawResponse,
23+
AsyncSettingsResourceWithRawResponse,
24+
SettingsResourceWithStreamingResponse,
25+
AsyncSettingsResourceWithStreamingResponse,
26+
)
27+
28+
__all__ = [
29+
"ZoneResource",
30+
"AsyncZoneResource",
31+
"ZoneResourceWithRawResponse",
32+
"AsyncZoneResourceWithRawResponse",
33+
"ZoneResourceWithStreamingResponse",
34+
"AsyncZoneResourceWithStreamingResponse",
35+
"AccountResource",
36+
"AsyncAccountResource",
37+
"AccountResourceWithRawResponse",
38+
"AsyncAccountResourceWithRawResponse",
39+
"AccountResourceWithStreamingResponse",
40+
"AsyncAccountResourceWithStreamingResponse",
41+
"SettingsResource",
42+
"AsyncSettingsResource",
43+
"SettingsResourceWithRawResponse",
44+
"AsyncSettingsResourceWithRawResponse",
45+
"SettingsResourceWithStreamingResponse",
46+
"AsyncSettingsResourceWithStreamingResponse",
47+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Type, Optional, cast
6+
7+
import httpx
8+
9+
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10+
from ...._utils import (
11+
maybe_transform,
12+
async_maybe_transform,
13+
)
14+
from ...._compat import cached_property
15+
from ...._resource import SyncAPIResource, AsyncAPIResource
16+
from ...._response import (
17+
to_raw_response_wrapper,
18+
to_streamed_response_wrapper,
19+
async_to_raw_response_wrapper,
20+
async_to_streamed_response_wrapper,
21+
)
22+
from ...._wrappers import ResultWrapper
23+
from ...._base_client import make_request_options
24+
from ....types.dns.settings import account_edit_params
25+
from ....types.dns.settings.account_get_response import AccountGetResponse
26+
from ....types.dns.settings.account_edit_response import AccountEditResponse
27+
28+
__all__ = ["AccountResource", "AsyncAccountResource"]
29+
30+
31+
class AccountResource(SyncAPIResource):
32+
@cached_property
33+
def with_raw_response(self) -> AccountResourceWithRawResponse:
34+
"""
35+
This property can be used as a prefix for any HTTP method call to return
36+
the raw response object instead of the parsed content.
37+
38+
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
39+
"""
40+
return AccountResourceWithRawResponse(self)
41+
42+
@cached_property
43+
def with_streaming_response(self) -> AccountResourceWithStreamingResponse:
44+
"""
45+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
46+
47+
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
48+
"""
49+
return AccountResourceWithStreamingResponse(self)
50+
51+
def edit(
52+
self,
53+
*,
54+
account_id: str,
55+
zone_defaults: account_edit_params.ZoneDefaults | NotGiven = NOT_GIVEN,
56+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
57+
# The extra values given here take precedence over values defined on the client or passed to this method.
58+
extra_headers: Headers | None = None,
59+
extra_query: Query | None = None,
60+
extra_body: Body | None = None,
61+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
62+
) -> Optional[AccountEditResponse]:
63+
"""
64+
Update DNS settings for an account
65+
66+
Args:
67+
account_id: Identifier
68+
69+
extra_headers: Send extra headers
70+
71+
extra_query: Add additional query parameters to the request
72+
73+
extra_body: Add additional JSON properties to the request
74+
75+
timeout: Override the client-level default timeout for this request, in seconds
76+
"""
77+
if not account_id:
78+
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
79+
return self._patch(
80+
f"/accounts/{account_id}/dns_settings",
81+
body=maybe_transform({"zone_defaults": zone_defaults}, account_edit_params.AccountEditParams),
82+
options=make_request_options(
83+
extra_headers=extra_headers,
84+
extra_query=extra_query,
85+
extra_body=extra_body,
86+
timeout=timeout,
87+
post_parser=ResultWrapper[Optional[AccountEditResponse]]._unwrapper,
88+
),
89+
cast_to=cast(Type[Optional[AccountEditResponse]], ResultWrapper[AccountEditResponse]),
90+
)
91+
92+
def get(
93+
self,
94+
*,
95+
account_id: str,
96+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
97+
# The extra values given here take precedence over values defined on the client or passed to this method.
98+
extra_headers: Headers | None = None,
99+
extra_query: Query | None = None,
100+
extra_body: Body | None = None,
101+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
102+
) -> Optional[AccountGetResponse]:
103+
"""
104+
Show DNS settings for an account
105+
106+
Args:
107+
account_id: Identifier
108+
109+
extra_headers: Send extra headers
110+
111+
extra_query: Add additional query parameters to the request
112+
113+
extra_body: Add additional JSON properties to the request
114+
115+
timeout: Override the client-level default timeout for this request, in seconds
116+
"""
117+
if not account_id:
118+
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
119+
return self._get(
120+
f"/accounts/{account_id}/dns_settings",
121+
options=make_request_options(
122+
extra_headers=extra_headers,
123+
extra_query=extra_query,
124+
extra_body=extra_body,
125+
timeout=timeout,
126+
post_parser=ResultWrapper[Optional[AccountGetResponse]]._unwrapper,
127+
),
128+
cast_to=cast(Type[Optional[AccountGetResponse]], ResultWrapper[AccountGetResponse]),
129+
)
130+
131+
132+
class AsyncAccountResource(AsyncAPIResource):
133+
@cached_property
134+
def with_raw_response(self) -> AsyncAccountResourceWithRawResponse:
135+
"""
136+
This property can be used as a prefix for any HTTP method call to return
137+
the raw response object instead of the parsed content.
138+
139+
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
140+
"""
141+
return AsyncAccountResourceWithRawResponse(self)
142+
143+
@cached_property
144+
def with_streaming_response(self) -> AsyncAccountResourceWithStreamingResponse:
145+
"""
146+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
147+
148+
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
149+
"""
150+
return AsyncAccountResourceWithStreamingResponse(self)
151+
152+
async def edit(
153+
self,
154+
*,
155+
account_id: str,
156+
zone_defaults: account_edit_params.ZoneDefaults | NotGiven = NOT_GIVEN,
157+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
158+
# The extra values given here take precedence over values defined on the client or passed to this method.
159+
extra_headers: Headers | None = None,
160+
extra_query: Query | None = None,
161+
extra_body: Body | None = None,
162+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
163+
) -> Optional[AccountEditResponse]:
164+
"""
165+
Update DNS settings for an account
166+
167+
Args:
168+
account_id: Identifier
169+
170+
extra_headers: Send extra headers
171+
172+
extra_query: Add additional query parameters to the request
173+
174+
extra_body: Add additional JSON properties to the request
175+
176+
timeout: Override the client-level default timeout for this request, in seconds
177+
"""
178+
if not account_id:
179+
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
180+
return await self._patch(
181+
f"/accounts/{account_id}/dns_settings",
182+
body=await async_maybe_transform({"zone_defaults": zone_defaults}, account_edit_params.AccountEditParams),
183+
options=make_request_options(
184+
extra_headers=extra_headers,
185+
extra_query=extra_query,
186+
extra_body=extra_body,
187+
timeout=timeout,
188+
post_parser=ResultWrapper[Optional[AccountEditResponse]]._unwrapper,
189+
),
190+
cast_to=cast(Type[Optional[AccountEditResponse]], ResultWrapper[AccountEditResponse]),
191+
)
192+
193+
async def get(
194+
self,
195+
*,
196+
account_id: str,
197+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
198+
# The extra values given here take precedence over values defined on the client or passed to this method.
199+
extra_headers: Headers | None = None,
200+
extra_query: Query | None = None,
201+
extra_body: Body | None = None,
202+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
203+
) -> Optional[AccountGetResponse]:
204+
"""
205+
Show DNS settings for an account
206+
207+
Args:
208+
account_id: Identifier
209+
210+
extra_headers: Send extra headers
211+
212+
extra_query: Add additional query parameters to the request
213+
214+
extra_body: Add additional JSON properties to the request
215+
216+
timeout: Override the client-level default timeout for this request, in seconds
217+
"""
218+
if not account_id:
219+
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
220+
return await self._get(
221+
f"/accounts/{account_id}/dns_settings",
222+
options=make_request_options(
223+
extra_headers=extra_headers,
224+
extra_query=extra_query,
225+
extra_body=extra_body,
226+
timeout=timeout,
227+
post_parser=ResultWrapper[Optional[AccountGetResponse]]._unwrapper,
228+
),
229+
cast_to=cast(Type[Optional[AccountGetResponse]], ResultWrapper[AccountGetResponse]),
230+
)
231+
232+
233+
class AccountResourceWithRawResponse:
234+
def __init__(self, account: AccountResource) -> None:
235+
self._account = account
236+
237+
self.edit = to_raw_response_wrapper(
238+
account.edit,
239+
)
240+
self.get = to_raw_response_wrapper(
241+
account.get,
242+
)
243+
244+
245+
class AsyncAccountResourceWithRawResponse:
246+
def __init__(self, account: AsyncAccountResource) -> None:
247+
self._account = account
248+
249+
self.edit = async_to_raw_response_wrapper(
250+
account.edit,
251+
)
252+
self.get = async_to_raw_response_wrapper(
253+
account.get,
254+
)
255+
256+
257+
class AccountResourceWithStreamingResponse:
258+
def __init__(self, account: AccountResource) -> None:
259+
self._account = account
260+
261+
self.edit = to_streamed_response_wrapper(
262+
account.edit,
263+
)
264+
self.get = to_streamed_response_wrapper(
265+
account.get,
266+
)
267+
268+
269+
class AsyncAccountResourceWithStreamingResponse:
270+
def __init__(self, account: AsyncAccountResource) -> None:
271+
self._account = account
272+
273+
self.edit = async_to_streamed_response_wrapper(
274+
account.edit,
275+
)
276+
self.get = async_to_streamed_response_wrapper(
277+
account.get,
278+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from .zone import (
6+
ZoneResource,
7+
AsyncZoneResource,
8+
ZoneResourceWithRawResponse,
9+
AsyncZoneResourceWithRawResponse,
10+
ZoneResourceWithStreamingResponse,
11+
AsyncZoneResourceWithStreamingResponse,
12+
)
13+
from .account import (
14+
AccountResource,
15+
AsyncAccountResource,
16+
AccountResourceWithRawResponse,
17+
AsyncAccountResourceWithRawResponse,
18+
AccountResourceWithStreamingResponse,
19+
AsyncAccountResourceWithStreamingResponse,
20+
)
21+
from ...._compat import cached_property
22+
from ...._resource import SyncAPIResource, AsyncAPIResource
23+
24+
__all__ = ["SettingsResource", "AsyncSettingsResource"]
25+
26+
27+
class SettingsResource(SyncAPIResource):
28+
@cached_property
29+
def zone(self) -> ZoneResource:
30+
return ZoneResource(self._client)
31+
32+
@cached_property
33+
def account(self) -> AccountResource:
34+
return AccountResource(self._client)
35+
36+
@cached_property
37+
def with_raw_response(self) -> SettingsResourceWithRawResponse:
38+
"""
39+
This property can be used as a prefix for any HTTP method call to return
40+
the raw response object instead of the parsed content.
41+
42+
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
43+
"""
44+
return SettingsResourceWithRawResponse(self)
45+
46+
@cached_property
47+
def with_streaming_response(self) -> SettingsResourceWithStreamingResponse:
48+
"""
49+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
50+
51+
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
52+
"""
53+
return SettingsResourceWithStreamingResponse(self)
54+
55+
56+
class AsyncSettingsResource(AsyncAPIResource):
57+
@cached_property
58+
def zone(self) -> AsyncZoneResource:
59+
return AsyncZoneResource(self._client)
60+
61+
@cached_property
62+
def account(self) -> AsyncAccountResource:
63+
return AsyncAccountResource(self._client)
64+
65+
@cached_property
66+
def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse:
67+
"""
68+
This property can be used as a prefix for any HTTP method call to return
69+
the raw response object instead of the parsed content.
70+
71+
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
72+
"""
73+
return AsyncSettingsResourceWithRawResponse(self)
74+
75+
@cached_property
76+
def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse:
77+
"""
78+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
79+
80+
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
81+
"""
82+
return AsyncSettingsResourceWithStreamingResponse(self)
83+
84+
85+
class SettingsResourceWithRawResponse:
86+
def __init__(self, settings: SettingsResource) -> None:
87+
self._settings = settings
88+
89+
@cached_property
90+
def zone(self) -> ZoneResourceWithRawResponse:
91+
return ZoneResourceWithRawResponse(self._settings.zone)
92+
93+
@cached_property
94+
def account(self) -> AccountResourceWithRawResponse:
95+
return AccountResourceWithRawResponse(self._settings.account)
96+
97+
98+
class AsyncSettingsResourceWithRawResponse:
99+
def __init__(self, settings: AsyncSettingsResource) -> None:
100+
self._settings = settings
101+
102+
@cached_property
103+
def zone(self) -> AsyncZoneResourceWithRawResponse:
104+
return AsyncZoneResourceWithRawResponse(self._settings.zone)
105+
106+
@cached_property
107+
def account(self) -> AsyncAccountResourceWithRawResponse:
108+
return AsyncAccountResourceWithRawResponse(self._settings.account)
109+
110+
111+
class SettingsResourceWithStreamingResponse:
112+
def __init__(self, settings: SettingsResource) -> None:
113+
self._settings = settings
114+
115+
@cached_property
116+
def zone(self) -> ZoneResourceWithStreamingResponse:
117+
return ZoneResourceWithStreamingResponse(self._settings.zone)
118+
119+
@cached_property
120+
def account(self) -> AccountResourceWithStreamingResponse:
121+
return AccountResourceWithStreamingResponse(self._settings.account)
122+
123+
124+
class AsyncSettingsResourceWithStreamingResponse:
125+
def __init__(self, settings: AsyncSettingsResource) -> None:
126+
self._settings = settings
127+
128+
@cached_property
129+
def zone(self) -> AsyncZoneResourceWithStreamingResponse:
130+
return AsyncZoneResourceWithStreamingResponse(self._settings.zone)
131+
132+
@cached_property
133+
def account(self) -> AsyncAccountResourceWithStreamingResponse:
134+
return AsyncAccountResourceWithStreamingResponse(self._settings.account)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,365 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Type, Optional, cast
6+
from typing_extensions import Literal
7+
8+
import httpx
9+
10+
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
11+
from ...._utils import (
12+
maybe_transform,
13+
async_maybe_transform,
14+
)
15+
from ...._compat import cached_property
16+
from ...._resource import SyncAPIResource, AsyncAPIResource
17+
from ...._response import (
18+
to_raw_response_wrapper,
19+
to_streamed_response_wrapper,
20+
async_to_raw_response_wrapper,
21+
async_to_streamed_response_wrapper,
22+
)
23+
from ...._wrappers import ResultWrapper
24+
from ...._base_client import make_request_options
25+
from ....types.dns.settings import zone_edit_params
26+
from ....types.dns.settings.zone_get_response import ZoneGetResponse
27+
from ....types.dns.settings.zone_edit_response import ZoneEditResponse
28+
29+
__all__ = ["ZoneResource", "AsyncZoneResource"]
30+
31+
32+
class ZoneResource(SyncAPIResource):
33+
@cached_property
34+
def with_raw_response(self) -> ZoneResourceWithRawResponse:
35+
"""
36+
This property can be used as a prefix for any HTTP method call to return
37+
the raw response object instead of the parsed content.
38+
39+
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
40+
"""
41+
return ZoneResourceWithRawResponse(self)
42+
43+
@cached_property
44+
def with_streaming_response(self) -> ZoneResourceWithStreamingResponse:
45+
"""
46+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
47+
48+
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
49+
"""
50+
return ZoneResourceWithStreamingResponse(self)
51+
52+
def edit(
53+
self,
54+
*,
55+
zone_id: str,
56+
flatten_all_cnames: bool | NotGiven = NOT_GIVEN,
57+
foundation_dns: bool | NotGiven = NOT_GIVEN,
58+
internal_dns: zone_edit_params.InternalDNS | NotGiven = NOT_GIVEN,
59+
multi_provider: bool | NotGiven = NOT_GIVEN,
60+
nameservers: zone_edit_params.Nameservers | NotGiven = NOT_GIVEN,
61+
ns_ttl: float | NotGiven = NOT_GIVEN,
62+
secondary_overrides: bool | NotGiven = NOT_GIVEN,
63+
soa: zone_edit_params.SOA | NotGiven = NOT_GIVEN,
64+
zone_mode: Literal["standard", "cdn_only", "dns_only"] | NotGiven = NOT_GIVEN,
65+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
66+
# The extra values given here take precedence over values defined on the client or passed to this method.
67+
extra_headers: Headers | None = None,
68+
extra_query: Query | None = None,
69+
extra_body: Body | None = None,
70+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
71+
) -> Optional[ZoneEditResponse]:
72+
"""
73+
Update DNS settings for a zone
74+
75+
Args:
76+
zone_id: Identifier
77+
78+
flatten_all_cnames: Whether to flatten all CNAME records in the zone. Note that, due to DNS
79+
limitations, a CNAME record at the zone apex will always be flattened.
80+
81+
foundation_dns: Whether to enable Foundation DNS Advanced Nameservers on the zone.
82+
83+
internal_dns: Settings for this internal zone.
84+
85+
multi_provider: Whether to enable multi-provider DNS, which causes Cloudflare to activate the
86+
zone even when non-Cloudflare NS records exist, and to respect NS records at the
87+
zone apex during outbound zone transfers.
88+
89+
nameservers: Settings determining the nameservers through which the zone should be available.
90+
91+
ns_ttl: The time to live (TTL) of the zone's nameserver (NS) records.
92+
93+
secondary_overrides: Allows a Secondary DNS zone to use (proxied) override records and CNAME
94+
flattening at the zone apex.
95+
96+
soa: Components of the zone's SOA record.
97+
98+
zone_mode: Whether the zone mode is a regular or CDN/DNS only zone.
99+
100+
extra_headers: Send extra headers
101+
102+
extra_query: Add additional query parameters to the request
103+
104+
extra_body: Add additional JSON properties to the request
105+
106+
timeout: Override the client-level default timeout for this request, in seconds
107+
"""
108+
if not zone_id:
109+
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
110+
return self._patch(
111+
f"/zones/{zone_id}/dns_settings",
112+
body=maybe_transform(
113+
{
114+
"flatten_all_cnames": flatten_all_cnames,
115+
"foundation_dns": foundation_dns,
116+
"internal_dns": internal_dns,
117+
"multi_provider": multi_provider,
118+
"nameservers": nameservers,
119+
"ns_ttl": ns_ttl,
120+
"secondary_overrides": secondary_overrides,
121+
"soa": soa,
122+
"zone_mode": zone_mode,
123+
},
124+
zone_edit_params.ZoneEditParams,
125+
),
126+
options=make_request_options(
127+
extra_headers=extra_headers,
128+
extra_query=extra_query,
129+
extra_body=extra_body,
130+
timeout=timeout,
131+
post_parser=ResultWrapper[Optional[ZoneEditResponse]]._unwrapper,
132+
),
133+
cast_to=cast(Type[Optional[ZoneEditResponse]], ResultWrapper[ZoneEditResponse]),
134+
)
135+
136+
def get(
137+
self,
138+
*,
139+
zone_id: str,
140+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
141+
# The extra values given here take precedence over values defined on the client or passed to this method.
142+
extra_headers: Headers | None = None,
143+
extra_query: Query | None = None,
144+
extra_body: Body | None = None,
145+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
146+
) -> Optional[ZoneGetResponse]:
147+
"""
148+
Show DNS settings for a zone
149+
150+
Args:
151+
zone_id: Identifier
152+
153+
extra_headers: Send extra headers
154+
155+
extra_query: Add additional query parameters to the request
156+
157+
extra_body: Add additional JSON properties to the request
158+
159+
timeout: Override the client-level default timeout for this request, in seconds
160+
"""
161+
if not zone_id:
162+
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
163+
return self._get(
164+
f"/zones/{zone_id}/dns_settings",
165+
options=make_request_options(
166+
extra_headers=extra_headers,
167+
extra_query=extra_query,
168+
extra_body=extra_body,
169+
timeout=timeout,
170+
post_parser=ResultWrapper[Optional[ZoneGetResponse]]._unwrapper,
171+
),
172+
cast_to=cast(Type[Optional[ZoneGetResponse]], ResultWrapper[ZoneGetResponse]),
173+
)
174+
175+
176+
class AsyncZoneResource(AsyncAPIResource):
177+
@cached_property
178+
def with_raw_response(self) -> AsyncZoneResourceWithRawResponse:
179+
"""
180+
This property can be used as a prefix for any HTTP method call to return
181+
the raw response object instead of the parsed content.
182+
183+
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
184+
"""
185+
return AsyncZoneResourceWithRawResponse(self)
186+
187+
@cached_property
188+
def with_streaming_response(self) -> AsyncZoneResourceWithStreamingResponse:
189+
"""
190+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
191+
192+
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
193+
"""
194+
return AsyncZoneResourceWithStreamingResponse(self)
195+
196+
async def edit(
197+
self,
198+
*,
199+
zone_id: str,
200+
flatten_all_cnames: bool | NotGiven = NOT_GIVEN,
201+
foundation_dns: bool | NotGiven = NOT_GIVEN,
202+
internal_dns: zone_edit_params.InternalDNS | NotGiven = NOT_GIVEN,
203+
multi_provider: bool | NotGiven = NOT_GIVEN,
204+
nameservers: zone_edit_params.Nameservers | NotGiven = NOT_GIVEN,
205+
ns_ttl: float | NotGiven = NOT_GIVEN,
206+
secondary_overrides: bool | NotGiven = NOT_GIVEN,
207+
soa: zone_edit_params.SOA | NotGiven = NOT_GIVEN,
208+
zone_mode: Literal["standard", "cdn_only", "dns_only"] | NotGiven = NOT_GIVEN,
209+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
210+
# The extra values given here take precedence over values defined on the client or passed to this method.
211+
extra_headers: Headers | None = None,
212+
extra_query: Query | None = None,
213+
extra_body: Body | None = None,
214+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
215+
) -> Optional[ZoneEditResponse]:
216+
"""
217+
Update DNS settings for a zone
218+
219+
Args:
220+
zone_id: Identifier
221+
222+
flatten_all_cnames: Whether to flatten all CNAME records in the zone. Note that, due to DNS
223+
limitations, a CNAME record at the zone apex will always be flattened.
224+
225+
foundation_dns: Whether to enable Foundation DNS Advanced Nameservers on the zone.
226+
227+
internal_dns: Settings for this internal zone.
228+
229+
multi_provider: Whether to enable multi-provider DNS, which causes Cloudflare to activate the
230+
zone even when non-Cloudflare NS records exist, and to respect NS records at the
231+
zone apex during outbound zone transfers.
232+
233+
nameservers: Settings determining the nameservers through which the zone should be available.
234+
235+
ns_ttl: The time to live (TTL) of the zone's nameserver (NS) records.
236+
237+
secondary_overrides: Allows a Secondary DNS zone to use (proxied) override records and CNAME
238+
flattening at the zone apex.
239+
240+
soa: Components of the zone's SOA record.
241+
242+
zone_mode: Whether the zone mode is a regular or CDN/DNS only zone.
243+
244+
extra_headers: Send extra headers
245+
246+
extra_query: Add additional query parameters to the request
247+
248+
extra_body: Add additional JSON properties to the request
249+
250+
timeout: Override the client-level default timeout for this request, in seconds
251+
"""
252+
if not zone_id:
253+
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
254+
return await self._patch(
255+
f"/zones/{zone_id}/dns_settings",
256+
body=await async_maybe_transform(
257+
{
258+
"flatten_all_cnames": flatten_all_cnames,
259+
"foundation_dns": foundation_dns,
260+
"internal_dns": internal_dns,
261+
"multi_provider": multi_provider,
262+
"nameservers": nameservers,
263+
"ns_ttl": ns_ttl,
264+
"secondary_overrides": secondary_overrides,
265+
"soa": soa,
266+
"zone_mode": zone_mode,
267+
},
268+
zone_edit_params.ZoneEditParams,
269+
),
270+
options=make_request_options(
271+
extra_headers=extra_headers,
272+
extra_query=extra_query,
273+
extra_body=extra_body,
274+
timeout=timeout,
275+
post_parser=ResultWrapper[Optional[ZoneEditResponse]]._unwrapper,
276+
),
277+
cast_to=cast(Type[Optional[ZoneEditResponse]], ResultWrapper[ZoneEditResponse]),
278+
)
279+
280+
async def get(
281+
self,
282+
*,
283+
zone_id: str,
284+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
285+
# The extra values given here take precedence over values defined on the client or passed to this method.
286+
extra_headers: Headers | None = None,
287+
extra_query: Query | None = None,
288+
extra_body: Body | None = None,
289+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
290+
) -> Optional[ZoneGetResponse]:
291+
"""
292+
Show DNS settings for a zone
293+
294+
Args:
295+
zone_id: Identifier
296+
297+
extra_headers: Send extra headers
298+
299+
extra_query: Add additional query parameters to the request
300+
301+
extra_body: Add additional JSON properties to the request
302+
303+
timeout: Override the client-level default timeout for this request, in seconds
304+
"""
305+
if not zone_id:
306+
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
307+
return await self._get(
308+
f"/zones/{zone_id}/dns_settings",
309+
options=make_request_options(
310+
extra_headers=extra_headers,
311+
extra_query=extra_query,
312+
extra_body=extra_body,
313+
timeout=timeout,
314+
post_parser=ResultWrapper[Optional[ZoneGetResponse]]._unwrapper,
315+
),
316+
cast_to=cast(Type[Optional[ZoneGetResponse]], ResultWrapper[ZoneGetResponse]),
317+
)
318+
319+
320+
class ZoneResourceWithRawResponse:
321+
def __init__(self, zone: ZoneResource) -> None:
322+
self._zone = zone
323+
324+
self.edit = to_raw_response_wrapper(
325+
zone.edit,
326+
)
327+
self.get = to_raw_response_wrapper(
328+
zone.get,
329+
)
330+
331+
332+
class AsyncZoneResourceWithRawResponse:
333+
def __init__(self, zone: AsyncZoneResource) -> None:
334+
self._zone = zone
335+
336+
self.edit = async_to_raw_response_wrapper(
337+
zone.edit,
338+
)
339+
self.get = async_to_raw_response_wrapper(
340+
zone.get,
341+
)
342+
343+
344+
class ZoneResourceWithStreamingResponse:
345+
def __init__(self, zone: ZoneResource) -> None:
346+
self._zone = zone
347+
348+
self.edit = to_streamed_response_wrapper(
349+
zone.edit,
350+
)
351+
self.get = to_streamed_response_wrapper(
352+
zone.get,
353+
)
354+
355+
356+
class AsyncZoneResourceWithStreamingResponse:
357+
def __init__(self, zone: AsyncZoneResource) -> None:
358+
self._zone = zone
359+
360+
self.edit = async_to_streamed_response_wrapper(
361+
zone.edit,
362+
)
363+
self.get = async_to_streamed_response_wrapper(
364+
zone.get,
365+
)
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
from __future__ import annotations
4+
5+
from .zone_edit_params import ZoneEditParams as ZoneEditParams
6+
from .zone_get_response import ZoneGetResponse as ZoneGetResponse
7+
from .zone_edit_response import ZoneEditResponse as ZoneEditResponse
8+
from .account_edit_params import AccountEditParams as AccountEditParams
9+
from .account_get_response import AccountGetResponse as AccountGetResponse
10+
from .account_edit_response import AccountEditResponse as AccountEditResponse
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Literal, Required, TypedDict
6+
7+
__all__ = ["AccountEditParams", "ZoneDefaults", "ZoneDefaultsInternalDNS", "ZoneDefaultsNameservers", "ZoneDefaultsSOA"]
8+
9+
10+
class AccountEditParams(TypedDict, total=False):
11+
account_id: Required[str]
12+
"""Identifier"""
13+
14+
zone_defaults: ZoneDefaults
15+
16+
17+
class ZoneDefaultsInternalDNS(TypedDict, total=False):
18+
reference_zone_id: str
19+
"""The ID of the zone to fallback to."""
20+
21+
22+
class ZoneDefaultsNameservers(TypedDict, total=False):
23+
type: Required[Literal["cloudflare.standard", "cloudflare.standard.random", "custom.account", "custom.tenant"]]
24+
"""Nameserver type"""
25+
26+
27+
class ZoneDefaultsSOA(TypedDict, total=False):
28+
expire: Required[float]
29+
"""
30+
Time in seconds of being unable to query the primary server after which
31+
secondary servers should stop serving the zone.
32+
"""
33+
34+
min_ttl: Required[float]
35+
"""The time to live (TTL) for negative caching of records within the zone."""
36+
37+
mname: Required[str]
38+
"""The primary nameserver, which may be used for outbound zone transfers."""
39+
40+
refresh: Required[float]
41+
"""
42+
Time in seconds after which secondary servers should re-check the SOA record to
43+
see if the zone has been updated.
44+
"""
45+
46+
retry: Required[float]
47+
"""
48+
Time in seconds after which secondary servers should retry queries after the
49+
primary server was unresponsive.
50+
"""
51+
52+
rname: Required[str]
53+
"""
54+
The email address of the zone administrator, with the first label representing
55+
the local part of the email address.
56+
"""
57+
58+
ttl: Required[float]
59+
"""The time to live (TTL) of the SOA record itself."""
60+
61+
62+
class ZoneDefaults(TypedDict, total=False):
63+
flatten_all_cnames: bool
64+
"""Whether to flatten all CNAME records in the zone.
65+
66+
Note that, due to DNS limitations, a CNAME record at the zone apex will always
67+
be flattened.
68+
"""
69+
70+
foundation_dns: bool
71+
"""Whether to enable Foundation DNS Advanced Nameservers on the zone."""
72+
73+
internal_dns: ZoneDefaultsInternalDNS
74+
"""Settings for this internal zone."""
75+
76+
multi_provider: bool
77+
"""
78+
Whether to enable multi-provider DNS, which causes Cloudflare to activate the
79+
zone even when non-Cloudflare NS records exist, and to respect NS records at the
80+
zone apex during outbound zone transfers.
81+
"""
82+
83+
nameservers: ZoneDefaultsNameservers
84+
"""
85+
Settings determining the nameservers through which the zone should be available.
86+
"""
87+
88+
ns_ttl: float
89+
"""The time to live (TTL) of the zone's nameserver (NS) records."""
90+
91+
secondary_overrides: bool
92+
"""
93+
Allows a Secondary DNS zone to use (proxied) override records and CNAME
94+
flattening at the zone apex.
95+
"""
96+
97+
soa: ZoneDefaultsSOA
98+
"""Components of the zone's SOA record."""
99+
100+
zone_mode: Literal["standard", "cdn_only", "dns_only"]
101+
"""Whether the zone mode is a regular or CDN/DNS only zone."""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
from typing_extensions import Literal
5+
6+
from ...._models import BaseModel
7+
8+
__all__ = [
9+
"AccountEditResponse",
10+
"ZoneDefaults",
11+
"ZoneDefaultsInternalDNS",
12+
"ZoneDefaultsNameservers",
13+
"ZoneDefaultsSOA",
14+
]
15+
16+
17+
class ZoneDefaultsInternalDNS(BaseModel):
18+
reference_zone_id: Optional[str] = None
19+
"""The ID of the zone to fallback to."""
20+
21+
22+
class ZoneDefaultsNameservers(BaseModel):
23+
type: Literal["cloudflare.standard", "cloudflare.standard.random", "custom.account", "custom.tenant"]
24+
"""Nameserver type"""
25+
26+
27+
class ZoneDefaultsSOA(BaseModel):
28+
expire: float
29+
"""
30+
Time in seconds of being unable to query the primary server after which
31+
secondary servers should stop serving the zone.
32+
"""
33+
34+
min_ttl: float
35+
"""The time to live (TTL) for negative caching of records within the zone."""
36+
37+
mname: str
38+
"""The primary nameserver, which may be used for outbound zone transfers."""
39+
40+
refresh: float
41+
"""
42+
Time in seconds after which secondary servers should re-check the SOA record to
43+
see if the zone has been updated.
44+
"""
45+
46+
retry: float
47+
"""
48+
Time in seconds after which secondary servers should retry queries after the
49+
primary server was unresponsive.
50+
"""
51+
52+
rname: str
53+
"""
54+
The email address of the zone administrator, with the first label representing
55+
the local part of the email address.
56+
"""
57+
58+
ttl: float
59+
"""The time to live (TTL) of the SOA record itself."""
60+
61+
62+
class ZoneDefaults(BaseModel):
63+
flatten_all_cnames: Optional[bool] = None
64+
"""Whether to flatten all CNAME records in the zone.
65+
66+
Note that, due to DNS limitations, a CNAME record at the zone apex will always
67+
be flattened.
68+
"""
69+
70+
foundation_dns: Optional[bool] = None
71+
"""Whether to enable Foundation DNS Advanced Nameservers on the zone."""
72+
73+
internal_dns: Optional[ZoneDefaultsInternalDNS] = None
74+
"""Settings for this internal zone."""
75+
76+
multi_provider: Optional[bool] = None
77+
"""
78+
Whether to enable multi-provider DNS, which causes Cloudflare to activate the
79+
zone even when non-Cloudflare NS records exist, and to respect NS records at the
80+
zone apex during outbound zone transfers.
81+
"""
82+
83+
nameservers: Optional[ZoneDefaultsNameservers] = None
84+
"""
85+
Settings determining the nameservers through which the zone should be available.
86+
"""
87+
88+
ns_ttl: Optional[float] = None
89+
"""The time to live (TTL) of the zone's nameserver (NS) records."""
90+
91+
secondary_overrides: Optional[bool] = None
92+
"""
93+
Allows a Secondary DNS zone to use (proxied) override records and CNAME
94+
flattening at the zone apex.
95+
"""
96+
97+
soa: Optional[ZoneDefaultsSOA] = None
98+
"""Components of the zone's SOA record."""
99+
100+
zone_mode: Optional[Literal["standard", "cdn_only", "dns_only"]] = None
101+
"""Whether the zone mode is a regular or CDN/DNS only zone."""
102+
103+
104+
class AccountEditResponse(BaseModel):
105+
zone_defaults: Optional[ZoneDefaults] = None
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
from typing_extensions import Literal
5+
6+
from ...._models import BaseModel
7+
8+
__all__ = [
9+
"AccountGetResponse",
10+
"ZoneDefaults",
11+
"ZoneDefaultsInternalDNS",
12+
"ZoneDefaultsNameservers",
13+
"ZoneDefaultsSOA",
14+
]
15+
16+
17+
class ZoneDefaultsInternalDNS(BaseModel):
18+
reference_zone_id: Optional[str] = None
19+
"""The ID of the zone to fallback to."""
20+
21+
22+
class ZoneDefaultsNameservers(BaseModel):
23+
type: Literal["cloudflare.standard", "cloudflare.standard.random", "custom.account", "custom.tenant"]
24+
"""Nameserver type"""
25+
26+
27+
class ZoneDefaultsSOA(BaseModel):
28+
expire: float
29+
"""
30+
Time in seconds of being unable to query the primary server after which
31+
secondary servers should stop serving the zone.
32+
"""
33+
34+
min_ttl: float
35+
"""The time to live (TTL) for negative caching of records within the zone."""
36+
37+
mname: str
38+
"""The primary nameserver, which may be used for outbound zone transfers."""
39+
40+
refresh: float
41+
"""
42+
Time in seconds after which secondary servers should re-check the SOA record to
43+
see if the zone has been updated.
44+
"""
45+
46+
retry: float
47+
"""
48+
Time in seconds after which secondary servers should retry queries after the
49+
primary server was unresponsive.
50+
"""
51+
52+
rname: str
53+
"""
54+
The email address of the zone administrator, with the first label representing
55+
the local part of the email address.
56+
"""
57+
58+
ttl: float
59+
"""The time to live (TTL) of the SOA record itself."""
60+
61+
62+
class ZoneDefaults(BaseModel):
63+
flatten_all_cnames: Optional[bool] = None
64+
"""Whether to flatten all CNAME records in the zone.
65+
66+
Note that, due to DNS limitations, a CNAME record at the zone apex will always
67+
be flattened.
68+
"""
69+
70+
foundation_dns: Optional[bool] = None
71+
"""Whether to enable Foundation DNS Advanced Nameservers on the zone."""
72+
73+
internal_dns: Optional[ZoneDefaultsInternalDNS] = None
74+
"""Settings for this internal zone."""
75+
76+
multi_provider: Optional[bool] = None
77+
"""
78+
Whether to enable multi-provider DNS, which causes Cloudflare to activate the
79+
zone even when non-Cloudflare NS records exist, and to respect NS records at the
80+
zone apex during outbound zone transfers.
81+
"""
82+
83+
nameservers: Optional[ZoneDefaultsNameservers] = None
84+
"""
85+
Settings determining the nameservers through which the zone should be available.
86+
"""
87+
88+
ns_ttl: Optional[float] = None
89+
"""The time to live (TTL) of the zone's nameserver (NS) records."""
90+
91+
secondary_overrides: Optional[bool] = None
92+
"""
93+
Allows a Secondary DNS zone to use (proxied) override records and CNAME
94+
flattening at the zone apex.
95+
"""
96+
97+
soa: Optional[ZoneDefaultsSOA] = None
98+
"""Components of the zone's SOA record."""
99+
100+
zone_mode: Optional[Literal["standard", "cdn_only", "dns_only"]] = None
101+
"""Whether the zone mode is a regular or CDN/DNS only zone."""
102+
103+
104+
class AccountGetResponse(BaseModel):
105+
zone_defaults: Optional[ZoneDefaults] = None
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Literal, Required, TypedDict
6+
7+
__all__ = ["ZoneEditParams", "InternalDNS", "Nameservers", "SOA"]
8+
9+
10+
class ZoneEditParams(TypedDict, total=False):
11+
zone_id: Required[str]
12+
"""Identifier"""
13+
14+
flatten_all_cnames: bool
15+
"""Whether to flatten all CNAME records in the zone.
16+
17+
Note that, due to DNS limitations, a CNAME record at the zone apex will always
18+
be flattened.
19+
"""
20+
21+
foundation_dns: bool
22+
"""Whether to enable Foundation DNS Advanced Nameservers on the zone."""
23+
24+
internal_dns: InternalDNS
25+
"""Settings for this internal zone."""
26+
27+
multi_provider: bool
28+
"""
29+
Whether to enable multi-provider DNS, which causes Cloudflare to activate the
30+
zone even when non-Cloudflare NS records exist, and to respect NS records at the
31+
zone apex during outbound zone transfers.
32+
"""
33+
34+
nameservers: Nameservers
35+
"""
36+
Settings determining the nameservers through which the zone should be available.
37+
"""
38+
39+
ns_ttl: float
40+
"""The time to live (TTL) of the zone's nameserver (NS) records."""
41+
42+
secondary_overrides: bool
43+
"""
44+
Allows a Secondary DNS zone to use (proxied) override records and CNAME
45+
flattening at the zone apex.
46+
"""
47+
48+
soa: SOA
49+
"""Components of the zone's SOA record."""
50+
51+
zone_mode: Literal["standard", "cdn_only", "dns_only"]
52+
"""Whether the zone mode is a regular or CDN/DNS only zone."""
53+
54+
55+
class InternalDNS(TypedDict, total=False):
56+
reference_zone_id: str
57+
"""The ID of the zone to fallback to."""
58+
59+
60+
class Nameservers(TypedDict, total=False):
61+
type: Required[Literal["cloudflare.standard", "custom.account", "custom.tenant", "custom.zone"]]
62+
"""Nameserver type"""
63+
64+
ns_set: int
65+
"""Configured nameserver set to be used for this zone"""
66+
67+
68+
class SOA(TypedDict, total=False):
69+
expire: Required[float]
70+
"""
71+
Time in seconds of being unable to query the primary server after which
72+
secondary servers should stop serving the zone.
73+
"""
74+
75+
min_ttl: Required[float]
76+
"""The time to live (TTL) for negative caching of records within the zone."""
77+
78+
mname: Required[str]
79+
"""The primary nameserver, which may be used for outbound zone transfers."""
80+
81+
refresh: Required[float]
82+
"""
83+
Time in seconds after which secondary servers should re-check the SOA record to
84+
see if the zone has been updated.
85+
"""
86+
87+
retry: Required[float]
88+
"""
89+
Time in seconds after which secondary servers should retry queries after the
90+
primary server was unresponsive.
91+
"""
92+
93+
rname: Required[str]
94+
"""
95+
The email address of the zone administrator, with the first label representing
96+
the local part of the email address.
97+
"""
98+
99+
ttl: Required[float]
100+
"""The time to live (TTL) of the SOA record itself."""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
from typing_extensions import Literal
5+
6+
from ...._models import BaseModel
7+
8+
__all__ = ["ZoneEditResponse", "InternalDNS", "Nameservers", "SOA"]
9+
10+
11+
class InternalDNS(BaseModel):
12+
reference_zone_id: Optional[str] = None
13+
"""The ID of the zone to fallback to."""
14+
15+
16+
class Nameservers(BaseModel):
17+
type: Literal["cloudflare.standard", "custom.account", "custom.tenant", "custom.zone"]
18+
"""Nameserver type"""
19+
20+
ns_set: Optional[int] = None
21+
"""Configured nameserver set to be used for this zone"""
22+
23+
24+
class SOA(BaseModel):
25+
expire: float
26+
"""
27+
Time in seconds of being unable to query the primary server after which
28+
secondary servers should stop serving the zone.
29+
"""
30+
31+
min_ttl: float
32+
"""The time to live (TTL) for negative caching of records within the zone."""
33+
34+
mname: str
35+
"""The primary nameserver, which may be used for outbound zone transfers."""
36+
37+
refresh: float
38+
"""
39+
Time in seconds after which secondary servers should re-check the SOA record to
40+
see if the zone has been updated.
41+
"""
42+
43+
retry: float
44+
"""
45+
Time in seconds after which secondary servers should retry queries after the
46+
primary server was unresponsive.
47+
"""
48+
49+
rname: str
50+
"""
51+
The email address of the zone administrator, with the first label representing
52+
the local part of the email address.
53+
"""
54+
55+
ttl: float
56+
"""The time to live (TTL) of the SOA record itself."""
57+
58+
59+
class ZoneEditResponse(BaseModel):
60+
flatten_all_cnames: Optional[bool] = None
61+
"""Whether to flatten all CNAME records in the zone.
62+
63+
Note that, due to DNS limitations, a CNAME record at the zone apex will always
64+
be flattened.
65+
"""
66+
67+
foundation_dns: Optional[bool] = None
68+
"""Whether to enable Foundation DNS Advanced Nameservers on the zone."""
69+
70+
internal_dns: Optional[InternalDNS] = None
71+
"""Settings for this internal zone."""
72+
73+
multi_provider: Optional[bool] = None
74+
"""
75+
Whether to enable multi-provider DNS, which causes Cloudflare to activate the
76+
zone even when non-Cloudflare NS records exist, and to respect NS records at the
77+
zone apex during outbound zone transfers.
78+
"""
79+
80+
nameservers: Optional[Nameservers] = None
81+
"""
82+
Settings determining the nameservers through which the zone should be available.
83+
"""
84+
85+
ns_ttl: Optional[float] = None
86+
"""The time to live (TTL) of the zone's nameserver (NS) records."""
87+
88+
secondary_overrides: Optional[bool] = None
89+
"""
90+
Allows a Secondary DNS zone to use (proxied) override records and CNAME
91+
flattening at the zone apex.
92+
"""
93+
94+
soa: Optional[SOA] = None
95+
"""Components of the zone's SOA record."""
96+
97+
zone_mode: Optional[Literal["standard", "cdn_only", "dns_only"]] = None
98+
"""Whether the zone mode is a regular or CDN/DNS only zone."""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
from typing_extensions import Literal
5+
6+
from ...._models import BaseModel
7+
8+
__all__ = ["ZoneGetResponse", "InternalDNS", "Nameservers", "SOA"]
9+
10+
11+
class InternalDNS(BaseModel):
12+
reference_zone_id: Optional[str] = None
13+
"""The ID of the zone to fallback to."""
14+
15+
16+
class Nameservers(BaseModel):
17+
type: Literal["cloudflare.standard", "custom.account", "custom.tenant", "custom.zone"]
18+
"""Nameserver type"""
19+
20+
ns_set: Optional[int] = None
21+
"""Configured nameserver set to be used for this zone"""
22+
23+
24+
class SOA(BaseModel):
25+
expire: float
26+
"""
27+
Time in seconds of being unable to query the primary server after which
28+
secondary servers should stop serving the zone.
29+
"""
30+
31+
min_ttl: float
32+
"""The time to live (TTL) for negative caching of records within the zone."""
33+
34+
mname: str
35+
"""The primary nameserver, which may be used for outbound zone transfers."""
36+
37+
refresh: float
38+
"""
39+
Time in seconds after which secondary servers should re-check the SOA record to
40+
see if the zone has been updated.
41+
"""
42+
43+
retry: float
44+
"""
45+
Time in seconds after which secondary servers should retry queries after the
46+
primary server was unresponsive.
47+
"""
48+
49+
rname: str
50+
"""
51+
The email address of the zone administrator, with the first label representing
52+
the local part of the email address.
53+
"""
54+
55+
ttl: float
56+
"""The time to live (TTL) of the SOA record itself."""
57+
58+
59+
class ZoneGetResponse(BaseModel):
60+
flatten_all_cnames: Optional[bool] = None
61+
"""Whether to flatten all CNAME records in the zone.
62+
63+
Note that, due to DNS limitations, a CNAME record at the zone apex will always
64+
be flattened.
65+
"""
66+
67+
foundation_dns: Optional[bool] = None
68+
"""Whether to enable Foundation DNS Advanced Nameservers on the zone."""
69+
70+
internal_dns: Optional[InternalDNS] = None
71+
"""Settings for this internal zone."""
72+
73+
multi_provider: Optional[bool] = None
74+
"""
75+
Whether to enable multi-provider DNS, which causes Cloudflare to activate the
76+
zone even when non-Cloudflare NS records exist, and to respect NS records at the
77+
zone apex during outbound zone transfers.
78+
"""
79+
80+
nameservers: Optional[Nameservers] = None
81+
"""
82+
Settings determining the nameservers through which the zone should be available.
83+
"""
84+
85+
ns_ttl: Optional[float] = None
86+
"""The time to live (TTL) of the zone's nameserver (NS) records."""
87+
88+
secondary_overrides: Optional[bool] = None
89+
"""
90+
Allows a Secondary DNS zone to use (proxied) override records and CNAME
91+
flattening at the zone apex.
92+
"""
93+
94+
soa: Optional[SOA] = None
95+
"""Components of the zone's SOA record."""
96+
97+
zone_mode: Optional[Literal["standard", "cdn_only", "dns_only"]] = None
98+
"""Whether the zone mode is a regular or CDN/DNS only zone."""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
import os
6+
from typing import Any, Optional, cast
7+
8+
import pytest
9+
10+
from cloudflare import Cloudflare, AsyncCloudflare
11+
from tests.utils import assert_matches_type
12+
from cloudflare.types.dns.settings import AccountGetResponse, AccountEditResponse
13+
14+
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
15+
16+
17+
class TestAccount:
18+
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
19+
20+
@pytest.mark.skip(reason="HTTP 422 from prism")
21+
@parametrize
22+
def test_method_edit(self, client: Cloudflare) -> None:
23+
account = client.dns.settings.account.edit(
24+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
25+
)
26+
assert_matches_type(Optional[AccountEditResponse], account, path=["response"])
27+
28+
@pytest.mark.skip(reason="HTTP 422 from prism")
29+
@parametrize
30+
def test_method_edit_with_all_params(self, client: Cloudflare) -> None:
31+
account = client.dns.settings.account.edit(
32+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
33+
zone_defaults={
34+
"flatten_all_cnames": False,
35+
"foundation_dns": False,
36+
"internal_dns": {"reference_zone_id": "reference_zone_id"},
37+
"multi_provider": False,
38+
"nameservers": {"type": "cloudflare.standard"},
39+
"ns_ttl": 86400,
40+
"secondary_overrides": False,
41+
"soa": {
42+
"expire": 604800,
43+
"min_ttl": 1800,
44+
"mname": "kristina.ns.cloudflare.com",
45+
"refresh": 10000,
46+
"retry": 2400,
47+
"rname": "admin.example.com",
48+
"ttl": 3600,
49+
},
50+
"zone_mode": "standard",
51+
},
52+
)
53+
assert_matches_type(Optional[AccountEditResponse], account, path=["response"])
54+
55+
@pytest.mark.skip(reason="HTTP 422 from prism")
56+
@parametrize
57+
def test_raw_response_edit(self, client: Cloudflare) -> None:
58+
response = client.dns.settings.account.with_raw_response.edit(
59+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
60+
)
61+
62+
assert response.is_closed is True
63+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
64+
account = response.parse()
65+
assert_matches_type(Optional[AccountEditResponse], account, path=["response"])
66+
67+
@pytest.mark.skip(reason="HTTP 422 from prism")
68+
@parametrize
69+
def test_streaming_response_edit(self, client: Cloudflare) -> None:
70+
with client.dns.settings.account.with_streaming_response.edit(
71+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
72+
) as response:
73+
assert not response.is_closed
74+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
75+
76+
account = response.parse()
77+
assert_matches_type(Optional[AccountEditResponse], account, path=["response"])
78+
79+
assert cast(Any, response.is_closed) is True
80+
81+
@pytest.mark.skip(reason="HTTP 422 from prism")
82+
@parametrize
83+
def test_path_params_edit(self, client: Cloudflare) -> None:
84+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
85+
client.dns.settings.account.with_raw_response.edit(
86+
account_id="",
87+
)
88+
89+
@pytest.mark.skip(reason="HTTP 422 from prism")
90+
@parametrize
91+
def test_method_get(self, client: Cloudflare) -> None:
92+
account = client.dns.settings.account.get(
93+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
94+
)
95+
assert_matches_type(Optional[AccountGetResponse], account, path=["response"])
96+
97+
@pytest.mark.skip(reason="HTTP 422 from prism")
98+
@parametrize
99+
def test_raw_response_get(self, client: Cloudflare) -> None:
100+
response = client.dns.settings.account.with_raw_response.get(
101+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
102+
)
103+
104+
assert response.is_closed is True
105+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
106+
account = response.parse()
107+
assert_matches_type(Optional[AccountGetResponse], account, path=["response"])
108+
109+
@pytest.mark.skip(reason="HTTP 422 from prism")
110+
@parametrize
111+
def test_streaming_response_get(self, client: Cloudflare) -> None:
112+
with client.dns.settings.account.with_streaming_response.get(
113+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
114+
) as response:
115+
assert not response.is_closed
116+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
117+
118+
account = response.parse()
119+
assert_matches_type(Optional[AccountGetResponse], account, path=["response"])
120+
121+
assert cast(Any, response.is_closed) is True
122+
123+
@pytest.mark.skip(reason="HTTP 422 from prism")
124+
@parametrize
125+
def test_path_params_get(self, client: Cloudflare) -> None:
126+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
127+
client.dns.settings.account.with_raw_response.get(
128+
account_id="",
129+
)
130+
131+
132+
class TestAsyncAccount:
133+
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
134+
135+
@pytest.mark.skip(reason="HTTP 422 from prism")
136+
@parametrize
137+
async def test_method_edit(self, async_client: AsyncCloudflare) -> None:
138+
account = await async_client.dns.settings.account.edit(
139+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
140+
)
141+
assert_matches_type(Optional[AccountEditResponse], account, path=["response"])
142+
143+
@pytest.mark.skip(reason="HTTP 422 from prism")
144+
@parametrize
145+
async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None:
146+
account = await async_client.dns.settings.account.edit(
147+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
148+
zone_defaults={
149+
"flatten_all_cnames": False,
150+
"foundation_dns": False,
151+
"internal_dns": {"reference_zone_id": "reference_zone_id"},
152+
"multi_provider": False,
153+
"nameservers": {"type": "cloudflare.standard"},
154+
"ns_ttl": 86400,
155+
"secondary_overrides": False,
156+
"soa": {
157+
"expire": 604800,
158+
"min_ttl": 1800,
159+
"mname": "kristina.ns.cloudflare.com",
160+
"refresh": 10000,
161+
"retry": 2400,
162+
"rname": "admin.example.com",
163+
"ttl": 3600,
164+
},
165+
"zone_mode": "standard",
166+
},
167+
)
168+
assert_matches_type(Optional[AccountEditResponse], account, path=["response"])
169+
170+
@pytest.mark.skip(reason="HTTP 422 from prism")
171+
@parametrize
172+
async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None:
173+
response = await async_client.dns.settings.account.with_raw_response.edit(
174+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
175+
)
176+
177+
assert response.is_closed is True
178+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
179+
account = await response.parse()
180+
assert_matches_type(Optional[AccountEditResponse], account, path=["response"])
181+
182+
@pytest.mark.skip(reason="HTTP 422 from prism")
183+
@parametrize
184+
async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None:
185+
async with async_client.dns.settings.account.with_streaming_response.edit(
186+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
187+
) as response:
188+
assert not response.is_closed
189+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
190+
191+
account = await response.parse()
192+
assert_matches_type(Optional[AccountEditResponse], account, path=["response"])
193+
194+
assert cast(Any, response.is_closed) is True
195+
196+
@pytest.mark.skip(reason="HTTP 422 from prism")
197+
@parametrize
198+
async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None:
199+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
200+
await async_client.dns.settings.account.with_raw_response.edit(
201+
account_id="",
202+
)
203+
204+
@pytest.mark.skip(reason="HTTP 422 from prism")
205+
@parametrize
206+
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
207+
account = await async_client.dns.settings.account.get(
208+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
209+
)
210+
assert_matches_type(Optional[AccountGetResponse], account, path=["response"])
211+
212+
@pytest.mark.skip(reason="HTTP 422 from prism")
213+
@parametrize
214+
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
215+
response = await async_client.dns.settings.account.with_raw_response.get(
216+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
217+
)
218+
219+
assert response.is_closed is True
220+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
221+
account = await response.parse()
222+
assert_matches_type(Optional[AccountGetResponse], account, path=["response"])
223+
224+
@pytest.mark.skip(reason="HTTP 422 from prism")
225+
@parametrize
226+
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
227+
async with async_client.dns.settings.account.with_streaming_response.get(
228+
account_id="023e105f4ecef8ad9ca31a8372d0c353",
229+
) as response:
230+
assert not response.is_closed
231+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
232+
233+
account = await response.parse()
234+
assert_matches_type(Optional[AccountGetResponse], account, path=["response"])
235+
236+
assert cast(Any, response.is_closed) is True
237+
238+
@pytest.mark.skip(reason="HTTP 422 from prism")
239+
@parametrize
240+
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
241+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
242+
await async_client.dns.settings.account.with_raw_response.get(
243+
account_id="",
244+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
import os
6+
from typing import Any, Optional, cast
7+
8+
import pytest
9+
10+
from cloudflare import Cloudflare, AsyncCloudflare
11+
from tests.utils import assert_matches_type
12+
from cloudflare.types.dns.settings import ZoneGetResponse, ZoneEditResponse
13+
14+
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
15+
16+
17+
class TestZone:
18+
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
19+
20+
@pytest.mark.skip(reason="HTTP 422 from prism")
21+
@parametrize
22+
def test_method_edit(self, client: Cloudflare) -> None:
23+
zone = client.dns.settings.zone.edit(
24+
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
25+
)
26+
assert_matches_type(Optional[ZoneEditResponse], zone, path=["response"])
27+
28+
@pytest.mark.skip(reason="HTTP 422 from prism")
29+
@parametrize
30+
def test_method_edit_with_all_params(self, client: Cloudflare) -> None:
31+
zone = client.dns.settings.zone.edit(
32+
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
33+
flatten_all_cnames=False,
34+
foundation_dns=False,
35+
internal_dns={"reference_zone_id": "reference_zone_id"},
36+
multi_provider=False,
37+
nameservers={
38+
"type": "cloudflare.standard",
39+
"ns_set": 1,
40+
},
41+
ns_ttl=86400,
42+
secondary_overrides=False,
43+
soa={
44+
"expire": 604800,
45+
"min_ttl": 1800,
46+
"mname": "kristina.ns.cloudflare.com",
47+
"refresh": 10000,
48+
"retry": 2400,
49+
"rname": "admin.example.com",
50+
"ttl": 3600,
51+
},
52+
zone_mode="standard",
53+
)
54+
assert_matches_type(Optional[ZoneEditResponse], zone, path=["response"])
55+
56+
@pytest.mark.skip(reason="HTTP 422 from prism")
57+
@parametrize
58+
def test_raw_response_edit(self, client: Cloudflare) -> None:
59+
response = client.dns.settings.zone.with_raw_response.edit(
60+
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
61+
)
62+
63+
assert response.is_closed is True
64+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
65+
zone = response.parse()
66+
assert_matches_type(Optional[ZoneEditResponse], zone, path=["response"])
67+
68+
@pytest.mark.skip(reason="HTTP 422 from prism")
69+
@parametrize
70+
def test_streaming_response_edit(self, client: Cloudflare) -> None:
71+
with client.dns.settings.zone.with_streaming_response.edit(
72+
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
73+
) as response:
74+
assert not response.is_closed
75+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
76+
77+
zone = response.parse()
78+
assert_matches_type(Optional[ZoneEditResponse], zone, path=["response"])
79+
80+
assert cast(Any, response.is_closed) is True
81+
82+
@pytest.mark.skip(reason="HTTP 422 from prism")
83+
@parametrize
84+
def test_path_params_edit(self, client: Cloudflare) -> None:
85+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
86+
client.dns.settings.zone.with_raw_response.edit(
87+
zone_id="",
88+
)
89+
90+
@pytest.mark.skip(reason="HTTP 422 from prism")
91+
@parametrize
92+
def test_method_get(self, client: Cloudflare) -> None:
93+
zone = client.dns.settings.zone.get(
94+
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
95+
)
96+
assert_matches_type(Optional[ZoneGetResponse], zone, path=["response"])
97+
98+
@pytest.mark.skip(reason="HTTP 422 from prism")
99+
@parametrize
100+
def test_raw_response_get(self, client: Cloudflare) -> None:
101+
response = client.dns.settings.zone.with_raw_response.get(
102+
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
103+
)
104+
105+
assert response.is_closed is True
106+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
107+
zone = response.parse()
108+
assert_matches_type(Optional[ZoneGetResponse], zone, path=["response"])
109+
110+
@pytest.mark.skip(reason="HTTP 422 from prism")
111+
@parametrize
112+
def test_streaming_response_get(self, client: Cloudflare) -> None:
113+
with client.dns.settings.zone.with_streaming_response.get(
114+
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
115+
) as response:
116+
assert not response.is_closed
117+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
118+
119+
zone = response.parse()
120+
assert_matches_type(Optional[ZoneGetResponse], zone, path=["response"])
121+
122+
assert cast(Any, response.is_closed) is True
123+
124+
@pytest.mark.skip(reason="HTTP 422 from prism")
125+
@parametrize
126+
def test_path_params_get(self, client: Cloudflare) -> None:
127+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
128+
client.dns.settings.zone.with_raw_response.get(
129+
zone_id="",
130+
)
131+
132+
133+
class TestAsyncZone:
134+
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
135+
136+
@pytest.mark.skip(reason="HTTP 422 from prism")
137+
@parametrize
138+
async def test_method_edit(self, async_client: AsyncCloudflare) -> None:
139+
zone = await async_client.dns.settings.zone.edit(
140+
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
141+
)
142+
assert_matches_type(Optional[ZoneEditResponse], zone, path=["response"])
143+
144+
@pytest.mark.skip(reason="HTTP 422 from prism")
145+
@parametrize
146+
async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None:
147+
zone = await async_client.dns.settings.zone.edit(
148+
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
149+
flatten_all_cnames=False,
150+
foundation_dns=False,
151+
internal_dns={"reference_zone_id": "reference_zone_id"},
152+
multi_provider=False,
153+
nameservers={
154+
"type": "cloudflare.standard",
155+
"ns_set": 1,
156+
},
157+
ns_ttl=86400,
158+
secondary_overrides=False,
159+
soa={
160+
"expire": 604800,
161+
"min_ttl": 1800,
162+
"mname": "kristina.ns.cloudflare.com",
163+
"refresh": 10000,
164+
"retry": 2400,
165+
"rname": "admin.example.com",
166+
"ttl": 3600,
167+
},
168+
zone_mode="standard",
169+
)
170+
assert_matches_type(Optional[ZoneEditResponse], zone, path=["response"])
171+
172+
@pytest.mark.skip(reason="HTTP 422 from prism")
173+
@parametrize
174+
async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None:
175+
response = await async_client.dns.settings.zone.with_raw_response.edit(
176+
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
177+
)
178+
179+
assert response.is_closed is True
180+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
181+
zone = await response.parse()
182+
assert_matches_type(Optional[ZoneEditResponse], zone, path=["response"])
183+
184+
@pytest.mark.skip(reason="HTTP 422 from prism")
185+
@parametrize
186+
async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None:
187+
async with async_client.dns.settings.zone.with_streaming_response.edit(
188+
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
189+
) as response:
190+
assert not response.is_closed
191+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
192+
193+
zone = await response.parse()
194+
assert_matches_type(Optional[ZoneEditResponse], zone, path=["response"])
195+
196+
assert cast(Any, response.is_closed) is True
197+
198+
@pytest.mark.skip(reason="HTTP 422 from prism")
199+
@parametrize
200+
async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None:
201+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
202+
await async_client.dns.settings.zone.with_raw_response.edit(
203+
zone_id="",
204+
)
205+
206+
@pytest.mark.skip(reason="HTTP 422 from prism")
207+
@parametrize
208+
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
209+
zone = await async_client.dns.settings.zone.get(
210+
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
211+
)
212+
assert_matches_type(Optional[ZoneGetResponse], zone, path=["response"])
213+
214+
@pytest.mark.skip(reason="HTTP 422 from prism")
215+
@parametrize
216+
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
217+
response = await async_client.dns.settings.zone.with_raw_response.get(
218+
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
219+
)
220+
221+
assert response.is_closed is True
222+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
223+
zone = await response.parse()
224+
assert_matches_type(Optional[ZoneGetResponse], zone, path=["response"])
225+
226+
@pytest.mark.skip(reason="HTTP 422 from prism")
227+
@parametrize
228+
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
229+
async with async_client.dns.settings.zone.with_streaming_response.get(
230+
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
231+
) as response:
232+
assert not response.is_closed
233+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
234+
235+
zone = await response.parse()
236+
assert_matches_type(Optional[ZoneGetResponse], zone, path=["response"])
237+
238+
assert cast(Any, response.is_closed) is True
239+
240+
@pytest.mark.skip(reason="HTTP 422 from prism")
241+
@parametrize
242+
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
243+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
244+
await async_client.dns.settings.zone.with_raw_response.get(
245+
zone_id="",
246+
)

0 commit comments

Comments
 (0)
Please sign in to comment.