Skip to content

Commit e6a1bfa

Browse files
feat(addressing)!: reshuffle relationship in the namespace to align with the product (#2322)
1 parent f6b6e83 commit e6a1bfa

18 files changed

+371
-499
lines changed

api.md

+13-12
Original file line numberDiff line numberDiff line change
@@ -3245,35 +3245,36 @@ Methods:
32453245
- <code title="delete /accounts/{account_id}/addressing/prefixes/{prefix_id}/bindings/{binding_id}">client.addressing.prefixes.service_bindings.<a href="./src/cloudflare/resources/addressing/prefixes/service_bindings.py">delete</a>(binding_id, \*, account_id, prefix_id) -> <a href="./src/cloudflare/types/addressing/prefixes/service_binding_delete_response.py">ServiceBindingDeleteResponse</a></code>
32463246
- <code title="get /accounts/{account_id}/addressing/prefixes/{prefix_id}/bindings/{binding_id}">client.addressing.prefixes.service_bindings.<a href="./src/cloudflare/resources/addressing/prefixes/service_bindings.py">get</a>(binding_id, \*, account_id, prefix_id) -> <a href="./src/cloudflare/types/addressing/prefixes/service_binding.py">Optional[ServiceBinding]</a></code>
32473247

3248-
### BGP
3249-
3250-
#### Prefixes
3248+
### BGPPrefixes
32513249

32523250
Types:
32533251

32543252
```python
3255-
from cloudflare.types.addressing.prefixes.bgp import BGPPrefix
3253+
from cloudflare.types.addressing.prefixes import BGPPrefix
32563254
```
32573255

32583256
Methods:
32593257

3260-
- <code title="post /accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes">client.addressing.prefixes.bgp.prefixes.<a href="./src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py">create</a>(prefix_id, \*, account_id, \*\*<a href="src/cloudflare/types/addressing/prefixes/bgp/prefix_create_params.py">params</a>) -> <a href="./src/cloudflare/types/addressing/prefixes/bgp/bgp_prefix.py">Optional[BGPPrefix]</a></code>
3261-
- <code title="get /accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes">client.addressing.prefixes.bgp.prefixes.<a href="./src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py">list</a>(prefix_id, \*, account_id) -> <a href="./src/cloudflare/types/addressing/prefixes/bgp/bgp_prefix.py">SyncSinglePage[BGPPrefix]</a></code>
3262-
- <code title="patch /accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes/{bgp_prefix_id}">client.addressing.prefixes.bgp.prefixes.<a href="./src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py">edit</a>(bgp_prefix_id, \*, account_id, prefix_id, \*\*<a href="src/cloudflare/types/addressing/prefixes/bgp/prefix_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/addressing/prefixes/bgp/bgp_prefix.py">Optional[BGPPrefix]</a></code>
3263-
- <code title="get /accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes/{bgp_prefix_id}">client.addressing.prefixes.bgp.prefixes.<a href="./src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py">get</a>(bgp_prefix_id, \*, account_id, prefix_id) -> <a href="./src/cloudflare/types/addressing/prefixes/bgp/bgp_prefix.py">Optional[BGPPrefix]</a></code>
3258+
- <code title="post /accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes">client.addressing.prefixes.bgp_prefixes.<a href="./src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py">create</a>(prefix_id, \*, account_id, \*\*<a href="src/cloudflare/types/addressing/prefixes/bgp_prefix_create_params.py">params</a>) -> <a href="./src/cloudflare/types/addressing/prefixes/bgp_prefix.py">Optional[BGPPrefix]</a></code>
3259+
- <code title="get /accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes">client.addressing.prefixes.bgp_prefixes.<a href="./src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py">list</a>(prefix_id, \*, account_id) -> <a href="./src/cloudflare/types/addressing/prefixes/bgp_prefix.py">SyncSinglePage[BGPPrefix]</a></code>
3260+
- <code title="patch /accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes/{bgp_prefix_id}">client.addressing.prefixes.bgp_prefixes.<a href="./src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py">edit</a>(bgp_prefix_id, \*, account_id, prefix_id, \*\*<a href="src/cloudflare/types/addressing/prefixes/bgp_prefix_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/addressing/prefixes/bgp_prefix.py">Optional[BGPPrefix]</a></code>
3261+
- <code title="get /accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes/{bgp_prefix_id}">client.addressing.prefixes.bgp_prefixes.<a href="./src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py">get</a>(bgp_prefix_id, \*, account_id, prefix_id) -> <a href="./src/cloudflare/types/addressing/prefixes/bgp_prefix.py">Optional[BGPPrefix]</a></code>
32643262

3265-
#### Statuses
3263+
### AdvertisementStatus
32663264

32673265
Types:
32683266

32693267
```python
3270-
from cloudflare.types.addressing.prefixes.bgp import StatusEditResponse, StatusGetResponse
3268+
from cloudflare.types.addressing.prefixes import (
3269+
AdvertisementStatusEditResponse,
3270+
AdvertisementStatusGetResponse,
3271+
)
32713272
```
32723273

32733274
Methods:
32743275

3275-
- <code title="patch /accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/status">client.addressing.prefixes.bgp.statuses.<a href="./src/cloudflare/resources/addressing/prefixes/bgp/statuses.py">edit</a>(prefix_id, \*, account_id, \*\*<a href="src/cloudflare/types/addressing/prefixes/bgp/status_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/addressing/prefixes/bgp/status_edit_response.py">Optional[StatusEditResponse]</a></code>
3276-
- <code title="get /accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/status">client.addressing.prefixes.bgp.statuses.<a href="./src/cloudflare/resources/addressing/prefixes/bgp/statuses.py">get</a>(prefix_id, \*, account_id) -> <a href="./src/cloudflare/types/addressing/prefixes/bgp/status_get_response.py">Optional[StatusGetResponse]</a></code>
3276+
- <code title="patch /accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/status">client.addressing.prefixes.advertisement_status.<a href="./src/cloudflare/resources/addressing/prefixes/advertisement_status.py">edit</a>(prefix_id, \*, account_id, \*\*<a href="src/cloudflare/types/addressing/prefixes/advertisement_status_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/addressing/prefixes/advertisement_status_edit_response.py">Optional[AdvertisementStatusEditResponse]</a></code>
3277+
- <code title="get /accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/status">client.addressing.prefixes.advertisement_status.<a href="./src/cloudflare/resources/addressing/prefixes/advertisement_status.py">get</a>(prefix_id, \*, account_id) -> <a href="./src/cloudflare/types/addressing/prefixes/advertisement_status_get_response.py">Optional[AdvertisementStatusGetResponse]</a></code>
32773278

32783279
### Delegations
32793280

src/cloudflare/resources/addressing/prefixes/__init__.py

+28-14
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from .bgp import (
4-
BGPResource,
5-
AsyncBGPResource,
6-
BGPResourceWithRawResponse,
7-
AsyncBGPResourceWithRawResponse,
8-
BGPResourceWithStreamingResponse,
9-
AsyncBGPResourceWithStreamingResponse,
10-
)
113
from .prefixes import (
124
PrefixesResource,
135
AsyncPrefixesResource,
@@ -24,6 +16,14 @@
2416
DelegationsResourceWithStreamingResponse,
2517
AsyncDelegationsResourceWithStreamingResponse,
2618
)
19+
from .bgp_prefixes import (
20+
BGPPrefixesResource,
21+
AsyncBGPPrefixesResource,
22+
BGPPrefixesResourceWithRawResponse,
23+
AsyncBGPPrefixesResourceWithRawResponse,
24+
BGPPrefixesResourceWithStreamingResponse,
25+
AsyncBGPPrefixesResourceWithStreamingResponse,
26+
)
2727
from .service_bindings import (
2828
ServiceBindingsResource,
2929
AsyncServiceBindingsResource,
@@ -32,6 +32,14 @@
3232
ServiceBindingsResourceWithStreamingResponse,
3333
AsyncServiceBindingsResourceWithStreamingResponse,
3434
)
35+
from .advertisement_status import (
36+
AdvertisementStatusResource,
37+
AsyncAdvertisementStatusResource,
38+
AdvertisementStatusResourceWithRawResponse,
39+
AsyncAdvertisementStatusResourceWithRawResponse,
40+
AdvertisementStatusResourceWithStreamingResponse,
41+
AsyncAdvertisementStatusResourceWithStreamingResponse,
42+
)
3543

3644
__all__ = [
3745
"ServiceBindingsResource",
@@ -40,12 +48,18 @@
4048
"AsyncServiceBindingsResourceWithRawResponse",
4149
"ServiceBindingsResourceWithStreamingResponse",
4250
"AsyncServiceBindingsResourceWithStreamingResponse",
43-
"BGPResource",
44-
"AsyncBGPResource",
45-
"BGPResourceWithRawResponse",
46-
"AsyncBGPResourceWithRawResponse",
47-
"BGPResourceWithStreamingResponse",
48-
"AsyncBGPResourceWithStreamingResponse",
51+
"BGPPrefixesResource",
52+
"AsyncBGPPrefixesResource",
53+
"BGPPrefixesResourceWithRawResponse",
54+
"AsyncBGPPrefixesResourceWithRawResponse",
55+
"BGPPrefixesResourceWithStreamingResponse",
56+
"AsyncBGPPrefixesResourceWithStreamingResponse",
57+
"AdvertisementStatusResource",
58+
"AsyncAdvertisementStatusResource",
59+
"AdvertisementStatusResourceWithRawResponse",
60+
"AsyncAdvertisementStatusResourceWithRawResponse",
61+
"AdvertisementStatusResourceWithStreamingResponse",
62+
"AsyncAdvertisementStatusResourceWithStreamingResponse",
4963
"DelegationsResource",
5064
"AsyncDelegationsResource",
5165
"DelegationsResourceWithRawResponse",

src/cloudflare/resources/addressing/prefixes/bgp/statuses.py src/cloudflare/resources/addressing/prefixes/advertisement_status.py

+63-55
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,47 @@
66

77
import httpx
88

9-
from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10-
from ....._utils import (
9+
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10+
from ...._utils import (
1111
maybe_transform,
1212
async_maybe_transform,
1313
)
14-
from ....._compat import cached_property
15-
from ....._resource import SyncAPIResource, AsyncAPIResource
16-
from ....._response import (
14+
from ...._compat import cached_property
15+
from ...._resource import SyncAPIResource, AsyncAPIResource
16+
from ...._response import (
1717
to_raw_response_wrapper,
1818
to_streamed_response_wrapper,
1919
async_to_raw_response_wrapper,
2020
async_to_streamed_response_wrapper,
2121
)
22-
from ....._wrappers import ResultWrapper
23-
from ....._base_client import make_request_options
24-
from .....types.addressing.prefixes.bgp import status_edit_params
25-
from .....types.addressing.prefixes.bgp.status_get_response import StatusGetResponse
26-
from .....types.addressing.prefixes.bgp.status_edit_response import StatusEditResponse
22+
from ...._wrappers import ResultWrapper
23+
from ...._base_client import make_request_options
24+
from ....types.addressing.prefixes import advertisement_status_edit_params
25+
from ....types.addressing.prefixes.advertisement_status_get_response import AdvertisementStatusGetResponse
26+
from ....types.addressing.prefixes.advertisement_status_edit_response import AdvertisementStatusEditResponse
2727

28-
__all__ = ["StatusesResource", "AsyncStatusesResource"]
28+
__all__ = ["AdvertisementStatusResource", "AsyncAdvertisementStatusResource"]
2929

3030

31-
class StatusesResource(SyncAPIResource):
31+
class AdvertisementStatusResource(SyncAPIResource):
3232
@cached_property
33-
def with_raw_response(self) -> StatusesResourceWithRawResponse:
33+
def with_raw_response(self) -> AdvertisementStatusResourceWithRawResponse:
3434
"""
3535
This property can be used as a prefix for any HTTP method call to return the
3636
the raw response object instead of the parsed content.
3737
3838
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
3939
"""
40-
return StatusesResourceWithRawResponse(self)
40+
return AdvertisementStatusResourceWithRawResponse(self)
4141

4242
@cached_property
43-
def with_streaming_response(self) -> StatusesResourceWithStreamingResponse:
43+
def with_streaming_response(self) -> AdvertisementStatusResourceWithStreamingResponse:
4444
"""
4545
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
4646
4747
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
4848
"""
49-
return StatusesResourceWithStreamingResponse(self)
49+
return AdvertisementStatusResourceWithStreamingResponse(self)
5050

5151
def edit(
5252
self,
@@ -60,7 +60,7 @@ def edit(
6060
extra_query: Query | None = None,
6161
extra_body: Body | None = None,
6262
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
63-
) -> Optional[StatusEditResponse]:
63+
) -> Optional[AdvertisementStatusEditResponse]:
6464
"""
6565
Advertise or withdraw BGP route for a prefix.
6666
@@ -85,15 +85,19 @@ def edit(
8585
raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}")
8686
return self._patch(
8787
f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/status",
88-
body=maybe_transform({"advertised": advertised}, status_edit_params.StatusEditParams),
88+
body=maybe_transform(
89+
{"advertised": advertised}, advertisement_status_edit_params.AdvertisementStatusEditParams
90+
),
8991
options=make_request_options(
9092
extra_headers=extra_headers,
9193
extra_query=extra_query,
9294
extra_body=extra_body,
9395
timeout=timeout,
94-
post_parser=ResultWrapper[Optional[StatusEditResponse]]._unwrapper,
96+
post_parser=ResultWrapper[Optional[AdvertisementStatusEditResponse]]._unwrapper,
97+
),
98+
cast_to=cast(
99+
Type[Optional[AdvertisementStatusEditResponse]], ResultWrapper[AdvertisementStatusEditResponse]
95100
),
96-
cast_to=cast(Type[Optional[StatusEditResponse]], ResultWrapper[StatusEditResponse]),
97101
)
98102

99103
def get(
@@ -107,7 +111,7 @@ def get(
107111
extra_query: Query | None = None,
108112
extra_body: Body | None = None,
109113
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
110-
) -> Optional[StatusGetResponse]:
114+
) -> Optional[AdvertisementStatusGetResponse]:
111115
"""
112116
List the current advertisement state for a prefix.
113117
@@ -135,31 +139,31 @@ def get(
135139
extra_query=extra_query,
136140
extra_body=extra_body,
137141
timeout=timeout,
138-
post_parser=ResultWrapper[Optional[StatusGetResponse]]._unwrapper,
142+
post_parser=ResultWrapper[Optional[AdvertisementStatusGetResponse]]._unwrapper,
139143
),
140-
cast_to=cast(Type[Optional[StatusGetResponse]], ResultWrapper[StatusGetResponse]),
144+
cast_to=cast(Type[Optional[AdvertisementStatusGetResponse]], ResultWrapper[AdvertisementStatusGetResponse]),
141145
)
142146

143147

144-
class AsyncStatusesResource(AsyncAPIResource):
148+
class AsyncAdvertisementStatusResource(AsyncAPIResource):
145149
@cached_property
146-
def with_raw_response(self) -> AsyncStatusesResourceWithRawResponse:
150+
def with_raw_response(self) -> AsyncAdvertisementStatusResourceWithRawResponse:
147151
"""
148152
This property can be used as a prefix for any HTTP method call to return the
149153
the raw response object instead of the parsed content.
150154
151155
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
152156
"""
153-
return AsyncStatusesResourceWithRawResponse(self)
157+
return AsyncAdvertisementStatusResourceWithRawResponse(self)
154158

155159
@cached_property
156-
def with_streaming_response(self) -> AsyncStatusesResourceWithStreamingResponse:
160+
def with_streaming_response(self) -> AsyncAdvertisementStatusResourceWithStreamingResponse:
157161
"""
158162
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
159163
160164
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
161165
"""
162-
return AsyncStatusesResourceWithStreamingResponse(self)
166+
return AsyncAdvertisementStatusResourceWithStreamingResponse(self)
163167

164168
async def edit(
165169
self,
@@ -173,7 +177,7 @@ async def edit(
173177
extra_query: Query | None = None,
174178
extra_body: Body | None = None,
175179
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
176-
) -> Optional[StatusEditResponse]:
180+
) -> Optional[AdvertisementStatusEditResponse]:
177181
"""
178182
Advertise or withdraw BGP route for a prefix.
179183
@@ -198,15 +202,19 @@ async def edit(
198202
raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}")
199203
return await self._patch(
200204
f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/status",
201-
body=await async_maybe_transform({"advertised": advertised}, status_edit_params.StatusEditParams),
205+
body=await async_maybe_transform(
206+
{"advertised": advertised}, advertisement_status_edit_params.AdvertisementStatusEditParams
207+
),
202208
options=make_request_options(
203209
extra_headers=extra_headers,
204210
extra_query=extra_query,
205211
extra_body=extra_body,
206212
timeout=timeout,
207-
post_parser=ResultWrapper[Optional[StatusEditResponse]]._unwrapper,
213+
post_parser=ResultWrapper[Optional[AdvertisementStatusEditResponse]]._unwrapper,
214+
),
215+
cast_to=cast(
216+
Type[Optional[AdvertisementStatusEditResponse]], ResultWrapper[AdvertisementStatusEditResponse]
208217
),
209-
cast_to=cast(Type[Optional[StatusEditResponse]], ResultWrapper[StatusEditResponse]),
210218
)
211219

212220
async def get(
@@ -220,7 +228,7 @@ async def get(
220228
extra_query: Query | None = None,
221229
extra_body: Body | None = None,
222230
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
223-
) -> Optional[StatusGetResponse]:
231+
) -> Optional[AdvertisementStatusGetResponse]:
224232
"""
225233
List the current advertisement state for a prefix.
226234
@@ -248,55 +256,55 @@ async def get(
248256
extra_query=extra_query,
249257
extra_body=extra_body,
250258
timeout=timeout,
251-
post_parser=ResultWrapper[Optional[StatusGetResponse]]._unwrapper,
259+
post_parser=ResultWrapper[Optional[AdvertisementStatusGetResponse]]._unwrapper,
252260
),
253-
cast_to=cast(Type[Optional[StatusGetResponse]], ResultWrapper[StatusGetResponse]),
261+
cast_to=cast(Type[Optional[AdvertisementStatusGetResponse]], ResultWrapper[AdvertisementStatusGetResponse]),
254262
)
255263

256264

257-
class StatusesResourceWithRawResponse:
258-
def __init__(self, statuses: StatusesResource) -> None:
259-
self._statuses = statuses
265+
class AdvertisementStatusResourceWithRawResponse:
266+
def __init__(self, advertisement_status: AdvertisementStatusResource) -> None:
267+
self._advertisement_status = advertisement_status
260268

261269
self.edit = to_raw_response_wrapper(
262-
statuses.edit,
270+
advertisement_status.edit,
263271
)
264272
self.get = to_raw_response_wrapper(
265-
statuses.get,
273+
advertisement_status.get,
266274
)
267275

268276

269-
class AsyncStatusesResourceWithRawResponse:
270-
def __init__(self, statuses: AsyncStatusesResource) -> None:
271-
self._statuses = statuses
277+
class AsyncAdvertisementStatusResourceWithRawResponse:
278+
def __init__(self, advertisement_status: AsyncAdvertisementStatusResource) -> None:
279+
self._advertisement_status = advertisement_status
272280

273281
self.edit = async_to_raw_response_wrapper(
274-
statuses.edit,
282+
advertisement_status.edit,
275283
)
276284
self.get = async_to_raw_response_wrapper(
277-
statuses.get,
285+
advertisement_status.get,
278286
)
279287

280288

281-
class StatusesResourceWithStreamingResponse:
282-
def __init__(self, statuses: StatusesResource) -> None:
283-
self._statuses = statuses
289+
class AdvertisementStatusResourceWithStreamingResponse:
290+
def __init__(self, advertisement_status: AdvertisementStatusResource) -> None:
291+
self._advertisement_status = advertisement_status
284292

285293
self.edit = to_streamed_response_wrapper(
286-
statuses.edit,
294+
advertisement_status.edit,
287295
)
288296
self.get = to_streamed_response_wrapper(
289-
statuses.get,
297+
advertisement_status.get,
290298
)
291299

292300

293-
class AsyncStatusesResourceWithStreamingResponse:
294-
def __init__(self, statuses: AsyncStatusesResource) -> None:
295-
self._statuses = statuses
301+
class AsyncAdvertisementStatusResourceWithStreamingResponse:
302+
def __init__(self, advertisement_status: AsyncAdvertisementStatusResource) -> None:
303+
self._advertisement_status = advertisement_status
296304

297305
self.edit = async_to_streamed_response_wrapper(
298-
statuses.edit,
306+
advertisement_status.edit,
299307
)
300308
self.get = async_to_streamed_response_wrapper(
301-
statuses.get,
309+
advertisement_status.get,
302310
)

0 commit comments

Comments
 (0)