Skip to content

Commit 8eedd02

Browse files
feat(api): aggregated API specs update
1 parent 939a647 commit 8eedd02

5 files changed

Lines changed: 135 additions & 90 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 612
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-22bbef253f2956b3c6b7b4b809fa8b89dba489b8af41b29d43a2aec20b783ec1.yml
3-
openapi_spec_hash: 39ed3f8ee69486683f458fc9bf7672d1
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9d544c0c6403897f31c25f5630228b123f6542f9ac7deee6ef2bade239c637c2.yml
3+
openapi_spec_hash: 504c8bea0ced4e280b59f75422f29764
44
config_hash: 399dda838c78c5d92532b7efcaaa0345

src/gcore/resources/cloud/billing_reservations.py

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import typing_extensions
56
from typing import List, Union
67
from datetime import date, datetime
78
from typing_extensions import Literal
@@ -46,6 +47,7 @@ def with_streaming_response(self) -> BillingReservationsResourceWithStreamingRes
4647
"""
4748
return BillingReservationsResourceWithStreamingResponse(self)
4849

50+
@typing_extensions.deprecated("deprecated")
4951
def list(
5052
self,
5153
*,
@@ -150,6 +152,7 @@ def list(
150152
model=BillingReservation,
151153
)
152154

155+
@typing_extensions.deprecated("deprecated")
153156
def get(
154157
self,
155158
reservation_id: int,
@@ -206,6 +209,7 @@ def with_streaming_response(self) -> AsyncBillingReservationsResourceWithStreami
206209
"""
207210
return AsyncBillingReservationsResourceWithStreamingResponse(self)
208211

