6868from ....types .cloud .instance import Instance
6969from ....types .cloud .task_id_list import TaskIDList
7070from ....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 ),
0 commit comments