@@ -124,24 +124,67 @@ def create(
124124 cast_to = TaskIDList ,
125125 )
126126
127- @typing_extensions .deprecated ("deprecated" )
128127 def update (
129128 self ,
130129 floating_ip_id : str ,
131130 * ,
132131 project_id : int | None = None ,
133132 region_id : int | None = None ,
133+ fixed_ip_address : Optional [str ] | Omit = omit ,
134+ port_id : Optional [str ] | Omit = omit ,
134135 tags : Optional [TagUpdateMapParam ] | Omit = omit ,
135136 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
136137 # The extra values given here take precedence over values defined on the client or passed to this method.
137138 extra_headers : Headers | None = None ,
138139 extra_query : Query | None = None ,
139140 extra_body : Body | None = None ,
140141 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
141- ) -> FloatingIP :
142- """
143- **Deprecated**: Use PATCH
144- /v2/floatingips/{`project_id`}/{`region_id`}/{`floating_ip_id`} instead
142+ ) -> TaskIDList :
143+ """This endpoint updates the association and tags of an existing Floating IP.
144+
145+ The
146+ behavior depends on the current association state and the provided fields:
147+
148+ Parameters:
149+
150+ `port_id`: The unique identifier of the network interface (port) to which the
151+ Floating IP should be assigned. This ID can be retrieved from the "Get instance"
152+ or "List network interfaces" endpoints.
153+
154+ `fixed_ip_address`: The private IP address assigned to the network interface.
155+ This must be one of the IP addresses currently assigned to the specified port.
156+ You can retrieve available fixed IP addresses from the "Get instance" or "List
157+ network interfaces" endpoints.
158+
159+ When the Floating IP has no port associated (`port_id` is null):
160+
161+ - Patch with both `port_id` and `fixed_ip_address`: Assign the Floating IP to
162+ the specified port and the provided `fixed_ip_address`, if that
163+ `fixed_ip_address` exists on the port and is not yet used by another Floating
164+ IP.
165+ - Patch with `port_id` only (`fixed_ip_address` omitted): Assign the Floating IP
166+ to the specified port using the first available IPv4 fixed IP of that port.
167+
168+ When the Floating IP is already associated with a port:
169+
170+ - Patch with both `port_id` and `fixed_ip_address`: Re-assign the Floating IP to
171+ the specified port and address if all validations pass.
172+ - Patch with `port_id` only (`fixed_ip_address` omitted): Re-assign the Floating
173+ IP to the specified port using the first available IPv4 fixed IP of that port.
174+ - Patch with `port_id` = null: Unassign the Floating IP from its current port.
175+
176+ Tags:
177+
178+ - You can update tags alongside association changes. Tags are provided as a list
179+ of key-value pairs.
180+
181+ Idempotency and task creation:
182+
183+ - No worker task is created if the requested state is already actual, i.e., the
184+ requested `port_id` equals the current `port_id` and/or the requested
185+ `fixed_ip_address` equals the current `fixed_ip_address`, and the tags already
186+ match the current tags. In such cases, the endpoint returns an empty tasks
187+ list.
145188
146189 Args:
147190 project_id: Project ID
@@ -150,6 +193,10 @@ def update(
150193
151194 floating_ip_id: Floating IP ID
152195
196+ fixed_ip_address: Fixed IP address
197+
198+ port_id: Port ID
199+
153200 tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide
154201 key-value pairs to add or update tags. Set tag values to `null` to remove tags.
155202 Unspecified tags remain unchanged. Read-only tags are always preserved and
@@ -192,12 +239,19 @@ def update(
192239 if not floating_ip_id :
193240 raise ValueError (f"Expected a non-empty value for `floating_ip_id` but received { floating_ip_id !r} " )
194241 return self ._patch (
195- f"/cloud/v1/floatingips/{ project_id } /{ region_id } /{ floating_ip_id } " ,
196- body = maybe_transform ({"tags" : tags }, floating_ip_update_params .FloatingIPUpdateParams ),
242+ f"/cloud/v2/floatingips/{ project_id } /{ region_id } /{ floating_ip_id } " ,
243+ body = maybe_transform (
244+ {
245+ "fixed_ip_address" : fixed_ip_address ,
246+ "port_id" : port_id ,
247+ "tags" : tags ,
248+ },
249+ floating_ip_update_params .FloatingIPUpdateParams ,
250+ ),
197251 options = make_request_options (
198252 extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
199253 ),
200- cast_to = FloatingIP ,
254+ cast_to = TaskIDList ,
201255 )
202256
203257 def list (
@@ -648,24 +702,67 @@ async def create(
648702 cast_to = TaskIDList ,
649703 )
650704
651- @typing_extensions .deprecated ("deprecated" )
652705 async def update (
653706 self ,
654707 floating_ip_id : str ,
655708 * ,
656709 project_id : int | None = None ,
657710 region_id : int | None = None ,
711+ fixed_ip_address : Optional [str ] | Omit = omit ,
712+ port_id : Optional [str ] | Omit = omit ,
658713 tags : Optional [TagUpdateMapParam ] | Omit = omit ,
659714 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
660715 # The extra values given here take precedence over values defined on the client or passed to this method.
661716 extra_headers : Headers | None = None ,
662717 extra_query : Query | None = None ,
663718 extra_body : Body | None = None ,
664719 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
665- ) -> FloatingIP :
666- """
667- **Deprecated**: Use PATCH
668- /v2/floatingips/{`project_id`}/{`region_id`}/{`floating_ip_id`} instead
720+ ) -> TaskIDList :
721+ """This endpoint updates the association and tags of an existing Floating IP.
722+
723+ The
724+ behavior depends on the current association state and the provided fields:
725+
726+ Parameters:
727+
728+ `port_id`: The unique identifier of the network interface (port) to which the
729+ Floating IP should be assigned. This ID can be retrieved from the "Get instance"
730+ or "List network interfaces" endpoints.
731+
732+ `fixed_ip_address`: The private IP address assigned to the network interface.
733+ This must be one of the IP addresses currently assigned to the specified port.
734+ You can retrieve available fixed IP addresses from the "Get instance" or "List
735+ network interfaces" endpoints.
736+
737+ When the Floating IP has no port associated (`port_id` is null):
738+
739+ - Patch with both `port_id` and `fixed_ip_address`: Assign the Floating IP to
740+ the specified port and the provided `fixed_ip_address`, if that
741+ `fixed_ip_address` exists on the port and is not yet used by another Floating
742+ IP.
743+ - Patch with `port_id` only (`fixed_ip_address` omitted): Assign the Floating IP
744+ to the specified port using the first available IPv4 fixed IP of that port.
745+
746+ When the Floating IP is already associated with a port:
747+
748+ - Patch with both `port_id` and `fixed_ip_address`: Re-assign the Floating IP to
749+ the specified port and address if all validations pass.
750+ - Patch with `port_id` only (`fixed_ip_address` omitted): Re-assign the Floating
751+ IP to the specified port using the first available IPv4 fixed IP of that port.
752+ - Patch with `port_id` = null: Unassign the Floating IP from its current port.
753+
754+ Tags:
755+
756+ - You can update tags alongside association changes. Tags are provided as a list
757+ of key-value pairs.
758+
759+ Idempotency and task creation:
760+
761+ - No worker task is created if the requested state is already actual, i.e., the
762+ requested `port_id` equals the current `port_id` and/or the requested
763+ `fixed_ip_address` equals the current `fixed_ip_address`, and the tags already
764+ match the current tags. In such cases, the endpoint returns an empty tasks
765+ list.
669766
670767 Args:
671768 project_id: Project ID
@@ -674,6 +771,10 @@ async def update(
674771
675772 floating_ip_id: Floating IP ID
676773
774+ fixed_ip_address: Fixed IP address
775+
776+ port_id: Port ID
777+
677778 tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide
678779 key-value pairs to add or update tags. Set tag values to `null` to remove tags.
679780 Unspecified tags remain unchanged. Read-only tags are always preserved and
@@ -716,12 +817,19 @@ async def update(
716817 if not floating_ip_id :
717818 raise ValueError (f"Expected a non-empty value for `floating_ip_id` but received { floating_ip_id !r} " )
718819 return await self ._patch (
719- f"/cloud/v1/floatingips/{ project_id } /{ region_id } /{ floating_ip_id } " ,
720- body = await async_maybe_transform ({"tags" : tags }, floating_ip_update_params .FloatingIPUpdateParams ),
820+ f"/cloud/v2/floatingips/{ project_id } /{ region_id } /{ floating_ip_id } " ,
821+ body = await async_maybe_transform (
822+ {
823+ "fixed_ip_address" : fixed_ip_address ,
824+ "port_id" : port_id ,
825+ "tags" : tags ,
826+ },
827+ floating_ip_update_params .FloatingIPUpdateParams ,
828+ ),
721829 options = make_request_options (
722830 extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
723831 ),
724- cast_to = FloatingIP ,
832+ cast_to = TaskIDList ,
725833 )
726834
727835 def list (
@@ -1090,10 +1198,8 @@ def __init__(self, floating_ips: FloatingIPsResource) -> None:
10901198 self .create = to_raw_response_wrapper (
10911199 floating_ips .create ,
10921200 )
1093- self .update = ( # pyright: ignore[reportDeprecated]
1094- to_raw_response_wrapper (
1095- floating_ips .update , # pyright: ignore[reportDeprecated],
1096- )
1201+ self .update = to_raw_response_wrapper (
1202+ floating_ips .update ,
10971203 )
10981204 self .list = to_raw_response_wrapper (
10991205 floating_ips .list ,
@@ -1129,10 +1235,8 @@ def __init__(self, floating_ips: AsyncFloatingIPsResource) -> None:
11291235 self .create = async_to_raw_response_wrapper (
11301236 floating_ips .create ,
11311237 )
1132- self .update = ( # pyright: ignore[reportDeprecated]
1133- async_to_raw_response_wrapper (
1134- floating_ips .update , # pyright: ignore[reportDeprecated],
1135- )
1238+ self .update = async_to_raw_response_wrapper (
1239+ floating_ips .update ,
11361240 )
11371241 self .list = async_to_raw_response_wrapper (
11381242 floating_ips .list ,
@@ -1168,10 +1272,8 @@ def __init__(self, floating_ips: FloatingIPsResource) -> None:
11681272 self .create = to_streamed_response_wrapper (
11691273 floating_ips .create ,
11701274 )
1171- self .update = ( # pyright: ignore[reportDeprecated]
1172- to_streamed_response_wrapper (
1173- floating_ips .update , # pyright: ignore[reportDeprecated],
1174- )
1275+ self .update = to_streamed_response_wrapper (
1276+ floating_ips .update ,
11751277 )
11761278 self .list = to_streamed_response_wrapper (
11771279 floating_ips .list ,
@@ -1207,10 +1309,8 @@ def __init__(self, floating_ips: AsyncFloatingIPsResource) -> None:
12071309 self .create = async_to_streamed_response_wrapper (
12081310 floating_ips .create ,
12091311 )
1210- self .update = ( # pyright: ignore[reportDeprecated]
1211- async_to_streamed_response_wrapper (
1212- floating_ips .update , # pyright: ignore[reportDeprecated],
1213- )
1312+ self .update = async_to_streamed_response_wrapper (
1313+ floating_ips .update ,
12141314 )
12151315 self .list = async_to_streamed_response_wrapper (
12161316 floating_ips .list ,
0 commit comments