diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a36746b8..caf5ca3f 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.25.0" + ".": "0.26.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 99de8068..f80e20ce 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 640 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-739b0d84ccefaa883a2334ad16738cc87ec625ded28ee0e2e11781f17ba36580.yml -openapi_spec_hash: deb6a4c127edd808cfd8c8eb9eb9610b -config_hash: 1607041fe51cd832db709af848355624 +configured_endpoints: 641 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2c3abe1f1637f97f6bc750aff6eb77efc45ac2b527376541ac2af6b9626b35af.yml +openapi_spec_hash: ff74a4ccd9ec5ddb1a65963d52e709ba +config_hash: 0df262ae146e43627e9daf27e6b3bebf diff --git a/CHANGELOG.md b/CHANGELOG.md index d954d7ed..129d52ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,35 @@ # Changelog +## 0.26.0 (2025-12-23) + +Full Changelog: [v0.25.0...v0.26.0](https://github.com/G-Core/gcore-python/compare/v0.25.0...v0.26.0) + +### ⚠ BREAKING CHANGES + +* **cloud:** move methods to gpu_baremetal_clusters.interfaces.attach()/detach() +* **cloud:** restructure to be gpu_virtual.clusters + +### Features + +* **api:** aggregated API specs update ([3a272e8](https://github.com/G-Core/gcore-python/commit/3a272e8b9a0399be48094ce82cc9127e59a2867a)) +* **api:** aggregated API specs update ([789277a](https://github.com/G-Core/gcore-python/commit/789277a61a3ead490d9b8b0f439e0e21100036ba)) +* **cloud:** add k8s cluster pools check quotas method ([326786c](https://github.com/G-Core/gcore-python/commit/326786cd4d499fffe760f308326bbd79003e4856)) + + +### Bug Fixes + +* **cloud:** move methods to gpu_baremetal_clusters.interfaces.attach()/detach() ([053ebcf](https://github.com/G-Core/gcore-python/commit/053ebcfdf462a66c3edc929e052b75d8afd51a20)) +* **cloud:** restructure to be gpu_virtual.clusters ([36b7b63](https://github.com/G-Core/gcore-python/commit/36b7b63d98a20c3927069bb396154b068304f321)) +* **examples:** make code consistent with comment ([85a0331](https://github.com/G-Core/gcore-python/commit/85a03310d31fa3ac6b74897b8754a19bd905df75)) +* use async_to_httpx_files in patch method ([88c4050](https://github.com/G-Core/gcore-python/commit/88c4050f59d8a55796ab553a60b1e55aaadc81ca)) + + +### Chores + +* **internal:** add missing files argument to base client ([7d81efb](https://github.com/G-Core/gcore-python/commit/7d81efb323f72cdcaed3faa59a4fc5182f0fedab)) +* **internal:** codegen related update ([3c38f42](https://github.com/G-Core/gcore-python/commit/3c38f4280bc1b57f987ff984c7504c4781d74ab8)) +* speedup initial import ([ff1db23](https://github.com/G-Core/gcore-python/commit/ff1db23e58ffc5e118bd1fed3585ffc0cd04855e)) + ## 0.25.0 (2025-12-12) Full Changelog: [v0.24.0...v0.25.0](https://github.com/G-Core/gcore-python/compare/v0.24.0...v0.25.0) diff --git a/api.md b/api.md index 06fef89f..562bb4ed 100644 --- a/api.md +++ b/api.md @@ -798,6 +798,8 @@ Methods: Methods: - client.cloud.gpu_baremetal_clusters.interfaces.list(cluster_id, \*, project_id, region_id) -> NetworkInterfaceList +- client.cloud.gpu_baremetal_clusters.interfaces.attach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal_clusters.interfaces.detach(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList ### Servers @@ -815,8 +817,6 @@ Methods: - client.cloud.gpu_baremetal_clusters.servers.list(cluster_id, \*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUBaremetalClusterServer] - client.cloud.gpu_baremetal_clusters.servers.delete(instance_id, \*, project_id, region_id, cluster_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal_clusters.servers.attach_interface(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_baremetal_clusters.servers.detach_interface(instance_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.gpu_baremetal_clusters.servers.get_console(instance_id, \*, project_id, region_id) -> Console - client.cloud.gpu_baremetal_clusters.servers.powercycle(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1 - client.cloud.gpu_baremetal_clusters.servers.reboot(instance_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1 @@ -842,29 +842,31 @@ Methods: - client.cloud.gpu_baremetal_clusters.images.get(image_id, \*, project_id, region_id) -> GPUImage - client.cloud.gpu_baremetal_clusters.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList -## GPUVirtualClusters +## GPUVirtual + +### Clusters Types: ```python -from gcore.types.cloud import GPUVirtualCluster +from gcore.types.cloud.gpu_virtual import GPUVirtualCluster ``` Methods: -- client.cloud.gpu_virtual_clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_virtual_clusters.update(cluster_id, \*, project_id, region_id, \*\*params) -> GPUVirtualCluster -- client.cloud.gpu_virtual_clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUVirtualCluster] -- client.cloud.gpu_virtual_clusters.delete(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_virtual_clusters.action(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.gpu_virtual_clusters.get(cluster_id, \*, project_id, region_id) -> GPUVirtualCluster +- client.cloud.gpu_virtual.clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_virtual.clusters.update(cluster_id, \*, project_id, region_id, \*\*params) -> GPUVirtualCluster +- client.cloud.gpu_virtual.clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUVirtualCluster] +- client.cloud.gpu_virtual.clusters.delete(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_virtual.clusters.action(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_virtual.clusters.get(cluster_id, \*, project_id, region_id) -> GPUVirtualCluster -### Servers +#### Servers Types: ```python -from gcore.types.cloud.gpu_virtual_clusters import ( +from gcore.types.cloud.gpu_virtual.clusters import ( GPUVirtualClusterServer, GPUVirtualClusterServerList, ) @@ -872,15 +874,15 @@ from gcore.types.cloud.gpu_virtual_clusters import ( Methods: -- client.cloud.gpu_virtual_clusters.servers.list(cluster_id, \*, project_id, region_id, \*\*params) -> GPUVirtualClusterServerList -- client.cloud.gpu_virtual_clusters.servers.delete(server_id, \*, project_id, region_id, cluster_id, \*\*params) -> TaskIDList +- client.cloud.gpu_virtual.clusters.servers.list(cluster_id, \*, project_id, region_id, \*\*params) -> GPUVirtualClusterServerList +- client.cloud.gpu_virtual.clusters.servers.delete(server_id, \*, project_id, region_id, cluster_id, \*\*params) -> TaskIDList -### Volumes +#### Volumes Types: ```python -from gcore.types.cloud.gpu_virtual_clusters import ( +from gcore.types.cloud.gpu_virtual.clusters import ( GPUVirtualClusterVolume, GPUVirtualClusterVolumeList, ) @@ -888,40 +890,40 @@ from gcore.types.cloud.gpu_virtual_clusters import ( Methods: -- client.cloud.gpu_virtual_clusters.volumes.list(cluster_id, \*, project_id, region_id) -> GPUVirtualClusterVolumeList +- client.cloud.gpu_virtual.clusters.volumes.list(cluster_id, \*, project_id, region_id) -> GPUVirtualClusterVolumeList -### Interfaces +#### Interfaces Types: ```python -from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualInterface, GPUVirtualInterfaceList +from gcore.types.cloud.gpu_virtual.clusters import GPUVirtualInterface, GPUVirtualInterfaceList ``` Methods: -- client.cloud.gpu_virtual_clusters.interfaces.list(cluster_id, \*, project_id, region_id) -> GPUVirtualInterfaceList +- client.cloud.gpu_virtual.clusters.interfaces.list(cluster_id, \*, project_id, region_id) -> GPUVirtualInterfaceList -### Flavors +#### Flavors Types: ```python -from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualFlavor, GPUVirtualFlavorList +from gcore.types.cloud.gpu_virtual.clusters import GPUVirtualFlavor, GPUVirtualFlavorList ``` Methods: -- client.cloud.gpu_virtual_clusters.flavors.list(\*, project_id, region_id, \*\*params) -> GPUVirtualFlavorList +- client.cloud.gpu_virtual.clusters.flavors.list(\*, project_id, region_id, \*\*params) -> GPUVirtualFlavorList -### Images +#### Images Methods: -- client.cloud.gpu_virtual_clusters.images.list(\*, project_id, region_id) -> GPUImageList -- client.cloud.gpu_virtual_clusters.images.delete(image_id, \*, project_id, region_id) -> TaskIDList -- client.cloud.gpu_virtual_clusters.images.get(image_id, \*, project_id, region_id) -> GPUImage -- client.cloud.gpu_virtual_clusters.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_virtual.clusters.images.list(\*, project_id, region_id) -> GPUImageList +- client.cloud.gpu_virtual.clusters.images.delete(image_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.gpu_virtual.clusters.images.get(image_id, \*, project_id, region_id) -> GPUImage +- client.cloud.gpu_virtual.clusters.images.upload(\*, project_id, region_id, \*\*params) -> TaskIDList ## Instances @@ -1046,7 +1048,7 @@ Methods: Types: ```python -from gcore.types.cloud.k8s.clusters import K8SClusterPool, K8SClusterPoolList +from gcore.types.cloud.k8s.clusters import K8SClusterPool, K8SClusterPoolList, K8SClusterPoolQuota ``` Methods: @@ -1055,6 +1057,7 @@ Methods: - client.cloud.k8s.clusters.pools.update(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> K8SClusterPool - client.cloud.k8s.clusters.pools.list(cluster_name, \*, project_id, region_id) -> K8SClusterPoolList - client.cloud.k8s.clusters.pools.delete(pool_name, \*, project_id, region_id, cluster_name) -> TaskIDList +- client.cloud.k8s.clusters.pools.check_quota(\*, project_id, region_id, \*\*params) -> K8SClusterPoolQuota - client.cloud.k8s.clusters.pools.get(pool_name, \*, project_id, region_id, cluster_name) -> K8SClusterPool - client.cloud.k8s.clusters.pools.resize(pool_name, \*, project_id, region_id, cluster_name, \*\*params) -> TaskIDList @@ -2155,7 +2158,7 @@ Methods: - client.dns.network_mappings.get(id) -> DNSNetworkMapping - client.dns.network_mappings.get_by_name(name) -> DNSNetworkMapping - client.dns.network*mappings.import*() -> NetworkMappingImportResponse -- client.dns.network_mappings.replace(path_id, \*\*params) -> object +- client.dns.network_mappings.replace(id, \*\*params) -> object # Storage diff --git a/pyproject.toml b/pyproject.toml index c810ecea..6d4eae5e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.25.0" +version = "0.26.0" description = "The official Python library for the gcore API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/gcore/_version.py b/src/gcore/_version.py index 7771dae8..3749030a 100644 --- a/src/gcore/_version.py +++ b/src/gcore/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "gcore" -__version__ = "0.25.0" # x-release-please-version +__version__ = "0.26.0" # x-release-please-version diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index aa77fd72..e4c125cc 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -152,6 +152,14 @@ FileSharesResourceWithStreamingResponse, AsyncFileSharesResourceWithStreamingResponse, ) +from .gpu_virtual import ( + GPUVirtualResource, + AsyncGPUVirtualResource, + GPUVirtualResourceWithRawResponse, + AsyncGPUVirtualResourceWithRawResponse, + GPUVirtualResourceWithStreamingResponse, + AsyncGPUVirtualResourceWithStreamingResponse, +) from .cost_reports import ( CostReportsResource, AsyncCostReportsResource, @@ -216,14 +224,6 @@ BillingReservationsResourceWithStreamingResponse, AsyncBillingReservationsResourceWithStreamingResponse, ) -from .gpu_virtual_clusters import ( - GPUVirtualClustersResource, - AsyncGPUVirtualClustersResource, - GPUVirtualClustersResourceWithRawResponse, - AsyncGPUVirtualClustersResourceWithRawResponse, - GPUVirtualClustersResourceWithStreamingResponse, - AsyncGPUVirtualClustersResourceWithStreamingResponse, -) from .gpu_baremetal_clusters import ( GPUBaremetalClustersResource, AsyncGPUBaremetalClustersResource, @@ -360,12 +360,12 @@ "AsyncGPUBaremetalClustersResourceWithRawResponse", "GPUBaremetalClustersResourceWithStreamingResponse", "AsyncGPUBaremetalClustersResourceWithStreamingResponse", - "GPUVirtualClustersResource", - "AsyncGPUVirtualClustersResource", - "GPUVirtualClustersResourceWithRawResponse", - "AsyncGPUVirtualClustersResourceWithRawResponse", - "GPUVirtualClustersResourceWithStreamingResponse", - "AsyncGPUVirtualClustersResourceWithStreamingResponse", + "GPUVirtualResource", + "AsyncGPUVirtualResource", + "GPUVirtualResourceWithRawResponse", + "AsyncGPUVirtualResourceWithRawResponse", + "GPUVirtualResourceWithStreamingResponse", + "AsyncGPUVirtualResourceWithStreamingResponse", "InstancesResource", "AsyncInstancesResource", "InstancesResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index 6147e663..9db7efd3 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -188,6 +188,14 @@ FileSharesResourceWithStreamingResponse, AsyncFileSharesResourceWithStreamingResponse, ) +from .gpu_virtual.gpu_virtual import ( + GPUVirtualResource, + AsyncGPUVirtualResource, + GPUVirtualResourceWithRawResponse, + AsyncGPUVirtualResourceWithRawResponse, + GPUVirtualResourceWithStreamingResponse, + AsyncGPUVirtualResourceWithStreamingResponse, +) from .load_balancers.load_balancers import ( LoadBalancersResource, AsyncLoadBalancersResource, @@ -212,14 +220,6 @@ ReservedFixedIPsResourceWithStreamingResponse, AsyncReservedFixedIPsResourceWithStreamingResponse, ) -from .gpu_virtual_clusters.gpu_virtual_clusters import ( - GPUVirtualClustersResource, - AsyncGPUVirtualClustersResource, - GPUVirtualClustersResourceWithRawResponse, - AsyncGPUVirtualClustersResourceWithRawResponse, - GPUVirtualClustersResourceWithStreamingResponse, - AsyncGPUVirtualClustersResourceWithStreamingResponse, -) from .gpu_baremetal_clusters.gpu_baremetal_clusters import ( GPUBaremetalClustersResource, AsyncGPUBaremetalClustersResource, @@ -325,8 +325,8 @@ def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResource: return GPUBaremetalClustersResource(self._client) @cached_property - def gpu_virtual_clusters(self) -> GPUVirtualClustersResource: - return GPUVirtualClustersResource(self._client) + def gpu_virtual(self) -> GPUVirtualResource: + return GPUVirtualResource(self._client) @cached_property def instances(self) -> InstancesResource: @@ -465,8 +465,8 @@ def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResource: return AsyncGPUBaremetalClustersResource(self._client) @cached_property - def gpu_virtual_clusters(self) -> AsyncGPUVirtualClustersResource: - return AsyncGPUVirtualClustersResource(self._client) + def gpu_virtual(self) -> AsyncGPUVirtualResource: + return AsyncGPUVirtualResource(self._client) @cached_property def instances(self) -> AsyncInstancesResource: @@ -608,8 +608,8 @@ def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResourceWithRawResponse: return GPUBaremetalClustersResourceWithRawResponse(self._cloud.gpu_baremetal_clusters) @cached_property - def gpu_virtual_clusters(self) -> GPUVirtualClustersResourceWithRawResponse: - return GPUVirtualClustersResourceWithRawResponse(self._cloud.gpu_virtual_clusters) + def gpu_virtual(self) -> GPUVirtualResourceWithRawResponse: + return GPUVirtualResourceWithRawResponse(self._cloud.gpu_virtual) @cached_property def instances(self) -> InstancesResourceWithRawResponse: @@ -732,8 +732,8 @@ def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResourceWithRawResp return AsyncGPUBaremetalClustersResourceWithRawResponse(self._cloud.gpu_baremetal_clusters) @cached_property - def gpu_virtual_clusters(self) -> AsyncGPUVirtualClustersResourceWithRawResponse: - return AsyncGPUVirtualClustersResourceWithRawResponse(self._cloud.gpu_virtual_clusters) + def gpu_virtual(self) -> AsyncGPUVirtualResourceWithRawResponse: + return AsyncGPUVirtualResourceWithRawResponse(self._cloud.gpu_virtual) @cached_property def instances(self) -> AsyncInstancesResourceWithRawResponse: @@ -856,8 +856,8 @@ def gpu_baremetal_clusters(self) -> GPUBaremetalClustersResourceWithStreamingRes return GPUBaremetalClustersResourceWithStreamingResponse(self._cloud.gpu_baremetal_clusters) @cached_property - def gpu_virtual_clusters(self) -> GPUVirtualClustersResourceWithStreamingResponse: - return GPUVirtualClustersResourceWithStreamingResponse(self._cloud.gpu_virtual_clusters) + def gpu_virtual(self) -> GPUVirtualResourceWithStreamingResponse: + return GPUVirtualResourceWithStreamingResponse(self._cloud.gpu_virtual) @cached_property def instances(self) -> InstancesResourceWithStreamingResponse: @@ -980,8 +980,8 @@ def gpu_baremetal_clusters(self) -> AsyncGPUBaremetalClustersResourceWithStreami return AsyncGPUBaremetalClustersResourceWithStreamingResponse(self._cloud.gpu_baremetal_clusters) @cached_property - def gpu_virtual_clusters(self) -> AsyncGPUVirtualClustersResourceWithStreamingResponse: - return AsyncGPUVirtualClustersResourceWithStreamingResponse(self._cloud.gpu_virtual_clusters) + def gpu_virtual(self) -> AsyncGPUVirtualResourceWithStreamingResponse: + return AsyncGPUVirtualResourceWithStreamingResponse(self._cloud.gpu_virtual) @cached_property def instances(self) -> AsyncInstancesResourceWithStreamingResponse: diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py index 63371d8e..f7c10022 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -2,9 +2,13 @@ from __future__ import annotations +from typing import Iterable +from typing_extensions import Literal, overload + import httpx -from ...._types import Body, Query, Headers, NotGiven, not_given +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -14,6 +18,8 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options +from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.gpu_baremetal_clusters import interface_attach_params, interface_detach_params from ....types.cloud.network_interface_list import NetworkInterfaceList __all__ = ["InterfacesResource", "AsyncInterfacesResource"] @@ -78,6 +84,304 @@ def list( cast_to=NetworkInterfaceList, ) + @overload + def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | Omit = omit, + type: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Attach interface to bare metal GPU cluster server + + Args: + ddos_profile: Advanced DDoS protection. + + interface_name: Interface name + + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. + + port_group: Each group will be added to the separate trunk. + + security_groups: List of security group IDs + + type: Must be 'external'. Union tag + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + subnet_id: str, + ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Attach interface to bare metal GPU cluster server + + Args: + subnet_id: Port will get an IP address from this subnet + + ddos_profile: Advanced DDoS protection. + + interface_name: Interface name + + port_group: Each group will be added to the separate trunk. + + security_groups: List of security group IDs + + type: Must be 'subnet' + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + network_id: str, + ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Attach interface to bare metal GPU cluster server + + Args: + network_id: Port will get an IP address in this network subnet + + ddos_profile: Advanced DDoS protection. + + interface_name: Interface name + + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. + + port_group: Each group will be added to the separate trunk. + + security_groups: List of security group IDs + + type: Must be '`any_subnet`' + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + port_id: str, + ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Attach interface to bare metal GPU cluster server + + Args: + port_id: Port ID + + ddos_profile: Advanced DDoS protection. + + interface_name: Interface name + + port_group: Each group will be added to the separate trunk. + + security_groups: List of security group IDs + + type: Must be '`reserved_fixed_ip`'. Union tag + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + | interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile + | interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile + | interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile + | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] + | Omit = omit, + type: str | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + port_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._post( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + body=maybe_transform( + { + "ddos_profile": ddos_profile, + "interface_name": interface_name, + "ip_family": ip_family, + "port_group": port_group, + "security_groups": security_groups, + "type": type, + "subnet_id": subnet_id, + "network_id": network_id, + "port_id": port_id, + }, + interface_attach_params.InterfaceAttachParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def detach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ip_address: str, + port_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Detach interface from bare metal GPU cluster server + + Args: + ip_address: IP address + + port_id: ID of the port + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return self._post( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + body=maybe_transform( + { + "ip_address": ip_address, + "port_id": port_id, + }, + interface_detach_params.InterfaceDetachParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + class AsyncInterfacesResource(AsyncAPIResource): @cached_property @@ -138,6 +442,304 @@ async def list( cast_to=NetworkInterfaceList, ) + @overload + async def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | Omit = omit, + type: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Attach interface to bare metal GPU cluster server + + Args: + ddos_profile: Advanced DDoS protection. + + interface_name: Interface name + + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. + + port_group: Each group will be added to the separate trunk. + + security_groups: List of security group IDs + + type: Must be 'external'. Union tag + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + subnet_id: str, + ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Attach interface to bare metal GPU cluster server + + Args: + subnet_id: Port will get an IP address from this subnet + + ddos_profile: Advanced DDoS protection. + + interface_name: Interface name + + port_group: Each group will be added to the separate trunk. + + security_groups: List of security group IDs + + type: Must be 'subnet' + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + network_id: str, + ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Attach interface to bare metal GPU cluster server + + Args: + network_id: Port will get an IP address in this network subnet + + ddos_profile: Advanced DDoS protection. + + interface_name: Interface name + + ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. + + port_group: Each group will be added to the separate trunk. + + security_groups: List of security group IDs + + type: Must be '`any_subnet`' + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + port_id: str, + ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Attach interface to bare metal GPU cluster server + + Args: + port_id: Port ID + + ddos_profile: Advanced DDoS protection. + + interface_name: Interface name + + port_group: Each group will be added to the separate trunk. + + security_groups: List of security group IDs + + type: Must be '`reserved_fixed_ip`'. Union tag + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + async def attach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile + | interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile + | interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile + | interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile + | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] + | Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] + | Omit = omit, + type: str | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + port_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._post( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + body=await async_maybe_transform( + { + "ddos_profile": ddos_profile, + "interface_name": interface_name, + "ip_family": ip_family, + "port_group": port_group, + "security_groups": security_groups, + "type": type, + "subnet_id": subnet_id, + "network_id": network_id, + "port_id": port_id, + }, + interface_attach_params.InterfaceAttachParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def detach( + self, + instance_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + ip_address: str, + port_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Detach interface from bare metal GPU cluster server + + Args: + ip_address: IP address + + port_id: ID of the port + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not instance_id: + raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") + return await self._post( + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + body=await async_maybe_transform( + { + "ip_address": ip_address, + "port_id": port_id, + }, + interface_detach_params.InterfaceDetachParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + class InterfacesResourceWithRawResponse: def __init__(self, interfaces: InterfacesResource) -> None: @@ -146,6 +748,12 @@ def __init__(self, interfaces: InterfacesResource) -> None: self.list = to_raw_response_wrapper( interfaces.list, ) + self.attach = to_raw_response_wrapper( + interfaces.attach, + ) + self.detach = to_raw_response_wrapper( + interfaces.detach, + ) class AsyncInterfacesResourceWithRawResponse: @@ -155,6 +763,12 @@ def __init__(self, interfaces: AsyncInterfacesResource) -> None: self.list = async_to_raw_response_wrapper( interfaces.list, ) + self.attach = async_to_raw_response_wrapper( + interfaces.attach, + ) + self.detach = async_to_raw_response_wrapper( + interfaces.detach, + ) class InterfacesResourceWithStreamingResponse: @@ -164,6 +778,12 @@ def __init__(self, interfaces: InterfacesResource) -> None: self.list = to_streamed_response_wrapper( interfaces.list, ) + self.attach = to_streamed_response_wrapper( + interfaces.attach, + ) + self.detach = to_streamed_response_wrapper( + interfaces.detach, + ) class AsyncInterfacesResourceWithStreamingResponse: @@ -173,3 +793,9 @@ def __init__(self, interfaces: AsyncInterfacesResource) -> None: self.list = async_to_streamed_response_wrapper( interfaces.list, ) + self.attach = async_to_streamed_response_wrapper( + interfaces.attach, + ) + self.detach = async_to_streamed_response_wrapper( + interfaces.detach, + ) diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index 0394a1b1..044c15a6 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -2,13 +2,13 @@ from __future__ import annotations -from typing import Union, Iterable +from typing import Union from datetime import datetime -from typing_extensions import Literal, overload +from typing_extensions import Literal import httpx -from ...._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -22,12 +22,7 @@ from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.console import Console from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.gpu_baremetal_clusters import ( - server_list_params, - server_delete_params, - server_attach_interface_params, - server_detach_interface_params, -) +from ....types.cloud.gpu_baremetal_clusters import server_list_params, server_delete_params from ....types.cloud.gpu_baremetal_clusters.gpu_baremetal_cluster_server import GPUBaremetalClusterServer from ....types.cloud.gpu_baremetal_clusters.gpu_baremetal_cluster_server_v1 import GPUBaremetalClusterServerV1 @@ -220,6 +215,7 @@ def delete( cast_to=TaskIDList, ) + def delete_and_poll( self, instance_id: str, @@ -235,7 +231,7 @@ def delete_and_poll( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a bare metal GPU server from cluster and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method. @@ -262,306 +258,6 @@ def delete_and_poll( polling_timeout_seconds=polling_timeout_seconds, ) - @overload - def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile | Omit = omit, - interface_name: str | Omit = omit, - ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Attach interface to bare metal GPU cluster server - - Args: - ddos_profile: Advanced DDoS protection. - - interface_name: Interface name - - ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - - port_group: Each group will be added to the separate trunk. - - security_groups: List of security group IDs - - type: Must be 'external'. Union tag - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - subnet_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, - interface_name: str | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Attach interface to bare metal GPU cluster server - - Args: - subnet_id: Port will get an IP address from this subnet - - ddos_profile: Advanced DDoS protection. - - interface_name: Interface name - - port_group: Each group will be added to the separate trunk. - - security_groups: List of security group IDs - - type: Must be 'subnet' - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - network_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, - interface_name: str | Omit = omit, - ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Attach interface to bare metal GPU cluster server - - Args: - network_id: Port will get an IP address in this network subnet - - ddos_profile: Advanced DDoS protection. - - interface_name: Interface name - - ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - - port_group: Each group will be added to the separate trunk. - - security_groups: List of security group IDs - - type: Must be '`any_subnet`' - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - port_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, - interface_name: str | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Attach interface to bare metal GPU cluster server - - Args: - port_id: Port ID - - ddos_profile: Advanced DDoS protection. - - interface_name: Interface name - - port_group: Each group will be added to the separate trunk. - - security_groups: List of security group IDs - - type: Must be '`reserved_fixed_ip`'. Union tag - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - | server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile - | server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile - | server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile - | Omit = omit, - interface_name: str | Omit = omit, - ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - subnet_id: str | Omit = omit, - network_id: str | Omit = omit, - port_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not instance_id: - raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") - return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", - body=maybe_transform( - { - "ddos_profile": ddos_profile, - "interface_name": interface_name, - "ip_family": ip_family, - "port_group": port_group, - "security_groups": security_groups, - "type": type, - "subnet_id": subnet_id, - "network_id": network_id, - "port_id": port_id, - }, - server_attach_interface_params.ServerAttachInterfaceParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - - def detach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - ip_address: str, - port_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Detach interface from bare metal GPU cluster server - - Args: - ip_address: IP address - - port_id: ID of the port - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not instance_id: - raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") - return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", - body=maybe_transform( - { - "ip_address": ip_address, - "port_id": port_id, - }, - server_detach_interface_params.ServerDetachInterfaceParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) def get_console( self, @@ -869,6 +565,7 @@ async def delete( cast_to=TaskIDList, ) + async def delete_and_poll( self, instance_id: str, @@ -884,7 +581,7 @@ async def delete_and_poll( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a bare metal GPU server from cluster and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method. @@ -911,306 +608,6 @@ async def delete_and_poll( polling_timeout_seconds=polling_timeout_seconds, ) - @overload - async def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile | Omit = omit, - interface_name: str | Omit = omit, - ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Attach interface to bare metal GPU cluster server - - Args: - ddos_profile: Advanced DDoS protection. - - interface_name: Interface name - - ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - - port_group: Each group will be added to the separate trunk. - - security_groups: List of security group IDs - - type: Must be 'external'. Union tag - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - subnet_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, - interface_name: str | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Attach interface to bare metal GPU cluster server - - Args: - subnet_id: Port will get an IP address from this subnet - - ddos_profile: Advanced DDoS protection. - - interface_name: Interface name - - port_group: Each group will be added to the separate trunk. - - security_groups: List of security group IDs - - type: Must be 'subnet' - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - network_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, - interface_name: str | Omit = omit, - ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Attach interface to bare metal GPU cluster server - - Args: - network_id: Port will get an IP address in this network subnet - - ddos_profile: Advanced DDoS protection. - - interface_name: Interface name - - ip_family: Which subnets should be selected: IPv4, IPv6 or use dual stack. - - port_group: Each group will be added to the separate trunk. - - security_groups: List of security group IDs - - type: Must be '`any_subnet`' - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - port_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, - interface_name: str | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Attach interface to bare metal GPU cluster server - - Args: - port_id: Port ID - - ddos_profile: Advanced DDoS protection. - - interface_name: Interface name - - port_group: Each group will be added to the separate trunk. - - security_groups: List of security group IDs - - type: Must be '`reserved_fixed_ip`'. Union tag - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - async def attach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - | server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile - | server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile - | server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile - | Omit = omit, - interface_name: str | Omit = omit, - ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, - port_group: int | Omit = omit, - security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | Omit = omit, - type: str | Omit = omit, - subnet_id: str | Omit = omit, - network_id: str | Omit = omit, - port_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not instance_id: - raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") - return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", - body=await async_maybe_transform( - { - "ddos_profile": ddos_profile, - "interface_name": interface_name, - "ip_family": ip_family, - "port_group": port_group, - "security_groups": security_groups, - "type": type, - "subnet_id": subnet_id, - "network_id": network_id, - "port_id": port_id, - }, - server_attach_interface_params.ServerAttachInterfaceParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - - async def detach_interface( - self, - instance_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - ip_address: str, - port_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - """ - Detach interface from bare metal GPU cluster server - - Args: - ip_address: IP address - - port_id: ID of the port - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not instance_id: - raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") - return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", - body=await async_maybe_transform( - { - "ip_address": ip_address, - "port_id": port_id, - }, - server_detach_interface_params.ServerDetachInterfaceParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) async def get_console( self, @@ -1340,12 +737,6 @@ def __init__(self, servers: ServersResource) -> None: self.delete = to_raw_response_wrapper( servers.delete, ) - self.attach_interface = to_raw_response_wrapper( - servers.attach_interface, - ) - self.detach_interface = to_raw_response_wrapper( - servers.detach_interface, - ) self.get_console = to_raw_response_wrapper( servers.get_console, ) @@ -1370,12 +761,6 @@ def __init__(self, servers: AsyncServersResource) -> None: self.delete = async_to_raw_response_wrapper( servers.delete, ) - self.attach_interface = async_to_raw_response_wrapper( - servers.attach_interface, - ) - self.detach_interface = async_to_raw_response_wrapper( - servers.detach_interface, - ) self.get_console = async_to_raw_response_wrapper( servers.get_console, ) @@ -1400,12 +785,6 @@ def __init__(self, servers: ServersResource) -> None: self.delete = to_streamed_response_wrapper( servers.delete, ) - self.attach_interface = to_streamed_response_wrapper( - servers.attach_interface, - ) - self.detach_interface = to_streamed_response_wrapper( - servers.detach_interface, - ) self.get_console = to_streamed_response_wrapper( servers.get_console, ) @@ -1430,12 +809,6 @@ def __init__(self, servers: AsyncServersResource) -> None: self.delete = async_to_streamed_response_wrapper( servers.delete, ) - self.attach_interface = async_to_streamed_response_wrapper( - servers.attach_interface, - ) - self.detach_interface = async_to_streamed_response_wrapper( - servers.detach_interface, - ) self.get_console = async_to_streamed_response_wrapper( servers.get_console, ) diff --git a/src/gcore/resources/cloud/gpu_virtual/__init__.py b/src/gcore/resources/cloud/gpu_virtual/__init__.py new file mode 100644 index 00000000..214d9c94 --- /dev/null +++ b/src/gcore/resources/cloud/gpu_virtual/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .clusters import ( + ClustersResource, + AsyncClustersResource, + ClustersResourceWithRawResponse, + AsyncClustersResourceWithRawResponse, + ClustersResourceWithStreamingResponse, + AsyncClustersResourceWithStreamingResponse, +) +from .gpu_virtual import ( + GPUVirtualResource, + AsyncGPUVirtualResource, + GPUVirtualResourceWithRawResponse, + AsyncGPUVirtualResourceWithRawResponse, + GPUVirtualResourceWithStreamingResponse, + AsyncGPUVirtualResourceWithStreamingResponse, +) + +__all__ = [ + "ClustersResource", + "AsyncClustersResource", + "ClustersResourceWithRawResponse", + "AsyncClustersResourceWithRawResponse", + "ClustersResourceWithStreamingResponse", + "AsyncClustersResourceWithStreamingResponse", + "GPUVirtualResource", + "AsyncGPUVirtualResource", + "GPUVirtualResourceWithRawResponse", + "AsyncGPUVirtualResourceWithRawResponse", + "GPUVirtualResourceWithStreamingResponse", + "AsyncGPUVirtualResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/__init__.py b/src/gcore/resources/cloud/gpu_virtual/clusters/__init__.py similarity index 80% rename from src/gcore/resources/cloud/gpu_virtual_clusters/__init__.py rename to src/gcore/resources/cloud/gpu_virtual/clusters/__init__.py index 6957a34c..567fb0f3 100644 --- a/src/gcore/resources/cloud/gpu_virtual_clusters/__init__.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/__init__.py @@ -32,6 +32,14 @@ VolumesResourceWithStreamingResponse, AsyncVolumesResourceWithStreamingResponse, ) +from .clusters import ( + ClustersResource, + AsyncClustersResource, + ClustersResourceWithRawResponse, + AsyncClustersResourceWithRawResponse, + ClustersResourceWithStreamingResponse, + AsyncClustersResourceWithStreamingResponse, +) from .interfaces import ( InterfacesResource, AsyncInterfacesResource, @@ -40,14 +48,6 @@ InterfacesResourceWithStreamingResponse, AsyncInterfacesResourceWithStreamingResponse, ) -from .gpu_virtual_clusters import ( - GPUVirtualClustersResource, - AsyncGPUVirtualClustersResource, - GPUVirtualClustersResourceWithRawResponse, - AsyncGPUVirtualClustersResourceWithRawResponse, - GPUVirtualClustersResourceWithStreamingResponse, - AsyncGPUVirtualClustersResourceWithStreamingResponse, -) __all__ = [ "ServersResource", @@ -80,10 +80,10 @@ "AsyncImagesResourceWithRawResponse", "ImagesResourceWithStreamingResponse", "AsyncImagesResourceWithStreamingResponse", - "GPUVirtualClustersResource", - "AsyncGPUVirtualClustersResource", - "GPUVirtualClustersResourceWithRawResponse", - "AsyncGPUVirtualClustersResourceWithRawResponse", - "GPUVirtualClustersResourceWithStreamingResponse", - "AsyncGPUVirtualClustersResourceWithStreamingResponse", + "ClustersResource", + "AsyncClustersResource", + "ClustersResourceWithRawResponse", + "AsyncClustersResourceWithRawResponse", + "ClustersResourceWithStreamingResponse", + "AsyncClustersResourceWithStreamingResponse", ] diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py b/src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py similarity index 89% rename from src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py rename to src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py index 6d00751f..a94d8752 100644 --- a/src/gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/clusters.py @@ -39,9 +39,8 @@ VolumesResourceWithStreamingResponse, AsyncVolumesResourceWithStreamingResponse, ) -from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from ...._utils import required_args, maybe_transform, async_maybe_transform -from ...._compat import cached_property +from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ....._utils import required_args, maybe_transform, async_maybe_transform from .interfaces import ( InterfacesResource, AsyncInterfacesResource, @@ -50,30 +49,31 @@ InterfacesResourceWithStreamingResponse, AsyncInterfacesResourceWithStreamingResponse, ) -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....pagination import SyncOffsetPage, AsyncOffsetPage -from ....types.cloud import ( - gpu_virtual_cluster_list_params, - gpu_virtual_cluster_action_params, - gpu_virtual_cluster_create_params, - gpu_virtual_cluster_delete_params, - gpu_virtual_cluster_update_params, +from .....pagination import SyncOffsetPage, AsyncOffsetPage +from ....._base_client import AsyncPaginator, make_request_options +from .....types.cloud.gpu_virtual import ( + cluster_list_params, + cluster_action_params, + cluster_create_params, + cluster_delete_params, + cluster_update_params, ) -from ...._base_client import AsyncPaginator, make_request_options -from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.gpu_virtual_cluster import GPUVirtualCluster -from ....types.cloud.tag_update_map_param import TagUpdateMapParam +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.tag_update_map_param import TagUpdateMapParam +from .....types.cloud.gpu_virtual.gpu_virtual_cluster import GPUVirtualCluster -__all__ = ["GPUVirtualClustersResource", "AsyncGPUVirtualClustersResource"] +__all__ = ["ClustersResource", "AsyncClustersResource"] -class GPUVirtualClustersResource(SyncAPIResource): +class ClustersResource(SyncAPIResource): @cached_property def servers(self) -> ServersResource: return ServersResource(self._client) @@ -95,23 +95,23 @@ def images(self) -> ImagesResource: return ImagesResource(self._client) @cached_property - def with_raw_response(self) -> GPUVirtualClustersResourceWithRawResponse: + def with_raw_response(self) -> ClustersResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ - return GPUVirtualClustersResourceWithRawResponse(self) + return ClustersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> GPUVirtualClustersResourceWithStreamingResponse: + def with_streaming_response(self) -> ClustersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ - return GPUVirtualClustersResourceWithStreamingResponse(self) + return ClustersResourceWithStreamingResponse(self) def create( self, @@ -121,7 +121,7 @@ def create( flavor: str, name: str, servers_count: int, - servers_settings: gpu_virtual_cluster_create_params.ServersSettings, + servers_settings: cluster_create_params.ServersSettings, tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -175,7 +175,7 @@ def create( "servers_settings": servers_settings, "tags": tags, }, - gpu_virtual_cluster_create_params.GPUVirtualClusterCreateParams, + cluster_create_params.ClusterCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -225,7 +225,7 @@ def update( raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._patch( f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}", - body=maybe_transform({"name": name}, gpu_virtual_cluster_update_params.GPUVirtualClusterUpdateParams), + body=maybe_transform({"name": name}, cluster_update_params.ClusterUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -283,7 +283,7 @@ def list( "limit": limit, "offset": offset, }, - gpu_virtual_cluster_list_params.GPUVirtualClusterListParams, + cluster_list_params.ClusterListParams, ), ), model=GPUVirtualCluster, @@ -362,7 +362,7 @@ def delete( "reserved_fixed_ip_ids": reserved_fixed_ip_ids, "volume_ids": volume_ids, }, - gpu_virtual_cluster_delete_params.GPUVirtualClusterDeleteParams, + cluster_delete_params.ClusterDeleteParams, ), ), cast_to=TaskIDList, @@ -669,7 +669,7 @@ def action( "tags": tags, "servers_count": servers_count, }, - gpu_virtual_cluster_action_params.GPUVirtualClusterActionParams, + cluster_action_params.ClusterActionParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -723,7 +723,7 @@ def get( ) -class AsyncGPUVirtualClustersResource(AsyncAPIResource): +class AsyncClustersResource(AsyncAPIResource): @cached_property def servers(self) -> AsyncServersResource: return AsyncServersResource(self._client) @@ -745,23 +745,23 @@ def images(self) -> AsyncImagesResource: return AsyncImagesResource(self._client) @cached_property - def with_raw_response(self) -> AsyncGPUVirtualClustersResourceWithRawResponse: + def with_raw_response(self) -> AsyncClustersResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers """ - return AsyncGPUVirtualClustersResourceWithRawResponse(self) + return AsyncClustersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncGPUVirtualClustersResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncClustersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response """ - return AsyncGPUVirtualClustersResourceWithStreamingResponse(self) + return AsyncClustersResourceWithStreamingResponse(self) async def create( self, @@ -771,7 +771,7 @@ async def create( flavor: str, name: str, servers_count: int, - servers_settings: gpu_virtual_cluster_create_params.ServersSettings, + servers_settings: cluster_create_params.ServersSettings, tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -825,7 +825,7 @@ async def create( "servers_settings": servers_settings, "tags": tags, }, - gpu_virtual_cluster_create_params.GPUVirtualClusterCreateParams, + cluster_create_params.ClusterCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -875,9 +875,7 @@ async def update( raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._patch( f"/cloud/v3/gpu/virtual/{project_id}/{region_id}/clusters/{cluster_id}", - body=await async_maybe_transform( - {"name": name}, gpu_virtual_cluster_update_params.GPUVirtualClusterUpdateParams - ), + body=await async_maybe_transform({"name": name}, cluster_update_params.ClusterUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -935,7 +933,7 @@ def list( "limit": limit, "offset": offset, }, - gpu_virtual_cluster_list_params.GPUVirtualClusterListParams, + cluster_list_params.ClusterListParams, ), ), model=GPUVirtualCluster, @@ -1014,7 +1012,7 @@ async def delete( "reserved_fixed_ip_ids": reserved_fixed_ip_ids, "volume_ids": volume_ids, }, - gpu_virtual_cluster_delete_params.GPUVirtualClusterDeleteParams, + cluster_delete_params.ClusterDeleteParams, ), ), cast_to=TaskIDList, @@ -1321,7 +1319,7 @@ async def action( "tags": tags, "servers_count": servers_count, }, - gpu_virtual_cluster_action_params.GPUVirtualClusterActionParams, + cluster_action_params.ClusterActionParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1375,177 +1373,177 @@ async def get( ) -class GPUVirtualClustersResourceWithRawResponse: - def __init__(self, gpu_virtual_clusters: GPUVirtualClustersResource) -> None: - self._gpu_virtual_clusters = gpu_virtual_clusters +class ClustersResourceWithRawResponse: + def __init__(self, clusters: ClustersResource) -> None: + self._clusters = clusters self.create = to_raw_response_wrapper( - gpu_virtual_clusters.create, + clusters.create, ) self.update = to_raw_response_wrapper( - gpu_virtual_clusters.update, + clusters.update, ) self.list = to_raw_response_wrapper( - gpu_virtual_clusters.list, + clusters.list, ) self.delete = to_raw_response_wrapper( - gpu_virtual_clusters.delete, + clusters.delete, ) self.action = to_raw_response_wrapper( - gpu_virtual_clusters.action, + clusters.action, ) self.get = to_raw_response_wrapper( - gpu_virtual_clusters.get, + clusters.get, ) @cached_property def servers(self) -> ServersResourceWithRawResponse: - return ServersResourceWithRawResponse(self._gpu_virtual_clusters.servers) + return ServersResourceWithRawResponse(self._clusters.servers) @cached_property def volumes(self) -> VolumesResourceWithRawResponse: - return VolumesResourceWithRawResponse(self._gpu_virtual_clusters.volumes) + return VolumesResourceWithRawResponse(self._clusters.volumes) @cached_property def interfaces(self) -> InterfacesResourceWithRawResponse: - return InterfacesResourceWithRawResponse(self._gpu_virtual_clusters.interfaces) + return InterfacesResourceWithRawResponse(self._clusters.interfaces) @cached_property def flavors(self) -> FlavorsResourceWithRawResponse: - return FlavorsResourceWithRawResponse(self._gpu_virtual_clusters.flavors) + return FlavorsResourceWithRawResponse(self._clusters.flavors) @cached_property def images(self) -> ImagesResourceWithRawResponse: - return ImagesResourceWithRawResponse(self._gpu_virtual_clusters.images) + return ImagesResourceWithRawResponse(self._clusters.images) -class AsyncGPUVirtualClustersResourceWithRawResponse: - def __init__(self, gpu_virtual_clusters: AsyncGPUVirtualClustersResource) -> None: - self._gpu_virtual_clusters = gpu_virtual_clusters +class AsyncClustersResourceWithRawResponse: + def __init__(self, clusters: AsyncClustersResource) -> None: + self._clusters = clusters self.create = async_to_raw_response_wrapper( - gpu_virtual_clusters.create, + clusters.create, ) self.update = async_to_raw_response_wrapper( - gpu_virtual_clusters.update, + clusters.update, ) self.list = async_to_raw_response_wrapper( - gpu_virtual_clusters.list, + clusters.list, ) self.delete = async_to_raw_response_wrapper( - gpu_virtual_clusters.delete, + clusters.delete, ) self.action = async_to_raw_response_wrapper( - gpu_virtual_clusters.action, + clusters.action, ) self.get = async_to_raw_response_wrapper( - gpu_virtual_clusters.get, + clusters.get, ) @cached_property def servers(self) -> AsyncServersResourceWithRawResponse: - return AsyncServersResourceWithRawResponse(self._gpu_virtual_clusters.servers) + return AsyncServersResourceWithRawResponse(self._clusters.servers) @cached_property def volumes(self) -> AsyncVolumesResourceWithRawResponse: - return AsyncVolumesResourceWithRawResponse(self._gpu_virtual_clusters.volumes) + return AsyncVolumesResourceWithRawResponse(self._clusters.volumes) @cached_property def interfaces(self) -> AsyncInterfacesResourceWithRawResponse: - return AsyncInterfacesResourceWithRawResponse(self._gpu_virtual_clusters.interfaces) + return AsyncInterfacesResourceWithRawResponse(self._clusters.interfaces) @cached_property def flavors(self) -> AsyncFlavorsResourceWithRawResponse: - return AsyncFlavorsResourceWithRawResponse(self._gpu_virtual_clusters.flavors) + return AsyncFlavorsResourceWithRawResponse(self._clusters.flavors) @cached_property def images(self) -> AsyncImagesResourceWithRawResponse: - return AsyncImagesResourceWithRawResponse(self._gpu_virtual_clusters.images) + return AsyncImagesResourceWithRawResponse(self._clusters.images) -class GPUVirtualClustersResourceWithStreamingResponse: - def __init__(self, gpu_virtual_clusters: GPUVirtualClustersResource) -> None: - self._gpu_virtual_clusters = gpu_virtual_clusters +class ClustersResourceWithStreamingResponse: + def __init__(self, clusters: ClustersResource) -> None: + self._clusters = clusters self.create = to_streamed_response_wrapper( - gpu_virtual_clusters.create, + clusters.create, ) self.update = to_streamed_response_wrapper( - gpu_virtual_clusters.update, + clusters.update, ) self.list = to_streamed_response_wrapper( - gpu_virtual_clusters.list, + clusters.list, ) self.delete = to_streamed_response_wrapper( - gpu_virtual_clusters.delete, + clusters.delete, ) self.action = to_streamed_response_wrapper( - gpu_virtual_clusters.action, + clusters.action, ) self.get = to_streamed_response_wrapper( - gpu_virtual_clusters.get, + clusters.get, ) @cached_property def servers(self) -> ServersResourceWithStreamingResponse: - return ServersResourceWithStreamingResponse(self._gpu_virtual_clusters.servers) + return ServersResourceWithStreamingResponse(self._clusters.servers) @cached_property def volumes(self) -> VolumesResourceWithStreamingResponse: - return VolumesResourceWithStreamingResponse(self._gpu_virtual_clusters.volumes) + return VolumesResourceWithStreamingResponse(self._clusters.volumes) @cached_property def interfaces(self) -> InterfacesResourceWithStreamingResponse: - return InterfacesResourceWithStreamingResponse(self._gpu_virtual_clusters.interfaces) + return InterfacesResourceWithStreamingResponse(self._clusters.interfaces) @cached_property def flavors(self) -> FlavorsResourceWithStreamingResponse: - return FlavorsResourceWithStreamingResponse(self._gpu_virtual_clusters.flavors) + return FlavorsResourceWithStreamingResponse(self._clusters.flavors) @cached_property def images(self) -> ImagesResourceWithStreamingResponse: - return ImagesResourceWithStreamingResponse(self._gpu_virtual_clusters.images) + return ImagesResourceWithStreamingResponse(self._clusters.images) -class AsyncGPUVirtualClustersResourceWithStreamingResponse: - def __init__(self, gpu_virtual_clusters: AsyncGPUVirtualClustersResource) -> None: - self._gpu_virtual_clusters = gpu_virtual_clusters +class AsyncClustersResourceWithStreamingResponse: + def __init__(self, clusters: AsyncClustersResource) -> None: + self._clusters = clusters self.create = async_to_streamed_response_wrapper( - gpu_virtual_clusters.create, + clusters.create, ) self.update = async_to_streamed_response_wrapper( - gpu_virtual_clusters.update, + clusters.update, ) self.list = async_to_streamed_response_wrapper( - gpu_virtual_clusters.list, + clusters.list, ) self.delete = async_to_streamed_response_wrapper( - gpu_virtual_clusters.delete, + clusters.delete, ) self.action = async_to_streamed_response_wrapper( - gpu_virtual_clusters.action, + clusters.action, ) self.get = async_to_streamed_response_wrapper( - gpu_virtual_clusters.get, + clusters.get, ) @cached_property def servers(self) -> AsyncServersResourceWithStreamingResponse: - return AsyncServersResourceWithStreamingResponse(self._gpu_virtual_clusters.servers) + return AsyncServersResourceWithStreamingResponse(self._clusters.servers) @cached_property def volumes(self) -> AsyncVolumesResourceWithStreamingResponse: - return AsyncVolumesResourceWithStreamingResponse(self._gpu_virtual_clusters.volumes) + return AsyncVolumesResourceWithStreamingResponse(self._clusters.volumes) @cached_property def interfaces(self) -> AsyncInterfacesResourceWithStreamingResponse: - return AsyncInterfacesResourceWithStreamingResponse(self._gpu_virtual_clusters.interfaces) + return AsyncInterfacesResourceWithStreamingResponse(self._clusters.interfaces) @cached_property def flavors(self) -> AsyncFlavorsResourceWithStreamingResponse: - return AsyncFlavorsResourceWithStreamingResponse(self._gpu_virtual_clusters.flavors) + return AsyncFlavorsResourceWithStreamingResponse(self._clusters.flavors) @cached_property def images(self) -> AsyncImagesResourceWithStreamingResponse: - return AsyncImagesResourceWithStreamingResponse(self._gpu_virtual_clusters.images) + return AsyncImagesResourceWithStreamingResponse(self._clusters.images) diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/flavors.py b/src/gcore/resources/cloud/gpu_virtual/clusters/flavors.py similarity index 93% rename from src/gcore/resources/cloud/gpu_virtual_clusters/flavors.py rename to src/gcore/resources/cloud/gpu_virtual/clusters/flavors.py index 269932f2..ee6fd7dc 100644 --- a/src/gcore/resources/cloud/gpu_virtual_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/flavors.py @@ -4,19 +4,19 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options -from ....types.cloud.gpu_virtual_clusters import flavor_list_params -from ....types.cloud.gpu_virtual_clusters.gpu_virtual_flavor_list import GPUVirtualFlavorList +from ....._base_client import make_request_options +from .....types.cloud.gpu_virtual.clusters import flavor_list_params +from .....types.cloud.gpu_virtual.clusters.gpu_virtual_flavor_list import GPUVirtualFlavorList __all__ = ["FlavorsResource", "AsyncFlavorsResource"] diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/images.py b/src/gcore/resources/cloud/gpu_virtual/clusters/images.py similarity index 97% rename from src/gcore/resources/cloud/gpu_virtual_clusters/images.py rename to src/gcore/resources/cloud/gpu_virtual/clusters/images.py index 8d408ad5..9c7d1472 100644 --- a/src/gcore/resources/cloud/gpu_virtual_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/images.py @@ -7,21 +7,21 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options -from ....types.cloud.gpu_image import GPUImage -from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.gpu_image_list import GPUImageList -from ....types.cloud.gpu_virtual_clusters import image_upload_params +from ....._base_client import make_request_options +from .....types.cloud.gpu_image import GPUImage +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.gpu_image_list import GPUImageList +from .....types.cloud.gpu_virtual.clusters import image_upload_params __all__ = ["ImagesResource", "AsyncImagesResource"] diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_virtual/clusters/interfaces.py similarity index 95% rename from src/gcore/resources/cloud/gpu_virtual_clusters/interfaces.py rename to src/gcore/resources/cloud/gpu_virtual/clusters/interfaces.py index ca97cda6..28bae5d4 100644 --- a/src/gcore/resources/cloud/gpu_virtual_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/interfaces.py @@ -4,17 +4,17 @@ import httpx -from ...._types import Body, Query, Headers, NotGiven, not_given -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._types import Body, Query, Headers, NotGiven, not_given +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options -from ....types.cloud.gpu_virtual_clusters.gpu_virtual_interface_list import GPUVirtualInterfaceList +from ....._base_client import make_request_options +from .....types.cloud.gpu_virtual.clusters.gpu_virtual_interface_list import GPUVirtualInterfaceList __all__ = ["InterfacesResource", "AsyncInterfacesResource"] diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/servers.py b/src/gcore/resources/cloud/gpu_virtual/clusters/servers.py similarity index 96% rename from src/gcore/resources/cloud/gpu_virtual_clusters/servers.py rename to src/gcore/resources/cloud/gpu_virtual/clusters/servers.py index a0176570..4895fd83 100644 --- a/src/gcore/resources/cloud/gpu_virtual_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/servers.py @@ -8,20 +8,20 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ....._utils import maybe_transform, async_maybe_transform +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options -from ....types.cloud.task_id_list import TaskIDList -from ....types.cloud.gpu_virtual_clusters import server_list_params, server_delete_params -from ....types.cloud.gpu_virtual_clusters.gpu_virtual_cluster_server_list import GPUVirtualClusterServerList +from ....._base_client import make_request_options +from .....types.cloud.task_id_list import TaskIDList +from .....types.cloud.gpu_virtual.clusters import server_list_params, server_delete_params +from .....types.cloud.gpu_virtual.clusters.gpu_virtual_cluster_server_list import GPUVirtualClusterServerList __all__ = ["ServersResource", "AsyncServersResource"] diff --git a/src/gcore/resources/cloud/gpu_virtual_clusters/volumes.py b/src/gcore/resources/cloud/gpu_virtual/clusters/volumes.py similarity index 94% rename from src/gcore/resources/cloud/gpu_virtual_clusters/volumes.py rename to src/gcore/resources/cloud/gpu_virtual/clusters/volumes.py index 390e7cf9..afa07662 100644 --- a/src/gcore/resources/cloud/gpu_virtual_clusters/volumes.py +++ b/src/gcore/resources/cloud/gpu_virtual/clusters/volumes.py @@ -4,17 +4,17 @@ import httpx -from ...._types import Body, Query, Headers, NotGiven, not_given -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( +from ....._types import Body, Query, Headers, NotGiven, not_given +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._base_client import make_request_options -from ....types.cloud.gpu_virtual_clusters.gpu_virtual_cluster_volume_list import GPUVirtualClusterVolumeList +from ....._base_client import make_request_options +from .....types.cloud.gpu_virtual.clusters.gpu_virtual_cluster_volume_list import GPUVirtualClusterVolumeList __all__ = ["VolumesResource", "AsyncVolumesResource"] diff --git a/src/gcore/resources/cloud/gpu_virtual/gpu_virtual.py b/src/gcore/resources/cloud/gpu_virtual/gpu_virtual.py new file mode 100644 index 00000000..959b2156 --- /dev/null +++ b/src/gcore/resources/cloud/gpu_virtual/gpu_virtual.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from .clusters.clusters import ( + ClustersResource, + AsyncClustersResource, + ClustersResourceWithRawResponse, + AsyncClustersResourceWithRawResponse, + ClustersResourceWithStreamingResponse, + AsyncClustersResourceWithStreamingResponse, +) + +__all__ = ["GPUVirtualResource", "AsyncGPUVirtualResource"] + + +class GPUVirtualResource(SyncAPIResource): + @cached_property + def clusters(self) -> ClustersResource: + return ClustersResource(self._client) + + @cached_property + def with_raw_response(self) -> GPUVirtualResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return GPUVirtualResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> GPUVirtualResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return GPUVirtualResourceWithStreamingResponse(self) + + +class AsyncGPUVirtualResource(AsyncAPIResource): + @cached_property + def clusters(self) -> AsyncClustersResource: + return AsyncClustersResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncGPUVirtualResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncGPUVirtualResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncGPUVirtualResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncGPUVirtualResourceWithStreamingResponse(self) + + +class GPUVirtualResourceWithRawResponse: + def __init__(self, gpu_virtual: GPUVirtualResource) -> None: + self._gpu_virtual = gpu_virtual + + @cached_property + def clusters(self) -> ClustersResourceWithRawResponse: + return ClustersResourceWithRawResponse(self._gpu_virtual.clusters) + + +class AsyncGPUVirtualResourceWithRawResponse: + def __init__(self, gpu_virtual: AsyncGPUVirtualResource) -> None: + self._gpu_virtual = gpu_virtual + + @cached_property + def clusters(self) -> AsyncClustersResourceWithRawResponse: + return AsyncClustersResourceWithRawResponse(self._gpu_virtual.clusters) + + +class GPUVirtualResourceWithStreamingResponse: + def __init__(self, gpu_virtual: GPUVirtualResource) -> None: + self._gpu_virtual = gpu_virtual + + @cached_property + def clusters(self) -> ClustersResourceWithStreamingResponse: + return ClustersResourceWithStreamingResponse(self._gpu_virtual.clusters) + + +class AsyncGPUVirtualResourceWithStreamingResponse: + def __init__(self, gpu_virtual: AsyncGPUVirtualResource) -> None: + self._gpu_virtual = gpu_virtual + + @cached_property + def clusters(self) -> AsyncClustersResourceWithStreamingResponse: + return AsyncClustersResourceWithStreamingResponse(self._gpu_virtual.clusters) diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index 6cc9863a..7de8cf65 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -26,10 +26,16 @@ async_to_streamed_response_wrapper, ) from ......_base_client import make_request_options -from ......types.cloud.k8s.clusters import pool_create_params, pool_resize_params, pool_update_params +from ......types.cloud.k8s.clusters import ( + pool_create_params, + pool_resize_params, + pool_update_params, + pool_check_quota_params, +) from ......types.cloud.task_id_list import TaskIDList from ......types.cloud.k8s.clusters.k8s_cluster_pool import K8SClusterPool from ......types.cloud.k8s.clusters.k8s_cluster_pool_list import K8SClusterPoolList +from ......types.cloud.k8s.clusters.k8s_cluster_pool_quota import K8SClusterPoolQuota __all__ = ["PoolsResource", "AsyncPoolsResource"] @@ -307,6 +313,83 @@ def delete( cast_to=TaskIDList, ) + def check_quota( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor_id: str, + boot_volume_size: Optional[int] | Omit = omit, + max_node_count: Optional[int] | Omit = omit, + min_node_count: Optional[int] | Omit = omit, + name: Optional[str] | Omit = omit, + node_count: Optional[int] | Omit = omit, + servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> K8SClusterPoolQuota: + """Calculate quota requirements for a new cluster pool before creation. + + Returns + exceeded quotas if regional limits would be violated. Use before pool creation + to validate resource availability. Checks: CPU, RAM, volumes, VMs, GPUs, and + baremetal quotas depending on flavor type. + + Args: + project_id: Project ID + + region_id: Region ID + + flavor_id: Flavor ID + + boot_volume_size: Boot volume size + + max_node_count: Maximum node count + + min_node_count: Minimum node count + + name: Name of the cluster pool + + node_count: Maximum node count + + servergroup_policy: Server group policy: anti-affinity, soft-anti-affinity or affinity + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return self._post( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/pools/check_limits", + body=maybe_transform( + { + "flavor_id": flavor_id, + "boot_volume_size": boot_volume_size, + "max_node_count": max_node_count, + "min_node_count": min_node_count, + "name": name, + "node_count": node_count, + "servergroup_policy": servergroup_policy, + }, + pool_check_quota_params.PoolCheckQuotaParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8SClusterPoolQuota, + ) + def get( self, pool_name: str, @@ -669,6 +752,83 @@ async def delete( cast_to=TaskIDList, ) + async def check_quota( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + flavor_id: str, + boot_volume_size: Optional[int] | Omit = omit, + max_node_count: Optional[int] | Omit = omit, + min_node_count: Optional[int] | Omit = omit, + name: Optional[str] | Omit = omit, + node_count: Optional[int] | Omit = omit, + servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> K8SClusterPoolQuota: + """Calculate quota requirements for a new cluster pool before creation. + + Returns + exceeded quotas if regional limits would be violated. Use before pool creation + to validate resource availability. Checks: CPU, RAM, volumes, VMs, GPUs, and + baremetal quotas depending on flavor type. + + Args: + project_id: Project ID + + region_id: Region ID + + flavor_id: Flavor ID + + boot_volume_size: Boot volume size + + max_node_count: Maximum node count + + min_node_count: Minimum node count + + name: Name of the cluster pool + + node_count: Maximum node count + + servergroup_policy: Server group policy: anti-affinity, soft-anti-affinity or affinity + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + return await self._post( + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/pools/check_limits", + body=await async_maybe_transform( + { + "flavor_id": flavor_id, + "boot_volume_size": boot_volume_size, + "max_node_count": max_node_count, + "min_node_count": min_node_count, + "name": name, + "node_count": node_count, + "servergroup_policy": servergroup_policy, + }, + pool_check_quota_params.PoolCheckQuotaParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=K8SClusterPoolQuota, + ) + async def get( self, pool_name: str, @@ -774,6 +934,9 @@ def __init__(self, pools: PoolsResource) -> None: self.delete = to_raw_response_wrapper( pools.delete, ) + self.check_quota = to_raw_response_wrapper( + pools.check_quota, + ) self.get = to_raw_response_wrapper( pools.get, ) @@ -802,6 +965,9 @@ def __init__(self, pools: AsyncPoolsResource) -> None: self.delete = async_to_raw_response_wrapper( pools.delete, ) + self.check_quota = async_to_raw_response_wrapper( + pools.check_quota, + ) self.get = async_to_raw_response_wrapper( pools.get, ) @@ -830,6 +996,9 @@ def __init__(self, pools: PoolsResource) -> None: self.delete = to_streamed_response_wrapper( pools.delete, ) + self.check_quota = to_streamed_response_wrapper( + pools.check_quota, + ) self.get = to_streamed_response_wrapper( pools.get, ) @@ -858,6 +1027,9 @@ def __init__(self, pools: AsyncPoolsResource) -> None: self.delete = async_to_streamed_response_wrapper( pools.delete, ) + self.check_quota = async_to_streamed_response_wrapper( + pools.check_quota, + ) self.get = async_to_streamed_response_wrapper( pools.get, ) diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 1e8c89e0..fe0177c0 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -64,6 +64,7 @@ def create( protocol_port: int, allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, connection_limit: int | Omit = omit, + default_pool_id: str | Omit = omit, insert_x_forwarded: bool | Omit = omit, secret_id: str | Omit = omit, sni_secret_id: SequenceNotStr[str] | Omit = omit, @@ -86,7 +87,7 @@ def create( region_id: Region ID - load_balancer_id: Load balancer ID + load_balancer_id: ID of already existent Load Balancer. name: Load balancer listener name @@ -99,6 +100,8 @@ def create( connection_limit: Limit of the simultaneous connections. If -1 is provided, it is translated to the default value 100000. + default_pool_id: ID of already existent Load Balancer Pool to attach listener to. + insert_x_forwarded: Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. Only used with HTTP or `TERMINATED_HTTPS` protocols. @@ -138,6 +141,7 @@ def create( "protocol_port": protocol_port, "allowed_cidrs": allowed_cidrs, "connection_limit": connection_limit, + "default_pool_id": default_pool_id, "insert_x_forwarded": insert_x_forwarded, "secret_id": secret_id, "sni_secret_id": sni_secret_id, @@ -604,6 +608,7 @@ async def create( protocol_port: int, allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, connection_limit: int | Omit = omit, + default_pool_id: str | Omit = omit, insert_x_forwarded: bool | Omit = omit, secret_id: str | Omit = omit, sni_secret_id: SequenceNotStr[str] | Omit = omit, @@ -626,7 +631,7 @@ async def create( region_id: Region ID - load_balancer_id: Load balancer ID + load_balancer_id: ID of already existent Load Balancer. name: Load balancer listener name @@ -639,6 +644,8 @@ async def create( connection_limit: Limit of the simultaneous connections. If -1 is provided, it is translated to the default value 100000. + default_pool_id: ID of already existent Load Balancer Pool to attach listener to. + insert_x_forwarded: Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. Only used with HTTP or `TERMINATED_HTTPS` protocols. @@ -678,6 +685,7 @@ async def create( "protocol_port": protocol_port, "allowed_cidrs": allowed_cidrs, "connection_limit": connection_limit, + "default_pool_id": default_pool_id, "insert_x_forwarded": insert_x_forwarded, "secret_id": secret_id, "sni_secret_id": sni_secret_id, diff --git a/src/gcore/resources/dns/network_mappings.py b/src/gcore/resources/dns/network_mappings.py index 1292d320..1feb1047 100644 --- a/src/gcore/resources/dns/network_mappings.py +++ b/src/gcore/resources/dns/network_mappings.py @@ -51,7 +51,6 @@ def with_streaming_response(self) -> NetworkMappingsResourceWithStreamingRespons def create( self, *, - id: int | Omit = omit, mapping: Iterable[DNSMappingEntryParam] | Omit = omit, name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -112,7 +111,6 @@ def create( "/dns/v2/network-mappings", body=maybe_transform( { - "id": id, "mapping": mapping, "name": name, }, @@ -388,9 +386,8 @@ def import_( def replace( self, - path_id: int, + id: int, *, - body_id: int | Omit = omit, mapping: Iterable[DNSMappingEntryParam] | Omit = omit, name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -446,10 +443,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/dns/v2/network-mappings/{path_id}", + f"/dns/v2/network-mappings/{id}", body=maybe_transform( { - "body_id": body_id, "mapping": mapping, "name": name, }, @@ -485,7 +481,6 @@ def with_streaming_response(self) -> AsyncNetworkMappingsResourceWithStreamingRe async def create( self, *, - id: int | Omit = omit, mapping: Iterable[DNSMappingEntryParam] | Omit = omit, name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -546,7 +541,6 @@ async def create( "/dns/v2/network-mappings", body=await async_maybe_transform( { - "id": id, "mapping": mapping, "name": name, }, @@ -822,9 +816,8 @@ async def import_( async def replace( self, - path_id: int, + id: int, *, - body_id: int | Omit = omit, mapping: Iterable[DNSMappingEntryParam] | Omit = omit, name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -880,10 +873,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/dns/v2/network-mappings/{path_id}", + f"/dns/v2/network-mappings/{id}", body=await async_maybe_transform( { - "body_id": body_id, "mapping": mapping, "name": name, }, diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 33f051d9..0503e14b 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -64,7 +64,6 @@ from .billing_reservation import BillingReservation as BillingReservation from .ddos_profile_status import DDOSProfileStatus as DDOSProfileStatus from .fixed_address_short import FixedAddressShort as FixedAddressShort -from .gpu_virtual_cluster import GPUVirtualCluster as GPUVirtualCluster from .interface_ip_family import InterfaceIPFamily as InterfaceIPFamily from .k8s_cluster_version import K8SClusterVersion as K8SClusterVersion from .network_list_params import NetworkListParams as NetworkListParams @@ -161,16 +160,11 @@ from .load_balancer_operating_status import LoadBalancerOperatingStatus as LoadBalancerOperatingStatus from .billing_reservation_list_params import BillingReservationListParams as BillingReservationListParams from .cost_report_get_detailed_params import CostReportGetDetailedParams as CostReportGetDetailedParams -from .gpu_virtual_cluster_list_params import GPUVirtualClusterListParams as GPUVirtualClusterListParams from .reserved_fixed_ip_create_params import ReservedFixedIPCreateParams as ReservedFixedIPCreateParams from .reserved_fixed_ip_update_params import ReservedFixedIPUpdateParams as ReservedFixedIPUpdateParams from .volume_attach_to_instance_params import VolumeAttachToInstanceParams as VolumeAttachToInstanceParams from .cost_report_get_aggregated_params import CostReportGetAggregatedParams as CostReportGetAggregatedParams from .gpu_baremetal_cluster_list_params import GPUBaremetalClusterListParams as GPUBaremetalClusterListParams -from .gpu_virtual_cluster_action_params import GPUVirtualClusterActionParams as GPUVirtualClusterActionParams -from .gpu_virtual_cluster_create_params import GPUVirtualClusterCreateParams as GPUVirtualClusterCreateParams -from .gpu_virtual_cluster_delete_params import GPUVirtualClusterDeleteParams as GPUVirtualClusterDeleteParams -from .gpu_virtual_cluster_update_params import GPUVirtualClusterUpdateParams as GPUVirtualClusterUpdateParams from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam as LaasIndexRetentionPolicyParam from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity from .volume_detach_from_instance_params import VolumeDetachFromInstanceParams as VolumeDetachFromInstanceParams diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster.py b/src/gcore/types/cloud/gpu_baremetal_cluster.py index 85bc978c..bfbdff15 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster.py @@ -131,6 +131,9 @@ class GPUBaremetalCluster(BaseModel): flavor: str """Cluster flavor name""" + image_id: str + """Image ID""" + managed_by: Literal["k8s", "user"] """User type managing the resource""" diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py b/src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py index 30aeddac..7929f325 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/__init__.py @@ -7,9 +7,9 @@ from .image_upload_params import ImageUploadParams as ImageUploadParams from .gpu_baremetal_flavor import GPUBaremetalFlavor as GPUBaremetalFlavor from .server_delete_params import ServerDeleteParams as ServerDeleteParams +from .interface_attach_params import InterfaceAttachParams as InterfaceAttachParams +from .interface_detach_params import InterfaceDetachParams as InterfaceDetachParams from .gpu_baremetal_flavor_list import GPUBaremetalFlavorList as GPUBaremetalFlavorList from .gpu_baremetal_cluster_server import GPUBaremetalClusterServer as GPUBaremetalClusterServer -from .server_attach_interface_params import ServerAttachInterfaceParams as ServerAttachInterfaceParams -from .server_detach_interface_params import ServerDetachInterfaceParams as ServerDetachInterfaceParams from .gpu_baremetal_cluster_server_v1 import GPUBaremetalClusterServerV1 as GPUBaremetalClusterServerV1 from .gpu_baremetal_cluster_server_v1_list import GPUBaremetalClusterServerV1List as GPUBaremetalClusterServerV1List diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/interface_attach_params.py similarity index 98% rename from src/gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py rename to src/gcore/types/cloud/gpu_baremetal_clusters/interface_attach_params.py index 98bf36af..43ff9ee3 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/interface_attach_params.py @@ -6,7 +6,7 @@ from typing_extensions import Literal, Required, TypeAlias, TypedDict __all__ = [ - "ServerAttachInterfaceParams", + "InterfaceAttachParams", "NewInterfaceExternalExtendSchemaWithDDOS", "NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile", "NewInterfaceExternalExtendSchemaWithDdosddosProfileField", @@ -261,7 +261,7 @@ class NewInterfaceReservedFixedIPSchemaSecurityGroup(TypedDict, total=False): """Resource ID""" -ServerAttachInterfaceParams: TypeAlias = Union[ +InterfaceAttachParams: TypeAlias = Union[ NewInterfaceExternalExtendSchemaWithDDOS, NewInterfaceSpecificSubnetSchema, NewInterfaceAnySubnetSchema, diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/server_detach_interface_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/interface_detach_params.py similarity index 76% rename from src/gcore/types/cloud/gpu_baremetal_clusters/server_detach_interface_params.py rename to src/gcore/types/cloud/gpu_baremetal_clusters/interface_detach_params.py index 4c9cacc3..5f092a84 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/server_detach_interface_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/interface_detach_params.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["ServerDetachInterfaceParams"] +__all__ = ["InterfaceDetachParams"] -class ServerDetachInterfaceParams(TypedDict, total=False): +class InterfaceDetachParams(TypedDict, total=False): project_id: int region_id: int diff --git a/src/gcore/types/cloud/gpu_virtual/__init__.py b/src/gcore/types/cloud/gpu_virtual/__init__.py new file mode 100644 index 00000000..9c1abcb8 --- /dev/null +++ b/src/gcore/types/cloud/gpu_virtual/__init__.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .cluster_list_params import ClusterListParams as ClusterListParams +from .gpu_virtual_cluster import GPUVirtualCluster as GPUVirtualCluster +from .cluster_action_params import ClusterActionParams as ClusterActionParams +from .cluster_create_params import ClusterCreateParams as ClusterCreateParams +from .cluster_delete_params import ClusterDeleteParams as ClusterDeleteParams +from .cluster_update_params import ClusterUpdateParams as ClusterUpdateParams diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_action_params.py b/src/gcore/types/cloud/gpu_virtual/cluster_action_params.py similarity index 95% rename from src/gcore/types/cloud/gpu_virtual_cluster_action_params.py rename to src/gcore/types/cloud/gpu_virtual/cluster_action_params.py index 9319deff..a1c0cd75 100644 --- a/src/gcore/types/cloud/gpu_virtual_cluster_action_params.py +++ b/src/gcore/types/cloud/gpu_virtual/cluster_action_params.py @@ -5,10 +5,10 @@ from typing import Union, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict -from .tag_update_map_param import TagUpdateMapParam +from ..tag_update_map_param import TagUpdateMapParam __all__ = [ - "GPUVirtualClusterActionParams", + "ClusterActionParams", "StartVirtualGPUClusterSerializer", "StopVirtualGPUClusterSerializer", "SoftRebootVirtualGPUClusterSerializer", @@ -117,7 +117,7 @@ class ResizeVirtualGPUClusterSerializer(TypedDict, total=False): """Requested servers count""" -GPUVirtualClusterActionParams: TypeAlias = Union[ +ClusterActionParams: TypeAlias = Union[ StartVirtualGPUClusterSerializer, StopVirtualGPUClusterSerializer, SoftRebootVirtualGPUClusterSerializer, diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_create_params.py b/src/gcore/types/cloud/gpu_virtual/cluster_create_params.py similarity index 98% rename from src/gcore/types/cloud/gpu_virtual_cluster_create_params.py rename to src/gcore/types/cloud/gpu_virtual/cluster_create_params.py index b678cabf..f6235455 100644 --- a/src/gcore/types/cloud/gpu_virtual_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_virtual/cluster_create_params.py @@ -6,7 +6,7 @@ from typing_extensions import Literal, Required, TypeAlias, TypedDict __all__ = [ - "GPUVirtualClusterCreateParams", + "ClusterCreateParams", "ServersSettings", "ServersSettingsInterface", "ServersSettingsInterfaceExternalInterfaceInputSerializer", @@ -23,7 +23,7 @@ ] -class GPUVirtualClusterCreateParams(TypedDict, total=False): +class ClusterCreateParams(TypedDict, total=False): project_id: int """Project ID""" diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_delete_params.py b/src/gcore/types/cloud/gpu_virtual/cluster_delete_params.py similarity index 86% rename from src/gcore/types/cloud/gpu_virtual_cluster_delete_params.py rename to src/gcore/types/cloud/gpu_virtual/cluster_delete_params.py index 3cd9988b..5734cd7c 100644 --- a/src/gcore/types/cloud/gpu_virtual_cluster_delete_params.py +++ b/src/gcore/types/cloud/gpu_virtual/cluster_delete_params.py @@ -4,12 +4,12 @@ from typing_extensions import TypedDict -from ..._types import SequenceNotStr +from ...._types import SequenceNotStr -__all__ = ["GPUVirtualClusterDeleteParams"] +__all__ = ["ClusterDeleteParams"] -class GPUVirtualClusterDeleteParams(TypedDict, total=False): +class ClusterDeleteParams(TypedDict, total=False): project_id: int """Project ID""" diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_list_params.py b/src/gcore/types/cloud/gpu_virtual/cluster_list_params.py similarity index 77% rename from src/gcore/types/cloud/gpu_virtual_cluster_list_params.py rename to src/gcore/types/cloud/gpu_virtual/cluster_list_params.py index ff0dba49..e62cf44f 100644 --- a/src/gcore/types/cloud/gpu_virtual_cluster_list_params.py +++ b/src/gcore/types/cloud/gpu_virtual/cluster_list_params.py @@ -4,10 +4,10 @@ from typing_extensions import TypedDict -__all__ = ["GPUVirtualClusterListParams"] +__all__ = ["ClusterListParams"] -class GPUVirtualClusterListParams(TypedDict, total=False): +class ClusterListParams(TypedDict, total=False): project_id: int """Project ID""" diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_update_params.py b/src/gcore/types/cloud/gpu_virtual/cluster_update_params.py similarity index 74% rename from src/gcore/types/cloud/gpu_virtual_cluster_update_params.py rename to src/gcore/types/cloud/gpu_virtual/cluster_update_params.py index 790bbf88..8ce9c924 100644 --- a/src/gcore/types/cloud/gpu_virtual_cluster_update_params.py +++ b/src/gcore/types/cloud/gpu_virtual/cluster_update_params.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["GPUVirtualClusterUpdateParams"] +__all__ = ["ClusterUpdateParams"] -class GPUVirtualClusterUpdateParams(TypedDict, total=False): +class ClusterUpdateParams(TypedDict, total=False): project_id: int """Project ID""" diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/__init__.py b/src/gcore/types/cloud/gpu_virtual/clusters/__init__.py similarity index 100% rename from src/gcore/types/cloud/gpu_virtual_clusters/__init__.py rename to src/gcore/types/cloud/gpu_virtual/clusters/__init__.py diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/flavor_list_params.py b/src/gcore/types/cloud/gpu_virtual/clusters/flavor_list_params.py similarity index 100% rename from src/gcore/types/cloud/gpu_virtual_clusters/flavor_list_params.py rename to src/gcore/types/cloud/gpu_virtual/clusters/flavor_list_params.py diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server.py b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_server.py similarity index 96% rename from src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server.py rename to src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_server.py index b1b8b52f..d8126e53 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_server.py @@ -4,8 +4,8 @@ from datetime import datetime from typing_extensions import Literal -from ..tag import Tag -from ...._models import BaseModel +from ...tag import Tag +from ....._models import BaseModel __all__ = ["GPUVirtualClusterServer", "SecurityGroup"] diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server_list.py b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_server_list.py similarity index 91% rename from src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server_list.py rename to src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_server_list.py index d9cdad5a..4d6f87a2 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server_list.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_server_list.py @@ -2,7 +2,7 @@ from typing import List -from ...._models import BaseModel +from ....._models import BaseModel from .gpu_virtual_cluster_server import GPUVirtualClusterServer __all__ = ["GPUVirtualClusterServerList"] diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume.py b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_volume.py similarity index 95% rename from src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume.py rename to src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_volume.py index 06653cde..bab71b55 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_volume.py @@ -4,8 +4,8 @@ from datetime import datetime from typing_extensions import Literal -from ..tag import Tag -from ...._models import BaseModel +from ...tag import Tag +from ....._models import BaseModel __all__ = ["GPUVirtualClusterVolume"] diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume_list.py b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_volume_list.py similarity index 91% rename from src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume_list.py rename to src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_volume_list.py index feb8afbc..85b9ab5d 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume_list.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_cluster_volume_list.py @@ -2,7 +2,7 @@ from typing import List -from ...._models import BaseModel +from ....._models import BaseModel from .gpu_virtual_cluster_volume import GPUVirtualClusterVolume __all__ = ["GPUVirtualClusterVolumeList"] diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor.py b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_flavor.py similarity index 99% rename from src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor.py rename to src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_flavor.py index 5b94d243..9acea9fb 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_flavor.py @@ -3,7 +3,7 @@ from typing import Union, Optional from typing_extensions import Literal, TypeAlias -from ...._models import BaseModel +from ....._models import BaseModel __all__ = [ "GPUVirtualFlavor", diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor_list.py b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_flavor_list.py similarity index 90% rename from src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor_list.py rename to src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_flavor_list.py index fdfab090..71caf1fc 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor_list.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_flavor_list.py @@ -2,7 +2,7 @@ from typing import List -from ...._models import BaseModel +from ....._models import BaseModel from .gpu_virtual_flavor import GPUVirtualFlavor __all__ = ["GPUVirtualFlavorList"] diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface.py b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_interface.py similarity index 96% rename from src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface.py rename to src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_interface.py index 22892dca..50473b10 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_interface.py @@ -3,11 +3,11 @@ from typing import List, Optional from datetime import datetime -from ..tag import Tag -from ..route import Route -from ...._models import BaseModel -from ..ip_version import IPVersion -from ..floating_ip_status import FloatingIPStatus +from ...tag import Tag +from ...route import Route +from ....._models import BaseModel +from ...ip_version import IPVersion +from ...floating_ip_status import FloatingIPStatus __all__ = ["GPUVirtualInterface", "FloatingIP", "IPAssignment", "Network", "NetworkSubnet"] diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface_list.py b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_interface_list.py similarity index 90% rename from src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface_list.py rename to src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_interface_list.py index ae39f4cf..006974ba 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface_list.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/gpu_virtual_interface_list.py @@ -2,7 +2,7 @@ from typing import List -from ...._models import BaseModel +from ....._models import BaseModel from .gpu_virtual_interface import GPUVirtualInterface __all__ = ["GPUVirtualInterfaceList"] diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/image_upload_params.py b/src/gcore/types/cloud/gpu_virtual/clusters/image_upload_params.py similarity index 100% rename from src/gcore/types/cloud/gpu_virtual_clusters/image_upload_params.py rename to src/gcore/types/cloud/gpu_virtual/clusters/image_upload_params.py diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/server_delete_params.py b/src/gcore/types/cloud/gpu_virtual/clusters/server_delete_params.py similarity index 96% rename from src/gcore/types/cloud/gpu_virtual_clusters/server_delete_params.py rename to src/gcore/types/cloud/gpu_virtual/clusters/server_delete_params.py index 714cb4bb..a9b463f7 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/server_delete_params.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/server_delete_params.py @@ -4,7 +4,7 @@ from typing_extensions import Required, TypedDict -from ...._types import SequenceNotStr +from ....._types import SequenceNotStr __all__ = ["ServerDeleteParams"] diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/server_list_params.py b/src/gcore/types/cloud/gpu_virtual/clusters/server_list_params.py similarity index 96% rename from src/gcore/types/cloud/gpu_virtual_clusters/server_list_params.py rename to src/gcore/types/cloud/gpu_virtual/clusters/server_list_params.py index 35c7f374..89f4cb6d 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/server_list_params.py +++ b/src/gcore/types/cloud/gpu_virtual/clusters/server_list_params.py @@ -6,8 +6,8 @@ from datetime import datetime from typing_extensions import Literal, Annotated, TypedDict -from ...._types import SequenceNotStr -from ...._utils import PropertyInfo +from ....._types import SequenceNotStr +from ....._utils import PropertyInfo __all__ = ["ServerListParams"] diff --git a/src/gcore/types/cloud/gpu_virtual_cluster.py b/src/gcore/types/cloud/gpu_virtual/gpu_virtual_cluster.py similarity index 98% rename from src/gcore/types/cloud/gpu_virtual_cluster.py rename to src/gcore/types/cloud/gpu_virtual/gpu_virtual_cluster.py index 72aaad4e..9b71eb5e 100644 --- a/src/gcore/types/cloud/gpu_virtual_cluster.py +++ b/src/gcore/types/cloud/gpu_virtual/gpu_virtual_cluster.py @@ -4,9 +4,9 @@ from datetime import datetime from typing_extensions import Literal, Annotated, TypeAlias -from .tag import Tag -from ..._utils import PropertyInfo -from ..._models import BaseModel +from ..tag import Tag +from ...._utils import PropertyInfo +from ...._models import BaseModel __all__ = [ "GPUVirtualCluster", diff --git a/src/gcore/types/cloud/k8s/clusters/__init__.py b/src/gcore/types/cloud/k8s/clusters/__init__.py index e145306b..c8c5c859 100644 --- a/src/gcore/types/cloud/k8s/clusters/__init__.py +++ b/src/gcore/types/cloud/k8s/clusters/__init__.py @@ -8,3 +8,5 @@ from .pool_resize_params import PoolResizeParams as PoolResizeParams from .pool_update_params import PoolUpdateParams as PoolUpdateParams from .k8s_cluster_pool_list import K8SClusterPoolList as K8SClusterPoolList +from .k8s_cluster_pool_quota import K8SClusterPoolQuota as K8SClusterPoolQuota +from .pool_check_quota_params import PoolCheckQuotaParams as PoolCheckQuotaParams diff --git a/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_quota.py b/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_quota.py new file mode 100644 index 00000000..f7c178db --- /dev/null +++ b/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_quota.py @@ -0,0 +1,204 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ....._models import BaseModel + +__all__ = ["K8SClusterPoolQuota"] + + +class K8SClusterPoolQuota(BaseModel): + """Response schema for K8s cluster quota check. + + Returns quota fields that are exceeded. Fields are only included when + regional limits would be violated. Empty response means no quotas exceeded. + """ + + baremetal_gpu_a100_count_limit: Optional[int] = None + """Bare metal A100 GPU server count limit""" + + baremetal_gpu_a100_count_requested: Optional[int] = None + """Bare metal A100 GPU server count requested""" + + baremetal_gpu_a100_count_usage: Optional[int] = None + """Bare metal A100 GPU server count usage""" + + baremetal_gpu_h100_count_limit: Optional[int] = None + """Bare metal H100 GPU server count limit""" + + baremetal_gpu_h100_count_requested: Optional[int] = None + """Bare metal H100 GPU server count requested""" + + baremetal_gpu_h100_count_usage: Optional[int] = None + """Bare metal H100 GPU server count usage""" + + baremetal_gpu_h200_count_limit: Optional[int] = None + """Bare metal H200 GPU server count limit""" + + baremetal_gpu_h200_count_requested: Optional[int] = None + """Bare metal H200 GPU server count requested""" + + baremetal_gpu_h200_count_usage: Optional[int] = None + """Bare metal H200 GPU server count usage""" + + baremetal_gpu_l40s_count_limit: Optional[int] = None + """Bare metal L40S GPU server count limit""" + + baremetal_gpu_l40s_count_requested: Optional[int] = None + """Bare metal L40S GPU server count requested""" + + baremetal_gpu_l40s_count_usage: Optional[int] = None + """Bare metal L40S GPU server count usage""" + + baremetal_hf_count_limit: Optional[int] = None + """High-frequency bare metal servers count limit""" + + baremetal_hf_count_requested: Optional[int] = None + """High-frequency bare metal servers count requested""" + + baremetal_hf_count_usage: Optional[int] = None + """High-frequency bare metal servers count usage""" + + cluster_count_limit: Optional[int] = None + """K8s clusters count limit""" + + cluster_count_requested: Optional[int] = None + """K8s clusters count requested""" + + cluster_count_usage: Optional[int] = None + """K8s clusters count usage""" + + cpu_count_limit: Optional[int] = None + """vCPU Count limit""" + + cpu_count_requested: Optional[int] = None + """vCPU Count requested""" + + cpu_count_usage: Optional[int] = None + """vCPU Count usage""" + + firewall_count_limit: Optional[int] = None + """Firewalls Count limit""" + + firewall_count_requested: Optional[int] = None + """Firewalls Count requested""" + + firewall_count_usage: Optional[int] = None + """Firewalls Count usage""" + + floating_count_limit: Optional[int] = None + """Floating IP Count limit""" + + floating_count_requested: Optional[int] = None + """Floating IP Count requested""" + + floating_count_usage: Optional[int] = None + """Floating IP Count usage""" + + gpu_count_limit: Optional[int] = None + """GPU Count limit""" + + gpu_count_requested: Optional[int] = None + """GPU Count requested""" + + gpu_count_usage: Optional[int] = None + """GPU Count usage""" + + gpu_virtual_a100_count_limit: Optional[int] = None + """Virtual A100 GPU card count limit""" + + gpu_virtual_a100_count_requested: Optional[int] = None + """Virtual A100 GPU card count requested""" + + gpu_virtual_a100_count_usage: Optional[int] = None + """Virtual A100 GPU card count usage""" + + gpu_virtual_h100_count_limit: Optional[int] = None + """Virtual H100 GPU card count limit""" + + gpu_virtual_h100_count_requested: Optional[int] = None + """Virtual H100 GPU card count requested""" + + gpu_virtual_h100_count_usage: Optional[int] = None + """Virtual H100 GPU card count usage""" + + gpu_virtual_h200_count_limit: Optional[int] = None + """Virtual H200 GPU card count limit""" + + gpu_virtual_h200_count_requested: Optional[int] = None + """Virtual H200 GPU card count requested""" + + gpu_virtual_h200_count_usage: Optional[int] = None + """Virtual H200 GPU card count usage""" + + gpu_virtual_l40s_count_limit: Optional[int] = None + """Virtual L40S GPU card count limit""" + + gpu_virtual_l40s_count_requested: Optional[int] = None + """Virtual L40S GPU card count requested""" + + gpu_virtual_l40s_count_usage: Optional[int] = None + """Virtual L40S GPU card count usage""" + + laas_topic_count_limit: Optional[int] = None + """LaaS Topics Count limit""" + + laas_topic_count_requested: Optional[int] = None + """LaaS Topics Count requested""" + + laas_topic_count_usage: Optional[int] = None + """LaaS Topics Count usage""" + + loadbalancer_count_limit: Optional[int] = None + """Load Balancers Count limit""" + + loadbalancer_count_requested: Optional[int] = None + """Load Balancers Count requested""" + + loadbalancer_count_usage: Optional[int] = None + """Load Balancers Count usage""" + + ram_limit: Optional[int] = None + """RAM Size, MiB limit""" + + ram_requested: Optional[int] = None + """RAM Size, MiB requested""" + + ram_usage: Optional[int] = None + """RAM Size, MiB usage""" + + servergroup_count_limit: Optional[int] = None + """Placement Group Count limit""" + + servergroup_count_requested: Optional[int] = None + """Placement Group Count requested""" + + servergroup_count_usage: Optional[int] = None + """Placement Group Count usage""" + + vm_count_limit: Optional[int] = None + """VMs Count limit""" + + vm_count_requested: Optional[int] = None + """VMs Count requested""" + + vm_count_usage: Optional[int] = None + """VMs Count usage""" + + volume_count_limit: Optional[int] = None + """Volumes Count limit""" + + volume_count_requested: Optional[int] = None + """Volumes Count requested""" + + volume_count_usage: Optional[int] = None + """Volumes Count usage""" + + volume_size_limit: Optional[int] = None + """Volumes Size, GiB limit""" + + volume_size_requested: Optional[int] = None + """Volumes Size, GiB requested""" + + volume_size_usage: Optional[int] = None + """Volumes Size, GiB usage""" diff --git a/src/gcore/types/cloud/k8s/clusters/pool_check_quota_params.py b/src/gcore/types/cloud/k8s/clusters/pool_check_quota_params.py new file mode 100644 index 00000000..06880774 --- /dev/null +++ b/src/gcore/types/cloud/k8s/clusters/pool_check_quota_params.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["PoolCheckQuotaParams"] + + +class PoolCheckQuotaParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + flavor_id: Required[str] + """Flavor ID""" + + boot_volume_size: Optional[int] + """Boot volume size""" + + max_node_count: Optional[int] + """Maximum node count""" + + min_node_count: Optional[int] + """Minimum node count""" + + name: Optional[str] + """Name of the cluster pool""" + + node_count: Optional[int] + """Maximum node count""" + + servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] + """Server group policy: anti-affinity, soft-anti-affinity or affinity""" diff --git a/src/gcore/types/cloud/load_balancers/listener_create_params.py b/src/gcore/types/cloud/load_balancers/listener_create_params.py index 9850d348..8dc00324 100644 --- a/src/gcore/types/cloud/load_balancers/listener_create_params.py +++ b/src/gcore/types/cloud/load_balancers/listener_create_params.py @@ -19,7 +19,7 @@ class ListenerCreateParams(TypedDict, total=False): """Region ID""" load_balancer_id: Required[str] - """Load balancer ID""" + """ID of already existent Load Balancer.""" name: Required[str] """Load balancer listener name""" @@ -39,6 +39,9 @@ class ListenerCreateParams(TypedDict, total=False): If -1 is provided, it is translated to the default value 100000. """ + default_pool_id: str + """ID of already existent Load Balancer Pool to attach listener to.""" + insert_x_forwarded: bool """Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to requests. diff --git a/src/gcore/types/dns/dns_mapping_entry.py b/src/gcore/types/dns/dns_mapping_entry.py index 8f96c644..5d8db17c 100644 --- a/src/gcore/types/dns/dns_mapping_entry.py +++ b/src/gcore/types/dns/dns_mapping_entry.py @@ -8,8 +8,8 @@ class DNSMappingEntry(BaseModel): - cidr4: Optional[List[object]] = None + cidr4: Optional[List[str]] = None - cidr6: Optional[List[object]] = None + cidr6: Optional[List[str]] = None tags: Optional[List[str]] = None diff --git a/src/gcore/types/dns/dns_mapping_entry_param.py b/src/gcore/types/dns/dns_mapping_entry_param.py index 67942c37..d6504b98 100644 --- a/src/gcore/types/dns/dns_mapping_entry_param.py +++ b/src/gcore/types/dns/dns_mapping_entry_param.py @@ -2,7 +2,6 @@ from __future__ import annotations -from typing import Iterable from typing_extensions import TypedDict from ..._types import SequenceNotStr @@ -11,8 +10,8 @@ class DNSMappingEntryParam(TypedDict, total=False): - cidr4: Iterable[object] + cidr4: SequenceNotStr[str] - cidr6: Iterable[object] + cidr6: SequenceNotStr[str] tags: SequenceNotStr[str] diff --git a/src/gcore/types/dns/network_mapping_create_params.py b/src/gcore/types/dns/network_mapping_create_params.py index 2b82ed34..d670478a 100644 --- a/src/gcore/types/dns/network_mapping_create_params.py +++ b/src/gcore/types/dns/network_mapping_create_params.py @@ -11,8 +11,6 @@ class NetworkMappingCreateParams(TypedDict, total=False): - id: int - mapping: Iterable[DNSMappingEntryParam] name: str diff --git a/src/gcore/types/dns/network_mapping_replace_params.py b/src/gcore/types/dns/network_mapping_replace_params.py index cb10d570..7e7d7b2e 100644 --- a/src/gcore/types/dns/network_mapping_replace_params.py +++ b/src/gcore/types/dns/network_mapping_replace_params.py @@ -3,17 +3,14 @@ from __future__ import annotations from typing import Iterable -from typing_extensions import Annotated, TypedDict +from typing_extensions import TypedDict -from ..._utils import PropertyInfo from .dns_mapping_entry_param import DNSMappingEntryParam __all__ = ["NetworkMappingReplaceParams"] class NetworkMappingReplaceParams(TypedDict, total=False): - body_id: Annotated[int, PropertyInfo(alias="id")] - mapping: Iterable[DNSMappingEntryParam] name: str diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py index ec77e011..0afb78c8 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_interfaces.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import NetworkInterfaceList +from gcore.types.cloud import TaskIDList, NetworkInterfaceList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -63,6 +63,373 @@ def test_path_params_list(self, client: Gcore) -> None: region_id=0, ) + @parametrize + def test_method_attach_overload_1(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_method_attach_with_all_params_overload_1(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="interface_name", + ip_family="dual", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="external", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_raw_response_attach_overload_1(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_streaming_response_attach_overload_1(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_overload_1(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + def test_method_attach_overload_2(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_method_attach_with_all_params_overload_2(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-subnet-interface", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="subnet", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_raw_response_attach_overload_2(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_streaming_response_attach_overload_2(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_overload_2(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + @parametrize + def test_method_attach_overload_3(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_method_attach_with_all_params_overload_3(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-any-subnet-interface", + ip_family="dual", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="any_subnet", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_raw_response_attach_overload_3(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_streaming_response_attach_overload_3(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_overload_3(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + @parametrize + def test_method_attach_overload_4(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_method_attach_with_all_params_overload_4(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-rfip-interface", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="reserved_fixed_ip", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_raw_response_attach_overload_4(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_streaming_response_attach_overload_4(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_attach_overload_4(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + + @parametrize + def test_method_detach(self, client: Gcore) -> None: + interface = client.cloud.gpu_baremetal_clusters.interfaces.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_raw_response_detach(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + def test_streaming_response_detach(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_detach(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.detach( + instance_id="", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + class TestAsyncInterfaces: parametrize = pytest.mark.parametrize( @@ -114,3 +481,370 @@ async def test_path_params_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) + + @parametrize + async def test_method_attach_overload_1(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_method_attach_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="interface_name", + ip_family="dual", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="external", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_raw_response_attach_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_attach_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_overload_1(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + ) + + @parametrize + async def test_method_attach_overload_2(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_method_attach_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-subnet-interface", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="subnet", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_raw_response_attach_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_attach_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_overload_2(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + @parametrize + async def test_method_attach_overload_3(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_method_attach_with_all_params_overload_3(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-any-subnet-interface", + ip_family="dual", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="any_subnet", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_raw_response_attach_overload_3(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_attach_overload_3(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_overload_3(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", + ) + + @parametrize + async def test_method_attach_overload_4(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_method_attach_with_all_params_overload_4(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ddos_profile={ + "profile_template": 29, + "fields": [ + { + "base_field": 10, + "field_name": "field_name", + "field_value": [45046, 45047], + "value": None, + } + ], + "profile_template_name": "profile_template_name", + }, + interface_name="my-rfip-interface", + port_group=0, + security_groups=[ + {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, + {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, + ], + type="reserved_fixed_ip", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_raw_response_attach_overload_4(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_attach_overload_4(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.attach( + instance_id="instance_id", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_attach_overload_4(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.attach( + instance_id="", + project_id=0, + region_id=0, + port_id="59905c8e-2619-420a-b046-536096473370", + ) + + @parametrize + async def test_method_detach(self, async_client: AsyncGcore) -> None: + interface = await async_client.cloud.gpu_baremetal_clusters.interfaces.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_raw_response_detach(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + @parametrize + async def test_streaming_response_detach(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.interfaces.with_streaming_response.detach( + instance_id="instance_id", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + interface = await response.parse() + assert_matches_type(TaskIDList, interface, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_detach(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.interfaces.with_raw_response.detach( + instance_id="", + project_id=0, + region_id=0, + ip_address="192.168.123.20", + port_id="351b0dd7-ca09-431c-be53-935db3785067", + ) diff --git a/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py b/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py index 204a8ffb..e3631089 100644 --- a/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py +++ b/tests/api_resources/cloud/gpu_baremetal_clusters/test_servers.py @@ -156,373 +156,6 @@ def test_path_params_delete(self, client: Gcore) -> None: cluster_id="cluster_id", ) - @parametrize - def test_method_attach_interface_overload_1(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_method_attach_interface_with_all_params_overload_1(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ddos_profile={ - "profile_template": 29, - "fields": [ - { - "base_field": 10, - "field_name": "field_name", - "field_value": [45046, 45047], - "value": None, - } - ], - "profile_template_name": "profile_template_name", - }, - interface_name="interface_name", - ip_family="dual", - port_group=0, - security_groups=[ - {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, - {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, - ], - type="external", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_raw_response_attach_interface_overload_1(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_streaming_response_attach_interface_overload_1(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_attach_interface_overload_1(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="", - project_id=0, - region_id=0, - ) - - @parametrize - def test_method_attach_interface_overload_2(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_method_attach_interface_with_all_params_overload_2(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ddos_profile={ - "profile_template": 29, - "fields": [ - { - "base_field": 10, - "field_name": "field_name", - "field_value": [45046, 45047], - "value": None, - } - ], - "profile_template_name": "profile_template_name", - }, - interface_name="my-subnet-interface", - port_group=0, - security_groups=[ - {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, - {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, - ], - type="subnet", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_raw_response_attach_interface_overload_2(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_streaming_response_attach_interface_overload_2(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_attach_interface_overload_2(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - - @parametrize - def test_method_attach_interface_overload_3(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_method_attach_interface_with_all_params_overload_3(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ddos_profile={ - "profile_template": 29, - "fields": [ - { - "base_field": 10, - "field_name": "field_name", - "field_value": [45046, 45047], - "value": None, - } - ], - "profile_template_name": "profile_template_name", - }, - interface_name="my-any-subnet-interface", - ip_family="dual", - port_group=0, - security_groups=[ - {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, - {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, - ], - type="any_subnet", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_raw_response_attach_interface_overload_3(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_streaming_response_attach_interface_overload_3(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_attach_interface_overload_3(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - - @parametrize - def test_method_attach_interface_overload_4(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_method_attach_interface_with_all_params_overload_4(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ddos_profile={ - "profile_template": 29, - "fields": [ - { - "base_field": 10, - "field_name": "field_name", - "field_value": [45046, 45047], - "value": None, - } - ], - "profile_template_name": "profile_template_name", - }, - interface_name="my-rfip-interface", - port_group=0, - security_groups=[ - {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, - {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, - ], - type="reserved_fixed_ip", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_raw_response_attach_interface_overload_4(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_streaming_response_attach_interface_overload_4(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_attach_interface_overload_4(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ) - - @parametrize - def test_method_detach_interface(self, client: Gcore) -> None: - server = client.cloud.gpu_baremetal_clusters.servers.detach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ip_address="192.168.123.20", - port_id="351b0dd7-ca09-431c-be53-935db3785067", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_raw_response_detach_interface(self, client: Gcore) -> None: - response = client.cloud.gpu_baremetal_clusters.servers.with_raw_response.detach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ip_address="192.168.123.20", - port_id="351b0dd7-ca09-431c-be53-935db3785067", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - def test_streaming_response_detach_interface(self, client: Gcore) -> None: - with client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.detach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ip_address="192.168.123.20", - port_id="351b0dd7-ca09-431c-be53-935db3785067", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_detach_interface(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - client.cloud.gpu_baremetal_clusters.servers.with_raw_response.detach_interface( - instance_id="", - project_id=0, - region_id=0, - ip_address="192.168.123.20", - port_id="351b0dd7-ca09-431c-be53-935db3785067", - ) - @parametrize def test_method_get_console(self, client: Gcore) -> None: server = client.cloud.gpu_baremetal_clusters.servers.get_console( @@ -800,373 +433,6 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: cluster_id="cluster_id", ) - @parametrize - async def test_method_attach_interface_overload_1(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_method_attach_interface_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ddos_profile={ - "profile_template": 29, - "fields": [ - { - "base_field": 10, - "field_name": "field_name", - "field_value": [45046, 45047], - "value": None, - } - ], - "profile_template_name": "profile_template_name", - }, - interface_name="interface_name", - ip_family="dual", - port_group=0, - security_groups=[ - {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, - {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, - ], - type="external", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_raw_response_attach_interface_overload_1(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_streaming_response_attach_interface_overload_1(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_attach_interface_overload_1(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="", - project_id=0, - region_id=0, - ) - - @parametrize - async def test_method_attach_interface_overload_2(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_method_attach_interface_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ddos_profile={ - "profile_template": 29, - "fields": [ - { - "base_field": 10, - "field_name": "field_name", - "field_value": [45046, 45047], - "value": None, - } - ], - "profile_template_name": "profile_template_name", - }, - interface_name="my-subnet-interface", - port_group=0, - security_groups=[ - {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, - {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, - ], - type="subnet", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_raw_response_attach_interface_overload_2(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_streaming_response_attach_interface_overload_2(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_attach_interface_overload_2(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="", - project_id=0, - region_id=0, - subnet_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - - @parametrize - async def test_method_attach_interface_overload_3(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_method_attach_interface_with_all_params_overload_3(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ddos_profile={ - "profile_template": 29, - "fields": [ - { - "base_field": 10, - "field_name": "field_name", - "field_value": [45046, 45047], - "value": None, - } - ], - "profile_template_name": "profile_template_name", - }, - interface_name="my-any-subnet-interface", - ip_family="dual", - port_group=0, - security_groups=[ - {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, - {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, - ], - type="any_subnet", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_raw_response_attach_interface_overload_3(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_streaming_response_attach_interface_overload_3(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_attach_interface_overload_3(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="", - project_id=0, - region_id=0, - network_id="e3c6ee77-48cb-416b-b204-11b492cc776e3", - ) - - @parametrize - async def test_method_attach_interface_overload_4(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_method_attach_interface_with_all_params_overload_4(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ddos_profile={ - "profile_template": 29, - "fields": [ - { - "base_field": 10, - "field_name": "field_name", - "field_value": [45046, 45047], - "value": None, - } - ], - "profile_template_name": "profile_template_name", - }, - interface_name="my-rfip-interface", - port_group=0, - security_groups=[ - {"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"}, - {"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"}, - ], - type="reserved_fixed_ip", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_raw_response_attach_interface_overload_4(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_streaming_response_attach_interface_overload_4(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.attach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_attach_interface_overload_4(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.attach_interface( - instance_id="", - project_id=0, - region_id=0, - port_id="59905c8e-2619-420a-b046-536096473370", - ) - - @parametrize - async def test_method_detach_interface(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_baremetal_clusters.servers.detach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ip_address="192.168.123.20", - port_id="351b0dd7-ca09-431c-be53-935db3785067", - ) - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_raw_response_detach_interface(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.detach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ip_address="192.168.123.20", - port_id="351b0dd7-ca09-431c-be53-935db3785067", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - @parametrize - async def test_streaming_response_detach_interface(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_baremetal_clusters.servers.with_streaming_response.detach_interface( - instance_id="instance_id", - project_id=0, - region_id=0, - ip_address="192.168.123.20", - port_id="351b0dd7-ca09-431c-be53-935db3785067", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - server = await response.parse() - assert_matches_type(TaskIDList, server, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_detach_interface(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `instance_id` but received ''"): - await async_client.cloud.gpu_baremetal_clusters.servers.with_raw_response.detach_interface( - instance_id="", - project_id=0, - region_id=0, - ip_address="192.168.123.20", - port_id="351b0dd7-ca09-431c-be53-935db3785067", - ) - @parametrize async def test_method_get_console(self, async_client: AsyncGcore) -> None: server = await async_client.cloud.gpu_baremetal_clusters.servers.get_console( diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/__init__.py b/tests/api_resources/cloud/gpu_virtual/__init__.py similarity index 100% rename from tests/api_resources/cloud/gpu_virtual_clusters/__init__.py rename to tests/api_resources/cloud/gpu_virtual/__init__.py diff --git a/tests/api_resources/cloud/gpu_virtual/clusters/__init__.py b/tests/api_resources/cloud/gpu_virtual/clusters/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cloud/gpu_virtual/clusters/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/test_flavors.py b/tests/api_resources/cloud/gpu_virtual/clusters/test_flavors.py similarity index 86% rename from tests/api_resources/cloud/gpu_virtual_clusters/test_flavors.py rename to tests/api_resources/cloud/gpu_virtual/clusters/test_flavors.py index 89b949ed..4f1118ae 100644 --- a/tests/api_resources/cloud/gpu_virtual_clusters/test_flavors.py +++ b/tests/api_resources/cloud/gpu_virtual/clusters/test_flavors.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualFlavorList +from gcore.types.cloud.gpu_virtual.clusters import GPUVirtualFlavorList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,7 +19,7 @@ class TestFlavors: @parametrize def test_method_list(self, client: Gcore) -> None: - flavor = client.cloud.gpu_virtual_clusters.flavors.list( + flavor = client.cloud.gpu_virtual.clusters.flavors.list( project_id=1, region_id=7, ) @@ -27,7 +27,7 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - flavor = client.cloud.gpu_virtual_clusters.flavors.list( + flavor = client.cloud.gpu_virtual.clusters.flavors.list( project_id=1, region_id=7, hide_disabled=True, @@ -37,7 +37,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.flavors.with_raw_response.list( + response = client.cloud.gpu_virtual.clusters.flavors.with_raw_response.list( project_id=1, region_id=7, ) @@ -49,7 +49,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.flavors.with_streaming_response.list( + with client.cloud.gpu_virtual.clusters.flavors.with_streaming_response.list( project_id=1, region_id=7, ) as response: @@ -69,7 +69,7 @@ class TestAsyncFlavors: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - flavor = await async_client.cloud.gpu_virtual_clusters.flavors.list( + flavor = await async_client.cloud.gpu_virtual.clusters.flavors.list( project_id=1, region_id=7, ) @@ -77,7 +77,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - flavor = await async_client.cloud.gpu_virtual_clusters.flavors.list( + flavor = await async_client.cloud.gpu_virtual.clusters.flavors.list( project_id=1, region_id=7, hide_disabled=True, @@ -87,7 +87,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.flavors.with_raw_response.list( + response = await async_client.cloud.gpu_virtual.clusters.flavors.with_raw_response.list( project_id=1, region_id=7, ) @@ -99,7 +99,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.flavors.with_streaming_response.list( + async with async_client.cloud.gpu_virtual.clusters.flavors.with_streaming_response.list( project_id=1, region_id=7, ) as response: diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/test_images.py b/tests/api_resources/cloud/gpu_virtual/clusters/test_images.py similarity index 87% rename from tests/api_resources/cloud/gpu_virtual_clusters/test_images.py rename to tests/api_resources/cloud/gpu_virtual/clusters/test_images.py index 7312ccb7..669aa6c0 100644 --- a/tests/api_resources/cloud/gpu_virtual_clusters/test_images.py +++ b/tests/api_resources/cloud/gpu_virtual/clusters/test_images.py @@ -19,7 +19,7 @@ class TestImages: @parametrize def test_method_list(self, client: Gcore) -> None: - image = client.cloud.gpu_virtual_clusters.images.list( + image = client.cloud.gpu_virtual.clusters.images.list( project_id=1, region_id=7, ) @@ -27,7 +27,7 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.images.with_raw_response.list( + response = client.cloud.gpu_virtual.clusters.images.with_raw_response.list( project_id=1, region_id=7, ) @@ -39,7 +39,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.images.with_streaming_response.list( + with client.cloud.gpu_virtual.clusters.images.with_streaming_response.list( project_id=1, region_id=7, ) as response: @@ -53,7 +53,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: - image = client.cloud.gpu_virtual_clusters.images.delete( + image = client.cloud.gpu_virtual.clusters.images.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -62,7 +62,7 @@ def test_method_delete(self, client: Gcore) -> None: @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.images.with_raw_response.delete( + response = client.cloud.gpu_virtual.clusters.images.with_raw_response.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -75,7 +75,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.images.with_streaming_response.delete( + with client.cloud.gpu_virtual.clusters.images.with_streaming_response.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -91,7 +91,7 @@ def test_streaming_response_delete(self, client: Gcore) -> None: @parametrize def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): - client.cloud.gpu_virtual_clusters.images.with_raw_response.delete( + client.cloud.gpu_virtual.clusters.images.with_raw_response.delete( image_id="", project_id=1, region_id=7, @@ -99,7 +99,7 @@ def test_path_params_delete(self, client: Gcore) -> None: @parametrize def test_method_get(self, client: Gcore) -> None: - image = client.cloud.gpu_virtual_clusters.images.get( + image = client.cloud.gpu_virtual.clusters.images.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -108,7 +108,7 @@ def test_method_get(self, client: Gcore) -> None: @parametrize def test_raw_response_get(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.images.with_raw_response.get( + response = client.cloud.gpu_virtual.clusters.images.with_raw_response.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -121,7 +121,7 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.images.with_streaming_response.get( + with client.cloud.gpu_virtual.clusters.images.with_streaming_response.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -137,7 +137,7 @@ def test_streaming_response_get(self, client: Gcore) -> None: @parametrize def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): - client.cloud.gpu_virtual_clusters.images.with_raw_response.get( + client.cloud.gpu_virtual.clusters.images.with_raw_response.get( image_id="", project_id=1, region_id=7, @@ -145,7 +145,7 @@ def test_path_params_get(self, client: Gcore) -> None: @parametrize def test_method_upload(self, client: Gcore) -> None: - image = client.cloud.gpu_virtual_clusters.images.upload( + image = client.cloud.gpu_virtual.clusters.images.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -155,7 +155,7 @@ def test_method_upload(self, client: Gcore) -> None: @parametrize def test_method_upload_with_all_params(self, client: Gcore) -> None: - image = client.cloud.gpu_virtual_clusters.images.upload( + image = client.cloud.gpu_virtual.clusters.images.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -173,7 +173,7 @@ def test_method_upload_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_upload(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.images.with_raw_response.upload( + response = client.cloud.gpu_virtual.clusters.images.with_raw_response.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -187,7 +187,7 @@ def test_raw_response_upload(self, client: Gcore) -> None: @parametrize def test_streaming_response_upload(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.images.with_streaming_response.upload( + with client.cloud.gpu_virtual.clusters.images.with_streaming_response.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -209,7 +209,7 @@ class TestAsyncImages: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - image = await async_client.cloud.gpu_virtual_clusters.images.list( + image = await async_client.cloud.gpu_virtual.clusters.images.list( project_id=1, region_id=7, ) @@ -217,7 +217,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.list( + response = await async_client.cloud.gpu_virtual.clusters.images.with_raw_response.list( project_id=1, region_id=7, ) @@ -229,7 +229,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.images.with_streaming_response.list( + async with async_client.cloud.gpu_virtual.clusters.images.with_streaming_response.list( project_id=1, region_id=7, ) as response: @@ -243,7 +243,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - image = await async_client.cloud.gpu_virtual_clusters.images.delete( + image = await async_client.cloud.gpu_virtual.clusters.images.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -252,7 +252,7 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.delete( + response = await async_client.cloud.gpu_virtual.clusters.images.with_raw_response.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -265,7 +265,7 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.images.with_streaming_response.delete( + async with async_client.cloud.gpu_virtual.clusters.images.with_streaming_response.delete( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -281,7 +281,7 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None @parametrize async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.delete( + await async_client.cloud.gpu_virtual.clusters.images.with_raw_response.delete( image_id="", project_id=1, region_id=7, @@ -289,7 +289,7 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: - image = await async_client.cloud.gpu_virtual_clusters.images.get( + image = await async_client.cloud.gpu_virtual.clusters.images.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -298,7 +298,7 @@ async def test_method_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.get( + response = await async_client.cloud.gpu_virtual.clusters.images.with_raw_response.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -311,7 +311,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.images.with_streaming_response.get( + async with async_client.cloud.gpu_virtual.clusters.images.with_streaming_response.get( image_id="8cab6f28-09ca-4201-b3f7-23c7893f4bd6", project_id=1, region_id=7, @@ -327,7 +327,7 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `image_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.get( + await async_client.cloud.gpu_virtual.clusters.images.with_raw_response.get( image_id="", project_id=1, region_id=7, @@ -335,7 +335,7 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_upload(self, async_client: AsyncGcore) -> None: - image = await async_client.cloud.gpu_virtual_clusters.images.upload( + image = await async_client.cloud.gpu_virtual.clusters.images.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -345,7 +345,7 @@ async def test_method_upload(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_upload_with_all_params(self, async_client: AsyncGcore) -> None: - image = await async_client.cloud.gpu_virtual_clusters.images.upload( + image = await async_client.cloud.gpu_virtual.clusters.images.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -363,7 +363,7 @@ async def test_method_upload_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_upload(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.images.with_raw_response.upload( + response = await async_client.cloud.gpu_virtual.clusters.images.with_raw_response.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", @@ -377,7 +377,7 @@ async def test_raw_response_upload(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_upload(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.images.with_streaming_response.upload( + async with async_client.cloud.gpu_virtual.clusters.images.with_streaming_response.upload( project_id=1, region_id=7, name="ubuntu-23.10-x64", diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/test_interfaces.py b/tests/api_resources/cloud/gpu_virtual/clusters/test_interfaces.py similarity index 87% rename from tests/api_resources/cloud/gpu_virtual_clusters/test_interfaces.py rename to tests/api_resources/cloud/gpu_virtual/clusters/test_interfaces.py index c36ac28b..b2cbbb85 100644 --- a/tests/api_resources/cloud/gpu_virtual_clusters/test_interfaces.py +++ b/tests/api_resources/cloud/gpu_virtual/clusters/test_interfaces.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualInterfaceList +from gcore.types.cloud.gpu_virtual.clusters import GPUVirtualInterfaceList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,7 +19,7 @@ class TestInterfaces: @parametrize def test_method_list(self, client: Gcore) -> None: - interface = client.cloud.gpu_virtual_clusters.interfaces.list( + interface = client.cloud.gpu_virtual.clusters.interfaces.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -28,7 +28,7 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.interfaces.with_raw_response.list( + response = client.cloud.gpu_virtual.clusters.interfaces.with_raw_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -41,7 +41,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.interfaces.with_streaming_response.list( + with client.cloud.gpu_virtual.clusters.interfaces.with_streaming_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -57,7 +57,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_path_params_list(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.interfaces.with_raw_response.list( + client.cloud.gpu_virtual.clusters.interfaces.with_raw_response.list( cluster_id="", project_id=1, region_id=7, @@ -71,7 +71,7 @@ class TestAsyncInterfaces: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - interface = await async_client.cloud.gpu_virtual_clusters.interfaces.list( + interface = await async_client.cloud.gpu_virtual.clusters.interfaces.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -80,7 +80,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.interfaces.with_raw_response.list( + response = await async_client.cloud.gpu_virtual.clusters.interfaces.with_raw_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -93,7 +93,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.interfaces.with_streaming_response.list( + async with async_client.cloud.gpu_virtual.clusters.interfaces.with_streaming_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -109,7 +109,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_path_params_list(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.interfaces.with_raw_response.list( + await async_client.cloud.gpu_virtual.clusters.interfaces.with_raw_response.list( cluster_id="", project_id=1, region_id=7, diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/test_servers.py b/tests/api_resources/cloud/gpu_virtual/clusters/test_servers.py similarity index 88% rename from tests/api_resources/cloud/gpu_virtual_clusters/test_servers.py rename to tests/api_resources/cloud/gpu_virtual/clusters/test_servers.py index 6e341c99..29ca8dc8 100644 --- a/tests/api_resources/cloud/gpu_virtual_clusters/test_servers.py +++ b/tests/api_resources/cloud/gpu_virtual/clusters/test_servers.py @@ -11,7 +11,7 @@ from tests.utils import assert_matches_type from gcore._utils import parse_datetime from gcore.types.cloud import TaskIDList -from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualClusterServerList +from gcore.types.cloud.gpu_virtual.clusters import GPUVirtualClusterServerList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,7 +21,7 @@ class TestServers: @parametrize def test_method_list(self, client: Gcore) -> None: - server = client.cloud.gpu_virtual_clusters.servers.list( + server = client.cloud.gpu_virtual.clusters.servers.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -30,7 +30,7 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - server = client.cloud.gpu_virtual_clusters.servers.list( + server = client.cloud.gpu_virtual.clusters.servers.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -48,7 +48,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.servers.with_raw_response.list( + response = client.cloud.gpu_virtual.clusters.servers.with_raw_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -61,7 +61,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.servers.with_streaming_response.list( + with client.cloud.gpu_virtual.clusters.servers.with_streaming_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -77,7 +77,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_path_params_list(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.servers.with_raw_response.list( + client.cloud.gpu_virtual.clusters.servers.with_raw_response.list( cluster_id="", project_id=1, region_id=7, @@ -85,7 +85,7 @@ def test_path_params_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: - server = client.cloud.gpu_virtual_clusters.servers.delete( + server = client.cloud.gpu_virtual.clusters.servers.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -95,7 +95,7 @@ def test_method_delete(self, client: Gcore) -> None: @parametrize def test_method_delete_with_all_params(self, client: Gcore) -> None: - server = client.cloud.gpu_virtual_clusters.servers.delete( + server = client.cloud.gpu_virtual.clusters.servers.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -111,7 +111,7 @@ def test_method_delete_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + response = client.cloud.gpu_virtual.clusters.servers.with_raw_response.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -125,7 +125,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.servers.with_streaming_response.delete( + with client.cloud.gpu_virtual.clusters.servers.with_streaming_response.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -142,7 +142,7 @@ def test_streaming_response_delete(self, client: Gcore) -> None: @parametrize def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + client.cloud.gpu_virtual.clusters.servers.with_raw_response.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -150,7 +150,7 @@ def test_path_params_delete(self, client: Gcore) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `server_id` but received ''"): - client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + client.cloud.gpu_virtual.clusters.servers.with_raw_response.delete( server_id="", project_id=1, region_id=7, @@ -165,7 +165,7 @@ class TestAsyncServers: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_virtual_clusters.servers.list( + server = await async_client.cloud.gpu_virtual.clusters.servers.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -174,7 +174,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_virtual_clusters.servers.list( + server = await async_client.cloud.gpu_virtual.clusters.servers.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -192,7 +192,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.servers.with_raw_response.list( + response = await async_client.cloud.gpu_virtual.clusters.servers.with_raw_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -205,7 +205,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.servers.with_streaming_response.list( + async with async_client.cloud.gpu_virtual.clusters.servers.with_streaming_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -221,7 +221,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_path_params_list(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.servers.with_raw_response.list( + await async_client.cloud.gpu_virtual.clusters.servers.with_raw_response.list( cluster_id="", project_id=1, region_id=7, @@ -229,7 +229,7 @@ async def test_path_params_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_virtual_clusters.servers.delete( + server = await async_client.cloud.gpu_virtual.clusters.servers.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -239,7 +239,7 @@ async def test_method_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: - server = await async_client.cloud.gpu_virtual_clusters.servers.delete( + server = await async_client.cloud.gpu_virtual.clusters.servers.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -255,7 +255,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + response = await async_client.cloud.gpu_virtual.clusters.servers.with_raw_response.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -269,7 +269,7 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.servers.with_streaming_response.delete( + async with async_client.cloud.gpu_virtual.clusters.servers.with_streaming_response.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -286,7 +286,7 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None @parametrize async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + await async_client.cloud.gpu_virtual.clusters.servers.with_raw_response.delete( server_id="f1c1eeb6-1834-48c9-a7b0-daafce64872b", project_id=1, region_id=7, @@ -294,7 +294,7 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `server_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.servers.with_raw_response.delete( + await async_client.cloud.gpu_virtual.clusters.servers.with_raw_response.delete( server_id="", project_id=1, region_id=7, diff --git a/tests/api_resources/cloud/gpu_virtual_clusters/test_volumes.py b/tests/api_resources/cloud/gpu_virtual/clusters/test_volumes.py similarity index 87% rename from tests/api_resources/cloud/gpu_virtual_clusters/test_volumes.py rename to tests/api_resources/cloud/gpu_virtual/clusters/test_volumes.py index 294f4466..37d10355 100644 --- a/tests/api_resources/cloud/gpu_virtual_clusters/test_volumes.py +++ b/tests/api_resources/cloud/gpu_virtual/clusters/test_volumes.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.gpu_virtual_clusters import GPUVirtualClusterVolumeList +from gcore.types.cloud.gpu_virtual.clusters import GPUVirtualClusterVolumeList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,7 +19,7 @@ class TestVolumes: @parametrize def test_method_list(self, client: Gcore) -> None: - volume = client.cloud.gpu_virtual_clusters.volumes.list( + volume = client.cloud.gpu_virtual.clusters.volumes.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -28,7 +28,7 @@ def test_method_list(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.volumes.with_raw_response.list( + response = client.cloud.gpu_virtual.clusters.volumes.with_raw_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -41,7 +41,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.volumes.with_streaming_response.list( + with client.cloud.gpu_virtual.clusters.volumes.with_streaming_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -57,7 +57,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_path_params_list(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.volumes.with_raw_response.list( + client.cloud.gpu_virtual.clusters.volumes.with_raw_response.list( cluster_id="", project_id=1, region_id=7, @@ -71,7 +71,7 @@ class TestAsyncVolumes: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - volume = await async_client.cloud.gpu_virtual_clusters.volumes.list( + volume = await async_client.cloud.gpu_virtual.clusters.volumes.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -80,7 +80,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.volumes.with_raw_response.list( + response = await async_client.cloud.gpu_virtual.clusters.volumes.with_raw_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -93,7 +93,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.volumes.with_streaming_response.list( + async with async_client.cloud.gpu_virtual.clusters.volumes.with_streaming_response.list( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -109,7 +109,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_path_params_list(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.volumes.with_raw_response.list( + await async_client.cloud.gpu_virtual.clusters.volumes.with_raw_response.list( cluster_id="", project_id=1, region_id=7, diff --git a/tests/api_resources/cloud/test_gpu_virtual_clusters.py b/tests/api_resources/cloud/gpu_virtual/test_clusters.py similarity index 73% rename from tests/api_resources/cloud/test_gpu_virtual_clusters.py rename to tests/api_resources/cloud/gpu_virtual/test_clusters.py index 6f3758e5..91d2ae2d 100644 --- a/tests/api_resources/cloud/test_gpu_virtual_clusters.py +++ b/tests/api_resources/cloud/gpu_virtual/test_clusters.py @@ -10,20 +10,20 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.cloud import ( - TaskIDList, +from gcore.types.cloud import TaskIDList +from gcore.types.cloud.gpu_virtual import ( GPUVirtualCluster, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestGPUVirtualClusters: +class TestClusters: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_create(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.create( + cluster = client.cloud.gpu_virtual.clusters.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -42,11 +42,11 @@ def test_method_create(self, client: Gcore) -> None: ], }, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.create( + cluster = client.cloud.gpu_virtual.clusters.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -87,11 +87,11 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: }, tags={"my-tag": "my-tag-value"}, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.create( + response = client.cloud.gpu_virtual.clusters.with_raw_response.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -113,12 +113,12 @@ def test_raw_response_create(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.create( + with client.cloud.gpu_virtual.clusters.with_streaming_response.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -140,24 +140,24 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_update(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.update( + cluster = client.cloud.gpu_virtual.clusters.update( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, name="gpu-cluster-1", ) - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.update( + response = client.cloud.gpu_virtual.clusters.with_raw_response.update( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -166,12 +166,12 @@ def test_raw_response_update(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.update( + with client.cloud.gpu_virtual.clusters.with_streaming_response.update( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -180,15 +180,15 @@ def test_streaming_response_update(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_update(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.update( + client.cloud.gpu_virtual.clusters.with_raw_response.update( cluster_id="", project_id=1, region_id=7, @@ -197,60 +197,60 @@ def test_path_params_update(self, client: Gcore) -> None: @parametrize def test_method_list(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.list( + cluster = client.cloud.gpu_virtual.clusters.list( project_id=1, region_id=7, ) - assert_matches_type(SyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + assert_matches_type(SyncOffsetPage[GPUVirtualCluster], cluster, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.list( + cluster = client.cloud.gpu_virtual.clusters.list( project_id=1, region_id=7, limit=10, offset=0, ) - assert_matches_type(SyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + assert_matches_type(SyncOffsetPage[GPUVirtualCluster], cluster, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.list( + response = client.cloud.gpu_virtual.clusters.with_raw_response.list( project_id=1, region_id=7, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(SyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(SyncOffsetPage[GPUVirtualCluster], cluster, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.list( + with client.cloud.gpu_virtual.clusters.with_streaming_response.list( project_id=1, region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(SyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(SyncOffsetPage[GPUVirtualCluster], cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_delete(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.delete( + cluster = client.cloud.gpu_virtual.clusters.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_method_delete_with_all_params(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.delete( + cluster = client.cloud.gpu_virtual.clusters.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -261,11 +261,11 @@ def test_method_delete_with_all_params(self, client: Gcore) -> None: reserved_fixed_ip_ids=["a29b8e1e-08d3-4cec-91fb-06e81e5f46d5"], volume_ids=["1333c684-c3da-4b91-ac9e-a92706aa2824"], ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.delete( + response = client.cloud.gpu_virtual.clusters.with_raw_response.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -273,12 +273,12 @@ def test_raw_response_delete(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.delete( + with client.cloud.gpu_virtual.clusters.with_streaming_response.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -286,15 +286,15 @@ def test_streaming_response_delete(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.delete( + client.cloud.gpu_virtual.clusters.with_raw_response.delete( cluster_id="", project_id=1, region_id=7, @@ -302,17 +302,17 @@ def test_path_params_delete(self, client: Gcore) -> None: @parametrize def test_method_action_overload_1(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster = client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="start", ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_action_overload_1(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -321,12 +321,12 @@ def test_raw_response_action_overload_1(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_action_overload_1(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + with client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -335,15 +335,15 @@ def test_streaming_response_action_overload_1(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_action_overload_1(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.action( + client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -352,17 +352,17 @@ def test_path_params_action_overload_1(self, client: Gcore) -> None: @parametrize def test_method_action_overload_2(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster = client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="stop", ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_action_overload_2(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -371,12 +371,12 @@ def test_raw_response_action_overload_2(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_action_overload_2(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + with client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -385,15 +385,15 @@ def test_streaming_response_action_overload_2(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_action_overload_2(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.action( + client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -402,17 +402,17 @@ def test_path_params_action_overload_2(self, client: Gcore) -> None: @parametrize def test_method_action_overload_3(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster = client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="soft_reboot", ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_action_overload_3(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -421,12 +421,12 @@ def test_raw_response_action_overload_3(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_action_overload_3(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + with client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -435,15 +435,15 @@ def test_streaming_response_action_overload_3(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_action_overload_3(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.action( + client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -452,17 +452,17 @@ def test_path_params_action_overload_3(self, client: Gcore) -> None: @parametrize def test_method_action_overload_4(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster = client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="hard_reboot", ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_action_overload_4(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -471,12 +471,12 @@ def test_raw_response_action_overload_4(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_action_overload_4(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + with client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -485,15 +485,15 @@ def test_streaming_response_action_overload_4(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_action_overload_4(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.action( + client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -502,18 +502,18 @@ def test_path_params_action_overload_4(self, client: Gcore) -> None: @parametrize def test_method_action_overload_5(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster = client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="update_tags", tags={"foo": "my-tag-value"}, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_action_overload_5(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -523,12 +523,12 @@ def test_raw_response_action_overload_5(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_action_overload_5(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + with client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -538,15 +538,15 @@ def test_streaming_response_action_overload_5(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_action_overload_5(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.action( + client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -556,18 +556,18 @@ def test_path_params_action_overload_5(self, client: Gcore) -> None: @parametrize def test_method_action_overload_6(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.action( + cluster = client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="resize", servers_count=5, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_raw_response_action_overload_6(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -577,12 +577,12 @@ def test_raw_response_action_overload_6(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize def test_streaming_response_action_overload_6(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.action( + with client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -592,15 +592,15 @@ def test_streaming_response_action_overload_6(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_action_overload_6(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.action( + client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -610,16 +610,16 @@ def test_path_params_action_overload_6(self, client: Gcore) -> None: @parametrize def test_method_get(self, client: Gcore) -> None: - gpu_virtual_cluster = client.cloud.gpu_virtual_clusters.get( + cluster = client.cloud.gpu_virtual.clusters.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, ) - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: - response = client.cloud.gpu_virtual_clusters.with_raw_response.get( + response = client.cloud.gpu_virtual.clusters.with_raw_response.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -627,12 +627,12 @@ def test_raw_response_get(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) @parametrize def test_streaming_response_get(self, client: Gcore) -> None: - with client.cloud.gpu_virtual_clusters.with_streaming_response.get( + with client.cloud.gpu_virtual.clusters.with_streaming_response.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -640,29 +640,29 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = response.parse() - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + cluster = response.parse() + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - client.cloud.gpu_virtual_clusters.with_raw_response.get( + client.cloud.gpu_virtual.clusters.with_raw_response.get( cluster_id="", project_id=1, region_id=7, ) -class TestAsyncGPUVirtualClusters: +class TestAsyncClusters: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.create( + cluster = await async_client.cloud.gpu_virtual.clusters.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -681,11 +681,11 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: ], }, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.create( + cluster = await async_client.cloud.gpu_virtual.clusters.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -726,11 +726,11 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> }, tags={"my-tag": "my-tag-value"}, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.create( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -752,12 +752,12 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.create( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.create( project_id=1, region_id=7, flavor="g3-ai-32-192-1500-l40s-48-1", @@ -779,24 +779,24 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.update( + cluster = await async_client.cloud.gpu_virtual.clusters.update( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, name="gpu-cluster-1", ) - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.update( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.update( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -805,12 +805,12 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.update( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.update( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -819,15 +819,15 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_update(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.update( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.update( cluster_id="", project_id=1, region_id=7, @@ -836,60 +836,60 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.list( + cluster = await async_client.cloud.gpu_virtual.clusters.list( project_id=1, region_id=7, ) - assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], cluster, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.list( + cluster = await async_client.cloud.gpu_virtual.clusters.list( project_id=1, region_id=7, limit=10, offset=0, ) - assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], cluster, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.list( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.list( project_id=1, region_id=7, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], cluster, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.list( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.list( project_id=1, region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(AsyncOffsetPage[GPUVirtualCluster], cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.delete( + cluster = await async_client.cloud.gpu_virtual.clusters.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.delete( + cluster = await async_client.cloud.gpu_virtual.clusters.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -900,11 +900,11 @@ async def test_method_delete_with_all_params(self, async_client: AsyncGcore) -> reserved_fixed_ip_ids=["a29b8e1e-08d3-4cec-91fb-06e81e5f46d5"], volume_ids=["1333c684-c3da-4b91-ac9e-a92706aa2824"], ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.delete( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -912,12 +912,12 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.delete( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.delete( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -925,15 +925,15 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.delete( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.delete( cluster_id="", project_id=1, region_id=7, @@ -941,17 +941,17 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_action_overload_1(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster = await async_client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="start", ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_action_overload_1(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -960,12 +960,12 @@ async def test_raw_response_action_overload_1(self, async_client: AsyncGcore) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_action_overload_1(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -974,15 +974,15 @@ async def test_streaming_response_action_overload_1(self, async_client: AsyncGco assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_action_overload_1(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -991,17 +991,17 @@ async def test_path_params_action_overload_1(self, async_client: AsyncGcore) -> @parametrize async def test_method_action_overload_2(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster = await async_client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="stop", ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_action_overload_2(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1010,12 +1010,12 @@ async def test_raw_response_action_overload_2(self, async_client: AsyncGcore) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_action_overload_2(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1024,15 +1024,15 @@ async def test_streaming_response_action_overload_2(self, async_client: AsyncGco assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_action_overload_2(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -1041,17 +1041,17 @@ async def test_path_params_action_overload_2(self, async_client: AsyncGcore) -> @parametrize async def test_method_action_overload_3(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster = await async_client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="soft_reboot", ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_action_overload_3(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1060,12 +1060,12 @@ async def test_raw_response_action_overload_3(self, async_client: AsyncGcore) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_action_overload_3(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1074,15 +1074,15 @@ async def test_streaming_response_action_overload_3(self, async_client: AsyncGco assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_action_overload_3(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -1091,17 +1091,17 @@ async def test_path_params_action_overload_3(self, async_client: AsyncGcore) -> @parametrize async def test_method_action_overload_4(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster = await async_client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="hard_reboot", ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_action_overload_4(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1110,12 +1110,12 @@ async def test_raw_response_action_overload_4(self, async_client: AsyncGcore) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_action_overload_4(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1124,15 +1124,15 @@ async def test_streaming_response_action_overload_4(self, async_client: AsyncGco assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_action_overload_4(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -1141,18 +1141,18 @@ async def test_path_params_action_overload_4(self, async_client: AsyncGcore) -> @parametrize async def test_method_action_overload_5(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster = await async_client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="update_tags", tags={"foo": "my-tag-value"}, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_action_overload_5(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1162,12 +1162,12 @@ async def test_raw_response_action_overload_5(self, async_client: AsyncGcore) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_action_overload_5(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1177,15 +1177,15 @@ async def test_streaming_response_action_overload_5(self, async_client: AsyncGco assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_action_overload_5(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -1195,18 +1195,18 @@ async def test_path_params_action_overload_5(self, async_client: AsyncGcore) -> @parametrize async def test_method_action_overload_6(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.action( + cluster = await async_client.cloud.gpu_virtual.clusters.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, action="resize", servers_count=5, ) - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_raw_response_action_overload_6(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1216,12 +1216,12 @@ async def test_raw_response_action_overload_6(self, async_client: AsyncGcore) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) @parametrize async def test_streaming_response_action_overload_6(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.action( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.action( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1231,15 +1231,15 @@ async def test_streaming_response_action_overload_6(self, async_client: AsyncGco assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(TaskIDList, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(TaskIDList, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_action_overload_6(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.action( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.action( cluster_id="", project_id=1, region_id=7, @@ -1249,16 +1249,16 @@ async def test_path_params_action_overload_6(self, async_client: AsyncGcore) -> @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: - gpu_virtual_cluster = await async_client.cloud.gpu_virtual_clusters.get( + cluster = await async_client.cloud.gpu_virtual.clusters.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, ) - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.gpu_virtual_clusters.with_raw_response.get( + response = await async_client.cloud.gpu_virtual.clusters.with_raw_response.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1266,12 +1266,12 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.gpu_virtual_clusters.with_streaming_response.get( + async with async_client.cloud.gpu_virtual.clusters.with_streaming_response.get( cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", project_id=1, region_id=7, @@ -1279,15 +1279,15 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - gpu_virtual_cluster = await response.parse() - assert_matches_type(GPUVirtualCluster, gpu_virtual_cluster, path=["response"]) + cluster = await response.parse() + assert_matches_type(GPUVirtualCluster, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): - await async_client.cloud.gpu_virtual_clusters.with_raw_response.get( + await async_client.cloud.gpu_virtual.clusters.with_raw_response.get( cluster_id="", project_id=1, region_id=7, diff --git a/tests/api_resources/cloud/k8s/clusters/test_pools.py b/tests/api_resources/cloud/k8s/clusters/test_pools.py index 214fa14e..bc2d028a 100644 --- a/tests/api_resources/cloud/k8s/clusters/test_pools.py +++ b/tests/api_resources/cloud/k8s/clusters/test_pools.py @@ -13,6 +13,7 @@ from gcore.types.cloud.k8s.clusters import ( K8SClusterPool, K8SClusterPoolList, + K8SClusterPoolQuota, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -279,6 +280,58 @@ def test_path_params_delete(self, client: Gcore) -> None: cluster_name="cluster_name", ) + @parametrize + def test_method_check_quota(self, client: Gcore) -> None: + pool = client.cloud.k8s.clusters.pools.check_quota( + project_id=1, + region_id=7, + flavor_id="g1-standard-1-2", + ) + assert_matches_type(K8SClusterPoolQuota, pool, path=["response"]) + + @parametrize + def test_method_check_quota_with_all_params(self, client: Gcore) -> None: + pool = client.cloud.k8s.clusters.pools.check_quota( + project_id=1, + region_id=7, + flavor_id="g1-standard-1-2", + boot_volume_size=50, + max_node_count=5, + min_node_count=3, + name="test", + node_count=5, + servergroup_policy="anti-affinity", + ) + assert_matches_type(K8SClusterPoolQuota, pool, path=["response"]) + + @parametrize + def test_raw_response_check_quota(self, client: Gcore) -> None: + response = client.cloud.k8s.clusters.pools.with_raw_response.check_quota( + project_id=1, + region_id=7, + flavor_id="g1-standard-1-2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = response.parse() + assert_matches_type(K8SClusterPoolQuota, pool, path=["response"]) + + @parametrize + def test_streaming_response_check_quota(self, client: Gcore) -> None: + with client.cloud.k8s.clusters.pools.with_streaming_response.check_quota( + project_id=1, + region_id=7, + flavor_id="g1-standard-1-2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = response.parse() + assert_matches_type(K8SClusterPoolQuota, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize def test_method_get(self, client: Gcore) -> None: pool = client.cloud.k8s.clusters.pools.get( @@ -664,6 +717,58 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: cluster_name="cluster_name", ) + @parametrize + async def test_method_check_quota(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.k8s.clusters.pools.check_quota( + project_id=1, + region_id=7, + flavor_id="g1-standard-1-2", + ) + assert_matches_type(K8SClusterPoolQuota, pool, path=["response"]) + + @parametrize + async def test_method_check_quota_with_all_params(self, async_client: AsyncGcore) -> None: + pool = await async_client.cloud.k8s.clusters.pools.check_quota( + project_id=1, + region_id=7, + flavor_id="g1-standard-1-2", + boot_volume_size=50, + max_node_count=5, + min_node_count=3, + name="test", + node_count=5, + servergroup_policy="anti-affinity", + ) + assert_matches_type(K8SClusterPoolQuota, pool, path=["response"]) + + @parametrize + async def test_raw_response_check_quota(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.k8s.clusters.pools.with_raw_response.check_quota( + project_id=1, + region_id=7, + flavor_id="g1-standard-1-2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pool = await response.parse() + assert_matches_type(K8SClusterPoolQuota, pool, path=["response"]) + + @parametrize + async def test_streaming_response_check_quota(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.k8s.clusters.pools.with_streaming_response.check_quota( + project_id=1, + region_id=7, + flavor_id="g1-standard-1-2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pool = await response.parse() + assert_matches_type(K8SClusterPoolQuota, pool, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: pool = await async_client.cloud.k8s.clusters.pools.get( diff --git a/tests/api_resources/cloud/load_balancers/test_listeners.py b/tests/api_resources/cloud/load_balancers/test_listeners.py index 628a84f8..2e098f0f 100644 --- a/tests/api_resources/cloud/load_balancers/test_listeners.py +++ b/tests/api_resources/cloud/load_balancers/test_listeners.py @@ -40,6 +40,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: protocol_port=80, allowed_cidrs=["10.0.0.0/8"], connection_limit=100000, + default_pool_id="00000000-0000-4000-8000-000000000000", insert_x_forwarded=False, secret_id="f2e734d0-fa2b-42c2-ad33-4c6db5101e00", sni_secret_id=["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], @@ -343,6 +344,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> protocol_port=80, allowed_cidrs=["10.0.0.0/8"], connection_limit=100000, + default_pool_id="00000000-0000-4000-8000-000000000000", insert_x_forwarded=False, secret_id="f2e734d0-fa2b-42c2-ad33-4c6db5101e00", sni_secret_id=["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], diff --git a/tests/api_resources/dns/test_network_mappings.py b/tests/api_resources/dns/test_network_mappings.py index 7f7e164a..158a3f7b 100644 --- a/tests/api_resources/dns/test_network_mappings.py +++ b/tests/api_resources/dns/test_network_mappings.py @@ -30,11 +30,10 @@ def test_method_create(self, client: Gcore) -> None: @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: network_mapping = client.dns.network_mappings.create( - id=0, mapping=[ { - "cidr4": [{}], - "cidr6": [{}], + "cidr4": ["string"], + "cidr6": ["string"], "tags": ["string"], } ], @@ -225,19 +224,18 @@ def test_streaming_response_import(self, client: Gcore) -> None: @parametrize def test_method_replace(self, client: Gcore) -> None: network_mapping = client.dns.network_mappings.replace( - path_id=0, + id=0, ) assert_matches_type(object, network_mapping, path=["response"]) @parametrize def test_method_replace_with_all_params(self, client: Gcore) -> None: network_mapping = client.dns.network_mappings.replace( - path_id=0, - body_id=0, + id=0, mapping=[ { - "cidr4": [{}], - "cidr6": [{}], + "cidr4": ["string"], + "cidr6": ["string"], "tags": ["string"], } ], @@ -248,7 +246,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_replace(self, client: Gcore) -> None: response = client.dns.network_mappings.with_raw_response.replace( - path_id=0, + id=0, ) assert response.is_closed is True @@ -259,7 +257,7 @@ def test_raw_response_replace(self, client: Gcore) -> None: @parametrize def test_streaming_response_replace(self, client: Gcore) -> None: with client.dns.network_mappings.with_streaming_response.replace( - path_id=0, + id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -283,11 +281,10 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: network_mapping = await async_client.dns.network_mappings.create( - id=0, mapping=[ { - "cidr4": [{}], - "cidr6": [{}], + "cidr4": ["string"], + "cidr6": ["string"], "tags": ["string"], } ], @@ -478,19 +475,18 @@ async def test_streaming_response_import(self, async_client: AsyncGcore) -> None @parametrize async def test_method_replace(self, async_client: AsyncGcore) -> None: network_mapping = await async_client.dns.network_mappings.replace( - path_id=0, + id=0, ) assert_matches_type(object, network_mapping, path=["response"]) @parametrize async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: network_mapping = await async_client.dns.network_mappings.replace( - path_id=0, - body_id=0, + id=0, mapping=[ { - "cidr4": [{}], - "cidr6": [{}], + "cidr4": ["string"], + "cidr6": ["string"], "tags": ["string"], } ], @@ -501,7 +497,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: response = await async_client.dns.network_mappings.with_raw_response.replace( - path_id=0, + id=0, ) assert response.is_closed is True @@ -512,7 +508,7 @@ async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: async with async_client.dns.network_mappings.with_streaming_response.replace( - path_id=0, + id=0, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python"