Skip to content

Commit cba170c

Browse files
feat(cloud): use PATCH /v2/lbpools
1 parent 6fee9ab commit cba170c

File tree

3 files changed

+34
-10
lines changed

3 files changed

+34
-10
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 447
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-21dade7f2034ff31578d98a7d0e769aa271906ace022862be072adc14176a108.yml
33
openapi_spec_hash: a6b097bcb1ea27498a93ef4d26a35f90
4-
config_hash: 2f0d48b4e32c9c906836a67e06a1d72b
4+
config_hash: 0eef23ac91befdd529503f40af5ea9b1

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ Methods:
258258
Methods:
259259

260260
- <code title="post /cloud/v1/lbpools/{project_id}/{region_id}">client.cloud.load_balancers.pools.<a href="./src/gcore/resources/cloud/load_balancers/pools/pools.py">create</a>(\*, project_id, region_id, \*\*<a href="src/gcore/types/cloud/load_balancers/pool_create_params.py">params</a>) -> <a href="./src/gcore/types/cloud/task_id_list.py">TaskIDList</a></code>
261-
- <code title="patch /cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}">client.cloud.load_balancers.pools.<a href="./src/gcore/resources/cloud/load_balancers/pools/pools.py">update</a>(pool_id, \*, project_id, region_id, \*\*<a href="src/gcore/types/cloud/load_balancers/pool_update_params.py">params</a>) -> <a href="./src/gcore/types/cloud/task_id_list.py">TaskIDList</a></code>
261+
- <code title="patch /cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}">client.cloud.load_balancers.pools.<a href="./src/gcore/resources/cloud/load_balancers/pools/pools.py">update</a>(pool_id, \*, project_id, region_id, \*\*<a href="src/gcore/types/cloud/load_balancers/pool_update_params.py">params</a>) -> <a href="./src/gcore/types/cloud/task_id_list.py">TaskIDList</a></code>
262262
- <code title="get /cloud/v1/lbpools/{project_id}/{region_id}">client.cloud.load_balancers.pools.<a href="./src/gcore/resources/cloud/load_balancers/pools/pools.py">list</a>(\*, project_id, region_id, \*\*<a href="src/gcore/types/cloud/load_balancers/pool_list_params.py">params</a>) -> <a href="./src/gcore/types/cloud/load_balancer_pool_list.py">LoadBalancerPoolList</a></code>
263263
- <code title="delete /cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}">client.cloud.load_balancers.pools.<a href="./src/gcore/resources/cloud/load_balancers/pools/pools.py">delete</a>(pool_id, \*, project_id, region_id) -> <a href="./src/gcore/types/cloud/task_id_list.py">TaskIDList</a></code>
264264
- <code title="get /cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}">client.cloud.load_balancers.pools.<a href="./src/gcore/resources/cloud/load_balancers/pools/pools.py">get</a>(pool_id, \*, project_id, region_id) -> <a href="./src/gcore/types/cloud/load_balancer_pool.py">LoadBalancerPool</a></code>

src/gcore/resources/cloud/load_balancers/pools/pools.py

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,21 @@ def update(
199199
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
200200
) -> TaskIDList:
201201
"""
202-
Changes provided here will overwrite existing load balancer pool settings.
203-
Undefined fields will be kept as is. Complex objects need to be specified fully,
204-
they will be overwritten.
202+
Updates the specified load balancer pool with the provided changes.
203+
**Behavior:**
204+
205+
- Simple fields (strings, numbers, booleans) will be updated if provided
206+
- Complex objects (nested structures like members, health monitors, etc.) must
207+
be specified completely - partial updates are not supported for these objects
208+
- Undefined fields will remain unchanged
209+
- If no change is detected for a specific field compared to the current pool
210+
state, that field will be skipped
211+
- If no changes are detected at all across all fields, no task will be created
212+
and an empty task list will be returned **Examples of complex objects that
213+
require full specification:**
214+
- Pool members: All member properties must be provided when updating members
215+
- Health monitors: Complete health monitor configuration must be specified
216+
- Session persistence: Full session persistence settings must be included
205217
206218
Args:
207219
project_id: Project ID
@@ -250,7 +262,7 @@ def update(
250262
if not pool_id:
251263
raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}")
252264
return self._patch(
253-
f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}",
265+
f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}",
254266
body=maybe_transform(
255267
{
256268
"ca_secret_id": ca_secret_id,
@@ -745,9 +757,21 @@ async def update(
745757
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
746758
) -> TaskIDList:
747759
"""
748-
Changes provided here will overwrite existing load balancer pool settings.
749-
Undefined fields will be kept as is. Complex objects need to be specified fully,
750-
they will be overwritten.
760+
Updates the specified load balancer pool with the provided changes.
761+
**Behavior:**
762+
763+
- Simple fields (strings, numbers, booleans) will be updated if provided
764+
- Complex objects (nested structures like members, health monitors, etc.) must
765+
be specified completely - partial updates are not supported for these objects
766+
- Undefined fields will remain unchanged
767+
- If no change is detected for a specific field compared to the current pool
768+
state, that field will be skipped
769+
- If no changes are detected at all across all fields, no task will be created
770+
and an empty task list will be returned **Examples of complex objects that
771+
require full specification:**
772+
- Pool members: All member properties must be provided when updating members
773+
- Health monitors: Complete health monitor configuration must be specified
774+
- Session persistence: Full session persistence settings must be included
751775
752776
Args:
753777
project_id: Project ID
@@ -796,7 +820,7 @@ async def update(
796820
if not pool_id:
797821
raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}")
798822
return await self._patch(
799-
f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}",
823+
f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}",
800824
body=await async_maybe_transform(
801825
{
802826
"ca_secret_id": ca_secret_id,

0 commit comments

Comments
 (0)