6
6
7
7
import httpx
8
8
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 (
11
11
maybe_transform ,
12
12
async_maybe_transform ,
13
13
)
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 (
17
17
to_raw_response_wrapper ,
18
18
to_streamed_response_wrapper ,
19
19
async_to_raw_response_wrapper ,
20
20
async_to_streamed_response_wrapper ,
21
21
)
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
27
27
28
- __all__ = ["StatusesResource " , "AsyncStatusesResource " ]
28
+ __all__ = ["AdvertisementStatusResource " , "AsyncAdvertisementStatusResource " ]
29
29
30
30
31
- class StatusesResource (SyncAPIResource ):
31
+ class AdvertisementStatusResource (SyncAPIResource ):
32
32
@cached_property
33
- def with_raw_response (self ) -> StatusesResourceWithRawResponse :
33
+ def with_raw_response (self ) -> AdvertisementStatusResourceWithRawResponse :
34
34
"""
35
35
This property can be used as a prefix for any HTTP method call to return the
36
36
the raw response object instead of the parsed content.
37
37
38
38
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
39
39
"""
40
- return StatusesResourceWithRawResponse (self )
40
+ return AdvertisementStatusResourceWithRawResponse (self )
41
41
42
42
@cached_property
43
- def with_streaming_response (self ) -> StatusesResourceWithStreamingResponse :
43
+ def with_streaming_response (self ) -> AdvertisementStatusResourceWithStreamingResponse :
44
44
"""
45
45
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
46
46
47
47
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
48
48
"""
49
- return StatusesResourceWithStreamingResponse (self )
49
+ return AdvertisementStatusResourceWithStreamingResponse (self )
50
50
51
51
def edit (
52
52
self ,
@@ -60,7 +60,7 @@ def edit(
60
60
extra_query : Query | None = None ,
61
61
extra_body : Body | None = None ,
62
62
timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
63
- ) -> Optional [StatusEditResponse ]:
63
+ ) -> Optional [AdvertisementStatusEditResponse ]:
64
64
"""
65
65
Advertise or withdraw BGP route for a prefix.
66
66
@@ -85,15 +85,19 @@ def edit(
85
85
raise ValueError (f"Expected a non-empty value for `prefix_id` but received { prefix_id !r} " )
86
86
return self ._patch (
87
87
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
+ ),
89
91
options = make_request_options (
90
92
extra_headers = extra_headers ,
91
93
extra_query = extra_query ,
92
94
extra_body = extra_body ,
93
95
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 ]
95
100
),
96
- cast_to = cast (Type [Optional [StatusEditResponse ]], ResultWrapper [StatusEditResponse ]),
97
101
)
98
102
99
103
def get (
@@ -107,7 +111,7 @@ def get(
107
111
extra_query : Query | None = None ,
108
112
extra_body : Body | None = None ,
109
113
timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
110
- ) -> Optional [StatusGetResponse ]:
114
+ ) -> Optional [AdvertisementStatusGetResponse ]:
111
115
"""
112
116
List the current advertisement state for a prefix.
113
117
@@ -135,31 +139,31 @@ def get(
135
139
extra_query = extra_query ,
136
140
extra_body = extra_body ,
137
141
timeout = timeout ,
138
- post_parser = ResultWrapper [Optional [StatusGetResponse ]]._unwrapper ,
142
+ post_parser = ResultWrapper [Optional [AdvertisementStatusGetResponse ]]._unwrapper ,
139
143
),
140
- cast_to = cast (Type [Optional [StatusGetResponse ]], ResultWrapper [StatusGetResponse ]),
144
+ cast_to = cast (Type [Optional [AdvertisementStatusGetResponse ]], ResultWrapper [AdvertisementStatusGetResponse ]),
141
145
)
142
146
143
147
144
- class AsyncStatusesResource (AsyncAPIResource ):
148
+ class AsyncAdvertisementStatusResource (AsyncAPIResource ):
145
149
@cached_property
146
- def with_raw_response (self ) -> AsyncStatusesResourceWithRawResponse :
150
+ def with_raw_response (self ) -> AsyncAdvertisementStatusResourceWithRawResponse :
147
151
"""
148
152
This property can be used as a prefix for any HTTP method call to return the
149
153
the raw response object instead of the parsed content.
150
154
151
155
For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
152
156
"""
153
- return AsyncStatusesResourceWithRawResponse (self )
157
+ return AsyncAdvertisementStatusResourceWithRawResponse (self )
154
158
155
159
@cached_property
156
- def with_streaming_response (self ) -> AsyncStatusesResourceWithStreamingResponse :
160
+ def with_streaming_response (self ) -> AsyncAdvertisementStatusResourceWithStreamingResponse :
157
161
"""
158
162
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
159
163
160
164
For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
161
165
"""
162
- return AsyncStatusesResourceWithStreamingResponse (self )
166
+ return AsyncAdvertisementStatusResourceWithStreamingResponse (self )
163
167
164
168
async def edit (
165
169
self ,
@@ -173,7 +177,7 @@ async def edit(
173
177
extra_query : Query | None = None ,
174
178
extra_body : Body | None = None ,
175
179
timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
176
- ) -> Optional [StatusEditResponse ]:
180
+ ) -> Optional [AdvertisementStatusEditResponse ]:
177
181
"""
178
182
Advertise or withdraw BGP route for a prefix.
179
183
@@ -198,15 +202,19 @@ async def edit(
198
202
raise ValueError (f"Expected a non-empty value for `prefix_id` but received { prefix_id !r} " )
199
203
return await self ._patch (
200
204
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
+ ),
202
208
options = make_request_options (
203
209
extra_headers = extra_headers ,
204
210
extra_query = extra_query ,
205
211
extra_body = extra_body ,
206
212
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 ]
208
217
),
209
- cast_to = cast (Type [Optional [StatusEditResponse ]], ResultWrapper [StatusEditResponse ]),
210
218
)
211
219
212
220
async def get (
@@ -220,7 +228,7 @@ async def get(
220
228
extra_query : Query | None = None ,
221
229
extra_body : Body | None = None ,
222
230
timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
223
- ) -> Optional [StatusGetResponse ]:
231
+ ) -> Optional [AdvertisementStatusGetResponse ]:
224
232
"""
225
233
List the current advertisement state for a prefix.
226
234
@@ -248,55 +256,55 @@ async def get(
248
256
extra_query = extra_query ,
249
257
extra_body = extra_body ,
250
258
timeout = timeout ,
251
- post_parser = ResultWrapper [Optional [StatusGetResponse ]]._unwrapper ,
259
+ post_parser = ResultWrapper [Optional [AdvertisementStatusGetResponse ]]._unwrapper ,
252
260
),
253
- cast_to = cast (Type [Optional [StatusGetResponse ]], ResultWrapper [StatusGetResponse ]),
261
+ cast_to = cast (Type [Optional [AdvertisementStatusGetResponse ]], ResultWrapper [AdvertisementStatusGetResponse ]),
254
262
)
255
263
256
264
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
260
268
261
269
self .edit = to_raw_response_wrapper (
262
- statuses .edit ,
270
+ advertisement_status .edit ,
263
271
)
264
272
self .get = to_raw_response_wrapper (
265
- statuses .get ,
273
+ advertisement_status .get ,
266
274
)
267
275
268
276
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
272
280
273
281
self .edit = async_to_raw_response_wrapper (
274
- statuses .edit ,
282
+ advertisement_status .edit ,
275
283
)
276
284
self .get = async_to_raw_response_wrapper (
277
- statuses .get ,
285
+ advertisement_status .get ,
278
286
)
279
287
280
288
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
284
292
285
293
self .edit = to_streamed_response_wrapper (
286
- statuses .edit ,
294
+ advertisement_status .edit ,
287
295
)
288
296
self .get = to_streamed_response_wrapper (
289
- statuses .get ,
297
+ advertisement_status .get ,
290
298
)
291
299
292
300
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
296
304
297
305
self .edit = async_to_streamed_response_wrapper (
298
- statuses .edit ,
306
+ advertisement_status .edit ,
299
307
)
300
308
self .get = async_to_streamed_response_wrapper (
301
- statuses .get ,
309
+ advertisement_status .get ,
302
310
)
0 commit comments