|
26 | 26 | async_to_streamed_response_wrapper, |
27 | 27 | ) |
28 | 28 | from ......_base_client import make_request_options |
29 | | -from ......types.cloud.k8s.clusters import pool_create_params, pool_resize_params, pool_update_params |
| 29 | +from ......types.cloud.k8s.clusters import ( |
| 30 | + pool_create_params, |
| 31 | + pool_resize_params, |
| 32 | + pool_update_params, |
| 33 | + pool_check_quota_params, |
| 34 | +) |
30 | 35 | from ......types.cloud.task_id_list import TaskIDList |
31 | 36 | from ......types.cloud.k8s.clusters.k8s_cluster_pool import K8SClusterPool |
32 | 37 | from ......types.cloud.k8s.clusters.k8s_cluster_pool_list import K8SClusterPoolList |
| 38 | +from ......types.cloud.k8s.clusters.k8s_cluster_pool_quota import K8SClusterPoolQuota |
33 | 39 |
|
34 | 40 | __all__ = ["PoolsResource", "AsyncPoolsResource"] |
35 | 41 |
|
@@ -307,6 +313,83 @@ def delete( |
307 | 313 | cast_to=TaskIDList, |
308 | 314 | ) |
309 | 315 |
|
| 316 | + def check_quota( |
| 317 | + self, |
| 318 | + *, |
| 319 | + project_id: int | None = None, |
| 320 | + region_id: int | None = None, |
| 321 | + flavor_id: str, |
| 322 | + boot_volume_size: Optional[int] | Omit = omit, |
| 323 | + max_node_count: Optional[int] | Omit = omit, |
| 324 | + min_node_count: Optional[int] | Omit = omit, |
| 325 | + name: Optional[str] | Omit = omit, |
| 326 | + node_count: Optional[int] | Omit = omit, |
| 327 | + servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] | Omit = omit, |
| 328 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 329 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 330 | + extra_headers: Headers | None = None, |
| 331 | + extra_query: Query | None = None, |
| 332 | + extra_body: Body | None = None, |
| 333 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 334 | + ) -> K8SClusterPoolQuota: |
| 335 | + """Calculate quota requirements for a new cluster pool before creation. |
| 336 | +
|
| 337 | + Returns |
| 338 | + exceeded quotas if regional limits would be violated. Use before pool creation |
| 339 | + to validate resource availability. Checks: CPU, RAM, volumes, VMs, GPUs, and |
| 340 | + baremetal quotas depending on flavor type. |
| 341 | +
|
| 342 | + Args: |
| 343 | + project_id: Project ID |
| 344 | +
|
| 345 | + region_id: Region ID |
| 346 | +
|
| 347 | + flavor_id: Flavor ID |
| 348 | +
|
| 349 | + boot_volume_size: Boot volume size |
| 350 | +
|
| 351 | + max_node_count: Maximum node count |
| 352 | +
|
| 353 | + min_node_count: Minimum node count |
| 354 | +
|
| 355 | + name: Name of the cluster pool |
| 356 | +
|
| 357 | + node_count: Maximum node count |
| 358 | +
|
| 359 | + servergroup_policy: Server group policy: anti-affinity, soft-anti-affinity or affinity |
| 360 | +
|
| 361 | + extra_headers: Send extra headers |
| 362 | +
|
| 363 | + extra_query: Add additional query parameters to the request |
| 364 | +
|
| 365 | + extra_body: Add additional JSON properties to the request |
| 366 | +
|
| 367 | + timeout: Override the client-level default timeout for this request, in seconds |
| 368 | + """ |
| 369 | + if project_id is None: |
| 370 | + project_id = self._client._get_cloud_project_id_path_param() |
| 371 | + if region_id is None: |
| 372 | + region_id = self._client._get_cloud_region_id_path_param() |
| 373 | + return self._post( |
| 374 | + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/pools/check_limits", |
| 375 | + body=maybe_transform( |
| 376 | + { |
| 377 | + "flavor_id": flavor_id, |
| 378 | + "boot_volume_size": boot_volume_size, |
| 379 | + "max_node_count": max_node_count, |
| 380 | + "min_node_count": min_node_count, |
| 381 | + "name": name, |
| 382 | + "node_count": node_count, |
| 383 | + "servergroup_policy": servergroup_policy, |
| 384 | + }, |
| 385 | + pool_check_quota_params.PoolCheckQuotaParams, |
| 386 | + ), |
| 387 | + options=make_request_options( |
| 388 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 389 | + ), |
| 390 | + cast_to=K8SClusterPoolQuota, |
| 391 | + ) |
| 392 | + |
310 | 393 | def get( |
311 | 394 | self, |
312 | 395 | pool_name: str, |
@@ -669,6 +752,83 @@ async def delete( |
669 | 752 | cast_to=TaskIDList, |
670 | 753 | ) |
671 | 754 |
|
| 755 | + async def check_quota( |
| 756 | + self, |
| 757 | + *, |
| 758 | + project_id: int | None = None, |
| 759 | + region_id: int | None = None, |
| 760 | + flavor_id: str, |
| 761 | + boot_volume_size: Optional[int] | Omit = omit, |
| 762 | + max_node_count: Optional[int] | Omit = omit, |
| 763 | + min_node_count: Optional[int] | Omit = omit, |
| 764 | + name: Optional[str] | Omit = omit, |
| 765 | + node_count: Optional[int] | Omit = omit, |
| 766 | + servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] | Omit = omit, |
| 767 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 768 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 769 | + extra_headers: Headers | None = None, |
| 770 | + extra_query: Query | None = None, |
| 771 | + extra_body: Body | None = None, |
| 772 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 773 | + ) -> K8SClusterPoolQuota: |
| 774 | + """Calculate quota requirements for a new cluster pool before creation. |
| 775 | +
|
| 776 | + Returns |
| 777 | + exceeded quotas if regional limits would be violated. Use before pool creation |
| 778 | + to validate resource availability. Checks: CPU, RAM, volumes, VMs, GPUs, and |
| 779 | + baremetal quotas depending on flavor type. |
| 780 | +
|
| 781 | + Args: |
| 782 | + project_id: Project ID |
| 783 | +
|
| 784 | + region_id: Region ID |
| 785 | +
|
| 786 | + flavor_id: Flavor ID |
| 787 | +
|
| 788 | + boot_volume_size: Boot volume size |
| 789 | +
|
| 790 | + max_node_count: Maximum node count |
| 791 | +
|
| 792 | + min_node_count: Minimum node count |
| 793 | +
|
| 794 | + name: Name of the cluster pool |
| 795 | +
|
| 796 | + node_count: Maximum node count |
| 797 | +
|
| 798 | + servergroup_policy: Server group policy: anti-affinity, soft-anti-affinity or affinity |
| 799 | +
|
| 800 | + extra_headers: Send extra headers |
| 801 | +
|
| 802 | + extra_query: Add additional query parameters to the request |
| 803 | +
|
| 804 | + extra_body: Add additional JSON properties to the request |
| 805 | +
|
| 806 | + timeout: Override the client-level default timeout for this request, in seconds |
| 807 | + """ |
| 808 | + if project_id is None: |
| 809 | + project_id = self._client._get_cloud_project_id_path_param() |
| 810 | + if region_id is None: |
| 811 | + region_id = self._client._get_cloud_region_id_path_param() |
| 812 | + return await self._post( |
| 813 | + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/pools/check_limits", |
| 814 | + body=await async_maybe_transform( |
| 815 | + { |
| 816 | + "flavor_id": flavor_id, |
| 817 | + "boot_volume_size": boot_volume_size, |
| 818 | + "max_node_count": max_node_count, |
| 819 | + "min_node_count": min_node_count, |
| 820 | + "name": name, |
| 821 | + "node_count": node_count, |
| 822 | + "servergroup_policy": servergroup_policy, |
| 823 | + }, |
| 824 | + pool_check_quota_params.PoolCheckQuotaParams, |
| 825 | + ), |
| 826 | + options=make_request_options( |
| 827 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 828 | + ), |
| 829 | + cast_to=K8SClusterPoolQuota, |
| 830 | + ) |
| 831 | + |
672 | 832 | async def get( |
673 | 833 | self, |
674 | 834 | pool_name: str, |
@@ -774,6 +934,9 @@ def __init__(self, pools: PoolsResource) -> None: |
774 | 934 | self.delete = to_raw_response_wrapper( |
775 | 935 | pools.delete, |
776 | 936 | ) |
| 937 | + self.check_quota = to_raw_response_wrapper( |
| 938 | + pools.check_quota, |
| 939 | + ) |
777 | 940 | self.get = to_raw_response_wrapper( |
778 | 941 | pools.get, |
779 | 942 | ) |
@@ -802,6 +965,9 @@ def __init__(self, pools: AsyncPoolsResource) -> None: |
802 | 965 | self.delete = async_to_raw_response_wrapper( |
803 | 966 | pools.delete, |
804 | 967 | ) |
| 968 | + self.check_quota = async_to_raw_response_wrapper( |
| 969 | + pools.check_quota, |
| 970 | + ) |
805 | 971 | self.get = async_to_raw_response_wrapper( |
806 | 972 | pools.get, |
807 | 973 | ) |
@@ -830,6 +996,9 @@ def __init__(self, pools: PoolsResource) -> None: |
830 | 996 | self.delete = to_streamed_response_wrapper( |
831 | 997 | pools.delete, |
832 | 998 | ) |
| 999 | + self.check_quota = to_streamed_response_wrapper( |
| 1000 | + pools.check_quota, |
| 1001 | + ) |
833 | 1002 | self.get = to_streamed_response_wrapper( |
834 | 1003 | pools.get, |
835 | 1004 | ) |
@@ -858,6 +1027,9 @@ def __init__(self, pools: AsyncPoolsResource) -> None: |
858 | 1027 | self.delete = async_to_streamed_response_wrapper( |
859 | 1028 | pools.delete, |
860 | 1029 | ) |
| 1030 | + self.check_quota = async_to_streamed_response_wrapper( |
| 1031 | + pools.check_quota, |
| 1032 | + ) |
861 | 1033 | self.get = async_to_streamed_response_wrapper( |
862 | 1034 | pools.get, |
863 | 1035 | ) |
|
0 commit comments