212+
@typing_extensions.deprecated("deprecated")
209213
def list(
210214
self,
211215
*,
@@ -310,6 +314,7 @@ def list(
310314
model=BillingReservation,
311315
)
312316

317+
@typing_extensions.deprecated("deprecated")
313318
async def get(
314319
self,
315320
reservation_id: int,
@@ -350,45 +355,61 @@ class BillingReservationsResourceWithRawResponse:
350355
def __init__(self, billing_reservations: BillingReservationsResource) -> None:
351356
self._billing_reservations = billing_reservations
352357

353-
self.list = to_raw_response_wrapper(
354-
billing_reservations.list,
358+
self.list = ( # pyright: ignore[reportDeprecated]
359+
to_raw_response_wrapper(
360+
billing_reservations.list, # pyright: ignore[reportDeprecated],
361+
)
355362
)
356-
self.get = to_raw_response_wrapper(
357-
billing_reservations.get,
363+
self.get = ( # pyright: ignore[reportDeprecated]
364+
to_raw_response_wrapper(
365+
billing_reservations.get, # pyright: ignore[reportDeprecated],
366+
)
358367
)
359368

360369

361370
class AsyncBillingReservationsResourceWithRawResponse:
362371
def __init__(self, billing_reservations: AsyncBillingReservationsResource) -> None:
363372
self._billing_reservations = billing_reservations
364373

365-
self.list = async_to_raw_response_wrapper(
366-
billing_reservations.list,
374+
self.list = ( # pyright: ignore[reportDeprecated]
375+
async_to_raw_response_wrapper(
376+
billing_reservations.list, # pyright: ignore[reportDeprecated],
377+
)
367378
)
368-
self.get = async_to_raw_response_wrapper(
369-
billing_reservations.get,
379+
self.get = ( # pyright: ignore[reportDeprecated]
380+
async_to_raw_response_wrapper(
381+
billing_reservations.get, # pyright: ignore[reportDeprecated],
382+
)
370383
)
371384

372385

373386
class BillingReservationsResourceWithStreamingResponse:
374387
def __init__(self, billing_reservations: BillingReservationsResource) -> None:
375388
self._billing_reservations = billing_reservations
376389

377-
self.list = to_streamed_response_wrapper(
378-
billing_reservations.list,
390+
self.list = ( # pyright: ignore[reportDeprecated]
391+
to_streamed_response_wrapper(
392+
billing_reservations.list, # pyright: ignore[reportDeprecated],
393+
)
379394
)
380-
self.get = to_streamed_response_wrapper(
381-
billing_reservations.get,
395+
self.get = ( # pyright: ignore[reportDeprecated]
396+
to_streamed_response_wrapper(
397+
billing_reservations.get, # pyright: ignore[reportDeprecated],
398+
)
382399
)
383400

384401

385402
class AsyncBillingReservationsResourceWithStreamingResponse:
386403
def __init__(self, billing_reservations: AsyncBillingReservationsResource) -> None:
387404
self._billing_reservations = billing_reservations
388405

389-
self.list = async_to_streamed_response_wrapper(
390-
billing_reservations.list,
406+
self.list = ( # pyright: ignore[reportDeprecated]
407+
async_to_streamed_response_wrapper(
408+
billing_reservations.list, # pyright: ignore[reportDeprecated],
409+
)
391410
)
392-
self.get = async_to_streamed_response_wrapper(
393-
billing_reservations.get,
411+
self.get = ( # pyright: ignore[reportDeprecated]
412+
async_to_streamed_response_wrapper(
413+
billing_reservations.get, # pyright: ignore[reportDeprecated],
414+
)
394415
)

src/gcore/resources/cloud/instances/instances.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,8 @@ def list(
405405
offset: int | Omit = omit,
406406
only_isolated: bool | Omit = omit,
407407
only_with_fixed_external_ip: bool | Omit = omit,
408-
order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] | Omit = omit,
408+
order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc", "status.asc", "status.desc"]
409+
| Omit = omit,
409410
profile_name: str | Omit = omit,
410411
protection_status: Literal["Active", "Queued", "Error"] | Omit = omit,
411412
status: Literal[
@@ -1811,7 +1812,8 @@ def list(
18111812
offset: int | Omit = omit,
18121813
only_isolated: bool | Omit = omit,
18131814
only_with_fixed_external_ip: bool | Omit = omit,
1814-
order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] | Omit = omit,
1815+
order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc", "status.asc", "status.desc"]
1816+
| Omit = omit,
18151817
profile_name: str | Omit = omit,
18161818
protection_status: Literal["Active", "Queued", "Error"] | Omit = omit,
18171819
status: Literal[

src/gcore/types/cloud/instance_list_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class InstanceListParams(TypedDict, total=False):
8282
only_with_fixed_external_ip: bool
8383
"""Return bare metals only with external fixed IP addresses."""
8484

85-
order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"]
85+
order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc", "status.asc", "status.desc"]
8686
"""Order by field and direction."""
8787

8888
profile_name: str

tests/api_resources/cloud/test_billing_reservations.py

Lines changed: 91 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
from gcore.pagination import SyncOffsetPage, AsyncOffsetPage
1414
from gcore.types.cloud import BillingReservation
1515

16+
# pyright: reportDeprecated=false
17+
1618
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
1719

1820

@@ -21,30 +23,35 @@ class TestBillingReservations:
2123

2224
@parametrize
2325
def test_method_list(self, client: Gcore) -> None:
24-
billing_reservation = client.cloud.billing_reservations.list()
26+
with pytest.warns(DeprecationWarning):
27+
billing_reservation = client.cloud.billing_reservations.list()
28+
2529
assert_matches_type(SyncOffsetPage[BillingReservation], billing_reservation, path=["response"])
2630

2731
@parametrize
2832
def test_method_list_with_all_params(self, client: Gcore) -> None:
29-
billing_reservation = client.cloud.billing_reservations.list(
30-
activated_from=parse_date("2019-12-27"),
31-
activated_to=parse_date("2019-12-27"),
32-
created_from=parse_datetime("2019-12-27T18:11:19.117Z"),
33-
created_to=parse_datetime("2019-12-27T18:11:19.117Z"),
34-
deactivated_from=parse_date("2019-12-27"),
35-
deactivated_to=parse_date("2019-12-27"),
36-
limit=1,
37-
metric_name="metric_name",
38-
offset=0,
39-
order_by="active_from.asc",
40-
region_id=0,
41-
status=["ACTIVATED"],
42-
)
33+
with pytest.warns(DeprecationWarning):
34+
billing_reservation = client.cloud.billing_reservations.list(
35+
activated_from=parse_date("2019-12-27"),
36+
activated_to=parse_date("2019-12-27"),
37+
created_from=parse_datetime("2019-12-27T18:11:19.117Z"),
38+
created_to=parse_datetime("2019-12-27T18:11:19.117Z"),
39+
deactivated_from=parse_date("2019-12-27"),
40+
deactivated_to=parse_date("2019-12-27"),
41+
limit=1,
42+
metric_name="metric_name",
43+
offset=0,
44+
order_by="active_from.asc",
45+
region_id=0,
46+
status=["ACTIVATED"],
47+
)
48+
4349
assert_matches_type(SyncOffsetPage[BillingReservation], billing_reservation, path=["response"])
4450

4551
@parametrize
4652
def test_raw_response_list(self, client: Gcore) -> None:
47-
response = client.cloud.billing_reservations.with_raw_response.list()
53+
with pytest.warns(DeprecationWarning):
54+
response = client.cloud.billing_reservations.with_raw_response.list()
4855

4956
assert response.is_closed is True
5057
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -53,27 +60,31 @@ def test_raw_response_list(self, client: Gcore) -> None:
5360

5461
@parametrize
5562
def test_streaming_response_list(self, client: Gcore) -> None:
56-
with client.cloud.billing_reservations.with_streaming_response.list() as response:
57-
assert not response.is_closed
58-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
63+
with pytest.warns(DeprecationWarning):
64+
with client.cloud.billing_reservations.with_streaming_response.list() as response:
65+
assert not response.is_closed
66+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
5967

60-
billing_reservation = response.parse()
61-
assert_matches_type(SyncOffsetPage[BillingReservation], billing_reservation, path=["response"])
68+
billing_reservation = response.parse()
69+
assert_matches_type(SyncOffsetPage[BillingReservation], billing_reservation, path=["response"])
6270

6371
assert cast(Any, response.is_closed) is True
6472

6573
@parametrize
6674
def test_method_get(self, client: Gcore) -> None:
67-
billing_reservation = client.cloud.billing_reservations.get(
68-
0,
69-
)
75+
with pytest.warns(DeprecationWarning):
76+
billing_reservation = client.cloud.billing_reservations.get(
77+
0,
78+
)
79+
7080
assert_matches_type(BillingReservation, billing_reservation, path=["response"])
7181

7282
@parametrize
7383
def test_raw_response_get(self, client: Gcore) -> None:
74-
response = client.cloud.billing_reservations.with_raw_response.get(
75-
0,
76-
)
84+
with pytest.warns(DeprecationWarning):
85+
response = client.cloud.billing_reservations.with_raw_response.get(
86+
0,
87+
)
7788

7889
assert response.is_closed is True
7990
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -82,14 +93,15 @@ def test_raw_response_get(self, client: Gcore) -> None:
8293

8394
@parametrize
8495
def test_streaming_response_get(self, client: Gcore) -> None:
85-
with client.cloud.billing_reservations.with_streaming_response.get(
86-
0,
87-
) as response:
88-
assert not response.is_closed
89-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
96+
with pytest.warns(DeprecationWarning):
97+
with client.cloud.billing_reservations.with_streaming_response.get(
98+
0,
99+
) as response:
100+
assert not response.is_closed
101+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
90102

91-
billing_reservation = response.parse()
92-
assert_matches_type(BillingReservation, billing_reservation, path=["response"])
103+
billing_reservation = response.parse()
104+
assert_matches_type(BillingReservation, billing_reservation, path=["response"])
93105

94106
assert cast(Any, response.is_closed) is True
95107

@@ -101,30 +113,35 @@ class TestAsyncBillingReservations:
101113

102114
@parametrize
103115
async def test_method_list(self, async_client: AsyncGcore) -> None:
104-
billing_reservation = await async_client.cloud.billing_reservations.list()
116+
with pytest.warns(DeprecationWarning):
117+
billing_reservation = await async_client.cloud.billing_reservations.list()
118+
105119
assert_matches_type(AsyncOffsetPage[BillingReservation], billing_reservation, path=["response"])
106120

107121
@parametrize
108122
async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None:
109-
billing_reservation = await async_client.cloud.billing_reservations.list(
110-
activated_from=parse_date("2019-12-27"),
111-
activated_to=parse_date("2019-12-27"),
112-
created_from=parse_datetime("2019-12-27T18:11:19.117Z"),
113-
created_to=parse_datetime("2019-12-27T18:11:19.117Z"),
114-
deactivated_from=parse_date("2019-12-27"),
115-
deactivated_to=parse_date("2019-12-27"),
116-
limit=1,
117-
metric_name="metric_name",
118-
offset=0,
119-
order_by="active_from.asc",
120-
region_id=0,
121-
status=["ACTIVATED"],
122-
)
123+
with pytest.warns(DeprecationWarning):
124+
billing_reservation = await async_client.cloud.billing_reservations.list(
125+
activated_from=parse_date("2019-12-27"),
126+
activated_to=parse_date("2019-12-27"),
127+
created_from=parse_datetime("2019-12-27T18:11:19.117Z"),
128+
created_to=parse_datetime("2019-12-27T18:11:19.117Z"),
129+
deactivated_from=parse_date("2019-12-27"),
130+
deactivated_to=parse_date("2019-12-27"),
131+
limit=1,
132+
metric_name="metric_name",
133+
offset=0,
134+
order_by="active_from.asc",
135+
region_id=0,
136+
status=["ACTIVATED"],
137+
)
138+
123139
assert_matches_type(AsyncOffsetPage[BillingReservation], billing_reservation, path=["response"])
124140

125141
@parametrize
126142
async def test_raw_response_list(self, async_client: AsyncGcore) -> None:
127-
response = await async_client.cloud.billing_reservations.with_raw_response.list()
143+
with pytest.warns(DeprecationWarning):
144+
response = await async_client.cloud.billing_reservations.with_raw_response.list()
128145

129146
assert response.is_closed is True
130147
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -133,27 +150,31 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None:
133150

134151
@parametrize
135152
async def test_streaming_response_list(self, async_client: AsyncGcore) -> None:
136-
async with async_client.cloud.billing_reservations.with_streaming_response.list() as response:
137-
assert not response.is_closed
138-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
153+
with pytest.warns(DeprecationWarning):
154+
async with async_client.cloud.billing_reservations.with_streaming_response.list() as response:
155+
assert not response.is_closed
156+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
139157

140-
billing_reservation = await response.parse()
141-
assert_matches_type(AsyncOffsetPage[BillingReservation], billing_reservation, path=["response"])
158+
billing_reservation = await response.parse()
159+
assert_matches_type(AsyncOffsetPage[BillingReservation], billing_reservation, path=["response"])
142160

143161
assert cast(Any, response.is_closed) is True
144162

145163
@parametrize
146164
async def test_method_get(self, async_client: AsyncGcore) -> None:
147-
billing_reservation = await async_client.cloud.billing_reservations.get(
148-
0,
149-
)
165+
with pytest.warns(DeprecationWarning):
166+
billing_reservation = await async_client.cloud.billing_reservations.get(
167+
0,
168+
)
169+
150170
assert_matches_type(BillingReservation, billing_reservation, path=["response"])
151171

152172
@parametrize
153173
async def test_raw_response_get(self, async_client: AsyncGcore) -> None:
154-
response = await async_client.cloud.billing_reservations.with_raw_response.get(
155-
0,
156-
)
174+
with pytest.warns(DeprecationWarning):
175+
response = await async_client.cloud.billing_reservations.with_raw_response.get(
176+
0,
177+
)
157178

158179
assert response.is_closed is True
159180
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -162,13 +183,14 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None:
162183

163184
@parametrize
164185
async def test_streaming_response_get(self, async_client: AsyncGcore) -> None:
165-
async with async_client.cloud.billing_reservations.with_streaming_response.get(
166-
0,
167-
) as response:
168-
assert not response.is_closed
169-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
170-
171-
billing_reservation = await response.parse()
172-
assert_matches_type(BillingReservation, billing_reservation, path=["response"])
186+
with pytest.warns(DeprecationWarning):
187+
async with async_client.cloud.billing_reservations.with_streaming_response.get(
188+
0,
189+
) as response:
190+
assert not response.is_closed
191+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
192+
193+
billing_reservation = await response.parse()
194+
assert_matches_type(BillingReservation, billing_reservation, path=["response"])
173195

174196
assert cast(Any, response.is_closed) is True

0 commit comments

Comments
 (0)