Skip to content

Commit 2a0347f

Browse files
feat(api): aggregated API specs update
1 parent 289bea8 commit 2a0347f

File tree

8 files changed

+246
-112
lines changed

8 files changed

+246
-112
lines changed

.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-e03e7effe72aa3668976b9a30a76b188e8d2aa2f4210730cf46e66c70c62c116.yml
3-
openapi_spec_hash: da83e364ba42681bf2570c5d90372d97
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-7692ff469c0a20a3fde59d14a30c785a1773a8b60e5be9cc1280792a56b3b9e0.yml
3+
openapi_spec_hash: 188c9e304c287741b6a73552c939658f
44
config_hash: 399dda838c78c5d92532b7efcaaa0345

src/gcore/resources/cloud/file_shares/file_shares.py

Lines changed: 25 additions & 8 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 Dict, Iterable, Optional
67
from typing_extensions import Literal, overload
78

@@ -227,6 +228,7 @@ def create(
227228
cast_to=TaskIDList,
228229
)
229230

231+
@typing_extensions.deprecated("deprecated")
230232
def update(
231233
self,
232234
file_share_id: str,
@@ -246,6 +248,9 @@ def update(
246248
"""
247249
Rename file share or update tags
248250
251+
**Deprecated**: Use PATCH
252+
/v3/`file_shares`/{`project_id`}/{`region_id`}/{`file_share_id`} instead
253+
249254
Args:
250255
project_id: Project ID
251256
@@ -702,6 +707,7 @@ async def create(
702707
cast_to=TaskIDList,
703708
)
704709

710+
@typing_extensions.deprecated("deprecated")
705711
async def update(
706712
self,
707713
file_share_id: str,
@@ -721,6 +727,9 @@ async def update(
721727
"""
722728
Rename file share or update tags
723729
730+
**Deprecated**: Use PATCH
731+
/v3/`file_shares`/{`project_id`}/{`region_id`}/{`file_share_id`} instead
732+
724733
Args:
725734
project_id: Project ID
726735
@@ -997,8 +1006,10 @@ def __init__(self, file_shares: FileSharesResource) -> None:
9971006
self.create = to_raw_response_wrapper(
9981007
file_shares.create,
9991008
)
1000-
self.update = to_raw_response_wrapper(
1001-
file_shares.update,
1009+
self.update = ( # pyright: ignore[reportDeprecated]
1010+
to_raw_response_wrapper(
1011+
file_shares.update, # pyright: ignore[reportDeprecated],
1012+
)
10021013
)
10031014
self.list = to_raw_response_wrapper(
10041015
file_shares.list,
@@ -1025,8 +1036,10 @@ def __init__(self, file_shares: AsyncFileSharesResource) -> None:
10251036
self.create = async_to_raw_response_wrapper(
10261037
file_shares.create,
10271038
)
1028-
self.update = async_to_raw_response_wrapper(
1029-
file_shares.update,
1039+
self.update = ( # pyright: ignore[reportDeprecated]
1040+
async_to_raw_response_wrapper(
1041+
file_shares.update, # pyright: ignore[reportDeprecated],
1042+
)
10301043
)
10311044
self.list = async_to_raw_response_wrapper(
10321045
file_shares.list,
@@ -1053,8 +1066,10 @@ def __init__(self, file_shares: FileSharesResource) -> None:
10531066
self.create = to_streamed_response_wrapper(
10541067
file_shares.create,
10551068
)
1056-
self.update = to_streamed_response_wrapper(
1057-
file_shares.update,
1069+
self.update = ( # pyright: ignore[reportDeprecated]
1070+
to_streamed_response_wrapper(
1071+
file_shares.update, # pyright: ignore[reportDeprecated],
1072+
)
10581073
)
10591074
self.list = to_streamed_response_wrapper(
10601075
file_shares.list,
@@ -1081,8 +1096,10 @@ def __init__(self, file_shares: AsyncFileSharesResource) -> None:
10811096
self.create = async_to_streamed_response_wrapper(
10821097
file_shares.create,
10831098
)
1084-
self.update = async_to_streamed_response_wrapper(
1085-
file_shares.update,
1099+
self.update = ( # pyright: ignore[reportDeprecated]
1100+
async_to_streamed_response_wrapper(
1101+
file_shares.update, # pyright: ignore[reportDeprecated],
1102+
)
10861103
)
10871104
self.list = async_to_streamed_response_wrapper(
10881105
file_shares.list,

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

Lines changed: 67 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
from ....types.cloud.instance import Instance
6969
from ....types.cloud.task_id_list import TaskIDList
7070
from ....types.cloud.instance_interface import InstanceInterface
71+
from ....types.cloud.tag_update_map_param import TagUpdateMapParam
7172

7273
__all__ = ["InstancesResource", "AsyncInstancesResource"]
7374

@@ -337,7 +338,8 @@ def update(
337338
*,
338339
project_id: int | None = None,
339340
region_id: int | None = None,
340-
name: str,
341+
name: str | Omit = omit,
342+
tags: Optional[TagUpdateMapParam] | Omit = omit,
341343
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
342344
# The extra values given here take precedence over values defined on the client or passed to this method.
343345
extra_headers: Headers | None = None,
@@ -346,7 +348,7 @@ def update(
346348
timeout: float | httpx.Timeout | None | NotGiven = not_given,
347349
) -> Instance:
348350
"""
349-
Rename instance
351+
Rename instance or update tags
350352
351353
Args:
352354
project_id: Project ID
@@ -355,7 +357,29 @@ def update(
355357
356358
instance_id: Instance ID
357359
358-
name: Name.
360+
name: Name
361+
362+
tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide
363+
key-value pairs to add or update tags. Set tag values to `null` to remove tags.
364+
Unspecified tags remain unchanged. Read-only tags are always preserved and
365+
cannot be modified.
366+
367+
**Examples:**
368+
369+
- **Add/update tags:**
370+
`{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or
371+
updates existing ones.
372+
- **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags.
373+
- **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only
374+
tags are preserved).
375+
- **Partial update:** `{'tags': {'environment': 'staging'}}` only updates
376+
specified tags.
377+
- **Mixed operations:**
378+
`{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}`
379+
adds/updates 'environment' and '`cost_center`' while removing
380+
'`deprecated_tag`', preserving other existing tags.
381+
- **Replace all:** first delete existing tags with null values, then add new
382+
ones in the same request.
359383
360384
extra_headers: Send extra headers
361385
@@ -373,7 +397,13 @@ def update(
373397
raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
374398
return self._patch(
375399
f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}",
376-
body=maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams),
400+
body=maybe_transform(
401+
{
402+
"name": name,
403+
"tags": tags,
404+
},
405+
instance_update_params.InstanceUpdateParams,
406+
),
377407
options=make_request_options(
378408
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
379409
),
@@ -1716,7 +1746,8 @@ async def update(
17161746
*,
17171747
project_id: int | None = None,
17181748
region_id: int | None = None,
1719-
name: str,
1749+
name: str | Omit = omit,
1750+
tags: Optional[TagUpdateMapParam] | Omit = omit,
17201751
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
17211752
# The extra values given here take precedence over values defined on the client or passed to this method.
17221753
extra_headers: Headers | None = None,
@@ -1725,7 +1756,7 @@ async def update(
17251756
timeout: float | httpx.Timeout | None | NotGiven = not_given,
17261757
) -> Instance:
17271758
"""
1728-
Rename instance
1759+
Rename instance or update tags
17291760
17301761
Args:
17311762
project_id: Project ID
@@ -1734,7 +1765,29 @@ async def update(
17341765
17351766
instance_id: Instance ID
17361767
1737-
name: Name.
1768+
name: Name
1769+
1770+
tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide
1771+
key-value pairs to add or update tags. Set tag values to `null` to remove tags.
1772+
Unspecified tags remain unchanged. Read-only tags are always preserved and
1773+
cannot be modified.
1774+
1775+
**Examples:**
1776+
1777+
- **Add/update tags:**
1778+
`{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or
1779+
updates existing ones.
1780+
- **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags.
1781+
- **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only
1782+
tags are preserved).
1783+
- **Partial update:** `{'tags': {'environment': 'staging'}}` only updates
1784+
specified tags.
1785+
- **Mixed operations:**
1786+
`{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}`
1787+
adds/updates 'environment' and '`cost_center`' while removing
1788+
'`deprecated_tag`', preserving other existing tags.
1789+
- **Replace all:** first delete existing tags with null values, then add new
1790+
ones in the same request.
17381791
17391792
extra_headers: Send extra headers
17401793
@@ -1752,7 +1805,13 @@ async def update(
17521805
raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}")
17531806
return await self._patch(
17541807
f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}",
1755-
body=await async_maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams),
1808+
body=await async_maybe_transform(
1809+
{
1810+
"name": name,
1811+
"tags": tags,
1812+
},
1813+
instance_update_params.InstanceUpdateParams,
1814+
),
17561815
options=make_request_options(
17571816
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
17581817
),

src/gcore/resources/cloud/tasks.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,9 @@ def list(
178178
'`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`',
179179
'`update_inference_application`', '`update_inference_instance`',
180180
'`update_k8s_cluster_v2`', '`update_lbmetadata`',
181-
'`update_port_allowed_address_pairs`', '`update_tags_gpu_virtual_cluster`',
182-
'`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`',
183-
'`upscale_gpu_virtual_cluster`']
181+
'`update_port_allowed_address_pairs`', '`update_sfs`',
182+
'`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`',
183+
'`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`']
184184
185185
to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or
186186
equal to `to_timestamp`
@@ -487,9 +487,9 @@ def list(
487487
'`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`',
488488
'`update_inference_application`', '`update_inference_instance`',
489489
'`update_k8s_cluster_v2`', '`update_lbmetadata`',
490-
'`update_port_allowed_address_pairs`', '`update_tags_gpu_virtual_cluster`',
491-
'`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`',
492-
'`upscale_gpu_virtual_cluster`']
490+
'`update_port_allowed_address_pairs`', '`update_sfs`',
491+
'`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`',
492+
'`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`']
493493
494494
to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or
495495
equal to `to_timestamp`

src/gcore/types/cloud/instance_update_params.py

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Required, TypedDict
5+
from typing import Optional
6+
from typing_extensions import TypedDict
7+
8+
from .tag_update_map_param import TagUpdateMapParam
69

710
__all__ = ["InstanceUpdateParams"]
811

@@ -14,5 +17,30 @@ class InstanceUpdateParams(TypedDict, total=False):
1417
region_id: int
1518
"""Region ID"""
1619

17-
name: Required[str]
18-
"""Name."""
20+
name: str
21+
"""Name"""
22+
23+
tags: Optional[TagUpdateMapParam]
24+
"""Update key-value tags using JSON Merge Patch semantics (RFC 7386).
25+
26+
Provide key-value pairs to add or update tags. Set tag values to `null` to
27+
remove tags. Unspecified tags remain unchanged. Read-only tags are always
28+
preserved and cannot be modified.
29+
30+
**Examples:**
31+
32+
- **Add/update tags:**
33+
`{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or
34+
updates existing ones.
35+
- **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags.
36+
- **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only
37+
tags are preserved).
38+
- **Partial update:** `{'tags': {'environment': 'staging'}}` only updates
39+
specified tags.
40+
- **Mixed operations:**
41+
`{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}`
42+
adds/updates 'environment' and '`cost_center`' while removing
43+
'`deprecated_tag`', preserving other existing tags.
44+
- **Replace all:** first delete existing tags with null values, then add new
45+
ones in the same request.
46+
"""

src/gcore/types/cloud/task_list_params.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ class TaskListParams(TypedDict, total=False):
103103
'`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`',
104104
'`update_inference_application`', '`update_inference_instance`',
105105
'`update_k8s_cluster_v2`', '`update_lbmetadata`',
106-
'`update_port_allowed_address_pairs`', '`update_tags_gpu_virtual_cluster`',
107-
'`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`',
108-
'`upscale_gpu_virtual_cluster`']
106+
'`update_port_allowed_address_pairs`', '`update_sfs`',
107+
'`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`',
108+
'`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`']
109109
"""
110110

111111
to_timestamp: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]

0 commit comments

Comments
 (0)