Skip to content

Commit 7e5da92

Browse files
feat: fix(dns): Exclude dns_records From combineCloudflareResources in Prod Config (APIX-981)
* fix(dns): Exclude dns_records From combineCloudflareResources in Prod Config (APIX-981)
1 parent 8e90aea commit 7e5da92

14 files changed

Lines changed: 872 additions & 3 deletions

File tree

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 2317
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare/cloudflare-9b97be8ae999d02a73e0e2e4c6756b0b89db362800b3e37aaf84dc355ea50238.yml
1+
configured_endpoints: 2319
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare/cloudflare-95e73b4de689baa5f103f6b57f8b0c16e7a2380a5a707cbf8c35c33537adba54.yml
33
openapi_spec_hash: 9f044e790240c1256984f011c9b6539b
4-
config_hash: fb00b1d45d83236f53f8ef08adb2db5c
4+
config_hash: 3d78de7487c424794f10d37798c7cf95

src/cloudflare/resources/dns/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
DNSResourceWithStreamingResponse,
99
AsyncDNSResourceWithStreamingResponse,
1010
)
11+
from .usage import (
12+
UsageResource,
13+
AsyncUsageResource,
14+
UsageResourceWithRawResponse,
15+
AsyncUsageResourceWithRawResponse,
16+
UsageResourceWithStreamingResponse,
17+
AsyncUsageResourceWithStreamingResponse,
18+
)
1119
from .dnssec import (
1220
DNSSECResource,
1321
AsyncDNSSECResource,
@@ -62,6 +70,12 @@
6270
"AsyncRecordsResourceWithRawResponse",
6371
"RecordsResourceWithStreamingResponse",
6472
"AsyncRecordsResourceWithStreamingResponse",
73+
"UsageResource",
74+
"AsyncUsageResource",
75+
"UsageResourceWithRawResponse",
76+
"AsyncUsageResourceWithRawResponse",
77+
"UsageResourceWithStreamingResponse",
78+
"AsyncUsageResourceWithStreamingResponse",
6579
"SettingsResource",
6680
"AsyncSettingsResource",
6781
"SettingsResourceWithRawResponse",

src/cloudflare/resources/dns/api.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,32 @@ Methods:
7272
- <code title="post /zones/{zone_id}/dns_records/scan/review">client.dns.records.<a href="./src/cloudflare/resources/dns/records.py">scan_review</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/dns/record_scan_review_params.py">params</a>) -> <a href="./src/cloudflare/types/dns/record_scan_review_response.py">Optional[RecordScanReviewResponse]</a></code>
7373
- <code title="post /zones/{zone_id}/dns_records/scan/trigger">client.dns.records.<a href="./src/cloudflare/resources/dns/records.py">scan_trigger</a>(\*, zone_id) -> <a href="./src/cloudflare/types/dns/record_scan_trigger_response.py">RecordScanTriggerResponse</a></code>
7474

75+
## Usage
76+
77+
### Zone
78+
79+
Types:
80+
81+
```python
82+
from cloudflare.types.dns.usage import ZoneGetResponse
83+
```
84+
85+
Methods:
86+
87+
- <code title="get /zones/{zone_id}/dns_records/usage">client.dns.usage.zone.<a href="./src/cloudflare/resources/dns/usage/zone.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/dns/usage/zone_get_response.py">Optional[ZoneGetResponse]</a></code>
88+
89+
### Account
90+
91+
Types:
92+
93+
```python
94+
from cloudflare.types.dns.usage import AccountGetResponse
95+
```
96+
97+
Methods:
98+
99+
- <code title="get /accounts/{account_id}/dns_records/usage">client.dns.usage.account.<a href="./src/cloudflare/resources/dns/usage/account.py">get</a>(\*, account_id) -> <a href="./src/cloudflare/types/dns/usage/account_get_response.py">Optional[AccountGetResponse]</a></code>
100+
75101
## Settings
76102

77103
### Zone

src/cloudflare/resources/dns/dns.py

Lines changed: 32 additions & 0 deletions
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 .usage.usage import (
24+
UsageResource,
25+
AsyncUsageResource,
26+
UsageResourceWithRawResponse,
27+
AsyncUsageResourceWithRawResponse,
28+
UsageResourceWithStreamingResponse,
29+
AsyncUsageResourceWithStreamingResponse,
30+
)
2331
from .settings.settings import (
2432
SettingsResource,
2533
AsyncSettingsResource,
@@ -57,6 +65,10 @@ def dnssec(self) -> DNSSECResource:
5765
def records(self) -> RecordsResource:
5866
return RecordsResource(self._client)
5967

68+
@cached_property
69+
def usage(self) -> UsageResource:
70+
return UsageResource(self._client)
71+
6072
@cached_property
6173
def settings(self) -> SettingsResource:
6274
return SettingsResource(self._client)
@@ -98,6 +110,10 @@ def dnssec(self) -> AsyncDNSSECResource:
98110
def records(self) -> AsyncRecordsResource:
99111
return AsyncRecordsResource(self._client)
100112

113+
@cached_property
114+
def usage(self) -> AsyncUsageResource:
115+
return AsyncUsageResource(self._client)
116+
101117
@cached_property
102118
def settings(self) -> AsyncSettingsResource:
103119
return AsyncSettingsResource(self._client)
@@ -142,6 +158,10 @@ def dnssec(self) -> DNSSECResourceWithRawResponse:
142158
def records(self) -> RecordsResourceWithRawResponse:
143159
return RecordsResourceWithRawResponse(self._dns.records)
144160

161+
@cached_property
162+
def usage(self) -> UsageResourceWithRawResponse:
163+
return UsageResourceWithRawResponse(self._dns.usage)
164+
145165
@cached_property
146166
def settings(self) -> SettingsResourceWithRawResponse:
147167
return SettingsResourceWithRawResponse(self._dns.settings)
@@ -167,6 +187,10 @@ def dnssec(self) -> AsyncDNSSECResourceWithRawResponse:
167187
def records(self) -> AsyncRecordsResourceWithRawResponse:
168188
return AsyncRecordsResourceWithRawResponse(self._dns.records)
169189

190+
@cached_property
191+
def usage(self) -> AsyncUsageResourceWithRawResponse:
192+
return AsyncUsageResourceWithRawResponse(self._dns.usage)
193+
170194
@cached_property
171195
def settings(self) -> AsyncSettingsResourceWithRawResponse:
172196
return AsyncSettingsResourceWithRawResponse(self._dns.settings)
@@ -192,6 +216,10 @@ def dnssec(self) -> DNSSECResourceWithStreamingResponse:
192216
def records(self) -> RecordsResourceWithStreamingResponse:
193217
return RecordsResourceWithStreamingResponse(self._dns.records)
194218

219+
@cached_property
220+
def usage(self) -> UsageResourceWithStreamingResponse:
221+
return UsageResourceWithStreamingResponse(self._dns.usage)
222+
195223
@cached_property
196224
def settings(self) -> SettingsResourceWithStreamingResponse:
197225
return SettingsResourceWithStreamingResponse(self._dns.settings)
@@ -217,6 +245,10 @@ def dnssec(self) -> AsyncDNSSECResourceWithStreamingResponse:
217245
def records(self) -> AsyncRecordsResourceWithStreamingResponse:
218246
return AsyncRecordsResourceWithStreamingResponse(self._dns.records)
219247

248+
@cached_property
249+
def usage(self) -> AsyncUsageResourceWithStreamingResponse:
250+
return AsyncUsageResourceWithStreamingResponse(self._dns.usage)
251+
220252
@cached_property
221253
def settings(self) -> AsyncSettingsResourceWithStreamingResponse:
222254
return AsyncSettingsResourceWithStreamingResponse(self._dns.settings)
Lines changed: 47 additions & 0 deletions
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 .usage import (
12+
UsageResource,
13+
AsyncUsageResource,
14+
UsageResourceWithRawResponse,
15+
AsyncUsageResourceWithRawResponse,
16+
UsageResourceWithStreamingResponse,
17+
AsyncUsageResourceWithStreamingResponse,
18+
)
19+
from .account import (
20+
AccountResource,
21+
AsyncAccountResource,
22+
AccountResourceWithRawResponse,
23+
AsyncAccountResourceWithRawResponse,
24+
AccountResourceWithStreamingResponse,
25+
AsyncAccountResourceWithStreamingResponse,
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+
"UsageResource",
42+
"AsyncUsageResource",
43+
"UsageResourceWithRawResponse",
44+
"AsyncUsageResourceWithRawResponse",
45+
"UsageResourceWithStreamingResponse",
46+
"AsyncUsageResourceWithStreamingResponse",
47+
]
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
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 Body, Query, Headers, NotGiven, not_given
10+
from ...._utils import path_template
11+
from ...._compat import cached_property
12+
from ...._resource import SyncAPIResource, AsyncAPIResource
13+
from ...._response import (
14+
to_raw_response_wrapper,
15+
to_streamed_response_wrapper,
16+
async_to_raw_response_wrapper,
17+
async_to_streamed_response_wrapper,
18+
)
19+
from ...._wrappers import ResultWrapper
20+
from ...._base_client import make_request_options
21+
from ....types.dns.usage.account_get_response import AccountGetResponse
22+
23+
__all__ = ["AccountResource", "AsyncAccountResource"]
24+
25+
26+
class AccountResource(SyncAPIResource):
27+
@cached_property
28+
def with_raw_response(self) -> AccountResourceWithRawResponse:
29+
"""
30+
This property can be used as a prefix for any HTTP method call to return
31+
the raw response object instead of the parsed content.
32+
33+
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
34+
"""
35+
return AccountResourceWithRawResponse(self)
36+
37+
@cached_property
38+
def with_streaming_response(self) -> AccountResourceWithStreamingResponse:
39+
"""
40+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
41+
42+
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
43+
"""
44+
return AccountResourceWithStreamingResponse(self)
45+
46+
def get(
47+
self,
48+
*,
49+
account_id: str,
50+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
51+
# The extra values given here take precedence over values defined on the client or passed to this method.
52+
extra_headers: Headers | None = None,
53+
extra_query: Query | None = None,
54+
extra_body: Body | None = None,
55+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
56+
) -> Optional[AccountGetResponse]:
57+
"""Get the current DNS record usage and quota for an account.
58+
59+
May include internal
60+
DNS usage and quota.
61+
62+
Args:
63+
account_id: Identifier.
64+
65+
extra_headers: Send extra headers
66+
67+
extra_query: Add additional query parameters to the request
68+
69+
extra_body: Add additional JSON properties to the request
70+
71+
timeout: Override the client-level default timeout for this request, in seconds
72+
"""
73+
if not account_id:
74+
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
75+
return self._get(
76+
path_template("/accounts/{account_id}/dns_records/usage", account_id=account_id),
77+
options=make_request_options(
78+
extra_headers=extra_headers,
79+
extra_query=extra_query,
80+
extra_body=extra_body,
81+
timeout=timeout,
82+
post_parser=ResultWrapper[Optional[AccountGetResponse]]._unwrapper,
83+
),
84+
cast_to=cast(Type[Optional[AccountGetResponse]], ResultWrapper[AccountGetResponse]),
85+
)
86+
87+
88+
class AsyncAccountResource(AsyncAPIResource):
89+
@cached_property
90+
def with_raw_response(self) -> AsyncAccountResourceWithRawResponse:
91+
"""
92+
This property can be used as a prefix for any HTTP method call to return
93+
the raw response object instead of the parsed content.
94+
95+
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
96+
"""
97+
return AsyncAccountResourceWithRawResponse(self)
98+
99+
@cached_property
100+
def with_streaming_response(self) -> AsyncAccountResourceWithStreamingResponse:
101+
"""
102+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
103+
104+
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
105+
"""
106+
return AsyncAccountResourceWithStreamingResponse(self)
107+
108+
async def get(
109+
self,
110+
*,
111+
account_id: str,
112+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
113+
# The extra values given here take precedence over values defined on the client or passed to this method.
114+
extra_headers: Headers | None = None,
115+
extra_query: Query | None = None,
116+
extra_body: Body | None = None,
117+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
118+
) -> Optional[AccountGetResponse]:
119+
"""Get the current DNS record usage and quota for an account.
120+
121+
May include internal
122+
DNS usage and quota.
123+
124+
Args:
125+
account_id: Identifier.
126+
127+
extra_headers: Send extra headers
128+
129+
extra_query: Add additional query parameters to the request
130+
131+
extra_body: Add additional JSON properties to the request
132+
133+
timeout: Override the client-level default timeout for this request, in seconds
134+
"""
135+
if not account_id:
136+
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
137+
return await self._get(
138+
path_template("/accounts/{account_id}/dns_records/usage", account_id=account_id),
139+
options=make_request_options(
140+
extra_headers=extra_headers,
141+
extra_query=extra_query,
142+
extra_body=extra_body,
143+
timeout=timeout,
144+
post_parser=ResultWrapper[Optional[AccountGetResponse]]._unwrapper,
145+
),
146+
cast_to=cast(Type[Optional[AccountGetResponse]], ResultWrapper[AccountGetResponse]),
147+
)
148+
149+
150+
class AccountResourceWithRawResponse:
151+
def __init__(self, account: AccountResource) -> None:
152+
self._account = account
153+
154+
self.get = to_raw_response_wrapper(
155+
account.get,
156+
)
157+
158+
159+
class AsyncAccountResourceWithRawResponse:
160+
def __init__(self, account: AsyncAccountResource) -> None:
161+
self._account = account
162+
163+
self.get = async_to_raw_response_wrapper(
164+
account.get,
165+
)
166+
167+
168+
class AccountResourceWithStreamingResponse:
169+
def __init__(self, account: AccountResource) -> None:
170+
self._account = account
171+
172+
self.get = to_streamed_response_wrapper(
173+
account.get,
174+
)
175+
176+
177+
class AsyncAccountResourceWithStreamingResponse:
178+
def __init__(self, account: AsyncAccountResource) -> None:
179+
self._account = account
180+
181+
self.get = async_to_streamed_response_wrapper(
182+
account.get,
183+
)

0 commit comments

Comments
 (0)