From 3c15807ac8fdc5c0ca42421896f829054eaa82cf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 Jan 2026 10:11:05 +0000 Subject: [PATCH 01/13] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- LICENSE | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 698a6006..ed67f4d9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 641 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-2c3abe1f1637f97f6bc750aff6eb77efc45ac2b527376541ac2af6b9626b35af.yml -openapi_spec_hash: ff74a4ccd9ec5ddb1a65963d52e709ba +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9fe9802b8aaab88db204b099e3b00ce64e7671a0c1940238830a1170d6cdae51.yml +openapi_spec_hash: 1ccdc3a946fcdf0440c62453683783cd config_hash: df463160c27e4de887be7c27454ac4e0 diff --git a/LICENSE b/LICENSE index b28d04ff..03c99139 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2025 Gcore + Copyright 2026 Gcore Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 3dc71fe42e2466ae8040af28c77153383609e041 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 Jan 2026 10:11:32 +0000 Subject: [PATCH 02/13] feat(api): aggregated API specs update --- .stats.yml | 4 +-- src/gcore/types/dns/zone_get_response.py | 35 +++++++++-------------- src/gcore/types/dns/zone_list_response.py | 6 ++-- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/.stats.yml b/.stats.yml index ed67f4d9..7dc067f3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 641 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-9fe9802b8aaab88db204b099e3b00ce64e7671a0c1940238830a1170d6cdae51.yml -openapi_spec_hash: 1ccdc3a946fcdf0440c62453683783cd +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ee0efc59d50fe2618b65f41c253bdd82bd91407c103626f24b799f9f9ae517ba.yml +openapi_spec_hash: 81b30a58a624bbf417f1a096c8fc1534 config_hash: df463160c27e4de887be7c27454ac4e0 diff --git a/src/gcore/types/dns/zone_get_response.py b/src/gcore/types/dns/zone_get_response.py index 38422c5c..b984fa7a 100644 --- a/src/gcore/types/dns/zone_get_response.py +++ b/src/gcore/types/dns/zone_get_response.py @@ -1,15 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional - -from pydantic import Field as FieldInfo +from typing import Dict, List, Optional from ..._models import BaseModel -__all__ = ["ZoneGetResponse", "Zone", "ZoneRecord", "ZoneRrsetsAmount", "ZoneRrsetsAmountDynamic"] +__all__ = ["ZoneGetResponse", "Record", "RrsetsAmount", "RrsetsAmountDynamic"] -class ZoneRecord(BaseModel): +class Record(BaseModel): """Record - readonly short version of rrset""" name: Optional[str] = None @@ -21,7 +19,7 @@ class ZoneRecord(BaseModel): type: Optional[str] = None -class ZoneRrsetsAmountDynamic(BaseModel): +class RrsetsAmountDynamic(BaseModel): """Amount of dynamic RRsets in zone""" healthcheck: Optional[int] = None @@ -31,8 +29,8 @@ class ZoneRrsetsAmountDynamic(BaseModel): """Total amount of dynamic RRsets in zone""" -class ZoneRrsetsAmount(BaseModel): - dynamic: Optional[ZoneRrsetsAmountDynamic] = None +class RrsetsAmount(BaseModel): + dynamic: Optional[RrsetsAmountDynamic] = None """Amount of dynamic RRsets in zone""" static: Optional[int] = None @@ -42,8 +40,8 @@ class ZoneRrsetsAmount(BaseModel): """Total amount of RRsets in zone""" -class Zone(BaseModel): - """OutputZone""" +class ZoneGetResponse(BaseModel): + """Complete zone info with all records included""" id: Optional[int] = None """ @@ -51,8 +49,6 @@ class Zone(BaseModel): of getting deleted zones by admin. """ - client_id: Optional[int] = None - contact: Optional[str] = None """email address of the administrator responsible for this zone""" @@ -62,13 +58,15 @@ class Zone(BaseModel): dnssec is disabled for the zone """ + enabled: Optional[bool] = None + expiry: Optional[int] = None """ number of seconds after which secondary name servers should stop answering request for this zone """ - meta: Optional[object] = None + meta: Optional[Dict[str, object]] = None """arbitrarily data of zone in json format""" name: Optional[str] = None @@ -80,7 +78,7 @@ class Zone(BaseModel): primary_server: Optional[str] = None """primary master name server for zone""" - records: Optional[List[ZoneRecord]] = None + records: Optional[List[Record]] = None refresh: Optional[int] = None """ @@ -94,7 +92,7 @@ class Zone(BaseModel): serial number """ - rrsets_amount: Optional[ZoneRrsetsAmount] = None + rrsets_amount: Optional[RrsetsAmount] = None serial: Optional[int] = None """ @@ -105,10 +103,3 @@ class Zone(BaseModel): """ status: Optional[str] = None - - -class ZoneGetResponse(BaseModel): - """Complete zone info with all records included""" - - zone: Optional[Zone] = FieldInfo(alias="Zone", default=None) - """OutputZone""" diff --git a/src/gcore/types/dns/zone_list_response.py b/src/gcore/types/dns/zone_list_response.py index 16d0629b..4b0a0277 100644 --- a/src/gcore/types/dns/zone_list_response.py +++ b/src/gcore/types/dns/zone_list_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from ..._models import BaseModel @@ -60,13 +60,15 @@ class Zone(BaseModel): dnssec is disabled for the zone """ + enabled: Optional[bool] = None + expiry: Optional[int] = None """ number of seconds after which secondary name servers should stop answering request for this zone """ - meta: Optional[object] = None + meta: Optional[Dict[str, object]] = None """arbitrarily data of zone in json format""" name: Optional[str] = None From cf8ed1066a9c6919041dcb08a96c2832e6515a60 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 Jan 2026 15:04:09 +0000 Subject: [PATCH 03/13] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 7dc067f3..b7270892 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 641 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ee0efc59d50fe2618b65f41c253bdd82bd91407c103626f24b799f9f9ae517ba.yml openapi_spec_hash: 81b30a58a624bbf417f1a096c8fc1534 -config_hash: df463160c27e4de887be7c27454ac4e0 +config_hash: 8c967b4319f8d1992bbc86592ad01598 From 19103d9b95b37e597d545052d957d2593810307c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 Jan 2026 15:26:03 +0000 Subject: [PATCH 04/13] feat(cloud): add support for volume snapshots --- .stats.yml | 4 +- api.md | 15 + src/gcore/resources/cloud/__init__.py | 14 + src/gcore/resources/cloud/cloud.py | 32 + src/gcore/resources/cloud/volume_snapshots.py | 611 ++++++++++++++++++ src/gcore/types/cloud/__init__.py | 3 + src/gcore/types/cloud/snapshot.py | 75 +++ .../cloud/volume_snapshot_create_params.py | 33 + .../cloud/volume_snapshot_update_params.py | 54 ++ .../cloud/test_volume_snapshots.py | 429 ++++++++++++ 10 files changed, 1268 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cloud/volume_snapshots.py create mode 100644 src/gcore/types/cloud/snapshot.py create mode 100644 src/gcore/types/cloud/volume_snapshot_create_params.py create mode 100644 src/gcore/types/cloud/volume_snapshot_update_params.py create mode 100644 tests/api_resources/cloud/test_volume_snapshots.py diff --git a/.stats.yml b/.stats.yml index b7270892..6e8bc6bc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 641 +configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ee0efc59d50fe2618b65f41c253bdd82bd91407c103626f24b799f9f9ae517ba.yml openapi_spec_hash: 81b30a58a624bbf417f1a096c8fc1534 -config_hash: 8c967b4319f8d1992bbc86592ad01598 +config_hash: 37ad42485ffe4a964c3d7d7b2564550a diff --git a/api.md b/api.md index ff599062..d38c1ccf 100644 --- a/api.md +++ b/api.md @@ -1165,6 +1165,21 @@ Methods: - client.cloud.databases.postgres.custom_configurations.validate(\*, project_id, region_id, \*\*params) -> PgConfValidation +## VolumeSnapshots + +Types: + +```python +from gcore.types.cloud import Snapshot +``` + +Methods: + +- client.cloud.volume_snapshots.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.volume_snapshots.update(snapshot_id, \*, project_id, region_id, \*\*params) -> Snapshot +- client.cloud.volume_snapshots.delete(snapshot_id, \*, project_id, region_id) -> TaskIDList +- client.cloud.volume_snapshots.get(snapshot_id, \*, project_id, region_id) -> Snapshot + # Waap Types: diff --git a/src/gcore/resources/cloud/__init__.py b/src/gcore/resources/cloud/__init__.py index 36c2a495..df7277aa 100644 --- a/src/gcore/resources/cloud/__init__.py +++ b/src/gcore/resources/cloud/__init__.py @@ -216,6 +216,14 @@ PlacementGroupsResourceWithStreamingResponse, AsyncPlacementGroupsResourceWithStreamingResponse, ) +from .volume_snapshots import ( + VolumeSnapshotsResource, + AsyncVolumeSnapshotsResource, + VolumeSnapshotsResourceWithRawResponse, + AsyncVolumeSnapshotsResourceWithRawResponse, + VolumeSnapshotsResourceWithStreamingResponse, + AsyncVolumeSnapshotsResourceWithStreamingResponse, +) from .reserved_fixed_ips import ( ReservedFixedIPsResource, AsyncReservedFixedIPsResource, @@ -402,6 +410,12 @@ "AsyncDatabasesResourceWithRawResponse", "DatabasesResourceWithStreamingResponse", "AsyncDatabasesResourceWithStreamingResponse", + "VolumeSnapshotsResource", + "AsyncVolumeSnapshotsResource", + "VolumeSnapshotsResourceWithRawResponse", + "AsyncVolumeSnapshotsResourceWithRawResponse", + "VolumeSnapshotsResourceWithStreamingResponse", + "AsyncVolumeSnapshotsResourceWithStreamingResponse", "CloudResource", "AsyncCloudResource", "CloudResourceWithRawResponse", diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index f8c91a68..47a7caab 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -124,6 +124,14 @@ PlacementGroupsResourceWithStreamingResponse, AsyncPlacementGroupsResourceWithStreamingResponse, ) +from .volume_snapshots import ( + VolumeSnapshotsResource, + AsyncVolumeSnapshotsResource, + VolumeSnapshotsResourceWithRawResponse, + AsyncVolumeSnapshotsResourceWithRawResponse, + VolumeSnapshotsResourceWithStreamingResponse, + AsyncVolumeSnapshotsResourceWithStreamingResponse, +) from .networks.networks import ( NetworksResource, AsyncNetworksResource, @@ -352,6 +360,10 @@ def usage_reports(self) -> UsageReportsResource: def databases(self) -> DatabasesResource: return DatabasesResource(self._client) + @cached_property + def volume_snapshots(self) -> VolumeSnapshotsResource: + return VolumeSnapshotsResource(self._client) + @cached_property def with_raw_response(self) -> CloudResourceWithRawResponse: """ @@ -492,6 +504,10 @@ def usage_reports(self) -> AsyncUsageReportsResource: def databases(self) -> AsyncDatabasesResource: return AsyncDatabasesResource(self._client) + @cached_property + def volume_snapshots(self) -> AsyncVolumeSnapshotsResource: + return AsyncVolumeSnapshotsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCloudResourceWithRawResponse: """ @@ -635,6 +651,10 @@ def usage_reports(self) -> UsageReportsResourceWithRawResponse: def databases(self) -> DatabasesResourceWithRawResponse: return DatabasesResourceWithRawResponse(self._cloud.databases) + @cached_property + def volume_snapshots(self) -> VolumeSnapshotsResourceWithRawResponse: + return VolumeSnapshotsResourceWithRawResponse(self._cloud.volume_snapshots) + class AsyncCloudResourceWithRawResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -759,6 +779,10 @@ def usage_reports(self) -> AsyncUsageReportsResourceWithRawResponse: def databases(self) -> AsyncDatabasesResourceWithRawResponse: return AsyncDatabasesResourceWithRawResponse(self._cloud.databases) + @cached_property + def volume_snapshots(self) -> AsyncVolumeSnapshotsResourceWithRawResponse: + return AsyncVolumeSnapshotsResourceWithRawResponse(self._cloud.volume_snapshots) + class CloudResourceWithStreamingResponse: def __init__(self, cloud: CloudResource) -> None: @@ -883,6 +907,10 @@ def usage_reports(self) -> UsageReportsResourceWithStreamingResponse: def databases(self) -> DatabasesResourceWithStreamingResponse: return DatabasesResourceWithStreamingResponse(self._cloud.databases) + @cached_property + def volume_snapshots(self) -> VolumeSnapshotsResourceWithStreamingResponse: + return VolumeSnapshotsResourceWithStreamingResponse(self._cloud.volume_snapshots) + class AsyncCloudResourceWithStreamingResponse: def __init__(self, cloud: AsyncCloudResource) -> None: @@ -1006,3 +1034,7 @@ def usage_reports(self) -> AsyncUsageReportsResourceWithStreamingResponse: @cached_property def databases(self) -> AsyncDatabasesResourceWithStreamingResponse: return AsyncDatabasesResourceWithStreamingResponse(self._cloud.databases) + + @cached_property + def volume_snapshots(self) -> AsyncVolumeSnapshotsResourceWithStreamingResponse: + return AsyncVolumeSnapshotsResourceWithStreamingResponse(self._cloud.volume_snapshots) diff --git a/src/gcore/resources/cloud/volume_snapshots.py b/src/gcore/resources/cloud/volume_snapshots.py new file mode 100644 index 00000000..fefcddb8 --- /dev/null +++ b/src/gcore/resources/cloud/volume_snapshots.py @@ -0,0 +1,611 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional + +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 ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cloud import volume_snapshot_create_params, volume_snapshot_update_params +from ..._base_client import make_request_options +from ...types.cloud.snapshot import Snapshot +from ...types.cloud.task_id_list import TaskIDList +from ...types.cloud.tag_update_map_param import TagUpdateMapParam + +__all__ = ["VolumeSnapshotsResource", "AsyncVolumeSnapshotsResource"] + + +class VolumeSnapshotsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> VolumeSnapshotsResourceWithRawResponse: + """ + 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 VolumeSnapshotsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> VolumeSnapshotsResourceWithStreamingResponse: + """ + 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 VolumeSnapshotsResourceWithStreamingResponse(self) + + def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + volume_id: str, + description: str | Omit = omit, + 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Create a new snapshot from a volume. + + Args: + name: Snapshot name + + volume_id: Volume ID to make snapshot of + + description: Snapshot description + + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. + + 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/v1/snapshots/{project_id}/{region_id}", + body=maybe_transform( + { + "name": name, + "volume_id": volume_id, + "description": description, + "tags": tags, + }, + volume_snapshot_create_params.VolumeSnapshotCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def update( + self, + snapshot_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | 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, + ) -> Snapshot: + """ + Rename snapshot or update tags. + + Args: + project_id: Project ID + + region_id: Region ID + + snapshot_id: Unique identifier of the snapshot + + name: Display name for the snapshot (3-63 chars). Used in customer portal and API. + Does not affect snapshot data. + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + + - **Mixed operations:** + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + + 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 snapshot_id: + raise ValueError(f"Expected a non-empty value for `snapshot_id` but received {snapshot_id!r}") + return self._patch( + f"/cloud/v1/snapshots/{project_id}/{region_id}/{snapshot_id}", + body=maybe_transform( + { + "name": name, + "tags": tags, + }, + volume_snapshot_update_params.VolumeSnapshotUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Snapshot, + ) + + def delete( + self, + snapshot_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # 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: + """ + Delete a specific snapshot. + + Args: + project_id: Project ID + + region_id: Region ID + + snapshot_id: Unique identifier of the snapshot + + 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 snapshot_id: + raise ValueError(f"Expected a non-empty value for `snapshot_id` but received {snapshot_id!r}") + return self._delete( + f"/cloud/v1/snapshots/{project_id}/{region_id}/{snapshot_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + def get( + self, + snapshot_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # 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, + ) -> Snapshot: + """ + Get detailed information about a specific snapshot. + + Args: + project_id: Project ID + + region_id: Region ID + + snapshot_id: Unique identifier of the snapshot + + 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 snapshot_id: + raise ValueError(f"Expected a non-empty value for `snapshot_id` but received {snapshot_id!r}") + return self._get( + f"/cloud/v1/snapshots/{project_id}/{region_id}/{snapshot_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Snapshot, + ) + + +class AsyncVolumeSnapshotsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncVolumeSnapshotsResourceWithRawResponse: + """ + 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 AsyncVolumeSnapshotsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncVolumeSnapshotsResourceWithStreamingResponse: + """ + 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 AsyncVolumeSnapshotsResourceWithStreamingResponse(self) + + async def create( + self, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str, + volume_id: str, + description: str | Omit = omit, + 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """ + Create a new snapshot from a volume. + + Args: + name: Snapshot name + + volume_id: Volume ID to make snapshot of + + description: Snapshot description + + tags: Key-value tags to associate with the resource. A tag is a key-value pair that + can be associated with a resource, enabling efficient filtering and grouping for + better organization and management. Both tag keys and values have a maximum + length of 255 characters. Some tags are read-only and cannot be modified by the + user. Tags are also integrated with cost reports, allowing cost data to be + filtered based on tag keys or values. + + 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/v1/snapshots/{project_id}/{region_id}", + body=await async_maybe_transform( + { + "name": name, + "volume_id": volume_id, + "description": description, + "tags": tags, + }, + volume_snapshot_create_params.VolumeSnapshotCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def update( + self, + snapshot_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | 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, + ) -> Snapshot: + """ + Rename snapshot or update tags. + + Args: + project_id: Project ID + + region_id: Region ID + + snapshot_id: Unique identifier of the snapshot + + name: Display name for the snapshot (3-63 chars). Used in customer portal and API. + Does not affect snapshot data. + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + + - **Mixed operations:** + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + + 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 snapshot_id: + raise ValueError(f"Expected a non-empty value for `snapshot_id` but received {snapshot_id!r}") + return await self._patch( + f"/cloud/v1/snapshots/{project_id}/{region_id}/{snapshot_id}", + body=await async_maybe_transform( + { + "name": name, + "tags": tags, + }, + volume_snapshot_update_params.VolumeSnapshotUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Snapshot, + ) + + async def delete( + self, + snapshot_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # 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: + """ + Delete a specific snapshot. + + Args: + project_id: Project ID + + region_id: Region ID + + snapshot_id: Unique identifier of the snapshot + + 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 snapshot_id: + raise ValueError(f"Expected a non-empty value for `snapshot_id` but received {snapshot_id!r}") + return await self._delete( + f"/cloud/v1/snapshots/{project_id}/{region_id}/{snapshot_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + + async def get( + self, + snapshot_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + # 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, + ) -> Snapshot: + """ + Get detailed information about a specific snapshot. + + Args: + project_id: Project ID + + region_id: Region ID + + snapshot_id: Unique identifier of the snapshot + + 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 snapshot_id: + raise ValueError(f"Expected a non-empty value for `snapshot_id` but received {snapshot_id!r}") + return await self._get( + f"/cloud/v1/snapshots/{project_id}/{region_id}/{snapshot_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Snapshot, + ) + + +class VolumeSnapshotsResourceWithRawResponse: + def __init__(self, volume_snapshots: VolumeSnapshotsResource) -> None: + self._volume_snapshots = volume_snapshots + + self.create = to_raw_response_wrapper( + volume_snapshots.create, + ) + self.update = to_raw_response_wrapper( + volume_snapshots.update, + ) + self.delete = to_raw_response_wrapper( + volume_snapshots.delete, + ) + self.get = to_raw_response_wrapper( + volume_snapshots.get, + ) + + +class AsyncVolumeSnapshotsResourceWithRawResponse: + def __init__(self, volume_snapshots: AsyncVolumeSnapshotsResource) -> None: + self._volume_snapshots = volume_snapshots + + self.create = async_to_raw_response_wrapper( + volume_snapshots.create, + ) + self.update = async_to_raw_response_wrapper( + volume_snapshots.update, + ) + self.delete = async_to_raw_response_wrapper( + volume_snapshots.delete, + ) + self.get = async_to_raw_response_wrapper( + volume_snapshots.get, + ) + + +class VolumeSnapshotsResourceWithStreamingResponse: + def __init__(self, volume_snapshots: VolumeSnapshotsResource) -> None: + self._volume_snapshots = volume_snapshots + + self.create = to_streamed_response_wrapper( + volume_snapshots.create, + ) + self.update = to_streamed_response_wrapper( + volume_snapshots.update, + ) + self.delete = to_streamed_response_wrapper( + volume_snapshots.delete, + ) + self.get = to_streamed_response_wrapper( + volume_snapshots.get, + ) + + +class AsyncVolumeSnapshotsResourceWithStreamingResponse: + def __init__(self, volume_snapshots: AsyncVolumeSnapshotsResource) -> None: + self._volume_snapshots = volume_snapshots + + self.create = async_to_streamed_response_wrapper( + volume_snapshots.create, + ) + self.update = async_to_streamed_response_wrapper( + volume_snapshots.update, + ) + self.delete = async_to_streamed_response_wrapper( + volume_snapshots.delete, + ) + self.get = async_to_streamed_response_wrapper( + volume_snapshots.get, + ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 86a27485..87ed7492 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -18,6 +18,7 @@ from .ssh_key import SSHKey as SSHKey from .instance import Instance as Instance from .registry import Registry as Registry +from .snapshot import Snapshot as Snapshot from .gpu_image import GPUImage as GPUImage from .ip_ranges import IPRanges as IPRanges from .file_share import FileShare as FileShare @@ -154,6 +155,8 @@ from .load_balancer_listener_detail import LoadBalancerListenerDetail as LoadBalancerListenerDetail from .placement_group_create_params import PlacementGroupCreateParams as PlacementGroupCreateParams from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams +from .volume_snapshot_create_params import VolumeSnapshotCreateParams as VolumeSnapshotCreateParams +from .volume_snapshot_update_params import VolumeSnapshotUpdateParams as VolumeSnapshotUpdateParams from .cost_report_aggregated_monthly import CostReportAggregatedMonthly as CostReportAggregatedMonthly from .inference_region_capacity_list import InferenceRegionCapacityList as InferenceRegionCapacityList from .load_balancer_operating_status import LoadBalancerOperatingStatus as LoadBalancerOperatingStatus diff --git a/src/gcore/types/cloud/snapshot.py b/src/gcore/types/cloud/snapshot.py new file mode 100644 index 00000000..ac5ca594 --- /dev/null +++ b/src/gcore/types/cloud/snapshot.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from .tag import Tag +from ..._models import BaseModel + +__all__ = ["Snapshot"] + + +class Snapshot(BaseModel): + id: str + """Snapshot ID""" + + created_at: datetime + """Datetime when the snapshot was created""" + + creator_task_id: str + """Task that created this entity""" + + description: Optional[str] = None + """Snapshot description""" + + name: str + """Snapshot name""" + + project_id: int + """Project ID""" + + region: str + """Region name""" + + region_id: int + """Region ID""" + + size: int + """Snapshot size, GiB""" + + status: Literal[ + "available", + "backing-up", + "creating", + "deleted", + "deleting", + "error", + "error_deleting", + "restoring", + "unmanaging", + ] + """Snapshot status""" + + tags: List[Tag] + """List of key-value tags associated with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Some + tags are read-only and cannot be modified by the user. Tags are also integrated + with cost reports, allowing cost data to be filtered based on tag keys or + values. + """ + + task_id: Optional[str] = None + """The UUID of the active task that currently holds a lock on the resource. + + This lock prevents concurrent modifications to ensure consistency. If `null`, + the resource is not locked. + """ + + updated_at: datetime + """Datetime when the snapshot was last updated""" + + volume_id: str + """ID of the volume this snapshot was made from""" diff --git a/src/gcore/types/cloud/volume_snapshot_create_params.py b/src/gcore/types/cloud/volume_snapshot_create_params.py new file mode 100644 index 00000000..b832806b --- /dev/null +++ b/src/gcore/types/cloud/volume_snapshot_create_params.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict +from typing_extensions import Required, TypedDict + +__all__ = ["VolumeSnapshotCreateParams"] + + +class VolumeSnapshotCreateParams(TypedDict, total=False): + project_id: int + + region_id: int + + name: Required[str] + """Snapshot name""" + + volume_id: Required[str] + """Volume ID to make snapshot of""" + + description: str + """Snapshot description""" + + tags: Dict[str, str] + """Key-value tags to associate with the resource. + + A tag is a key-value pair that can be associated with a resource, enabling + efficient filtering and grouping for better organization and management. Both + tag keys and values have a maximum length of 255 characters. Some tags are + read-only and cannot be modified by the user. Tags are also integrated with cost + reports, allowing cost data to be filtered based on tag keys or values. + """ diff --git a/src/gcore/types/cloud/volume_snapshot_update_params.py b/src/gcore/types/cloud/volume_snapshot_update_params.py new file mode 100644 index 00000000..5e279e7e --- /dev/null +++ b/src/gcore/types/cloud/volume_snapshot_update_params.py @@ -0,0 +1,54 @@ +# 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 TypedDict + +from .tag_update_map_param import TagUpdateMapParam + +__all__ = ["VolumeSnapshotUpdateParams"] + + +class VolumeSnapshotUpdateParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + name: str + """Display name for the snapshot (3-63 chars). + + Used in customer portal and API. Does not affect snapshot data. + """ + + tags: Optional[TagUpdateMapParam] + """Update key-value tags using JSON Merge Patch semantics (RFC 7386). + + Provide key-value pairs to add or update tags. Set tag values to `null` to + remove tags. Unspecified tags remain unchanged. Read-only tags are always + preserved and cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + + - **Delete tags:** `{'tags': {'old_tag': null}}` removes specific tags. + + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + + - **Mixed operations:** + `{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + """ diff --git a/tests/api_resources/cloud/test_volume_snapshots.py b/tests/api_resources/cloud/test_volume_snapshots.py new file mode 100644 index 00000000..4b2d7bfd --- /dev/null +++ b/tests/api_resources/cloud/test_volume_snapshots.py @@ -0,0 +1,429 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cloud import ( + Snapshot, + TaskIDList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestVolumeSnapshots: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + volume_snapshot = client.cloud.volume_snapshots.create( + project_id=0, + region_id=0, + name="my-snapshot", + volume_id="67baa7d1-08ea-4fc5-bef2-6b2465b7d227", + ) + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + volume_snapshot = client.cloud.volume_snapshots.create( + project_id=0, + region_id=0, + name="my-snapshot", + volume_id="67baa7d1-08ea-4fc5-bef2-6b2465b7d227", + description="Snapshot description", + tags={"my-tag": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.volume_snapshots.with_raw_response.create( + project_id=0, + region_id=0, + name="my-snapshot", + volume_id="67baa7d1-08ea-4fc5-bef2-6b2465b7d227", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume_snapshot = response.parse() + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.volume_snapshots.with_streaming_response.create( + project_id=0, + region_id=0, + name="my-snapshot", + volume_id="67baa7d1-08ea-4fc5-bef2-6b2465b7d227", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume_snapshot = response.parse() + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + volume_snapshot = client.cloud.volume_snapshots.update( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + volume_snapshot = client.cloud.volume_snapshots.update( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + name="my-backup-snapshot", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cloud.volume_snapshots.with_raw_response.update( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume_snapshot = response.parse() + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cloud.volume_snapshots.with_streaming_response.update( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume_snapshot = response.parse() + assert_matches_type(Snapshot, volume_snapshot, 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 `snapshot_id` but received ''"): + client.cloud.volume_snapshots.with_raw_response.update( + snapshot_id="", + project_id=1, + region_id=1, + ) + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + volume_snapshot = client.cloud.volume_snapshots.delete( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.volume_snapshots.with_raw_response.delete( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume_snapshot = response.parse() + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.volume_snapshots.with_streaming_response.delete( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume_snapshot = response.parse() + assert_matches_type(TaskIDList, volume_snapshot, 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 `snapshot_id` but received ''"): + client.cloud.volume_snapshots.with_raw_response.delete( + snapshot_id="", + project_id=1, + region_id=1, + ) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + volume_snapshot = client.cloud.volume_snapshots.get( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cloud.volume_snapshots.with_raw_response.get( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume_snapshot = response.parse() + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cloud.volume_snapshots.with_streaming_response.get( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume_snapshot = response.parse() + assert_matches_type(Snapshot, volume_snapshot, 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 `snapshot_id` but received ''"): + client.cloud.volume_snapshots.with_raw_response.get( + snapshot_id="", + project_id=1, + region_id=1, + ) + + +class TestAsyncVolumeSnapshots: + 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: + volume_snapshot = await async_client.cloud.volume_snapshots.create( + project_id=0, + region_id=0, + name="my-snapshot", + volume_id="67baa7d1-08ea-4fc5-bef2-6b2465b7d227", + ) + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + volume_snapshot = await async_client.cloud.volume_snapshots.create( + project_id=0, + region_id=0, + name="my-snapshot", + volume_id="67baa7d1-08ea-4fc5-bef2-6b2465b7d227", + description="Snapshot description", + tags={"my-tag": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volume_snapshots.with_raw_response.create( + project_id=0, + region_id=0, + name="my-snapshot", + volume_id="67baa7d1-08ea-4fc5-bef2-6b2465b7d227", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume_snapshot = await response.parse() + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volume_snapshots.with_streaming_response.create( + project_id=0, + region_id=0, + name="my-snapshot", + volume_id="67baa7d1-08ea-4fc5-bef2-6b2465b7d227", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume_snapshot = await response.parse() + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + volume_snapshot = await async_client.cloud.volume_snapshots.update( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + volume_snapshot = await async_client.cloud.volume_snapshots.update( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + name="my-backup-snapshot", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volume_snapshots.with_raw_response.update( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume_snapshot = await response.parse() + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volume_snapshots.with_streaming_response.update( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume_snapshot = await response.parse() + assert_matches_type(Snapshot, volume_snapshot, 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 `snapshot_id` but received ''"): + await async_client.cloud.volume_snapshots.with_raw_response.update( + snapshot_id="", + project_id=1, + region_id=1, + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + volume_snapshot = await async_client.cloud.volume_snapshots.delete( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volume_snapshots.with_raw_response.delete( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume_snapshot = await response.parse() + assert_matches_type(TaskIDList, volume_snapshot, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volume_snapshots.with_streaming_response.delete( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume_snapshot = await response.parse() + assert_matches_type(TaskIDList, volume_snapshot, 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 `snapshot_id` but received ''"): + await async_client.cloud.volume_snapshots.with_raw_response.delete( + snapshot_id="", + project_id=1, + region_id=1, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + volume_snapshot = await async_client.cloud.volume_snapshots.get( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.volume_snapshots.with_raw_response.get( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + volume_snapshot = await response.parse() + assert_matches_type(Snapshot, volume_snapshot, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.volume_snapshots.with_streaming_response.get( + snapshot_id="726ecfcc-7fd0-4e30-a86e-7892524aa483", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + volume_snapshot = await response.parse() + assert_matches_type(Snapshot, volume_snapshot, 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 `snapshot_id` but received ''"): + await async_client.cloud.volume_snapshots.with_raw_response.get( + snapshot_id="", + project_id=1, + region_id=1, + ) From 60217ad074f19d84505e0b8eb235ccdb99285f4e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 Jan 2026 09:17:44 +0000 Subject: [PATCH 05/13] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 6e8bc6bc..e6455392 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ee0efc59d50fe2618b65f41c253bdd82bd91407c103626f24b799f9f9ae517ba.yml openapi_spec_hash: 81b30a58a624bbf417f1a096c8fc1534 -config_hash: 37ad42485ffe4a964c3d7d7b2564550a +config_hash: cba67c225c37fe0e91ed7586f53169e4 From 43225eb53397a63c3b44c518a20e665561d1a86e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 Jan 2026 10:11:38 +0000 Subject: [PATCH 06/13] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/cdn/logs_uploader/policies.py | 127 +++++++++++++++++- .../cdn/logs_uploader/logs_uploader_policy.py | 26 +++- .../cdn/logs_uploader/policy_create_params.py | 27 +++- .../logs_uploader/policy_replace_params.py | 27 +++- .../cdn/logs_uploader/policy_update_params.py | 27 +++- src/gcore/types/dns/zones/dns_output_rrset.py | 10 +- .../cdn/logs_uploader/test_policies.py | 18 ++- 8 files changed, 236 insertions(+), 30 deletions(-) diff --git a/.stats.yml b/.stats.yml index e6455392..58e08d86 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ee0efc59d50fe2618b65f41c253bdd82bd91407c103626f24b799f9f9ae517ba.yml -openapi_spec_hash: 81b30a58a624bbf417f1a096c8fc1534 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-33aa30cae2d845ec4347e37da18c094ba63cd87f8c80c1d40cb62fbcd84711e4.yml +openapi_spec_hash: ca2f0eca860c223ceb929d5533de8c9e config_hash: cba67c225c37fe0e91ed7586f53169e4 diff --git a/src/gcore/resources/cdn/logs_uploader/policies.py b/src/gcore/resources/cdn/logs_uploader/policies.py index 1ea24646..a6d933fb 100644 --- a/src/gcore/resources/cdn/logs_uploader/policies.py +++ b/src/gcore/resources/cdn/logs_uploader/policies.py @@ -3,6 +3,7 @@ from __future__ import annotations from typing import Dict, Iterable, Optional +from typing_extensions import Literal import httpx @@ -55,11 +56,12 @@ def create( *, date_format: str | Omit = omit, description: str | Omit = omit, + escape_special_characters: bool | Omit = omit, field_delimiter: str | Omit = omit, field_separator: str | Omit = omit, fields: SequenceNotStr[str] | Omit = omit, file_name_template: str | Omit = omit, - format_type: str | Omit = omit, + format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, name: str | Omit = omit, @@ -83,6 +85,17 @@ def create( description: Description of the policy. + escape_special_characters: When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + field_delimiter: Field delimiter for logs. field_separator: Field separator for logs. @@ -93,6 +106,12 @@ def create( format_type: Format type for logs. + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + include_empty_logs: Include empty logs in the upload. include_shield_logs: Include logs from origin shielding in the upload. @@ -125,6 +144,7 @@ def create( { "date_format": date_format, "description": description, + "escape_special_characters": escape_special_characters, "field_delimiter": field_delimiter, "field_separator": field_separator, "fields": fields, @@ -153,11 +173,12 @@ def update( *, date_format: str | Omit = omit, description: str | Omit = omit, + escape_special_characters: bool | Omit = omit, field_delimiter: str | Omit = omit, field_separator: str | Omit = omit, fields: SequenceNotStr[str] | Omit = omit, file_name_template: str | Omit = omit, - format_type: str | Omit = omit, + format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, name: str | Omit = omit, @@ -181,6 +202,17 @@ def update( description: Description of the policy. + escape_special_characters: When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + field_delimiter: Field delimiter for logs. field_separator: Field separator for logs. @@ -191,6 +223,12 @@ def update( format_type: Format type for logs. + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + include_empty_logs: Include empty logs in the upload. include_shield_logs: Include logs from origin shielding in the upload. @@ -223,6 +261,7 @@ def update( { "date_format": date_format, "description": description, + "escape_special_characters": escape_special_characters, "field_delimiter": field_delimiter, "field_separator": field_separator, "fields": fields, @@ -384,11 +423,12 @@ def replace( *, date_format: str | Omit = omit, description: str | Omit = omit, + escape_special_characters: bool | Omit = omit, field_delimiter: str | Omit = omit, field_separator: str | Omit = omit, fields: SequenceNotStr[str] | Omit = omit, file_name_template: str | Omit = omit, - format_type: str | Omit = omit, + format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, name: str | Omit = omit, @@ -412,6 +452,17 @@ def replace( description: Description of the policy. + escape_special_characters: When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + field_delimiter: Field delimiter for logs. field_separator: Field separator for logs. @@ -422,6 +473,12 @@ def replace( format_type: Format type for logs. + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + include_empty_logs: Include empty logs in the upload. include_shield_logs: Include logs from origin shielding in the upload. @@ -454,6 +511,7 @@ def replace( { "date_format": date_format, "description": description, + "escape_special_characters": escape_special_characters, "field_delimiter": field_delimiter, "field_separator": field_separator, "fields": fields, @@ -502,11 +560,12 @@ async def create( *, date_format: str | Omit = omit, description: str | Omit = omit, + escape_special_characters: bool | Omit = omit, field_delimiter: str | Omit = omit, field_separator: str | Omit = omit, fields: SequenceNotStr[str] | Omit = omit, file_name_template: str | Omit = omit, - format_type: str | Omit = omit, + format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, name: str | Omit = omit, @@ -530,6 +589,17 @@ async def create( description: Description of the policy. + escape_special_characters: When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + field_delimiter: Field delimiter for logs. field_separator: Field separator for logs. @@ -540,6 +610,12 @@ async def create( format_type: Format type for logs. + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + include_empty_logs: Include empty logs in the upload. include_shield_logs: Include logs from origin shielding in the upload. @@ -572,6 +648,7 @@ async def create( { "date_format": date_format, "description": description, + "escape_special_characters": escape_special_characters, "field_delimiter": field_delimiter, "field_separator": field_separator, "fields": fields, @@ -600,11 +677,12 @@ async def update( *, date_format: str | Omit = omit, description: str | Omit = omit, + escape_special_characters: bool | Omit = omit, field_delimiter: str | Omit = omit, field_separator: str | Omit = omit, fields: SequenceNotStr[str] | Omit = omit, file_name_template: str | Omit = omit, - format_type: str | Omit = omit, + format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, name: str | Omit = omit, @@ -628,6 +706,17 @@ async def update( description: Description of the policy. + escape_special_characters: When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + field_delimiter: Field delimiter for logs. field_separator: Field separator for logs. @@ -638,6 +727,12 @@ async def update( format_type: Format type for logs. + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + include_empty_logs: Include empty logs in the upload. include_shield_logs: Include logs from origin shielding in the upload. @@ -670,6 +765,7 @@ async def update( { "date_format": date_format, "description": description, + "escape_special_characters": escape_special_characters, "field_delimiter": field_delimiter, "field_separator": field_separator, "fields": fields, @@ -831,11 +927,12 @@ async def replace( *, date_format: str | Omit = omit, description: str | Omit = omit, + escape_special_characters: bool | Omit = omit, field_delimiter: str | Omit = omit, field_separator: str | Omit = omit, fields: SequenceNotStr[str] | Omit = omit, file_name_template: str | Omit = omit, - format_type: str | Omit = omit, + format_type: Literal["json", ""] | Omit = omit, include_empty_logs: bool | Omit = omit, include_shield_logs: bool | Omit = omit, name: str | Omit = omit, @@ -859,6 +956,17 @@ async def replace( description: Description of the policy. + escape_special_characters: When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + field_delimiter: Field delimiter for logs. field_separator: Field separator for logs. @@ -869,6 +977,12 @@ async def replace( format_type: Format type for logs. + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + include_empty_logs: Include empty logs in the upload. include_shield_logs: Include logs from origin shielding in the upload. @@ -901,6 +1015,7 @@ async def replace( { "date_format": date_format, "description": description, + "escape_special_characters": escape_special_characters, "field_delimiter": field_delimiter, "field_separator": field_separator, "fields": fields, diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py index 241cb7d5..dd6cfc5a 100644 --- a/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py @@ -2,6 +2,7 @@ from typing import Dict, List, Optional from datetime import datetime +from typing_extensions import Literal from ...._models import BaseModel @@ -23,6 +24,20 @@ class LogsUploaderPolicy(BaseModel): description: Optional[str] = None """Description of the policy.""" + escape_special_characters: Optional[bool] = None + """ + When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + """ + field_delimiter: Optional[str] = None """Field delimiter for logs.""" @@ -35,8 +50,15 @@ class LogsUploaderPolicy(BaseModel): file_name_template: Optional[str] = None """Template for log file name.""" - format_type: Optional[str] = None - """Format type for logs.""" + format_type: Optional[Literal["json", ""]] = None + """Format type for logs. + + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + """ include_empty_logs: Optional[bool] = None """Include empty logs in the upload.""" diff --git a/src/gcore/types/cdn/logs_uploader/policy_create_params.py b/src/gcore/types/cdn/logs_uploader/policy_create_params.py index 4d763619..7179d9d1 100644 --- a/src/gcore/types/cdn/logs_uploader/policy_create_params.py +++ b/src/gcore/types/cdn/logs_uploader/policy_create_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Dict, Optional -from typing_extensions import TypedDict +from typing_extensions import Literal, TypedDict from ...._types import SequenceNotStr @@ -17,6 +17,20 @@ class PolicyCreateParams(TypedDict, total=False): description: str """Description of the policy.""" + escape_special_characters: bool + """ + When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + """ + field_delimiter: str """Field delimiter for logs.""" @@ -29,8 +43,15 @@ class PolicyCreateParams(TypedDict, total=False): file_name_template: str """Template for log file name.""" - format_type: str - """Format type for logs.""" + format_type: Literal["json", ""] + """Format type for logs. + + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + """ include_empty_logs: bool """Include empty logs in the upload.""" diff --git a/src/gcore/types/cdn/logs_uploader/policy_replace_params.py b/src/gcore/types/cdn/logs_uploader/policy_replace_params.py index 7c62d955..cc779079 100644 --- a/src/gcore/types/cdn/logs_uploader/policy_replace_params.py +++ b/src/gcore/types/cdn/logs_uploader/policy_replace_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Dict, Optional -from typing_extensions import TypedDict +from typing_extensions import Literal, TypedDict from ...._types import SequenceNotStr @@ -17,6 +17,20 @@ class PolicyReplaceParams(TypedDict, total=False): description: str """Description of the policy.""" + escape_special_characters: bool + """ + When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + """ + field_delimiter: str """Field delimiter for logs.""" @@ -29,8 +43,15 @@ class PolicyReplaceParams(TypedDict, total=False): file_name_template: str """Template for log file name.""" - format_type: str - """Format type for logs.""" + format_type: Literal["json", ""] + """Format type for logs. + + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + """ include_empty_logs: bool """Include empty logs in the upload.""" diff --git a/src/gcore/types/cdn/logs_uploader/policy_update_params.py b/src/gcore/types/cdn/logs_uploader/policy_update_params.py index c1bb5811..0e8ce99d 100644 --- a/src/gcore/types/cdn/logs_uploader/policy_update_params.py +++ b/src/gcore/types/cdn/logs_uploader/policy_update_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Dict, Optional -from typing_extensions import TypedDict +from typing_extensions import Literal, TypedDict from ...._types import SequenceNotStr @@ -17,6 +17,20 @@ class PolicyUpdateParams(TypedDict, total=False): description: str """Description of the policy.""" + escape_special_characters: bool + """ + When set to true, the service sanitizes string values by escaping characters + that may be unsafe for transport, logging, or downstream processing. + + The following categories of characters are escaped: + + - Control and non-printable characters + - Quotation marks and escape characters + - Characters outside the standard ASCII range + + The resulting output contains only printable ASCII characters. + """ + field_delimiter: str """Field delimiter for logs.""" @@ -29,8 +43,15 @@ class PolicyUpdateParams(TypedDict, total=False): file_name_template: str """Template for log file name.""" - format_type: str - """Format type for logs.""" + format_type: Literal["json", ""] + """Format type for logs. + + Possible values: + + - **""** - empty, it means it will apply the format configurations from the + policy. + - **"json"** - output the logs as json lines. + """ include_empty_logs: bool """Include empty logs in the upload.""" diff --git a/src/gcore/types/dns/zones/dns_output_rrset.py b/src/gcore/types/dns/zones/dns_output_rrset.py index 13a99e28..67b794d6 100644 --- a/src/gcore/types/dns/zones/dns_output_rrset.py +++ b/src/gcore/types/dns/zones/dns_output_rrset.py @@ -38,11 +38,11 @@ class ResourceRecord(BaseModel): 2. `continents` (array of string) 3. `countries` (array of string) 4. `latlong` (array of float64, latitude and longitude) - 5. `fallback` (bool) - 6. `backup` (bool) - 7. `notes` (string) - 8. `weight` (float) - 9. `ip` (string) + 5. `backup` (bool) + 6. `notes` (string) + 7. `weight` (float) + 8. `ip` (string) + 9. `default` (bool) Some keys are reserved for balancing, @see https://api.gcore.com/dns/v2/info/meta diff --git a/tests/api_resources/cdn/logs_uploader/test_policies.py b/tests/api_resources/cdn/logs_uploader/test_policies.py index 07ed96bf..e197ed4c 100644 --- a/tests/api_resources/cdn/logs_uploader/test_policies.py +++ b/tests/api_resources/cdn/logs_uploader/test_policies.py @@ -31,11 +31,12 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: policy = client.cdn.logs_uploader.policies.create( date_format="[02/Jan/2006:15:04:05 -0700]", description="New policy", + escape_special_characters=True, field_delimiter=",", field_separator=";", fields=["remote_addr", "status"], file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", - format_type="flvproxy", + format_type="json", include_empty_logs=True, include_shield_logs=True, name="Policy", @@ -80,11 +81,12 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: id=0, date_format="[02/Jan/2006:15:04:05 -0700]", description="New policy", + escape_special_characters=True, field_delimiter=",", field_separator=";", fields=["remote_addr", "status"], file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", - format_type="flvproxy", + format_type="json", include_empty_logs=True, include_shield_logs=True, name="Policy", @@ -253,11 +255,12 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: id=0, date_format="[02/Jan/2006:15:04:05 -0700]", description="New policy", + escape_special_characters=True, field_delimiter=",", field_separator=";", fields=["remote_addr", "status"], file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", - format_type="flvproxy", + format_type="json", include_empty_logs=True, include_shield_logs=True, name="Policy", @@ -309,11 +312,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> policy = await async_client.cdn.logs_uploader.policies.create( date_format="[02/Jan/2006:15:04:05 -0700]", description="New policy", + escape_special_characters=True, field_delimiter=",", field_separator=";", fields=["remote_addr", "status"], file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", - format_type="flvproxy", + format_type="json", include_empty_logs=True, include_shield_logs=True, name="Policy", @@ -358,11 +362,12 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> id=0, date_format="[02/Jan/2006:15:04:05 -0700]", description="New policy", + escape_special_characters=True, field_delimiter=",", field_separator=";", fields=["remote_addr", "status"], file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", - format_type="flvproxy", + format_type="json", include_empty_logs=True, include_shield_logs=True, name="Policy", @@ -531,11 +536,12 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> id=0, date_format="[02/Jan/2006:15:04:05 -0700]", description="New policy", + escape_special_characters=True, field_delimiter=",", field_separator=";", fields=["remote_addr", "status"], file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", - format_type="flvproxy", + format_type="json", include_empty_logs=True, include_shield_logs=True, name="Policy", From 92caa3fa7f4d0052802905e5a469e620fe43e012 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 Jan 2026 11:09:47 +0000 Subject: [PATCH 07/13] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 58e08d86..012d8b2b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-33aa30cae2d845ec4347e37da18c094ba63cd87f8c80c1d40cb62fbcd84711e4.yml -openapi_spec_hash: ca2f0eca860c223ceb929d5533de8c9e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f7071d2209910e2d6aa64c6dc59a626672b55ac387f7ccbbb686d6c40f6789ca.yml +openapi_spec_hash: dada79ef3ca01512c80d9579bc03acb4 config_hash: cba67c225c37fe0e91ed7586f53169e4 From 9f567f9268490b9c1b403a502ddd5f5e7a617534 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 Jan 2026 10:12:07 +0000 Subject: [PATCH 08/13] feat(api): aggregated API specs update --- .stats.yml | 4 +- api.md | 69 ++-- .../resources/cloud/instances/flavors.py | 10 +- .../resources/cloud/k8s/clusters/clusters.py | 20 +- .../cloud/k8s/clusters/pools/pools.py | 10 +- src/gcore/resources/cloud/k8s/k8s.py | 10 +- .../resources/cloud/load_balancers/flavors.py | 18 +- .../cloud/load_balancers/load_balancers.py | 151 ++++++-- .../resources/cloud/load_balancers/metrics.py | 22 +- .../cloud/load_balancers/statuses.py | 30 +- src/gcore/resources/cloud/networks/subnets.py | 4 +- src/gcore/resources/cloud/placement_groups.py | 10 +- .../reserved_fixed_ips/vip/candidate_ports.py | 10 +- .../reserved_fixed_ips/vip/connected_ports.py | 28 +- .../resources/cloud/security_groups/rules.py | 48 ++- .../cloud/security_groups/security_groups.py | 60 ++++ src/gcore/types/cloud/__init__.py | 7 +- src/gcore/types/cloud/cost_report_detailed.py | 12 +- .../inference/deployment_update_params.py | 4 +- src/gcore/types/cloud/instances/__init__.py | 3 +- .../cloud/instances/flavor_list_response.py | 94 +++++ .../types/cloud/instances/instance_flavor.py | 51 --- src/gcore/types/cloud/k8s/__init__.py | 5 +- ...uster_list.py => cluster_list_response.py} | 4 +- ...ter_list_versions_for_upgrade_response.py} | 8 +- .../types/cloud/k8s/clusters/__init__.py | 2 +- ...ter_pool_list.py => pool_list_response.py} | 4 +- ..._list.py => k8s_list_versions_response.py} | 4 +- .../cloud/load_balancer_create_params.py | 8 +- .../cloud/load_balancer_failover_params.py | 2 + .../types/cloud/load_balancer_flavor_list.py | 16 - .../types/cloud/load_balancer_get_params.py | 4 +- .../types/cloud/load_balancer_list_params.py | 42 ++- .../cloud/load_balancer_resize_params.py | 2 + .../cloud/load_balancer_update_params.py | 2 + .../types/cloud/load_balancers/__init__.py | 3 + .../load_balancers/flavor_list_params.py | 2 + .../load_balancers/flavor_list_response.py | 34 ++ .../load_balancers/metric_list_params.py | 2 + .../metric_list_response.py} | 8 +- .../status_list_response.py} | 8 +- src/gcore/types/cloud/networks/__init__.py | 1 - src/gcore/types/cloud/networks/router_list.py | 16 - .../cloud/networks/subnet_update_params.py | 2 +- ...st.py => placement_group_list_response.py} | 4 +- src/gcore/types/cloud/region.py | 4 +- .../types/cloud/registries/registry_user.py | 3 +- .../cloud/registries/registry_user_created.py | 5 +- .../user_refresh_secret_response.py | 5 +- .../cloud/reserved_fixed_ips/vip/__init__.py | 6 +- ...ist.py => candidate_port_list_response.py} | 4 +- ...list.py => connected_port_add_response.py} | 4 +- .../vip/connected_port_list_response.py | 16 + .../vip/connected_port_replace_response.py | 16 + .../types/cloud/security_group_copy_params.py | 2 + .../cloud/security_group_create_params.py | 8 +- src/gcore/types/cloud/security_group_rule.py | 24 +- .../cloud/security_group_update_params.py | 2 + .../security_groups/rule_create_params.py | 12 +- .../security_groups/rule_replace_params.py | 2 + src/gcore/types/cloud/usage_report.py | 12 +- .../cloud/inference/test_deployments.py | 4 +- .../cloud/instances/test_flavors.py | 18 +- .../cloud/k8s/clusters/test_pools.py | 14 +- .../api_resources/cloud/k8s/test_clusters.py | 29 +- .../cloud/load_balancers/test_flavors.py | 50 +-- .../cloud/load_balancers/test_metrics.py | 58 +-- .../cloud/load_balancers/test_statuses.py | 83 ++--- .../vip/test_candidate_ports.py | 14 +- .../vip/test_connected_ports.py | 48 +-- .../cloud/security_groups/test_rules.py | 168 ++++----- tests/api_resources/cloud/test_k8s.py | 14 +- .../cloud/test_load_balancers.py | 340 +++++++++--------- .../cloud/test_placement_groups.py | 14 +- .../cloud/test_security_groups.py | 236 ++++++------ 75 files changed, 1227 insertions(+), 846 deletions(-) create mode 100644 src/gcore/types/cloud/instances/flavor_list_response.py delete mode 100644 src/gcore/types/cloud/instances/instance_flavor.py rename src/gcore/types/cloud/k8s/{k8s_cluster_list.py => cluster_list_response.py} (79%) rename src/gcore/types/cloud/{instances/instance_flavor_list.py => k8s/cluster_list_versions_for_upgrade_response.py} (51%) rename src/gcore/types/cloud/k8s/clusters/{k8s_cluster_pool_list.py => pool_list_response.py} (80%) rename src/gcore/types/cloud/{k8s_cluster_version_list.py => k8s_list_versions_response.py} (78%) delete mode 100644 src/gcore/types/cloud/load_balancer_flavor_list.py create mode 100644 src/gcore/types/cloud/load_balancers/flavor_list_response.py rename src/gcore/types/cloud/{load_balancer_metrics_list.py => load_balancers/metric_list_response.py} (56%) rename src/gcore/types/cloud/{load_balancer_status_list.py => load_balancers/status_list_response.py} (56%) delete mode 100644 src/gcore/types/cloud/networks/router_list.py rename src/gcore/types/cloud/{placement_group_list.py => placement_group_list_response.py} (77%) rename src/gcore/types/cloud/reserved_fixed_ips/vip/{candidate_port_list.py => candidate_port_list_response.py} (77%) rename src/gcore/types/cloud/reserved_fixed_ips/vip/{connected_port_list.py => connected_port_add_response.py} (77%) create mode 100644 src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list_response.py create mode 100644 src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_replace_response.py diff --git a/.stats.yml b/.stats.yml index 012d8b2b..d5976c8d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-f7071d2209910e2d6aa64c6dc59a626672b55ac387f7ccbbb686d6c40f6789ca.yml -openapi_spec_hash: dada79ef3ca01512c80d9579bc03acb4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-432dafc5e24ab4a5594e628f3ac9a35e906e1de7dd20eeecd27afaf143dec88f.yml +openapi_spec_hash: 57bd58f035387ac1efdcbefa5abab427 config_hash: cba67c225c37fe0e91ed7586f53169e4 diff --git a/api.md b/api.md index d38c1ccf..644fa847 100644 --- a/api.md +++ b/api.md @@ -187,7 +187,6 @@ from gcore.types.cloud import ( LbSessionPersistenceType, ListenerStatus, LoadBalancerFlavorDetail, - LoadBalancerFlavorList, LoadBalancerL7Policy, LoadBalancerL7PolicyList, LoadBalancerL7Rule, @@ -195,11 +194,9 @@ from gcore.types.cloud import ( LoadBalancerListenerDetail, LoadBalancerListenerList, LoadBalancerMetrics, - LoadBalancerMetricsList, LoadBalancerPool, LoadBalancerPoolList, LoadBalancerStatus, - LoadBalancerStatusList, Member, MemberStatus, PoolStatus, @@ -239,9 +236,15 @@ Methods: ### Flavors +Types: + +```python +from gcore.types.cloud.load_balancers import FlavorListResponse +``` + Methods: -- client.cloud.load_balancers.flavors.list(\*, project_id, region_id, \*\*params) -> LoadBalancerFlavorList +- client.cloud.load_balancers.flavors.list(\*, project_id, region_id, \*\*params) -> FlavorListResponse ### Listeners @@ -279,15 +282,27 @@ Methods: ### Metrics +Types: + +```python +from gcore.types.cloud.load_balancers import MetricListResponse +``` + Methods: -- client.cloud.load_balancers.metrics.list(load_balancer_id, \*, project_id, region_id, \*\*params) -> LoadBalancerMetricsList +- client.cloud.load_balancers.metrics.list(load_balancer_id, \*, project_id, region_id, \*\*params) -> MetricListResponse ### Statuses +Types: + +```python +from gcore.types.cloud.load_balancers import StatusListResponse +``` + Methods: -- client.cloud.load_balancers.statuses.list(\*, project_id, region_id) -> LoadBalancerStatusList +- client.cloud.load_balancers.statuses.list(\*, project_id, region_id) -> StatusListResponse - client.cloud.load_balancers.statuses.get(load_balancer_id, \*, project_id, region_id) -> LoadBalancerStatus ## ReservedFixedIPs @@ -323,26 +338,31 @@ Methods: Types: ```python -from gcore.types.cloud.reserved_fixed_ips.vip import CandidatePort, CandidatePortList +from gcore.types.cloud.reserved_fixed_ips.vip import CandidatePort, CandidatePortListResponse ``` Methods: -- client.cloud.reserved_fixed_ips.vip.candidate_ports.list(port_id, \*, project_id, region_id) -> CandidatePortList +- client.cloud.reserved_fixed_ips.vip.candidate_ports.list(port_id, \*, project_id, region_id) -> CandidatePortListResponse #### ConnectedPorts Types: ```python -from gcore.types.cloud.reserved_fixed_ips.vip import ConnectedPort, ConnectedPortList +from gcore.types.cloud.reserved_fixed_ips.vip import ( + ConnectedPort, + ConnectedPortListResponse, + ConnectedPortAddResponse, + ConnectedPortReplaceResponse, +) ``` Methods: -- client.cloud.reserved_fixed_ips.vip.connected_ports.list(port_id, \*, project_id, region_id) -> ConnectedPortList -- client.cloud.reserved_fixed_ips.vip.connected_ports.add(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList -- client.cloud.reserved_fixed_ips.vip.connected_ports.replace(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortList +- client.cloud.reserved_fixed_ips.vip.connected_ports.list(port_id, \*, project_id, region_id) -> ConnectedPortListResponse +- client.cloud.reserved_fixed_ips.vip.connected_ports.add(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortAddResponse +- client.cloud.reserved_fixed_ips.vip.connected_ports.replace(port_id, \*, project_id, region_id, \*\*params) -> ConnectedPortReplaceResponse ## Networks @@ -369,7 +389,7 @@ Methods: Types: ```python -from gcore.types.cloud.networks import Router, RouterList, SubnetID +from gcore.types.cloud.networks import Router, SubnetID ``` Methods: @@ -618,13 +638,13 @@ Methods: Types: ```python -from gcore.types.cloud import PlacementGroup, PlacementGroupList +from gcore.types.cloud import PlacementGroup, PlacementGroupListResponse ``` Methods: - client.cloud.placement_groups.create(\*, project_id, region_id, \*\*params) -> PlacementGroup -- client.cloud.placement_groups.list(\*, project_id, region_id) -> PlacementGroupList +- client.cloud.placement_groups.list(\*, project_id, region_id) -> PlacementGroupListResponse - client.cloud.placement_groups.delete(group_id, \*, project_id, region_id) -> TaskIDList - client.cloud.placement_groups.get(group_id, \*, project_id, region_id) -> PlacementGroup @@ -957,12 +977,12 @@ Methods: Types: ```python -from gcore.types.cloud.instances import InstanceFlavor, InstanceFlavorList +from gcore.types.cloud.instances import InstanceFlavor, InstanceFlavorList, FlavorListResponse ``` Methods: -- client.cloud.instances.flavors.list(\*, project_id, region_id, \*\*params) -> InstanceFlavorList +- client.cloud.instances.flavors.list(\*, project_id, region_id, \*\*params) -> FlavorListResponse ### Interfaces @@ -1000,12 +1020,12 @@ Methods: Types: ```python -from gcore.types.cloud import K8SClusterVersion, K8SClusterVersionList +from gcore.types.cloud import K8SClusterVersion, K8SListVersionsResponse ``` Methods: -- client.cloud.k8s.list_versions(\*, project_id, region_id) -> K8SClusterVersionList +- client.cloud.k8s.list_versions(\*, project_id, region_id) -> K8SListVersionsResponse ### Flavors @@ -1022,7 +1042,8 @@ from gcore.types.cloud.k8s import ( K8SCluster, K8SClusterCertificate, K8SClusterKubeconfig, - K8SClusterList, + ClusterListResponse, + ClusterListVersionsForUpgradeResponse, ) ``` @@ -1030,12 +1051,12 @@ Methods: - client.cloud.k8s.clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.k8s.clusters.update(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.k8s.clusters.list(\*, project_id, region_id) -> K8SClusterList +- client.cloud.k8s.clusters.list(\*, project_id, region_id) -> ClusterListResponse - client.cloud.k8s.clusters.delete(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.k8s.clusters.get(cluster_name, \*, project_id, region_id) -> K8SCluster - client.cloud.k8s.clusters.get_certificate(cluster_name, \*, project_id, region_id) -> K8SClusterCertificate - client.cloud.k8s.clusters.get_kubeconfig(cluster_name, \*, project_id, region_id) -> K8SClusterKubeconfig -- client.cloud.k8s.clusters.list_versions_for_upgrade(cluster_name, \*, project_id, region_id) -> K8SClusterVersionList +- client.cloud.k8s.clusters.list_versions_for_upgrade(cluster_name, \*, project_id, region_id) -> ClusterListVersionsForUpgradeResponse - client.cloud.k8s.clusters.upgrade(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList #### Nodes @@ -1050,14 +1071,14 @@ Methods: Types: ```python -from gcore.types.cloud.k8s.clusters import K8SClusterPool, K8SClusterPoolList, K8SClusterPoolQuota +from gcore.types.cloud.k8s.clusters import K8SClusterPool, K8SClusterPoolQuota, PoolListResponse ``` Methods: - client.cloud.k8s.clusters.pools.create(cluster_name, \*, project_id, region_id, \*\*params) -> TaskIDList - 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.list(cluster_name, \*, project_id, region_id) -> PoolListResponse - 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 diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 23ba0073..69f5eace 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -16,7 +16,7 @@ ) from ...._base_client import make_request_options from ....types.cloud.instances import flavor_list_params -from ....types.cloud.instances.instance_flavor_list import InstanceFlavorList +from ....types.cloud.instances.flavor_list_response import FlavorListResponse __all__ = ["FlavorsResource", "AsyncFlavorsResource"] @@ -56,7 +56,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> InstanceFlavorList: + ) -> FlavorListResponse: """Retrieve a list of available instance flavors in the project and region. When @@ -101,7 +101,7 @@ def list( flavor_list_params.FlavorListParams, ), ), - cast_to=InstanceFlavorList, + cast_to=FlavorListResponse, ) @@ -140,7 +140,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> InstanceFlavorList: + ) -> FlavorListResponse: """Retrieve a list of available instance flavors in the project and region. When @@ -185,7 +185,7 @@ async def list( flavor_list_params.FlavorListParams, ), ), - cast_to=InstanceFlavorList, + cast_to=FlavorListResponse, ) diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index 52ab2f78..8b48757d 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -41,10 +41,10 @@ ) from .....types.cloud.task_id_list import TaskIDList from .....types.cloud.k8s.k8s_cluster import K8SCluster -from .....types.cloud.k8s.k8s_cluster_list import K8SClusterList -from .....types.cloud.k8s_cluster_version_list import K8SClusterVersionList +from .....types.cloud.k8s.cluster_list_response import ClusterListResponse from .....types.cloud.k8s.k8s_cluster_kubeconfig import K8SClusterKubeconfig from .....types.cloud.k8s.k8s_cluster_certificate import K8SClusterCertificate +from .....types.cloud.k8s.cluster_list_versions_for_upgrade_response import ClusterListVersionsForUpgradeResponse __all__ = ["ClustersResource", "AsyncClustersResource"] @@ -381,7 +381,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SClusterList: + ) -> ClusterListResponse: """ List k8s clusters @@ -403,7 +403,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SClusterList, + cast_to=ClusterListResponse, ) def delete( @@ -581,7 +581,7 @@ def list_versions_for_upgrade( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SClusterVersionList: + ) -> ClusterListVersionsForUpgradeResponse: """ List available k8s cluster versions for upgrade @@ -605,7 +605,7 @@ def list_versions_for_upgrade( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SClusterVersionList, + cast_to=ClusterListVersionsForUpgradeResponse, ) def upgrade( @@ -984,7 +984,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SClusterList: + ) -> ClusterListResponse: """ List k8s clusters @@ -1006,7 +1006,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SClusterList, + cast_to=ClusterListResponse, ) async def delete( @@ -1184,7 +1184,7 @@ async def list_versions_for_upgrade( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SClusterVersionList: + ) -> ClusterListVersionsForUpgradeResponse: """ List available k8s cluster versions for upgrade @@ -1208,7 +1208,7 @@ async def list_versions_for_upgrade( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SClusterVersionList, + cast_to=ClusterListVersionsForUpgradeResponse, ) async def upgrade( diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index 7de8cf65..1dd0f32d 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -34,7 +34,7 @@ ) 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.pool_list_response import PoolListResponse from ......types.cloud.k8s.clusters.k8s_cluster_pool_quota import K8SClusterPoolQuota __all__ = ["PoolsResource", "AsyncPoolsResource"] @@ -244,7 +244,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SClusterPoolList: + ) -> PoolListResponse: """ List k8s cluster pools @@ -268,7 +268,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SClusterPoolList, + cast_to=PoolListResponse, ) def delete( @@ -683,7 +683,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SClusterPoolList: + ) -> PoolListResponse: """ List k8s cluster pools @@ -707,7 +707,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SClusterPoolList, + cast_to=PoolListResponse, ) async def delete( diff --git a/src/gcore/resources/cloud/k8s/k8s.py b/src/gcore/resources/cloud/k8s/k8s.py index e1dabed0..da703ea5 100644 --- a/src/gcore/resources/cloud/k8s/k8s.py +++ b/src/gcore/resources/cloud/k8s/k8s.py @@ -30,7 +30,7 @@ ClustersResourceWithStreamingResponse, AsyncClustersResourceWithStreamingResponse, ) -from ....types.cloud.k8s_cluster_version_list import K8SClusterVersionList +from ....types.cloud.k8s_list_versions_response import K8SListVersionsResponse __all__ = ["K8SResource", "AsyncK8SResource"] @@ -74,7 +74,7 @@ def list_versions( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SClusterVersionList: + ) -> K8SListVersionsResponse: """ List available k8s cluster versions for creation @@ -96,7 +96,7 @@ def list_versions( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SClusterVersionList, + cast_to=K8SListVersionsResponse, ) @@ -139,7 +139,7 @@ async def list_versions( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> K8SClusterVersionList: + ) -> K8SListVersionsResponse: """ List available k8s cluster versions for creation @@ -161,7 +161,7 @@ async def list_versions( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=K8SClusterVersionList, + cast_to=K8SListVersionsResponse, ) diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index 8d126cd7..c6c71f5c 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -16,7 +16,7 @@ ) from ...._base_client import make_request_options from ....types.cloud.load_balancers import flavor_list_params -from ....types.cloud.load_balancer_flavor_list import LoadBalancerFlavorList +from ....types.cloud.load_balancers.flavor_list_response import FlavorListResponse __all__ = ["FlavorsResource", "AsyncFlavorsResource"] @@ -53,7 +53,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerFlavorList: + ) -> FlavorListResponse: """Retrieve a list of load balancer flavors. When the `include_prices` query @@ -61,6 +61,10 @@ def list( price values as 0. If you get Pricing Error contact the support Args: + project_id: Project ID + + region_id: Region ID + include_prices: Set to true if the response should include flavor prices extra_headers: Send extra headers @@ -84,7 +88,7 @@ def list( timeout=timeout, query=maybe_transform({"include_prices": include_prices}, flavor_list_params.FlavorListParams), ), - cast_to=LoadBalancerFlavorList, + cast_to=FlavorListResponse, ) @@ -120,7 +124,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerFlavorList: + ) -> FlavorListResponse: """Retrieve a list of load balancer flavors. When the `include_prices` query @@ -128,6 +132,10 @@ async def list( price values as 0. If you get Pricing Error contact the support Args: + project_id: Project ID + + region_id: Region ID + include_prices: Set to true if the response should include flavor prices extra_headers: Send extra headers @@ -153,7 +161,7 @@ async def list( {"include_prices": include_prices}, flavor_list_params.FlavorListParams ), ), - cast_to=LoadBalancerFlavorList, + cast_to=FlavorListResponse, ) diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 3674e809..f25262eb 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -3,6 +3,7 @@ from __future__ import annotations from typing import Dict, Iterable, Optional +from typing_extensions import Literal import httpx @@ -157,6 +158,10 @@ def create( Create load balancer Args: + project_id: Project ID + + region_id: Region ID + flavor: Load balancer flavor name floating_ip: Floating IP configuration for assignment @@ -257,6 +262,12 @@ def update( remain unchanged. Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + logging: Logging configuration name: Name. @@ -332,7 +343,25 @@ def list( logging_enabled: bool | Omit = omit, name: str | Omit = omit, offset: int | Omit = omit, - order_by: str | Omit = omit, + order_by: Literal[ + "created_at.asc", + "created_at.desc", + "flavor.asc", + "flavor.desc", + "name.asc", + "name.desc", + "operating_status.asc", + "operating_status.desc", + "provisioning_status.asc", + "provisioning_status.desc", + "updated_at.asc", + "updated_at.desc", + "vip_address.asc", + "vip_address.desc", + "vip_ip_family.asc", + "vip_ip_family.desc", + ] + | Omit = omit, show_stats: bool | Omit = omit, tag_key: SequenceNotStr[str] | Omit = omit, tag_key_value: str | Omit = omit, @@ -348,26 +377,27 @@ def list( List load balancers Args: + project_id: Project ID + + region_id: Region ID + assigned_floating: With or without assigned floating IP - limit: Limit the number of returned limit request entities. + limit: Limit of items on a single page - logging_enabled: With or without logging + logging_enabled: With or without logging enabled name: Filter by name - offset: Offset value is used to exclude the first set of records from the result. + offset: Offset in results list - order_by: Ordering Load Balancer list result by name, `created_at`, `updated_at`, - `operating_status`, `provisioning_status`, `vip_address`, `vip_ip_family` and - flavor fields of the load balancer and directions (name.asc), default is - "`created_at`.asc" + order_by: Order by field and direction. show_stats: Show statistics - tag_key: Filter by tag keys. + tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 - tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. + tag_key_value: Optional. Filter by tag key-value pairs. with_ddos: Show Advanced DDoS protection profile, if exists @@ -621,6 +651,12 @@ def delete( Delete load balancer Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -661,6 +697,12 @@ def failover( Failover load balancer Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + force: Validate current load balancer status before failover or not. extra_headers: Send extra headers @@ -705,9 +747,15 @@ def get( Get load balancer Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + show_stats: Show statistics - with_ddos: Show DDoS profile + with_ddos: Show Advanced DDoS protection profile, if exists extra_headers: Send extra headers @@ -759,6 +807,12 @@ def resize( Resize load balancer Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + flavor: Name of the desired flavor to resize to. extra_headers: Send extra headers @@ -857,6 +911,10 @@ async def create( Create load balancer Args: + project_id: Project ID + + region_id: Region ID + flavor: Load balancer flavor name floating_ip: Floating IP configuration for assignment @@ -957,6 +1015,12 @@ async def update( remain unchanged. Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + logging: Logging configuration name: Name. @@ -1032,7 +1096,25 @@ def list( logging_enabled: bool | Omit = omit, name: str | Omit = omit, offset: int | Omit = omit, - order_by: str | Omit = omit, + order_by: Literal[ + "created_at.asc", + "created_at.desc", + "flavor.asc", + "flavor.desc", + "name.asc", + "name.desc", + "operating_status.asc", + "operating_status.desc", + "provisioning_status.asc", + "provisioning_status.desc", + "updated_at.asc", + "updated_at.desc", + "vip_address.asc", + "vip_address.desc", + "vip_ip_family.asc", + "vip_ip_family.desc", + ] + | Omit = omit, show_stats: bool | Omit = omit, tag_key: SequenceNotStr[str] | Omit = omit, tag_key_value: str | Omit = omit, @@ -1048,26 +1130,27 @@ def list( List load balancers Args: + project_id: Project ID + + region_id: Region ID + assigned_floating: With or without assigned floating IP - limit: Limit the number of returned limit request entities. + limit: Limit of items on a single page - logging_enabled: With or without logging + logging_enabled: With or without logging enabled name: Filter by name - offset: Offset value is used to exclude the first set of records from the result. + offset: Offset in results list - order_by: Ordering Load Balancer list result by name, `created_at`, `updated_at`, - `operating_status`, `provisioning_status`, `vip_address`, `vip_ip_family` and - flavor fields of the load balancer and directions (name.asc), default is - "`created_at`.asc" + order_by: Order by field and direction. show_stats: Show statistics - tag_key: Filter by tag keys. + tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 - tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string. + tag_key_value: Optional. Filter by tag key-value pairs. with_ddos: Show Advanced DDoS protection profile, if exists @@ -1321,6 +1404,12 @@ async def delete( Delete load balancer Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1361,6 +1450,12 @@ async def failover( Failover load balancer Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + force: Validate current load balancer status before failover or not. extra_headers: Send extra headers @@ -1407,9 +1502,15 @@ async def get( Get load balancer Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + show_stats: Show statistics - with_ddos: Show DDoS profile + with_ddos: Show Advanced DDoS protection profile, if exists extra_headers: Send extra headers @@ -1461,6 +1562,12 @@ async def resize( Resize load balancer Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + flavor: Name of the desired flavor to resize to. extra_headers: Send extra headers diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index e7647609..72ba10be 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -18,7 +18,7 @@ from ...._base_client import make_request_options from ....types.cloud.load_balancers import metric_list_params from ....types.cloud.instance_metrics_time_unit import InstanceMetricsTimeUnit -from ....types.cloud.load_balancer_metrics_list import LoadBalancerMetricsList +from ....types.cloud.load_balancers.metric_list_response import MetricListResponse __all__ = ["MetricsResource", "AsyncMetricsResource"] @@ -57,11 +57,17 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerMetricsList: + ) -> MetricListResponse: """ Get load balancer metrics, including cpu, memory and network Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + time_interval: Time interval time_unit: Time interval unit @@ -92,7 +98,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerMetricsList, + cast_to=MetricListResponse, ) @@ -130,11 +136,17 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerMetricsList: + ) -> MetricListResponse: """ Get load balancer metrics, including cpu, memory and network Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + time_interval: Time interval time_unit: Time interval unit @@ -165,7 +177,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerMetricsList, + cast_to=MetricListResponse, ) diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index e537b073..1805ddd4 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -15,7 +15,7 @@ ) from ...._base_client import make_request_options from ....types.cloud.load_balancer_status import LoadBalancerStatus -from ....types.cloud.load_balancer_status_list import LoadBalancerStatusList +from ....types.cloud.load_balancers.status_list_response import StatusListResponse __all__ = ["StatusesResource", "AsyncStatusesResource"] @@ -51,11 +51,15 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerStatusList: + ) -> StatusListResponse: """ List load balancers statuses Args: + project_id: Project ID + + region_id: Region ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -73,7 +77,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerStatusList, + cast_to=StatusListResponse, ) def get( @@ -93,6 +97,12 @@ def get( Get load balancer status Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -147,11 +157,15 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> LoadBalancerStatusList: + ) -> StatusListResponse: """ List load balancers statuses Args: + project_id: Project ID + + region_id: Region ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -169,7 +183,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=LoadBalancerStatusList, + cast_to=StatusListResponse, ) async def get( @@ -189,6 +203,12 @@ async def get( Get load balancer status Args: + project_id: Project ID + + region_id: Region ID + + load_balancer_id: Load-Balancer ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index 7c123a14..f1ea953f 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -218,7 +218,7 @@ def update( project_id: int | None = None, region_id: int | None = None, dns_nameservers: Optional[SequenceNotStr[str]] | Omit = omit, - enable_dhcp: Optional[bool] | Omit = omit, + enable_dhcp: bool | Omit = omit, gateway_ip: Optional[str] | Omit = omit, host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | Omit = omit, name: Optional[str] | Omit = omit, @@ -683,7 +683,7 @@ async def update( project_id: int | None = None, region_id: int | None = None, dns_nameservers: Optional[SequenceNotStr[str]] | Omit = omit, - enable_dhcp: Optional[bool] | Omit = omit, + enable_dhcp: bool | Omit = omit, gateway_ip: Optional[str] | Omit = omit, host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | Omit = omit, name: Optional[str] | Omit = omit, diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py index 243dd294..4cd753f3 100644 --- a/src/gcore/resources/cloud/placement_groups.py +++ b/src/gcore/resources/cloud/placement_groups.py @@ -20,7 +20,7 @@ from ..._base_client import make_request_options from ...types.cloud.task_id_list import TaskIDList from ...types.cloud.placement_group import PlacementGroup -from ...types.cloud.placement_group_list import PlacementGroupList +from ...types.cloud.placement_group_list_response import PlacementGroupListResponse __all__ = ["PlacementGroupsResource", "AsyncPlacementGroupsResource"] @@ -109,7 +109,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PlacementGroupList: + ) -> PlacementGroupListResponse: """ List placement groups @@ -131,7 +131,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PlacementGroupList, + cast_to=PlacementGroupListResponse, ) def delete( @@ -297,7 +297,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PlacementGroupList: + ) -> PlacementGroupListResponse: """ List placement groups @@ -319,7 +319,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PlacementGroupList, + cast_to=PlacementGroupListResponse, ) async def delete( diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip/candidate_ports.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip/candidate_ports.py index fdc29228..3c726b46 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip/candidate_ports.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip/candidate_ports.py @@ -14,7 +14,7 @@ async_to_streamed_response_wrapper, ) from ....._base_client import make_request_options -from .....types.cloud.reserved_fixed_ips.vip.candidate_port_list import CandidatePortList +from .....types.cloud.reserved_fixed_ips.vip.candidate_port_list_response import CandidatePortListResponse __all__ = ["CandidatePortsResource", "AsyncCandidatePortsResource"] @@ -51,7 +51,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CandidatePortList: + ) -> CandidatePortListResponse: """ List all instance ports that are available for connecting to a VIP. @@ -75,7 +75,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CandidatePortList, + cast_to=CandidatePortListResponse, ) @@ -111,7 +111,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CandidatePortList: + ) -> CandidatePortListResponse: """ List all instance ports that are available for connecting to a VIP. @@ -135,7 +135,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CandidatePortList, + cast_to=CandidatePortListResponse, ) diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip/connected_ports.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip/connected_ports.py index f98e4b8a..a78a8e6c 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip/connected_ports.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip/connected_ports.py @@ -16,7 +16,9 @@ ) from ....._base_client import make_request_options from .....types.cloud.reserved_fixed_ips.vip import connected_port_add_params, connected_port_replace_params -from .....types.cloud.reserved_fixed_ips.vip.connected_port_list import ConnectedPortList +from .....types.cloud.reserved_fixed_ips.vip.connected_port_add_response import ConnectedPortAddResponse +from .....types.cloud.reserved_fixed_ips.vip.connected_port_list_response import ConnectedPortListResponse +from .....types.cloud.reserved_fixed_ips.vip.connected_port_replace_response import ConnectedPortReplaceResponse __all__ = ["ConnectedPortsResource", "AsyncConnectedPortsResource"] @@ -53,7 +55,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortList: + ) -> ConnectedPortListResponse: """ List all instance ports that share a VIP. @@ -77,7 +79,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortList, + cast_to=ConnectedPortListResponse, ) def add( @@ -93,7 +95,7 @@ def add( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortList: + ) -> ConnectedPortAddResponse: """ Add instance ports to share a VIP. @@ -120,7 +122,7 @@ def add( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortList, + cast_to=ConnectedPortAddResponse, ) def replace( @@ -136,7 +138,7 @@ def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortList: + ) -> ConnectedPortReplaceResponse: """ Replace the list of instance ports that share a VIP. @@ -163,7 +165,7 @@ def replace( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortList, + cast_to=ConnectedPortReplaceResponse, ) @@ -199,7 +201,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortList: + ) -> ConnectedPortListResponse: """ List all instance ports that share a VIP. @@ -223,7 +225,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortList, + cast_to=ConnectedPortListResponse, ) async def add( @@ -239,7 +241,7 @@ async def add( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortList: + ) -> ConnectedPortAddResponse: """ Add instance ports to share a VIP. @@ -266,7 +268,7 @@ async def add( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortList, + cast_to=ConnectedPortAddResponse, ) async def replace( @@ -282,7 +284,7 @@ async def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ConnectedPortList: + ) -> ConnectedPortReplaceResponse: """ Replace the list of instance ports that share a VIP. @@ -311,7 +313,7 @@ async def replace( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConnectedPortList, + cast_to=ConnectedPortReplaceResponse, ) diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index aacd3921..dc4cdfa2 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -50,8 +50,8 @@ def create( *, project_id: int | None = None, region_id: int | None = None, + direction: Literal["egress", "ingress"], description: str | Omit = omit, - direction: Literal["egress", "ingress"] | Omit = omit, ethertype: Literal["IPv4", "IPv6"] | Omit = omit, port_range_max: Optional[int] | Omit = omit, port_range_min: Optional[int] | Omit = omit, @@ -95,10 +95,16 @@ def create( Add a new rule to an existing security group. Args: - description: Rule description + project_id: Project ID + + region_id: Region ID + + group_id: Group ID direction: Ingress or egress, which is the direction in which the security group is applied + description: Rule description + ethertype: Ether type port_range_max: The maximum port number in the range that is matched by the security group rule @@ -129,8 +135,8 @@ def create( f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=maybe_transform( { - "description": description, "direction": direction, + "description": description, "ethertype": ethertype, "port_range_max": port_range_max, "port_range_min": port_range_min, @@ -163,6 +169,12 @@ def delete( Delete a specific rule from a security group. Args: + project_id: Project ID + + region_id: Region ID + + rule_id: Rule ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -238,6 +250,12 @@ def replace( Update the configuration of an existing security group rule. Args: + project_id: Project ID + + region_id: Region ID + + rule_id: Rule ID + direction: Ingress or egress, which is the direction in which the security group rule is applied @@ -321,8 +339,8 @@ async def create( *, project_id: int | None = None, region_id: int | None = None, + direction: Literal["egress", "ingress"], description: str | Omit = omit, - direction: Literal["egress", "ingress"] | Omit = omit, ethertype: Literal["IPv4", "IPv6"] | Omit = omit, port_range_max: Optional[int] | Omit = omit, port_range_min: Optional[int] | Omit = omit, @@ -366,10 +384,16 @@ async def create( Add a new rule to an existing security group. Args: - description: Rule description + project_id: Project ID + + region_id: Region ID + + group_id: Group ID direction: Ingress or egress, which is the direction in which the security group is applied + description: Rule description + ethertype: Ether type port_range_max: The maximum port number in the range that is matched by the security group rule @@ -400,8 +424,8 @@ async def create( f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=await async_maybe_transform( { - "description": description, "direction": direction, + "description": description, "ethertype": ethertype, "port_range_max": port_range_max, "port_range_min": port_range_min, @@ -434,6 +458,12 @@ async def delete( Delete a specific rule from a security group. Args: + project_id: Project ID + + region_id: Region ID + + rule_id: Rule ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -509,6 +539,12 @@ async def replace( Update the configuration of an existing security group rule. Args: + project_id: Project ID + + region_id: Region ID + + rule_id: Rule ID + direction: Ingress or egress, which is the direction in which the security group rule is applied diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index ca0d7b65..27442cce 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -135,6 +135,12 @@ def update( Update the configuration of an existing security group. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + changed_rules: List of rules to create or delete name: Name @@ -278,6 +284,12 @@ def delete( Delete a specific security group and all its associated rules. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -319,6 +331,12 @@ def copy( Create a deep copy of an existing security group. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + name: Name. extra_headers: Send extra headers @@ -361,6 +379,12 @@ def get( Get detailed information about a specific security group. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -400,6 +424,12 @@ def revert_to_default( Revert a security group to its previous state. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -520,6 +550,12 @@ async def update( Update the configuration of an existing security group. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + changed_rules: List of rules to create or delete name: Name @@ -663,6 +699,12 @@ async def delete( Delete a specific security group and all its associated rules. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -704,6 +746,12 @@ async def copy( Create a deep copy of an existing security group. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + name: Name. extra_headers: Send extra headers @@ -746,6 +794,12 @@ async def get( Get detailed information about a specific security group. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -785,6 +839,12 @@ async def revert_to_default( Revert a security group to its previous state. Args: + project_id: Project ID + + region_id: Region ID + + group_id: Group ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 87ed7492..57125bdd 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -79,7 +79,6 @@ from .instance_list_params import InstanceListParams as InstanceListParams from .lb_listener_protocol import LbListenerProtocol as LbListenerProtocol from .load_balancer_status import LoadBalancerStatus as LoadBalancerStatus -from .placement_group_list import PlacementGroupList as PlacementGroupList from .tag_update_map_param import TagUpdateMapParam as TagUpdateMapParam from .volume_create_params import VolumeCreateParams as VolumeCreateParams from .volume_delete_params import VolumeDeleteParams as VolumeDeleteParams @@ -118,21 +117,18 @@ from .file_share_create_params import FileShareCreateParams as FileShareCreateParams from .file_share_resize_params import FileShareResizeParams as FileShareResizeParams from .file_share_update_params import FileShareUpdateParams as FileShareUpdateParams -from .k8s_cluster_version_list import K8SClusterVersionList as K8SClusterVersionList from .load_balancer_get_params import LoadBalancerGetParams as LoadBalancerGetParams from .load_balancer_statistics import LoadBalancerStatistics as LoadBalancerStatistics from .floating_ip_assign_params import FloatingIPAssignParams as FloatingIPAssignParams from .floating_ip_create_params import FloatingIPCreateParams as FloatingIPCreateParams from .floating_ip_update_params import FloatingIPUpdateParams as FloatingIPUpdateParams from .inference_region_capacity import InferenceRegionCapacity as InferenceRegionCapacity -from .load_balancer_flavor_list import LoadBalancerFlavorList as LoadBalancerFlavorList from .load_balancer_list_params import LoadBalancerListParams as LoadBalancerListParams -from .load_balancer_status_list import LoadBalancerStatusList as LoadBalancerStatusList from .quota_get_global_response import QuotaGetGlobalResponse as QuotaGetGlobalResponse from .volume_change_type_params import VolumeChangeTypeParams as VolumeChangeTypeParams from .instance_metrics_time_unit import InstanceMetricsTimeUnit as InstanceMetricsTimeUnit +from .k8s_list_versions_response import K8SListVersionsResponse as K8SListVersionsResponse from .load_balancer_l7_rule_list import LoadBalancerL7RuleList as LoadBalancerL7RuleList -from .load_balancer_metrics_list import LoadBalancerMetricsList as LoadBalancerMetricsList from .security_group_copy_params import SecurityGroupCopyParams as SecurityGroupCopyParams from .security_group_list_params import SecurityGroupListParams as SecurityGroupListParams from .ddos_profile_template_field import DDOSProfileTemplateField as DDOSProfileTemplateField @@ -154,6 +150,7 @@ from .load_balancer_failover_params import LoadBalancerFailoverParams as LoadBalancerFailoverParams from .load_balancer_listener_detail import LoadBalancerListenerDetail as LoadBalancerListenerDetail from .placement_group_create_params import PlacementGroupCreateParams as PlacementGroupCreateParams +from .placement_group_list_response import PlacementGroupListResponse as PlacementGroupListResponse from .reserved_fixed_ip_list_params import ReservedFixedIPListParams as ReservedFixedIPListParams from .volume_snapshot_create_params import VolumeSnapshotCreateParams as VolumeSnapshotCreateParams from .volume_snapshot_update_params import VolumeSnapshotUpdateParams as VolumeSnapshotUpdateParams diff --git a/src/gcore/types/cloud/cost_report_detailed.py b/src/gcore/types/cloud/cost_report_detailed.py index 5669ad22..348099af 100644 --- a/src/gcore/types/cloud/cost_report_detailed.py +++ b/src/gcore/types/cloud/cost_report_detailed.py @@ -365,6 +365,9 @@ class ResultResourceEgressTrafficWithCostSerializer(BaseModel): first_seen: datetime """First time the resource was seen in the given period""" + instance_name: Optional[str] = None + """Name of the instance""" + instance_type: Literal["baremetal", "vm"] """Type of the instance""" @@ -394,9 +397,6 @@ class ResultResourceEgressTrafficWithCostSerializer(BaseModel): vm_id: str """ID of the bare metal server the traffic is associated with""" - instance_name: Optional[str] = None - """Name of the instance""" - class ResultResourceExternalIPWithCostSerializer(BaseModel): attached_to_vm: Optional[str] = None @@ -1011,6 +1011,9 @@ class ResultResourceSnapshotWithCostSerializer(BaseModel): class ResultResourceVolumeWithCostSerializer(BaseModel): + attached_to_vm: Optional[str] = None + """ID of the VM the volume is attached to""" + billing_feature_name: Optional[str] = None billing_metric_name: str @@ -1066,9 +1069,6 @@ class ResultResourceVolumeWithCostSerializer(BaseModel): volume_type: str """Type of the volume""" - attached_to_vm: Optional[str] = None - """ID of the VM the volume is attached to""" - class ResultResourceDbaasPostgreSQLPoolerWithCostSerializer(BaseModel): billing_feature_name: Optional[str] = None diff --git a/src/gcore/types/cloud/inference/deployment_update_params.py b/src/gcore/types/cloud/inference/deployment_update_params.py index 85037b7b..ad86e3eb 100644 --- a/src/gcore/types/cloud/inference/deployment_update_params.py +++ b/src/gcore/types/cloud/inference/deployment_update_params.py @@ -230,10 +230,10 @@ class ContainerScale(TypedDict, total=False): class Container(TypedDict, total=False): - region_id: Required[Optional[int]] + region_id: Required[int] """Region id for the container""" - scale: Required[Optional[ContainerScale]] + scale: Required[ContainerScale] """Scale for the container""" diff --git a/src/gcore/types/cloud/instances/__init__.py b/src/gcore/types/cloud/instances/__init__.py index c2f77cfe..5fc63c97 100644 --- a/src/gcore/types/cloud/instances/__init__.py +++ b/src/gcore/types/cloud/instances/__init__.py @@ -4,14 +4,13 @@ from .metrics import Metrics as Metrics from .metrics_list import MetricsList as MetricsList -from .instance_flavor import InstanceFlavor as InstanceFlavor from .image_get_params import ImageGetParams as ImageGetParams from .image_list_params import ImageListParams as ImageListParams from .flavor_list_params import FlavorListParams as FlavorListParams from .metric_list_params import MetricListParams as MetricListParams from .image_update_params import ImageUpdateParams as ImageUpdateParams from .image_upload_params import ImageUploadParams as ImageUploadParams -from .instance_flavor_list import InstanceFlavorList as InstanceFlavorList +from .flavor_list_response import FlavorListResponse as FlavorListResponse from .interface_attach_params import InterfaceAttachParams as InterfaceAttachParams from .interface_detach_params import InterfaceDetachParams as InterfaceDetachParams from .image_create_from_volume_params import ImageCreateFromVolumeParams as ImageCreateFromVolumeParams diff --git a/src/gcore/types/cloud/instances/flavor_list_response.py b/src/gcore/types/cloud/instances/flavor_list_response.py new file mode 100644 index 00000000..7b51daf6 --- /dev/null +++ b/src/gcore/types/cloud/instances/flavor_list_response.py @@ -0,0 +1,94 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Union, Optional +from typing_extensions import Literal, TypeAlias + +from ...._models import BaseModel + +__all__ = [ + "FlavorListResponse", + "Result", + "ResultInstanceFlavorExtendedSerializerWithoutPrice", + "ResultInstanceFlavorExtendedSerializerWithPrice", +] + + +class ResultInstanceFlavorExtendedSerializerWithoutPrice(BaseModel): + """Instances flavor schema without price information""" + + architecture: str + """Flavor architecture type""" + + disabled: bool + """Disabled flavor flag""" + + flavor_id: str + """Flavor ID is the same as name""" + + flavor_name: str + """Flavor name""" + + hardware_description: Dict[str, str] + """Additional hardware description""" + + os_type: str + """Flavor operating system""" + + ram: int + """RAM size in MiB""" + + vcpus: int + """Virtual CPU count""" + + +class ResultInstanceFlavorExtendedSerializerWithPrice(BaseModel): + """Instances flavor schema with price information""" + + architecture: str + """Flavor architecture type""" + + currency_code: Optional[str] = None + """Currency code""" + + disabled: bool + """Disabled flavor flag""" + + flavor_id: str + """Flavor ID is the same as name""" + + flavor_name: str + """Flavor name""" + + hardware_description: Dict[str, str] + """Additional hardware description""" + + os_type: str + """Flavor operating system""" + + price_per_hour: Optional[float] = None + """Price per hour""" + + price_per_month: Optional[float] = None + """Price per month""" + + price_status: Optional[Literal["error", "hide", "show"]] = None + """Price status for the UI""" + + ram: int + """RAM size in MiB""" + + vcpus: int + """Virtual CPU count""" + + +Result: TypeAlias = Union[ + ResultInstanceFlavorExtendedSerializerWithoutPrice, ResultInstanceFlavorExtendedSerializerWithPrice +] + + +class FlavorListResponse(BaseModel): + count: int + """Number of objects""" + + results: List[Result] + """Objects""" diff --git a/src/gcore/types/cloud/instances/instance_flavor.py b/src/gcore/types/cloud/instances/instance_flavor.py deleted file mode 100644 index 07fbe85f..00000000 --- a/src/gcore/types/cloud/instances/instance_flavor.py +++ /dev/null @@ -1,51 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, Optional -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["InstanceFlavor"] - - -class InstanceFlavor(BaseModel): - """Instances flavor schema""" - - architecture: str - """Flavor architecture type""" - - disabled: bool - """Disabled flavor flag""" - - flavor_id: str - """Flavor ID is the same as name""" - - flavor_name: str - """Flavor name""" - - os_type: str - """Flavor operating system""" - - ram: int - """RAM size in MiB""" - - vcpus: int - """Virtual CPU count. For bare metal flavors, it's a physical CPU count""" - - capacity: Optional[int] = None - """Number of available instances of given configuration""" - - currency_code: Optional[str] = None - """Currency code. Shown if the `include_prices` query parameter if set to true""" - - hardware_description: Optional[Dict[str, str]] = None - """Additional hardware description""" - - price_per_hour: Optional[float] = None - """Price per hour. Shown if the `include_prices` query parameter if set to true""" - - price_per_month: Optional[float] = None - """Price per month. Shown if the `include_prices` query parameter if set to true""" - - price_status: Optional[Literal["error", "hide", "show"]] = None - """Price status for the UI""" diff --git a/src/gcore/types/cloud/k8s/__init__.py b/src/gcore/types/cloud/k8s/__init__.py index 0eed39f3..735764a4 100644 --- a/src/gcore/types/cloud/k8s/__init__.py +++ b/src/gcore/types/cloud/k8s/__init__.py @@ -3,11 +3,14 @@ from __future__ import annotations from .k8s_cluster import K8SCluster as K8SCluster -from .k8s_cluster_list import K8SClusterList as K8SClusterList from .flavor_list_params import FlavorListParams as FlavorListParams from .cluster_create_params import ClusterCreateParams as ClusterCreateParams from .cluster_delete_params import ClusterDeleteParams as ClusterDeleteParams +from .cluster_list_response import ClusterListResponse as ClusterListResponse from .cluster_update_params import ClusterUpdateParams as ClusterUpdateParams from .cluster_upgrade_params import ClusterUpgradeParams as ClusterUpgradeParams from .k8s_cluster_kubeconfig import K8SClusterKubeconfig as K8SClusterKubeconfig from .k8s_cluster_certificate import K8SClusterCertificate as K8SClusterCertificate +from .cluster_list_versions_for_upgrade_response import ( + ClusterListVersionsForUpgradeResponse as ClusterListVersionsForUpgradeResponse, +) diff --git a/src/gcore/types/cloud/k8s/k8s_cluster_list.py b/src/gcore/types/cloud/k8s/cluster_list_response.py similarity index 79% rename from src/gcore/types/cloud/k8s/k8s_cluster_list.py rename to src/gcore/types/cloud/k8s/cluster_list_response.py index bc252f6b..3e46fa0d 100644 --- a/src/gcore/types/cloud/k8s/k8s_cluster_list.py +++ b/src/gcore/types/cloud/k8s/cluster_list_response.py @@ -5,10 +5,10 @@ from ...._models import BaseModel from .k8s_cluster import K8SCluster -__all__ = ["K8SClusterList"] +__all__ = ["ClusterListResponse"] -class K8SClusterList(BaseModel): +class ClusterListResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/instances/instance_flavor_list.py b/src/gcore/types/cloud/k8s/cluster_list_versions_for_upgrade_response.py similarity index 51% rename from src/gcore/types/cloud/instances/instance_flavor_list.py rename to src/gcore/types/cloud/k8s/cluster_list_versions_for_upgrade_response.py index 5d1e52c2..7eae6ea0 100644 --- a/src/gcore/types/cloud/instances/instance_flavor_list.py +++ b/src/gcore/types/cloud/k8s/cluster_list_versions_for_upgrade_response.py @@ -3,14 +3,14 @@ from typing import List from ...._models import BaseModel -from .instance_flavor import InstanceFlavor +from ..k8s_cluster_version import K8SClusterVersion -__all__ = ["InstanceFlavorList"] +__all__ = ["ClusterListVersionsForUpgradeResponse"] -class InstanceFlavorList(BaseModel): +class ClusterListVersionsForUpgradeResponse(BaseModel): count: int """Number of objects""" - results: List[InstanceFlavor] + results: List[K8SClusterVersion] """Objects""" diff --git a/src/gcore/types/cloud/k8s/clusters/__init__.py b/src/gcore/types/cloud/k8s/clusters/__init__.py index c8c5c859..b96a1c38 100644 --- a/src/gcore/types/cloud/k8s/clusters/__init__.py +++ b/src/gcore/types/cloud/k8s/clusters/__init__.py @@ -5,8 +5,8 @@ from .k8s_cluster_pool import K8SClusterPool as K8SClusterPool from .node_list_params import NodeListParams as NodeListParams from .pool_create_params import PoolCreateParams as PoolCreateParams +from .pool_list_response import PoolListResponse as PoolListResponse 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_list.py b/src/gcore/types/cloud/k8s/clusters/pool_list_response.py similarity index 80% rename from src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py rename to src/gcore/types/cloud/k8s/clusters/pool_list_response.py index 23f3943a..25d4e977 100644 --- a/src/gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py +++ b/src/gcore/types/cloud/k8s/clusters/pool_list_response.py @@ -5,10 +5,10 @@ from ....._models import BaseModel from .k8s_cluster_pool import K8SClusterPool -__all__ = ["K8SClusterPoolList"] +__all__ = ["PoolListResponse"] -class K8SClusterPoolList(BaseModel): +class PoolListResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/k8s_cluster_version_list.py b/src/gcore/types/cloud/k8s_list_versions_response.py similarity index 78% rename from src/gcore/types/cloud/k8s_cluster_version_list.py rename to src/gcore/types/cloud/k8s_list_versions_response.py index 2f66ffb7..74ad65b1 100644 --- a/src/gcore/types/cloud/k8s_cluster_version_list.py +++ b/src/gcore/types/cloud/k8s_list_versions_response.py @@ -5,10 +5,10 @@ from ..._models import BaseModel from .k8s_cluster_version import K8SClusterVersion -__all__ = ["K8SClusterVersionList"] +__all__ = ["K8SListVersionsResponse"] -class K8SClusterVersionList(BaseModel): +class K8SListVersionsResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index 16e66ced..e52fd1c4 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -33,8 +33,10 @@ class LoadBalancerCreateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" flavor: str """Load balancer flavor name""" @@ -278,12 +280,6 @@ class ListenerPool(TypedDict, total=False): healthmonitor: Optional[ListenerPoolHealthmonitor] """Health monitor details""" - listener_id: Optional[str] - """Listener ID""" - - load_balancer_id: Optional[str] - """Loadbalancer ID""" - members: Iterable[ListenerPoolMember] """Pool members""" diff --git a/src/gcore/types/cloud/load_balancer_failover_params.py b/src/gcore/types/cloud/load_balancer_failover_params.py index b4a727a7..90da9688 100644 --- a/src/gcore/types/cloud/load_balancer_failover_params.py +++ b/src/gcore/types/cloud/load_balancer_failover_params.py @@ -9,8 +9,10 @@ class LoadBalancerFailoverParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" force: bool """Validate current load balancer status before failover or not.""" diff --git a/src/gcore/types/cloud/load_balancer_flavor_list.py b/src/gcore/types/cloud/load_balancer_flavor_list.py deleted file mode 100644 index 7b10dbd7..00000000 --- a/src/gcore/types/cloud/load_balancer_flavor_list.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel -from .load_balancer_flavor_detail import LoadBalancerFlavorDetail - -__all__ = ["LoadBalancerFlavorList"] - - -class LoadBalancerFlavorList(BaseModel): - count: int - """Number of objects""" - - results: List[LoadBalancerFlavorDetail] - """Objects""" diff --git a/src/gcore/types/cloud/load_balancer_get_params.py b/src/gcore/types/cloud/load_balancer_get_params.py index 233a6f3e..d1644e83 100644 --- a/src/gcore/types/cloud/load_balancer_get_params.py +++ b/src/gcore/types/cloud/load_balancer_get_params.py @@ -9,11 +9,13 @@ class LoadBalancerGetParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" show_stats: bool """Show statistics""" with_ddos: bool - """Show DDoS profile""" + """Show Advanced DDoS protection profile, if exists""" diff --git a/src/gcore/types/cloud/load_balancer_list_params.py b/src/gcore/types/cloud/load_balancer_list_params.py index 81ab5ea7..d6a71ba9 100644 --- a/src/gcore/types/cloud/load_balancer_list_params.py +++ b/src/gcore/types/cloud/load_balancer_list_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing_extensions import Literal, TypedDict from ..._types import SequenceNotStr @@ -11,40 +11,54 @@ class LoadBalancerListParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" assigned_floating: bool """With or without assigned floating IP""" limit: int - """Limit the number of returned limit request entities.""" + """Limit of items on a single page""" logging_enabled: bool - """With or without logging""" + """With or without logging enabled""" name: str """Filter by name""" offset: int - """Offset value is used to exclude the first set of records from the result.""" - - order_by: str - """ - Ordering Load Balancer list result by name, `created_at`, `updated_at`, - `operating_status`, `provisioning_status`, `vip_address`, `vip_ip_family` and - flavor fields of the load balancer and directions (name.asc), default is - "`created_at`.asc" - """ + """Offset in results list""" + + order_by: Literal[ + "created_at.asc", + "created_at.desc", + "flavor.asc", + "flavor.desc", + "name.asc", + "name.desc", + "operating_status.asc", + "operating_status.desc", + "provisioning_status.asc", + "provisioning_status.desc", + "updated_at.asc", + "updated_at.desc", + "vip_address.asc", + "vip_address.desc", + "vip_ip_family.asc", + "vip_ip_family.desc", + ] + """Order by field and direction.""" show_stats: bool """Show statistics""" tag_key: SequenceNotStr[str] - """Filter by tag keys.""" + """Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2""" tag_key_value: str - """Filter by tag key-value pairs. Must be a valid JSON string.""" + """Optional. Filter by tag key-value pairs.""" with_ddos: bool """Show Advanced DDoS protection profile, if exists""" diff --git a/src/gcore/types/cloud/load_balancer_resize_params.py b/src/gcore/types/cloud/load_balancer_resize_params.py index 05055dfe..80d1a0b5 100644 --- a/src/gcore/types/cloud/load_balancer_resize_params.py +++ b/src/gcore/types/cloud/load_balancer_resize_params.py @@ -9,8 +9,10 @@ class LoadBalancerResizeParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" flavor: Required[str] """Name of the desired flavor to resize to.""" diff --git a/src/gcore/types/cloud/load_balancer_update_params.py b/src/gcore/types/cloud/load_balancer_update_params.py index 94770401..0b6f23d8 100644 --- a/src/gcore/types/cloud/load_balancer_update_params.py +++ b/src/gcore/types/cloud/load_balancer_update_params.py @@ -14,8 +14,10 @@ class LoadBalancerUpdateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" logging: Logging """Logging configuration""" diff --git a/src/gcore/types/cloud/load_balancers/__init__.py b/src/gcore/types/cloud/load_balancers/__init__.py index cfacdce7..4674ceb5 100644 --- a/src/gcore/types/cloud/load_balancers/__init__.py +++ b/src/gcore/types/cloud/load_balancers/__init__.py @@ -8,7 +8,10 @@ from .pool_create_params import PoolCreateParams as PoolCreateParams from .pool_update_params import PoolUpdateParams as PoolUpdateParams from .listener_get_params import ListenerGetParams as ListenerGetParams +from .flavor_list_response import FlavorListResponse as FlavorListResponse from .listener_list_params import ListenerListParams as ListenerListParams +from .metric_list_response import MetricListResponse as MetricListResponse +from .status_list_response import StatusListResponse as StatusListResponse from .listener_create_params import ListenerCreateParams as ListenerCreateParams from .listener_delete_params import ListenerDeleteParams as ListenerDeleteParams from .listener_update_params import ListenerUpdateParams as ListenerUpdateParams diff --git a/src/gcore/types/cloud/load_balancers/flavor_list_params.py b/src/gcore/types/cloud/load_balancers/flavor_list_params.py index 4db3ee38..af622cd6 100644 --- a/src/gcore/types/cloud/load_balancers/flavor_list_params.py +++ b/src/gcore/types/cloud/load_balancers/flavor_list_params.py @@ -9,8 +9,10 @@ class FlavorListParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" include_prices: bool """Set to true if the response should include flavor prices""" diff --git a/src/gcore/types/cloud/load_balancers/flavor_list_response.py b/src/gcore/types/cloud/load_balancers/flavor_list_response.py new file mode 100644 index 00000000..202767ec --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/flavor_list_response.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union +from typing_extensions import TypeAlias + +from ...._models import BaseModel +from ..load_balancer_flavor_detail import LoadBalancerFlavorDetail + +__all__ = ["FlavorListResponse", "Result", "ResultLbFlavorSerializer"] + + +class ResultLbFlavorSerializer(BaseModel): + flavor_id: str + """Flavor ID is the same as name""" + + flavor_name: str + """Flavor name""" + + ram: int + """RAM size in MiB""" + + vcpus: int + """Virtual CPU count. For bare metal flavors, it's a physical CPU count""" + + +Result: TypeAlias = Union[ResultLbFlavorSerializer, LoadBalancerFlavorDetail] + + +class FlavorListResponse(BaseModel): + count: int + """Number of objects""" + + results: List[Result] + """Objects""" diff --git a/src/gcore/types/cloud/load_balancers/metric_list_params.py b/src/gcore/types/cloud/load_balancers/metric_list_params.py index 4af5e414..a88d2c11 100644 --- a/src/gcore/types/cloud/load_balancers/metric_list_params.py +++ b/src/gcore/types/cloud/load_balancers/metric_list_params.py @@ -11,8 +11,10 @@ class MetricListParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" time_interval: Required[int] """Time interval""" diff --git a/src/gcore/types/cloud/load_balancer_metrics_list.py b/src/gcore/types/cloud/load_balancers/metric_list_response.py similarity index 56% rename from src/gcore/types/cloud/load_balancer_metrics_list.py rename to src/gcore/types/cloud/load_balancers/metric_list_response.py index c270faf1..05b87752 100644 --- a/src/gcore/types/cloud/load_balancer_metrics_list.py +++ b/src/gcore/types/cloud/load_balancers/metric_list_response.py @@ -2,13 +2,13 @@ from typing import List -from ..._models import BaseModel -from .load_balancer_metrics import LoadBalancerMetrics +from ...._models import BaseModel +from ..load_balancer_metrics import LoadBalancerMetrics -__all__ = ["LoadBalancerMetricsList"] +__all__ = ["MetricListResponse"] -class LoadBalancerMetricsList(BaseModel): +class MetricListResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/load_balancer_status_list.py b/src/gcore/types/cloud/load_balancers/status_list_response.py similarity index 56% rename from src/gcore/types/cloud/load_balancer_status_list.py rename to src/gcore/types/cloud/load_balancers/status_list_response.py index 0432a12c..120dd86d 100644 --- a/src/gcore/types/cloud/load_balancer_status_list.py +++ b/src/gcore/types/cloud/load_balancers/status_list_response.py @@ -2,13 +2,13 @@ from typing import List -from ..._models import BaseModel -from .load_balancer_status import LoadBalancerStatus +from ...._models import BaseModel +from ..load_balancer_status import LoadBalancerStatus -__all__ = ["LoadBalancerStatusList"] +__all__ = ["StatusListResponse"] -class LoadBalancerStatusList(BaseModel): +class StatusListResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/networks/__init__.py b/src/gcore/types/cloud/networks/__init__.py index be19f7cf..84c111f1 100644 --- a/src/gcore/types/cloud/networks/__init__.py +++ b/src/gcore/types/cloud/networks/__init__.py @@ -3,7 +3,6 @@ from __future__ import annotations from .router import Router as Router -from .router_list import RouterList as RouterList from .router_list_params import RouterListParams as RouterListParams from .subnet_list_params import SubnetListParams as SubnetListParams from .router_create_params import RouterCreateParams as RouterCreateParams diff --git a/src/gcore/types/cloud/networks/router_list.py b/src/gcore/types/cloud/networks/router_list.py deleted file mode 100644 index 23a83fc8..00000000 --- a/src/gcore/types/cloud/networks/router_list.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .router import Router -from ...._models import BaseModel - -__all__ = ["RouterList"] - - -class RouterList(BaseModel): - count: int - """Number of objects""" - - results: List[Router] - """Objects""" diff --git a/src/gcore/types/cloud/networks/subnet_update_params.py b/src/gcore/types/cloud/networks/subnet_update_params.py index 0a79030b..267a9af7 100644 --- a/src/gcore/types/cloud/networks/subnet_update_params.py +++ b/src/gcore/types/cloud/networks/subnet_update_params.py @@ -21,7 +21,7 @@ class SubnetUpdateParams(TypedDict, total=False): dns_nameservers: Optional[SequenceNotStr[str]] """List IP addresses of DNS servers to advertise via DHCP.""" - enable_dhcp: Optional[bool] + enable_dhcp: bool """True if DHCP should be enabled""" gateway_ip: Optional[str] diff --git a/src/gcore/types/cloud/placement_group_list.py b/src/gcore/types/cloud/placement_group_list_response.py similarity index 77% rename from src/gcore/types/cloud/placement_group_list.py rename to src/gcore/types/cloud/placement_group_list_response.py index 92fbc1f9..708a9720 100644 --- a/src/gcore/types/cloud/placement_group_list.py +++ b/src/gcore/types/cloud/placement_group_list_response.py @@ -5,10 +5,10 @@ from ..._models import BaseModel from .placement_group import PlacementGroup -__all__ = ["PlacementGroupList"] +__all__ = ["PlacementGroupListResponse"] -class PlacementGroupList(BaseModel): +class PlacementGroupListResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/region.py b/src/gcore/types/cloud/region.py index ac2fa29b..e7bde6fe 100644 --- a/src/gcore/types/cloud/region.py +++ b/src/gcore/types/cloud/region.py @@ -30,8 +30,8 @@ class Region(BaseModel): coordinates: Optional[Coordinates] = None """Coordinates of the region""" - country: Optional[str] = None - """Country""" + country: str + """Two-letter country code, ISO 3166-1 alpha-2""" created_at: datetime """Region creation date and time""" diff --git a/src/gcore/types/cloud/registries/registry_user.py b/src/gcore/types/cloud/registries/registry_user.py index 81e7d4b8..23de4c01 100644 --- a/src/gcore/types/cloud/registries/registry_user.py +++ b/src/gcore/types/cloud/registries/registry_user.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional from datetime import datetime from ...._models import BaseModel @@ -24,5 +23,5 @@ class RegistryUser(BaseModel): name: str """User name""" - read_only: Optional[bool] = None + read_only: bool """Read-only user""" diff --git a/src/gcore/types/cloud/registries/registry_user_created.py b/src/gcore/types/cloud/registries/registry_user_created.py index 6cb1ae87..42564a72 100644 --- a/src/gcore/types/cloud/registries/registry_user_created.py +++ b/src/gcore/types/cloud/registries/registry_user_created.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional from datetime import datetime from ...._models import BaseModel @@ -24,8 +23,8 @@ class RegistryUserCreated(BaseModel): name: str """User name""" - read_only: Optional[bool] = None + read_only: bool """Read-only user""" - secret: Optional[str] = None + secret: str """User secret""" diff --git a/src/gcore/types/cloud/registries/user_refresh_secret_response.py b/src/gcore/types/cloud/registries/user_refresh_secret_response.py index 17fb1144..255c1e8a 100644 --- a/src/gcore/types/cloud/registries/user_refresh_secret_response.py +++ b/src/gcore/types/cloud/registries/user_refresh_secret_response.py @@ -1,6 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional from datetime import datetime from ...._models import BaseModel @@ -24,8 +23,8 @@ class UserRefreshSecretResponse(BaseModel): name: str """User name""" - read_only: Optional[bool] = None + read_only: bool """Read-only user""" - secret: Optional[str] = None + secret: str """User secret""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip/__init__.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/__init__.py index 0dd4eb7e..58c39149 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip/__init__.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/__init__.py @@ -4,7 +4,9 @@ from .candidate_port import CandidatePort as CandidatePort from .connected_port import ConnectedPort as ConnectedPort -from .candidate_port_list import CandidatePortList as CandidatePortList -from .connected_port_list import ConnectedPortList as ConnectedPortList from .connected_port_add_params import ConnectedPortAddParams as ConnectedPortAddParams +from .connected_port_add_response import ConnectedPortAddResponse as ConnectedPortAddResponse +from .candidate_port_list_response import CandidatePortListResponse as CandidatePortListResponse +from .connected_port_list_response import ConnectedPortListResponse as ConnectedPortListResponse from .connected_port_replace_params import ConnectedPortReplaceParams as ConnectedPortReplaceParams +from .connected_port_replace_response import ConnectedPortReplaceResponse as ConnectedPortReplaceResponse diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list_response.py similarity index 77% rename from src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list.py rename to src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list_response.py index 3c68db42..cffbde8a 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/candidate_port_list_response.py @@ -5,10 +5,10 @@ from ....._models import BaseModel from .candidate_port import CandidatePort -__all__ = ["CandidatePortList"] +__all__ = ["CandidatePortListResponse"] -class CandidatePortList(BaseModel): +class CandidatePortListResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_add_response.py similarity index 77% rename from src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list.py rename to src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_add_response.py index 6a0a2251..85c0ba11 100644 --- a/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list.py +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_add_response.py @@ -5,10 +5,10 @@ from ....._models import BaseModel from .connected_port import ConnectedPort -__all__ = ["ConnectedPortList"] +__all__ = ["ConnectedPortAddResponse"] -class ConnectedPortList(BaseModel): +class ConnectedPortAddResponse(BaseModel): count: int """Number of objects""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list_response.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list_response.py new file mode 100644 index 00000000..1bfa1883 --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_list_response.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ....._models import BaseModel +from .connected_port import ConnectedPort + +__all__ = ["ConnectedPortListResponse"] + + +class ConnectedPortListResponse(BaseModel): + count: int + """Number of objects""" + + results: List[ConnectedPort] + """Objects""" diff --git a/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_replace_response.py b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_replace_response.py new file mode 100644 index 00000000..ad469857 --- /dev/null +++ b/src/gcore/types/cloud/reserved_fixed_ips/vip/connected_port_replace_response.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ....._models import BaseModel +from .connected_port import ConnectedPort + +__all__ = ["ConnectedPortReplaceResponse"] + + +class ConnectedPortReplaceResponse(BaseModel): + count: int + """Number of objects""" + + results: List[ConnectedPort] + """Objects""" diff --git a/src/gcore/types/cloud/security_group_copy_params.py b/src/gcore/types/cloud/security_group_copy_params.py index 6a1666e9..c93aa980 100644 --- a/src/gcore/types/cloud/security_group_copy_params.py +++ b/src/gcore/types/cloud/security_group_copy_params.py @@ -9,8 +9,10 @@ class SecurityGroupCopyParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" name: Required[str] """Name.""" diff --git a/src/gcore/types/cloud/security_group_create_params.py b/src/gcore/types/cloud/security_group_create_params.py index 7ae07e15..b932ad13 100644 --- a/src/gcore/types/cloud/security_group_create_params.py +++ b/src/gcore/types/cloud/security_group_create_params.py @@ -25,14 +25,14 @@ class SecurityGroupCreateParams(TypedDict, total=False): class SecurityGroupSecurityGroupRule(TypedDict, total=False): - description: str - """Rule description""" - - direction: Literal["egress", "ingress"] + direction: Required[Literal["egress", "ingress"]] """ Ingress or egress, which is the direction in which the security group is applied """ + description: str + """Rule description""" + ethertype: Literal["IPv4", "IPv6"] """Ether type""" diff --git a/src/gcore/types/cloud/security_group_rule.py b/src/gcore/types/cloud/security_group_rule.py index 533537e8..aa717ba6 100644 --- a/src/gcore/types/cloud/security_group_rule.py +++ b/src/gcore/types/cloud/security_group_rule.py @@ -16,24 +16,15 @@ class SecurityGroupRule(BaseModel): created_at: datetime """Datetime when the rule was created""" + description: Optional[str] = None + """Rule description""" + direction: Literal["egress", "ingress"] """ Ingress or egress, which is the direction in which the security group rule is applied """ - revision_number: int - """The revision number of the resource""" - - security_group_id: str - """The security group ID to associate with this security group rule""" - - updated_at: datetime - """Datetime when the rule was last updated""" - - description: Optional[str] = None - """Rule description""" - ethertype: Optional[Literal["IPv4", "IPv6"]] = None """ Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress @@ -81,3 +72,12 @@ class SecurityGroupRule(BaseModel): remote_ip_prefix: Optional[str] = None """The remote IP prefix that is matched by this security group rule""" + + revision_number: int + """The revision number of the resource""" + + security_group_id: str + """The security group ID to associate with this security group rule""" + + updated_at: datetime + """Datetime when the rule was last updated""" diff --git a/src/gcore/types/cloud/security_group_update_params.py b/src/gcore/types/cloud/security_group_update_params.py index d085c208..1ac56005 100644 --- a/src/gcore/types/cloud/security_group_update_params.py +++ b/src/gcore/types/cloud/security_group_update_params.py @@ -12,8 +12,10 @@ class SecurityGroupUpdateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" changed_rules: Iterable[ChangedRule] """List of rules to create or delete""" diff --git a/src/gcore/types/cloud/security_groups/rule_create_params.py b/src/gcore/types/cloud/security_groups/rule_create_params.py index a8ff773d..46fdd411 100644 --- a/src/gcore/types/cloud/security_groups/rule_create_params.py +++ b/src/gcore/types/cloud/security_groups/rule_create_params.py @@ -3,24 +3,26 @@ from __future__ import annotations from typing import Optional -from typing_extensions import Literal, TypedDict +from typing_extensions import Literal, Required, TypedDict __all__ = ["RuleCreateParams"] class RuleCreateParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" - description: str - """Rule description""" - - direction: Literal["egress", "ingress"] + direction: Required[Literal["egress", "ingress"]] """ Ingress or egress, which is the direction in which the security group is applied """ + description: str + """Rule description""" + ethertype: Literal["IPv4", "IPv6"] """Ether type""" diff --git a/src/gcore/types/cloud/security_groups/rule_replace_params.py b/src/gcore/types/cloud/security_groups/rule_replace_params.py index be16eb3b..55d7a2ca 100644 --- a/src/gcore/types/cloud/security_groups/rule_replace_params.py +++ b/src/gcore/types/cloud/security_groups/rule_replace_params.py @@ -10,8 +10,10 @@ class RuleReplaceParams(TypedDict, total=False): project_id: int + """Project ID""" region_id: int + """Region ID""" direction: Required[Literal["egress", "ingress"]] """ diff --git a/src/gcore/types/cloud/usage_report.py b/src/gcore/types/cloud/usage_report.py index 6649aebf..659a5421 100644 --- a/src/gcore/types/cloud/usage_report.py +++ b/src/gcore/types/cloud/usage_report.py @@ -343,6 +343,9 @@ class ResourceResourceEgressTrafficSerializer(BaseModel): first_seen: datetime """First time the resource was seen in the given period""" + instance_name: Optional[str] = None + """Name of the instance""" + instance_type: Literal["baremetal", "vm"] """Type of the instance""" @@ -372,9 +375,6 @@ class ResourceResourceEgressTrafficSerializer(BaseModel): vm_id: str """ID of the bare metal server the traffic is associated with""" - instance_name: Optional[str] = None - """Name of the instance""" - class ResourceResourceExternalIPSerializer(BaseModel): """ @@ -917,6 +917,9 @@ class ResourceResourceVolumeSerializer(BaseModel): in all cost and usage reports results (but not in totals) """ + attached_to_vm: Optional[str] = None + """ID of the VM the volume is attached to""" + billing_metric_name: str """Name of the billing metric""" @@ -961,9 +964,6 @@ class ResourceResourceVolumeSerializer(BaseModel): volume_type: str """Type of the volume""" - attached_to_vm: Optional[str] = None - """ID of the VM the volume is attached to""" - class ResourceResourceDbaasPostgreSQLPoolerSerializer(BaseModel): billing_metric_name: str diff --git a/tests/api_resources/cloud/inference/test_deployments.py b/tests/api_resources/cloud/inference/test_deployments.py index 6b9b0802..a9e40264 100644 --- a/tests/api_resources/cloud/inference/test_deployments.py +++ b/tests/api_resources/cloud/inference/test_deployments.py @@ -230,7 +230,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: command=["nginx", "-g", "daemon off;"], containers=[ { - "region_id": 0, + "region_id": 1337, "scale": { "max": 3, "min": 1, @@ -839,7 +839,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> command=["nginx", "-g", "daemon off;"], containers=[ { - "region_id": 0, + "region_id": 1337, "scale": { "max": 3, "min": 1, diff --git a/tests/api_resources/cloud/instances/test_flavors.py b/tests/api_resources/cloud/instances/test_flavors.py index 51ff8119..1e0aecf5 100644 --- a/tests/api_resources/cloud/instances/test_flavors.py +++ b/tests/api_resources/cloud/instances/test_flavors.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.instances import InstanceFlavorList +from gcore.types.cloud.instances import FlavorListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -35,7 +35,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: exclude_windows=True, include_prices=True, ) - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -47,7 +47,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -59,7 +59,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,7 +75,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -87,7 +87,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No exclude_windows=True, include_prices=True, ) - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -99,7 +99,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -111,6 +111,6 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(InstanceFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/k8s/clusters/test_pools.py b/tests/api_resources/cloud/k8s/clusters/test_pools.py index bc2d028a..f97df4e7 100644 --- a/tests/api_resources/cloud/k8s/clusters/test_pools.py +++ b/tests/api_resources/cloud/k8s/clusters/test_pools.py @@ -12,7 +12,7 @@ from gcore.types.cloud import TaskIDList from gcore.types.cloud.k8s.clusters import ( K8SClusterPool, - K8SClusterPoolList, + PoolListResponse, K8SClusterPoolQuota, ) @@ -183,7 +183,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8SClusterPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -196,7 +196,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(K8SClusterPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -209,7 +209,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(K8SClusterPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -620,7 +620,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8SClusterPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -633,7 +633,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(K8SClusterPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -646,7 +646,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(K8SClusterPoolList, pool, path=["response"]) + assert_matches_type(PoolListResponse, pool, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/k8s/test_clusters.py b/tests/api_resources/cloud/k8s/test_clusters.py index d9296b23..4ab9f3a4 100644 --- a/tests/api_resources/cloud/k8s/test_clusters.py +++ b/tests/api_resources/cloud/k8s/test_clusters.py @@ -9,12 +9,13 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList, K8SClusterVersionList +from gcore.types.cloud import TaskIDList from gcore.types.cloud.k8s import ( K8SCluster, - K8SClusterList, + ClusterListResponse, K8SClusterKubeconfig, K8SClusterCertificate, + ClusterListVersionsForUpgradeResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -290,7 +291,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8SClusterList, cluster, path=["response"]) + assert_matches_type(ClusterListResponse, cluster, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -302,7 +303,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8SClusterList, cluster, path=["response"]) + assert_matches_type(ClusterListResponse, cluster, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -314,7 +315,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8SClusterList, cluster, path=["response"]) + assert_matches_type(ClusterListResponse, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -519,7 +520,7 @@ def test_method_list_versions_for_upgrade(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) + assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) @parametrize def test_raw_response_list_versions_for_upgrade(self, client: Gcore) -> None: @@ -532,7 +533,7 @@ def test_raw_response_list_versions_for_upgrade(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) + assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) @parametrize def test_streaming_response_list_versions_for_upgrade(self, client: Gcore) -> None: @@ -545,7 +546,7 @@ def test_streaming_response_list_versions_for_upgrade(self, client: Gcore) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = response.parse() - assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) + assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -881,7 +882,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8SClusterList, cluster, path=["response"]) + assert_matches_type(ClusterListResponse, cluster, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -893,7 +894,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8SClusterList, cluster, path=["response"]) + assert_matches_type(ClusterListResponse, cluster, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -905,7 +906,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8SClusterList, cluster, path=["response"]) + assert_matches_type(ClusterListResponse, cluster, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1110,7 +1111,7 @@ async def test_method_list_versions_for_upgrade(self, async_client: AsyncGcore) project_id=0, region_id=0, ) - assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) + assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) @parametrize async def test_raw_response_list_versions_for_upgrade(self, async_client: AsyncGcore) -> None: @@ -1123,7 +1124,7 @@ async def test_raw_response_list_versions_for_upgrade(self, async_client: AsyncG assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) + assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) @parametrize async def test_streaming_response_list_versions_for_upgrade(self, async_client: AsyncGcore) -> None: @@ -1136,7 +1137,7 @@ async def test_streaming_response_list_versions_for_upgrade(self, async_client: assert response.http_request.headers.get("X-Stainless-Lang") == "python" cluster = await response.parse() - assert_matches_type(K8SClusterVersionList, cluster, path=["response"]) + assert_matches_type(ClusterListVersionsForUpgradeResponse, cluster, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/load_balancers/test_flavors.py b/tests/api_resources/cloud/load_balancers/test_flavors.py index 51b2776e..25029744 100644 --- a/tests/api_resources/cloud/load_balancers/test_flavors.py +++ b/tests/api_resources/cloud/load_balancers/test_flavors.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import LoadBalancerFlavorList +from gcore.types.cloud.load_balancers import FlavorListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,43 +20,43 @@ class TestFlavors: @parametrize def test_method_list(self, client: Gcore) -> None: flavor = client.cloud.load_balancers.flavors.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) - assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: flavor = client.cloud.load_balancers.flavors.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, include_prices=True, ) - assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.load_balancers.flavors.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.load_balancers.flavors.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,42 +69,42 @@ class TestAsyncFlavors: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: flavor = await async_client.cloud.load_balancers.flavors.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) - assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: flavor = await async_client.cloud.load_balancers.flavors.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, include_prices=True, ) - assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.flavors.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.flavors.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(LoadBalancerFlavorList, flavor, path=["response"]) + assert_matches_type(FlavorListResponse, flavor, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/load_balancers/test_metrics.py b/tests/api_resources/cloud/load_balancers/test_metrics.py index 281f1d68..ec17405c 100644 --- a/tests/api_resources/cloud/load_balancers/test_metrics.py +++ b/tests/api_resources/cloud/load_balancers/test_metrics.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import LoadBalancerMetricsList +from gcore.types.cloud.load_balancers import MetricListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,20 +20,20 @@ class TestMetrics: @parametrize def test_method_list(self, client: Gcore) -> None: metric = client.cloud.load_balancers.metrics.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, time_interval=6, time_unit="day", ) - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + assert_matches_type(MetricListResponse, metric, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.load_balancers.metrics.with_raw_response.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, time_interval=6, time_unit="day", ) @@ -41,14 +41,14 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = response.parse() - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + assert_matches_type(MetricListResponse, metric, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.load_balancers.metrics.with_streaming_response.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, time_interval=6, time_unit="day", ) as response: @@ -56,7 +56,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = response.parse() - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + assert_matches_type(MetricListResponse, metric, path=["response"]) assert cast(Any, response.is_closed) is True @@ -65,8 +65,8 @@ def test_path_params_list(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): client.cloud.load_balancers.metrics.with_raw_response.list( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, time_interval=6, time_unit="day", ) @@ -80,20 +80,20 @@ class TestAsyncMetrics: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: metric = await async_client.cloud.load_balancers.metrics.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, time_interval=6, time_unit="day", ) - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + assert_matches_type(MetricListResponse, metric, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.metrics.with_raw_response.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, time_interval=6, time_unit="day", ) @@ -101,14 +101,14 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = await response.parse() - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + assert_matches_type(MetricListResponse, metric, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.metrics.with_streaming_response.list( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, time_interval=6, time_unit="day", ) as response: @@ -116,7 +116,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" metric = await response.parse() - assert_matches_type(LoadBalancerMetricsList, metric, path=["response"]) + assert_matches_type(MetricListResponse, metric, path=["response"]) assert cast(Any, response.is_closed) is True @@ -125,8 +125,8 @@ async def test_path_params_list(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): await async_client.cloud.load_balancers.metrics.with_raw_response.list( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, time_interval=6, time_unit="day", ) diff --git a/tests/api_resources/cloud/load_balancers/test_statuses.py b/tests/api_resources/cloud/load_balancers/test_statuses.py index da7e88cb..8e5d2536 100644 --- a/tests/api_resources/cloud/load_balancers/test_statuses.py +++ b/tests/api_resources/cloud/load_balancers/test_statuses.py @@ -9,7 +9,8 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import LoadBalancerStatus, LoadBalancerStatusList +from gcore.types.cloud import LoadBalancerStatus +from gcore.types.cloud.load_balancers import StatusListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,52 +21,52 @@ class TestStatuses: @parametrize def test_method_list(self, client: Gcore) -> None: status = client.cloud.load_balancers.statuses.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) - assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + assert_matches_type(StatusListResponse, status, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.load_balancers.statuses.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = response.parse() - assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + assert_matches_type(StatusListResponse, status, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.load_balancers.statuses.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = response.parse() - assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + assert_matches_type(StatusListResponse, status, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_get(self, client: Gcore) -> None: status = client.cloud.load_balancers.statuses.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(LoadBalancerStatus, status, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.load_balancers.statuses.with_raw_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -76,9 +77,9 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.load_balancers.statuses.with_streaming_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -93,8 +94,8 @@ def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): client.cloud.load_balancers.statuses.with_raw_response.get( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @@ -106,52 +107,52 @@ class TestAsyncStatuses: @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: status = await async_client.cloud.load_balancers.statuses.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) - assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + assert_matches_type(StatusListResponse, status, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.statuses.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = await response.parse() - assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + assert_matches_type(StatusListResponse, status, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.statuses.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" status = await response.parse() - assert_matches_type(LoadBalancerStatusList, status, path=["response"]) + assert_matches_type(StatusListResponse, status, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: status = await async_client.cloud.load_balancers.statuses.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(LoadBalancerStatus, status, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.statuses.with_raw_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -162,9 +163,9 @@ 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.load_balancers.statuses.with_streaming_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -179,6 +180,6 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): await async_client.cloud.load_balancers.statuses.with_raw_response.get( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) diff --git a/tests/api_resources/cloud/reserved_fixed_ips/vip/test_candidate_ports.py b/tests/api_resources/cloud/reserved_fixed_ips/vip/test_candidate_ports.py index cc679c0e..7b18df0d 100644 --- a/tests/api_resources/cloud/reserved_fixed_ips/vip/test_candidate_ports.py +++ b/tests/api_resources/cloud/reserved_fixed_ips/vip/test_candidate_ports.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.reserved_fixed_ips.vip import CandidatePortList +from gcore.types.cloud.reserved_fixed_ips.vip import CandidatePortListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -37,7 +37,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" candidate_port = response.parse() - assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -50,7 +50,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" candidate_port = response.parse() - assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -76,7 +76,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -89,7 +89,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" candidate_port = await response.parse() - assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -102,7 +102,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" candidate_port = await response.parse() - assert_matches_type(CandidatePortList, candidate_port, path=["response"]) + assert_matches_type(CandidatePortListResponse, candidate_port, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/reserved_fixed_ips/vip/test_connected_ports.py b/tests/api_resources/cloud/reserved_fixed_ips/vip/test_connected_ports.py index 7c47c319..8fb5bc82 100644 --- a/tests/api_resources/cloud/reserved_fixed_ips/vip/test_connected_ports.py +++ b/tests/api_resources/cloud/reserved_fixed_ips/vip/test_connected_ports.py @@ -10,7 +10,9 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.types.cloud.reserved_fixed_ips.vip import ( - ConnectedPortList, + ConnectedPortAddResponse, + ConnectedPortListResponse, + ConnectedPortReplaceResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +28,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -39,7 +41,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -52,7 +54,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -72,7 +74,7 @@ def test_method_add(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) @parametrize def test_method_add_with_all_params(self, client: Gcore) -> None: @@ -82,7 +84,7 @@ def test_method_add_with_all_params(self, client: Gcore) -> None: region_id=0, port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) @parametrize def test_raw_response_add(self, client: Gcore) -> None: @@ -95,7 +97,7 @@ def test_raw_response_add(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) @parametrize def test_streaming_response_add(self, client: Gcore) -> None: @@ -108,7 +110,7 @@ def test_streaming_response_add(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -128,7 +130,7 @@ def test_method_replace(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) @parametrize def test_method_replace_with_all_params(self, client: Gcore) -> None: @@ -138,7 +140,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: region_id=0, port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) @parametrize def test_raw_response_replace(self, client: Gcore) -> None: @@ -151,7 +153,7 @@ def test_raw_response_replace(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) @parametrize def test_streaming_response_replace(self, client: Gcore) -> None: @@ -164,7 +166,7 @@ def test_streaming_response_replace(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -190,7 +192,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -203,7 +205,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -216,7 +218,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortListResponse, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -236,7 +238,7 @@ async def test_method_add(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) @parametrize async def test_method_add_with_all_params(self, async_client: AsyncGcore) -> None: @@ -246,7 +248,7 @@ async def test_method_add_with_all_params(self, async_client: AsyncGcore) -> Non region_id=0, port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) @parametrize async def test_raw_response_add(self, async_client: AsyncGcore) -> None: @@ -259,7 +261,7 @@ async def test_raw_response_add(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) @parametrize async def test_streaming_response_add(self, async_client: AsyncGcore) -> None: @@ -272,7 +274,7 @@ async def test_streaming_response_add(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortAddResponse, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True @@ -292,7 +294,7 @@ async def test_method_replace(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) @parametrize async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: @@ -302,7 +304,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> region_id=0, port_ids=["351b0dd7-ca09-431c-be53-935db3785067", "bc688791-f1b0-44eb-97d4-07697294b1e1"], ) - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) @parametrize async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: @@ -315,7 +317,7 @@ async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) @parametrize async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: @@ -328,7 +330,7 @@ async def test_streaming_response_replace(self, async_client: AsyncGcore) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" connected_port = await response.parse() - assert_matches_type(ConnectedPortList, connected_port, path=["response"]) + assert_matches_type(ConnectedPortReplaceResponse, connected_port, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/security_groups/test_rules.py b/tests/api_resources/cloud/security_groups/test_rules.py index 6f84f09a..b3e9f95f 100644 --- a/tests/api_resources/cloud/security_groups/test_rules.py +++ b/tests/api_resources/cloud/security_groups/test_rules.py @@ -20,20 +20,21 @@ class TestRules: @parametrize def test_method_create(self, client: Gcore) -> None: rule = client.cloud.security_groups.rules.create( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", ) assert_matches_type(SecurityGroupRule, rule, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: rule = client.cloud.security_groups.rules.create( - group_id="group_id", - project_id=0, - region_id=0, - description="Some description", + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", + description="Some description", ethertype="IPv4", port_range_max=80, port_range_min=80, @@ -46,9 +47,10 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.security_groups.rules.with_raw_response.create( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", ) assert response.is_closed is True @@ -59,9 +61,10 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.security_groups.rules.with_streaming_response.create( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -76,25 +79,26 @@ def test_path_params_create(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): client.cloud.security_groups.rules.with_raw_response.create( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, + direction="ingress", ) @parametrize def test_method_delete(self, client: Gcore) -> None: rule = client.cloud.security_groups.rules.delete( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert rule is None @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.security_groups.rules.with_raw_response.delete( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -105,9 +109,9 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.security_groups.rules.with_streaming_response.delete( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -122,16 +126,16 @@ def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): client.cloud.security_groups.rules.with_raw_response.delete( rule_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize def test_method_replace(self, client: Gcore) -> None: rule = client.cloud.security_groups.rules.replace( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", ) @@ -140,9 +144,9 @@ def test_method_replace(self, client: Gcore) -> None: @parametrize def test_method_replace_with_all_params(self, client: Gcore) -> None: rule = client.cloud.security_groups.rules.replace( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", description="Some description", @@ -158,9 +162,9 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_replace(self, client: Gcore) -> None: response = client.cloud.security_groups.rules.with_raw_response.replace( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", ) @@ -173,9 +177,9 @@ def test_raw_response_replace(self, client: Gcore) -> None: @parametrize def test_streaming_response_replace(self, client: Gcore) -> None: with client.cloud.security_groups.rules.with_streaming_response.replace( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", ) as response: @@ -192,8 +196,8 @@ def test_path_params_replace(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): client.cloud.security_groups.rules.with_raw_response.replace( rule_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", ) @@ -207,20 +211,21 @@ class TestAsyncRules: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: rule = await async_client.cloud.security_groups.rules.create( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", ) assert_matches_type(SecurityGroupRule, rule, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: rule = await async_client.cloud.security_groups.rules.create( - group_id="group_id", - project_id=0, - region_id=0, - description="Some description", + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", + description="Some description", ethertype="IPv4", port_range_max=80, port_range_min=80, @@ -233,9 +238,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.security_groups.rules.with_raw_response.create( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", ) assert response.is_closed is True @@ -246,9 +252,10 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.cloud.security_groups.rules.with_streaming_response.create( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + direction="ingress", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -263,25 +270,26 @@ async def test_path_params_create(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): await async_client.cloud.security_groups.rules.with_raw_response.create( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, + direction="ingress", ) @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: rule = await async_client.cloud.security_groups.rules.delete( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert rule is None @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.security_groups.rules.with_raw_response.delete( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -292,9 +300,9 @@ 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.security_groups.rules.with_streaming_response.delete( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -309,16 +317,16 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): await async_client.cloud.security_groups.rules.with_raw_response.delete( rule_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize async def test_method_replace(self, async_client: AsyncGcore) -> None: rule = await async_client.cloud.security_groups.rules.replace( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", ) @@ -327,9 +335,9 @@ async def test_method_replace(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: rule = await async_client.cloud.security_groups.rules.replace( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", description="Some description", @@ -345,9 +353,9 @@ 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.cloud.security_groups.rules.with_raw_response.replace( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", ) @@ -360,9 +368,9 @@ 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.cloud.security_groups.rules.with_streaming_response.replace( - rule_id="rule_id", - project_id=0, - region_id=0, + rule_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", ) as response: @@ -379,8 +387,8 @@ async def test_path_params_replace(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): await async_client.cloud.security_groups.rules.with_raw_response.replace( rule_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, direction="ingress", security_group_id="00000000-0000-4000-8000-000000000000", ) diff --git a/tests/api_resources/cloud/test_k8s.py b/tests/api_resources/cloud/test_k8s.py index 98602a71..7500f600 100644 --- a/tests/api_resources/cloud/test_k8s.py +++ b/tests/api_resources/cloud/test_k8s.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import K8SClusterVersionList +from gcore.types.cloud import K8SListVersionsResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_list_versions(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) + assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) @parametrize def test_raw_response_list_versions(self, client: Gcore) -> None: @@ -35,7 +35,7 @@ def test_raw_response_list_versions(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" k8s = response.parse() - assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) + assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) @parametrize def test_streaming_response_list_versions(self, client: Gcore) -> None: @@ -47,7 +47,7 @@ def test_streaming_response_list_versions(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" k8s = response.parse() - assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) + assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) assert cast(Any, response.is_closed) is True @@ -63,7 +63,7 @@ async def test_method_list_versions(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) + assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) @parametrize async def test_raw_response_list_versions(self, async_client: AsyncGcore) -> None: @@ -75,7 +75,7 @@ async def test_raw_response_list_versions(self, async_client: AsyncGcore) -> Non assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" k8s = await response.parse() - assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) + assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) @parametrize async def test_streaming_response_list_versions(self, async_client: AsyncGcore) -> None: @@ -87,6 +87,6 @@ async def test_streaming_response_list_versions(self, async_client: AsyncGcore) assert response.http_request.headers.get("X-Stainless-Lang") == "python" k8s = await response.parse() - assert_matches_type(K8SClusterVersionList, k8s, path=["response"]) + assert_matches_type(K8SListVersionsResponse, k8s, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index faf824ef..abd1f5ce 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -24,16 +24,16 @@ class TestLoadBalancers: @parametrize def test_method_create(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, flavor="lb1-1-2", floating_ip={ "existing_floating_id": "c64e5db1-5f1f-43ec-a8d9-5090df85b82d", @@ -64,8 +64,6 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "max_retries_down": 3, "url_path": "/", }, - "listener_id": "listener_id", - "load_balancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", "members": [ { "address": "192.168.1.101", @@ -135,8 +133,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_create(self, client: Gcore) -> None: response = client.cloud.load_balancers.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -147,8 +145,8 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: with client.cloud.load_balancers.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -161,18 +159,18 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(LoadBalancer, load_balancer, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, logging={ "destination_region_id": 1, "enabled": True, @@ -188,9 +186,9 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_update(self, client: Gcore) -> None: response = client.cloud.load_balancers.with_raw_response.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -201,9 +199,9 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: with client.cloud.load_balancers.with_streaming_response.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -218,31 +216,31 @@ def test_path_params_update(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): client.cloud.load_balancers.with_raw_response.update( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize def test_method_list(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert_matches_type(SyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, assigned_floating=True, - limit=0, + limit=1000, logging_enabled=True, - name="name", + name="lb_name", offset=0, - order_by="order_by", + order_by="name.asc", show_stats=True, - tag_key=["string"], + tag_key=["key1", "key2"], tag_key_value="tag_key_value", with_ddos=True, ) @@ -251,8 +249,8 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.cloud.load_balancers.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -263,8 +261,8 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.cloud.load_balancers.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -277,18 +275,18 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.load_balancers.with_raw_response.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -299,9 +297,9 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.load_balancers.with_streaming_response.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -316,25 +314,25 @@ def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): client.cloud.load_balancers.with_raw_response.delete( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize def test_method_failover(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @parametrize def test_method_failover_with_all_params(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, force=True, ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @@ -342,9 +340,9 @@ def test_method_failover_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_failover(self, client: Gcore) -> None: response = client.cloud.load_balancers.with_raw_response.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -355,9 +353,9 @@ def test_raw_response_failover(self, client: Gcore) -> None: @parametrize def test_streaming_response_failover(self, client: Gcore) -> None: with client.cloud.load_balancers.with_streaming_response.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -372,25 +370,25 @@ def test_path_params_failover(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): client.cloud.load_balancers.with_raw_response.failover( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize def test_method_get(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(LoadBalancer, load_balancer, path=["response"]) @parametrize def test_method_get_with_all_params(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, show_stats=True, with_ddos=True, ) @@ -399,9 +397,9 @@ def test_method_get_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.load_balancers.with_raw_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -412,9 +410,9 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.load_balancers.with_streaming_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -429,16 +427,16 @@ def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): client.cloud.load_balancers.with_raw_response.get( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize def test_method_resize(self, client: Gcore) -> None: load_balancer = client.cloud.load_balancers.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, flavor="lb1-2-4", ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @@ -446,9 +444,9 @@ def test_method_resize(self, client: Gcore) -> None: @parametrize def test_raw_response_resize(self, client: Gcore) -> None: response = client.cloud.load_balancers.with_raw_response.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, flavor="lb1-2-4", ) @@ -460,9 +458,9 @@ def test_raw_response_resize(self, client: Gcore) -> None: @parametrize def test_streaming_response_resize(self, client: Gcore) -> None: with client.cloud.load_balancers.with_streaming_response.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, flavor="lb1-2-4", ) as response: assert not response.is_closed @@ -478,8 +476,8 @@ def test_path_params_resize(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): client.cloud.load_balancers.with_raw_response.resize( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, flavor="lb1-2-4", ) @@ -492,16 +490,16 @@ class TestAsyncLoadBalancers: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, flavor="lb1-1-2", floating_ip={ "existing_floating_id": "c64e5db1-5f1f-43ec-a8d9-5090df85b82d", @@ -532,8 +530,6 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "max_retries_down": 3, "url_path": "/", }, - "listener_id": "listener_id", - "load_balancer_id": "bbb35f84-35cc-4b2f-84c2-a6a29bba68aa", "members": [ { "address": "192.168.1.101", @@ -603,8 +599,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.with_raw_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -615,8 +611,8 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.with_streaming_response.create( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -629,18 +625,18 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(LoadBalancer, load_balancer, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, logging={ "destination_region_id": 1, "enabled": True, @@ -656,9 +652,9 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.with_raw_response.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -669,9 +665,9 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.with_streaming_response.update( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -686,31 +682,31 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): await async_client.cloud.load_balancers.with_raw_response.update( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert_matches_type(AsyncOffsetPage[LoadBalancer], load_balancer, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, assigned_floating=True, - limit=0, + limit=1000, logging_enabled=True, - name="name", + name="lb_name", offset=0, - order_by="order_by", + order_by="name.asc", show_stats=True, - tag_key=["string"], + tag_key=["key1", "key2"], tag_key_value="tag_key_value", with_ddos=True, ) @@ -719,8 +715,8 @@ 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.load_balancers.with_raw_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -731,8 +727,8 @@ 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.load_balancers.with_streaming_response.list( - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -745,18 +741,18 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.with_raw_response.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -767,9 +763,9 @@ 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.load_balancers.with_streaming_response.delete( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -784,25 +780,25 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): await async_client.cloud.load_balancers.with_raw_response.delete( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize async def test_method_failover(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @parametrize async def test_method_failover_with_all_params(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, force=True, ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @@ -810,9 +806,9 @@ async def test_method_failover_with_all_params(self, async_client: AsyncGcore) - @parametrize async def test_raw_response_failover(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.with_raw_response.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -823,9 +819,9 @@ async def test_raw_response_failover(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_failover(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.with_streaming_response.failover( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -840,25 +836,25 @@ async def test_path_params_failover(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): await async_client.cloud.load_balancers.with_raw_response.failover( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert_matches_type(LoadBalancer, load_balancer, path=["response"]) @parametrize async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, show_stats=True, with_ddos=True, ) @@ -867,9 +863,9 @@ async def test_method_get_with_all_params(self, async_client: AsyncGcore) -> Non @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.with_raw_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) assert response.is_closed is True @@ -880,9 +876,9 @@ 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.load_balancers.with_streaming_response.get( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -897,16 +893,16 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): await async_client.cloud.load_balancers.with_raw_response.get( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, ) @parametrize async def test_method_resize(self, async_client: AsyncGcore) -> None: load_balancer = await async_client.cloud.load_balancers.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, flavor="lb1-2-4", ) assert_matches_type(TaskIDList, load_balancer, path=["response"]) @@ -914,9 +910,9 @@ async def test_method_resize(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.load_balancers.with_raw_response.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, flavor="lb1-2-4", ) @@ -928,9 +924,9 @@ async def test_raw_response_resize(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_resize(self, async_client: AsyncGcore) -> None: async with async_client.cloud.load_balancers.with_streaming_response.resize( - load_balancer_id="load_balancer_id", - project_id=0, - region_id=0, + load_balancer_id="ac307687-31a4-4a11-a949-6bea1b2878f5", + project_id=1, + region_id=7, flavor="lb1-2-4", ) as response: assert not response.is_closed @@ -946,7 +942,7 @@ async def test_path_params_resize(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `load_balancer_id` but received ''"): await async_client.cloud.load_balancers.with_raw_response.resize( load_balancer_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=7, flavor="lb1-2-4", ) diff --git a/tests/api_resources/cloud/test_placement_groups.py b/tests/api_resources/cloud/test_placement_groups.py index 84783508..7c8276c3 100644 --- a/tests/api_resources/cloud/test_placement_groups.py +++ b/tests/api_resources/cloud/test_placement_groups.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud import TaskIDList, PlacementGroup, PlacementGroupList +from gcore.types.cloud import TaskIDList, PlacementGroup, PlacementGroupListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -63,7 +63,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -75,7 +75,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" placement_group = response.parse() - assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -87,7 +87,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" placement_group = response.parse() - assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -235,7 +235,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -247,7 +247,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" placement_group = await response.parse() - assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -259,7 +259,7 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" placement_group = await response.parse() - assert_matches_type(PlacementGroupList, placement_group, path=["response"]) + assert_matches_type(PlacementGroupListResponse, placement_group, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/test_security_groups.py b/tests/api_resources/cloud/test_security_groups.py index 41883f9e..6e6796b6 100644 --- a/tests/api_resources/cloud/test_security_groups.py +++ b/tests/api_resources/cloud/test_security_groups.py @@ -39,8 +39,8 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "description": "Some description", "security_group_rules": [ { - "description": "Some description", "direction": "ingress", + "description": "Some description", "ethertype": "IPv4", "port_range_max": 80, "port_range_min": 80, @@ -86,18 +86,18 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: security_group = client.cloud.security_groups.update( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: security_group = client.cloud.security_groups.update( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, changed_rules=[ { "action": "delete", @@ -120,9 +120,9 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_update(self, client: Gcore) -> None: response = client.cloud.security_groups.with_raw_response.update( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -133,9 +133,9 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: with client.cloud.security_groups.with_streaming_response.update( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -150,8 +150,8 @@ def test_path_params_update(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): client.cloud.security_groups.with_raw_response.update( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize @@ -203,18 +203,18 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: security_group = client.cloud.security_groups.delete( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert security_group is None @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.security_groups.with_raw_response.delete( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -225,9 +225,9 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.security_groups.with_streaming_response.delete( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -242,16 +242,16 @@ def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): client.cloud.security_groups.with_raw_response.delete( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize def test_method_copy(self, client: Gcore) -> None: security_group = client.cloud.security_groups.copy( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, name="some_name", ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @@ -259,9 +259,9 @@ def test_method_copy(self, client: Gcore) -> None: @parametrize def test_raw_response_copy(self, client: Gcore) -> None: response = client.cloud.security_groups.with_raw_response.copy( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, name="some_name", ) @@ -273,9 +273,9 @@ def test_raw_response_copy(self, client: Gcore) -> None: @parametrize def test_streaming_response_copy(self, client: Gcore) -> None: with client.cloud.security_groups.with_streaming_response.copy( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, name="some_name", ) as response: assert not response.is_closed @@ -291,26 +291,26 @@ def test_path_params_copy(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): client.cloud.security_groups.with_raw_response.copy( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="some_name", ) @parametrize def test_method_get(self, client: Gcore) -> None: security_group = client.cloud.security_groups.get( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.security_groups.with_raw_response.get( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -321,9 +321,9 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.security_groups.with_streaming_response.get( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -338,25 +338,25 @@ def test_path_params_get(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): client.cloud.security_groups.with_raw_response.get( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize def test_method_revert_to_default(self, client: Gcore) -> None: security_group = client.cloud.security_groups.revert_to_default( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize def test_raw_response_revert_to_default(self, client: Gcore) -> None: response = client.cloud.security_groups.with_raw_response.revert_to_default( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -367,9 +367,9 @@ def test_raw_response_revert_to_default(self, client: Gcore) -> None: @parametrize def test_streaming_response_revert_to_default(self, client: Gcore) -> None: with client.cloud.security_groups.with_streaming_response.revert_to_default( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -384,8 +384,8 @@ def test_path_params_revert_to_default(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): client.cloud.security_groups.with_raw_response.revert_to_default( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @@ -413,8 +413,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "description": "Some description", "security_group_rules": [ { - "description": "Some description", "direction": "ingress", + "description": "Some description", "ethertype": "IPv4", "port_range_max": 80, "port_range_min": 80, @@ -460,18 +460,18 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: security_group = await async_client.cloud.security_groups.update( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: security_group = await async_client.cloud.security_groups.update( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, changed_rules=[ { "action": "delete", @@ -494,9 +494,9 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.security_groups.with_raw_response.update( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -507,9 +507,9 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.cloud.security_groups.with_streaming_response.update( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -524,8 +524,8 @@ async def test_path_params_update(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): await async_client.cloud.security_groups.with_raw_response.update( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize @@ -577,18 +577,18 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: security_group = await async_client.cloud.security_groups.delete( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert security_group is None @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.security_groups.with_raw_response.delete( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -599,9 +599,9 @@ 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.security_groups.with_streaming_response.delete( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -616,16 +616,16 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): await async_client.cloud.security_groups.with_raw_response.delete( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize async def test_method_copy(self, async_client: AsyncGcore) -> None: security_group = await async_client.cloud.security_groups.copy( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, name="some_name", ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @@ -633,9 +633,9 @@ async def test_method_copy(self, async_client: AsyncGcore) -> None: @parametrize async def test_raw_response_copy(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.security_groups.with_raw_response.copy( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, name="some_name", ) @@ -647,9 +647,9 @@ async def test_raw_response_copy(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_copy(self, async_client: AsyncGcore) -> None: async with async_client.cloud.security_groups.with_streaming_response.copy( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, name="some_name", ) as response: assert not response.is_closed @@ -665,26 +665,26 @@ async def test_path_params_copy(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): await async_client.cloud.security_groups.with_raw_response.copy( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, name="some_name", ) @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: security_group = await async_client.cloud.security_groups.get( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.security_groups.with_raw_response.get( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -695,9 +695,9 @@ 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.security_groups.with_streaming_response.get( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -712,25 +712,25 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): await async_client.cloud.security_groups.with_raw_response.get( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) @parametrize async def test_method_revert_to_default(self, async_client: AsyncGcore) -> None: security_group = await async_client.cloud.security_groups.revert_to_default( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize async def test_raw_response_revert_to_default(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.security_groups.with_raw_response.revert_to_default( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) assert response.is_closed is True @@ -741,9 +741,9 @@ async def test_raw_response_revert_to_default(self, async_client: AsyncGcore) -> @parametrize async def test_streaming_response_revert_to_default(self, async_client: AsyncGcore) -> None: async with async_client.cloud.security_groups.with_streaming_response.revert_to_default( - group_id="group_id", - project_id=0, - region_id=0, + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -758,6 +758,6 @@ async def test_path_params_revert_to_default(self, async_client: AsyncGcore) -> with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): await async_client.cloud.security_groups.with_raw_response.revert_to_default( group_id="", - project_id=0, - region_id=0, + project_id=1, + region_id=1, ) From b3485b6cc3b213cc36c81f02a142cd7210a7db16 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 Jan 2026 10:14:03 +0000 Subject: [PATCH 09/13] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index d5976c8d..cf71f233 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-432dafc5e24ab4a5594e628f3ac9a35e906e1de7dd20eeecd27afaf143dec88f.yml openapi_spec_hash: 57bd58f035387ac1efdcbefa5abab427 -config_hash: cba67c225c37fe0e91ed7586f53169e4 +config_hash: 72dafc786d92b98aa097fd4ec34680ca From e4f64fd76cb32caa28782a171a4cf1cb4c47674d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 10:12:48 +0000 Subject: [PATCH 10/13] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/iam/users.py | 54 +++++------------------ src/gcore/types/iam/user_update_params.py | 45 ++++--------------- tests/api_resources/iam/test_users.py | 48 +++++++++----------- 4 files changed, 41 insertions(+), 110 deletions(-) diff --git a/.stats.yml b/.stats.yml index cf71f233..fb848d1e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-432dafc5e24ab4a5594e628f3ac9a35e906e1de7dd20eeecd27afaf143dec88f.yml -openapi_spec_hash: 57bd58f035387ac1efdcbefa5abab427 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ade61b5f8b94d9aaf24c2770f59a72e498afde0922d4967f51a5265d7848332a.yml +openapi_spec_hash: fd4ff75b24c8f9ddf0de165a37253859 config_hash: 72dafc786d92b98aa097fd4ec34680ca diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index 3cf6bbef..46d9a50c 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import List, Optional from typing_extensions import Literal import httpx @@ -52,13 +52,11 @@ def update( self, user_id: int, *, - auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] | Omit = omit, - company: str | Omit = omit, - email: str | Omit = omit, - groups: Iterable[user_update_params.Group] | Omit = omit, - lang: Literal["de", "en", "ru", "zh", "az"] | Omit = omit, - name: Optional[str] | Omit = omit, - phone: Optional[str] | Omit = omit, + auth_types: List[Literal["password", "sso", "github", "google-oauth2"]], + email: str, + lang: Literal["de", "en", "ru", "zh", "az"], + name: Optional[str], + phone: Optional[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, @@ -73,20 +71,8 @@ def update( List of auth types available for the account. - company: User's company. - email: User's email address. - groups: User's group in the current account. - - IAM supports 5 groups: - - - Users - - Administrators - - Engineers - - Purge and Prefetch only (API) - - Purge and Prefetch only (API+Web) - lang: User's language. Defines language of the control panel and email messages. @@ -108,9 +94,7 @@ def update( body=maybe_transform( { "auth_types": auth_types, - "company": company, "email": email, - "groups": groups, "lang": lang, "name": name, "phone": phone, @@ -325,13 +309,11 @@ async def update( self, user_id: int, *, - auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] | Omit = omit, - company: str | Omit = omit, - email: str | Omit = omit, - groups: Iterable[user_update_params.Group] | Omit = omit, - lang: Literal["de", "en", "ru", "zh", "az"] | Omit = omit, - name: Optional[str] | Omit = omit, - phone: Optional[str] | Omit = omit, + auth_types: List[Literal["password", "sso", "github", "google-oauth2"]], + email: str, + lang: Literal["de", "en", "ru", "zh", "az"], + name: Optional[str], + phone: Optional[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, @@ -346,20 +328,8 @@ async def update( List of auth types available for the account. - company: User's company. - email: User's email address. - groups: User's group in the current account. - - IAM supports 5 groups: - - - Users - - Administrators - - Engineers - - Purge and Prefetch only (API) - - Purge and Prefetch only (API+Web) - lang: User's language. Defines language of the control panel and email messages. @@ -381,9 +351,7 @@ async def update( body=await async_maybe_transform( { "auth_types": auth_types, - "company": company, "email": email, - "groups": groups, "lang": lang, "name": name, "phone": phone, diff --git a/src/gcore/types/iam/user_update_params.py b/src/gcore/types/iam/user_update_params.py index 80d93a28..2874ef20 100644 --- a/src/gcore/types/iam/user_update_params.py +++ b/src/gcore/types/iam/user_update_params.py @@ -2,56 +2,27 @@ from __future__ import annotations -from typing import List, Iterable, Optional -from typing_extensions import Literal, TypedDict +from typing import List, Optional +from typing_extensions import Literal, Required, TypedDict -__all__ = ["UserUpdateParams", "Group"] +__all__ = ["UserUpdateParams"] class UserUpdateParams(TypedDict, total=False): - auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] + auth_types: Required[List[Literal["password", "sso", "github", "google-oauth2"]]] """System field. List of auth types available for the account.""" - company: str - """User's company.""" - - email: str + email: Required[str] """User's email address.""" - groups: Iterable[Group] - """User's group in the current account. - - IAM supports 5 groups: - - - Users - - Administrators - - Engineers - - Purge and Prefetch only (API) - - Purge and Prefetch only (API+Web) - """ - - lang: Literal["de", "en", "ru", "zh", "az"] + lang: Required[Literal["de", "en", "ru", "zh", "az"]] """User's language. Defines language of the control panel and email messages. """ - name: Optional[str] + name: Required[Optional[str]] """User's name.""" - phone: Optional[str] + phone: Required[Optional[str]] """User's phone.""" - - -class Group(TypedDict, total=False): - id: int - """Group's ID: Possible values are: - - - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only - (API+Web)* 3022 - Purge and Prefetch only (API) - """ - - name: Literal[ - "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)", "Purge and Prefetch only (API+Web)" - ] - """Group's name.""" diff --git a/tests/api_resources/iam/test_users.py b/tests/api_resources/iam/test_users.py index 6c3635a9..72116b06 100644 --- a/tests/api_resources/iam/test_users.py +++ b/tests/api_resources/iam/test_users.py @@ -25,24 +25,10 @@ class TestUsers: @parametrize def test_method_update(self, client: Gcore) -> None: - user = client.iam.users.update( - user_id=0, - ) - assert_matches_type(UserUpdated, user, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Gcore) -> None: user = client.iam.users.update( user_id=0, auth_types=["password"], - company="company", email="dev@stainless.com", - groups=[ - { - "id": 1, - "name": "Administrators", - } - ], lang="de", name="name", phone="phone", @@ -53,6 +39,11 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: def test_raw_response_update(self, client: Gcore) -> None: response = client.iam.users.with_raw_response.update( user_id=0, + auth_types=["password"], + email="dev@stainless.com", + lang="de", + name="name", + phone="phone", ) assert response.is_closed is True @@ -64,6 +55,11 @@ def test_raw_response_update(self, client: Gcore) -> None: def test_streaming_response_update(self, client: Gcore) -> None: with client.iam.users.with_streaming_response.update( user_id=0, + auth_types=["password"], + email="dev@stainless.com", + lang="de", + name="name", + phone="phone", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -230,24 +226,10 @@ class TestAsyncUsers: @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - user = await async_client.iam.users.update( - user_id=0, - ) - assert_matches_type(UserUpdated, user, path=["response"]) - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: user = await async_client.iam.users.update( user_id=0, auth_types=["password"], - company="company", email="dev@stainless.com", - groups=[ - { - "id": 1, - "name": "Administrators", - } - ], lang="de", name="name", phone="phone", @@ -258,6 +240,11 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.iam.users.with_raw_response.update( user_id=0, + auth_types=["password"], + email="dev@stainless.com", + lang="de", + name="name", + phone="phone", ) assert response.is_closed is True @@ -269,6 +256,11 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.iam.users.with_streaming_response.update( user_id=0, + auth_types=["password"], + email="dev@stainless.com", + lang="de", + name="name", + phone="phone", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From 667f129c821808b2f2a250a90d4fb6adb36195e9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 12:17:15 +0000 Subject: [PATCH 11/13] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/cloud/audit_logs.py | 2 - .../cloud/security_groups/security_groups.py | 71 +++- src/gcore/resources/cloud/tasks.py | 20 +- src/gcore/types/cloud/audit_log_entry.py | 1 - .../types/cloud/audit_log_list_params.py | 1 - .../gpu_baremetal/gpu_baremetal_cluster.py | 4 +- .../cloud/gpu_virtual/gpu_virtual_cluster.py | 4 +- .../types/cloud/security_group_list_params.py | 3 + src/gcore/types/cloud/task.py | 3 + src/gcore/types/cloud/task_list_params.py | 10 +- .../cloud/test_security_groups.py | 378 ++++++++++-------- 12 files changed, 284 insertions(+), 217 deletions(-) diff --git a/.stats.yml b/.stats.yml index fb848d1e..4d118940 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ade61b5f8b94d9aaf24c2770f59a72e498afde0922d4967f51a5265d7848332a.yml -openapi_spec_hash: fd4ff75b24c8f9ddf0de165a37253859 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8d156dce8786b969c408f2d7fecc7b180388f3b0c16800b62a4af4f954cd343b.yml +openapi_spec_hash: 0f521c0d26f4dbcce241b9ed80c3c7bb config_hash: 72dafc786d92b98aa097fd4ec34680ca diff --git a/src/gcore/resources/cloud/audit_logs.py b/src/gcore/resources/cloud/audit_logs.py index f92e7daa..f47fa720 100644 --- a/src/gcore/resources/cloud/audit_logs.py +++ b/src/gcore/resources/cloud/audit_logs.py @@ -92,7 +92,6 @@ def list( api_group: List[ Literal[ "ai_cluster", - "backup_service", "caas_container", "caas_key", "caas_pull_secret", @@ -311,7 +310,6 @@ def list( api_group: List[ Literal[ "ai_cluster", - "backup_service", "caas_container", "caas_key", "caas_pull_secret", diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 27442cce..a287b6bf 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Iterable, Optional import httpx @@ -62,6 +63,7 @@ def with_streaming_response(self) -> SecurityGroupsResourceWithStreamingResponse """ return SecurityGroupsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") def create( self, *, @@ -77,7 +79,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ - Create a new security group with the specified configuration. + **Deprecated** Use `/v2/security_groups//` instead. Args: project_id: Project ID @@ -115,6 +117,7 @@ def create( cast_to=SecurityGroup, ) + @typing_extensions.deprecated("deprecated") def update( self, group_id: str, @@ -132,7 +135,8 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ - Update the configuration of an existing security group. + **Deprecated** Use `/v2/security_groups///` + instead. Args: project_id: Project ID @@ -208,6 +212,7 @@ def list( project_id: int | None = None, region_id: int | None = None, limit: int | Omit = omit, + name: str | Omit = omit, offset: int | Omit = omit, tag_key: SequenceNotStr[str] | Omit = omit, tag_key_value: str | Omit = omit, @@ -228,6 +233,8 @@ def list( limit: Limit of items on a single page + name: Optional. Filter by name. Must be specified a full name of the security group. + offset: Offset in results list tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 @@ -257,6 +264,7 @@ def list( query=maybe_transform( { "limit": limit, + "name": name, "offset": offset, "tag_key": tag_key, "tag_key_value": tag_key_value, @@ -477,6 +485,7 @@ def with_streaming_response(self) -> AsyncSecurityGroupsResourceWithStreamingRes """ return AsyncSecurityGroupsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("deprecated") async def create( self, *, @@ -492,7 +501,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ - Create a new security group with the specified configuration. + **Deprecated** Use `/v2/security_groups//` instead. Args: project_id: Project ID @@ -530,6 +539,7 @@ async def create( cast_to=SecurityGroup, ) + @typing_extensions.deprecated("deprecated") async def update( self, group_id: str, @@ -547,7 +557,8 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ - Update the configuration of an existing security group. + **Deprecated** Use `/v2/security_groups///` + instead. Args: project_id: Project ID @@ -623,6 +634,7 @@ def list( project_id: int | None = None, region_id: int | None = None, limit: int | Omit = omit, + name: str | Omit = omit, offset: int | Omit = omit, tag_key: SequenceNotStr[str] | Omit = omit, tag_key_value: str | Omit = omit, @@ -643,6 +655,8 @@ def list( limit: Limit of items on a single page + name: Optional. Filter by name. Must be specified a full name of the security group. + offset: Offset in results list tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 @@ -672,6 +686,7 @@ def list( query=maybe_transform( { "limit": limit, + "name": name, "offset": offset, "tag_key": tag_key, "tag_key_value": tag_key_value, @@ -872,11 +887,15 @@ class SecurityGroupsResourceWithRawResponse: def __init__(self, security_groups: SecurityGroupsResource) -> None: self._security_groups = security_groups - self.create = to_raw_response_wrapper( - security_groups.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + security_groups.create, # pyright: ignore[reportDeprecated], + ) ) - self.update = to_raw_response_wrapper( - security_groups.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + security_groups.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_raw_response_wrapper( security_groups.list, @@ -903,11 +922,15 @@ class AsyncSecurityGroupsResourceWithRawResponse: def __init__(self, security_groups: AsyncSecurityGroupsResource) -> None: self._security_groups = security_groups - self.create = async_to_raw_response_wrapper( - security_groups.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + security_groups.create, # pyright: ignore[reportDeprecated], + ) ) - self.update = async_to_raw_response_wrapper( - security_groups.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + security_groups.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_raw_response_wrapper( security_groups.list, @@ -934,11 +957,15 @@ class SecurityGroupsResourceWithStreamingResponse: def __init__(self, security_groups: SecurityGroupsResource) -> None: self._security_groups = security_groups - self.create = to_streamed_response_wrapper( - security_groups.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + security_groups.create, # pyright: ignore[reportDeprecated], + ) ) - self.update = to_streamed_response_wrapper( - security_groups.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + security_groups.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_streamed_response_wrapper( security_groups.list, @@ -965,11 +992,15 @@ class AsyncSecurityGroupsResourceWithStreamingResponse: def __init__(self, security_groups: AsyncSecurityGroupsResource) -> None: self._security_groups = security_groups - self.create = async_to_streamed_response_wrapper( - security_groups.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + security_groups.create, # pyright: ignore[reportDeprecated], + ) ) - self.update = async_to_streamed_response_wrapper( - security_groups.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + security_groups.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_streamed_response_wrapper( security_groups.list, diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index c8449a3a..e4ee0c51 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -152,9 +152,9 @@ def list( '`create_l7rule`', '`create_lblistener`', '`create_lbmember`', '`create_lbpool`', '`create_lbpool_health_monitor`', '`create_loadbalancer`', '`create_network`', '`create_reserved_fixed_ip`', '`create_router`', - '`create_secret`', '`create_servergroup`', '`create_sfs`', '`create_snapshot`', - '`create_subnet`', '`create_vm`', '`create_volume`', - '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', + '`create_secret`', '`create_security_group`', '`create_servergroup`', + '`create_sfs`', '`create_snapshot`', '`create_subnet`', '`create_vm`', + '`create_volume`', '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', '`delete_caas_container`', '`delete_dbaas_postgres_cluster`', '`delete_ddos_profile`', '`delete_faas_function`', '`delete_faas_namespace`', '`delete_fip`', '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', @@ -184,8 +184,8 @@ def list( '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', '`update_inference_application`', '`update_inference_instance`', '`update_k8s_cluster_v2`', '`update_l7policy`', '`update_lbmetadata`', - '`update_port_allowed_address_pairs`', '`update_sfs`', - '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', + '`update_port_allowed_address_pairs`', '`update_security_group`', + '`update_sfs`', '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`'] to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or @@ -470,9 +470,9 @@ def list( '`create_l7rule`', '`create_lblistener`', '`create_lbmember`', '`create_lbpool`', '`create_lbpool_health_monitor`', '`create_loadbalancer`', '`create_network`', '`create_reserved_fixed_ip`', '`create_router`', - '`create_secret`', '`create_servergroup`', '`create_sfs`', '`create_snapshot`', - '`create_subnet`', '`create_vm`', '`create_volume`', - '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', + '`create_secret`', '`create_security_group`', '`create_servergroup`', + '`create_sfs`', '`create_snapshot`', '`create_subnet`', '`create_vm`', + '`create_volume`', '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', '`delete_caas_container`', '`delete_dbaas_postgres_cluster`', '`delete_ddos_profile`', '`delete_faas_function`', '`delete_faas_namespace`', '`delete_fip`', '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', @@ -502,8 +502,8 @@ def list( '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', '`update_inference_application`', '`update_inference_instance`', '`update_k8s_cluster_v2`', '`update_l7policy`', '`update_lbmetadata`', - '`update_port_allowed_address_pairs`', '`update_sfs`', - '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', + '`update_port_allowed_address_pairs`', '`update_security_group`', + '`update_sfs`', '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`'] to_timestamp: ISO formatted datetime string. Filter the tasks by creation date less than or diff --git a/src/gcore/types/cloud/audit_log_entry.py b/src/gcore/types/cloud/audit_log_entry.py index f73e831e..80a077ae 100644 --- a/src/gcore/types/cloud/audit_log_entry.py +++ b/src/gcore/types/cloud/audit_log_entry.py @@ -161,7 +161,6 @@ class AuditLogEntry(BaseModel): api_group: Literal[ "ai_cluster", - "backup_service", "caas_container", "caas_key", "caas_pull_secret", diff --git a/src/gcore/types/cloud/audit_log_list_params.py b/src/gcore/types/cloud/audit_log_list_params.py index cec69e6a..87bcacce 100644 --- a/src/gcore/types/cloud/audit_log_list_params.py +++ b/src/gcore/types/cloud/audit_log_list_params.py @@ -57,7 +57,6 @@ class AuditLogListParams(TypedDict, total=False): api_group: List[ Literal[ "ai_cluster", - "backup_service", "caas_container", "caas_key", "caas_pull_secret", diff --git a/src/gcore/types/cloud/gpu_baremetal/gpu_baremetal_cluster.py b/src/gcore/types/cloud/gpu_baremetal/gpu_baremetal_cluster.py index 17cfcf4e..5eb7f5da 100644 --- a/src/gcore/types/cloud/gpu_baremetal/gpu_baremetal_cluster.py +++ b/src/gcore/types/cloud/gpu_baremetal/gpu_baremetal_cluster.py @@ -148,7 +148,9 @@ class GPUBaremetalCluster(BaseModel): servers_settings: ServersSettings - status: Literal["active", "deleting", "error", "new", "resizing"] + status: Literal[ + "active", "creating", "degraded", "deleting", "error", "new", "rebooting", "rebuilding", "resizing", "shutoff" + ] """Cluster status""" tags: List[Tag] diff --git a/src/gcore/types/cloud/gpu_virtual/gpu_virtual_cluster.py b/src/gcore/types/cloud/gpu_virtual/gpu_virtual_cluster.py index 9b71eb5e..3561daea 100644 --- a/src/gcore/types/cloud/gpu_virtual/gpu_virtual_cluster.py +++ b/src/gcore/types/cloud/gpu_virtual/gpu_virtual_cluster.py @@ -176,7 +176,9 @@ class GPUVirtualCluster(BaseModel): servers_settings: ServersSettings - status: Literal["active", "deleting", "error", "new", "resizing"] + status: Literal[ + "active", "creating", "degraded", "deleting", "error", "new", "rebooting", "rebuilding", "resizing", "shutoff" + ] """Cluster status""" tags: List[Tag] diff --git a/src/gcore/types/cloud/security_group_list_params.py b/src/gcore/types/cloud/security_group_list_params.py index 22b3bd2c..0f13ddad 100644 --- a/src/gcore/types/cloud/security_group_list_params.py +++ b/src/gcore/types/cloud/security_group_list_params.py @@ -19,6 +19,9 @@ class SecurityGroupListParams(TypedDict, total=False): limit: int """Limit of items on a single page""" + name: str + """Optional. Filter by name. Must be specified a full name of the security group.""" + offset: int """Offset in results list""" diff --git a/src/gcore/types/cloud/task.py b/src/gcore/types/cloud/task.py index aaa2f782..7eae7f01 100644 --- a/src/gcore/types/cloud/task.py +++ b/src/gcore/types/cloud/task.py @@ -98,6 +98,9 @@ class CreatedResources(BaseModel): secrets: Optional[List[str]] = None """IDs of created secrets""" + security_groups: Optional[List[str]] = None + """IDs of created security groups""" + servergroups: Optional[List[str]] = None """IDs of created server groups""" diff --git a/src/gcore/types/cloud/task_list_params.py b/src/gcore/types/cloud/task_list_params.py index 0fc29cca..1af00005 100644 --- a/src/gcore/types/cloud/task_list_params.py +++ b/src/gcore/types/cloud/task_list_params.py @@ -71,9 +71,9 @@ class TaskListParams(TypedDict, total=False): '`create_l7rule`', '`create_lblistener`', '`create_lbmember`', '`create_lbpool`', '`create_lbpool_health_monitor`', '`create_loadbalancer`', '`create_network`', '`create_reserved_fixed_ip`', '`create_router`', - '`create_secret`', '`create_servergroup`', '`create_sfs`', '`create_snapshot`', - '`create_subnet`', '`create_vm`', '`create_volume`', - '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', + '`create_secret`', '`create_security_group`', '`create_servergroup`', + '`create_sfs`', '`create_snapshot`', '`create_subnet`', '`create_vm`', + '`create_volume`', '`deactivate_ddos_profile`', '`delete_ai_cluster_gpu`', '`delete_caas_container`', '`delete_dbaas_postgres_cluster`', '`delete_ddos_profile`', '`delete_faas_function`', '`delete_faas_namespace`', '`delete_fip`', '`delete_gpu_virtual_cluster`', '`delete_gpu_virtual_server`', @@ -103,8 +103,8 @@ class TaskListParams(TypedDict, total=False): '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', '`update_inference_application`', '`update_inference_instance`', '`update_k8s_cluster_v2`', '`update_l7policy`', '`update_lbmetadata`', - '`update_port_allowed_address_pairs`', '`update_sfs`', - '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', + '`update_port_allowed_address_pairs`', '`update_security_group`', + '`update_sfs`', '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`'] """ diff --git a/tests/api_resources/cloud/test_security_groups.py b/tests/api_resources/cloud/test_security_groups.py index 6e6796b6..0b842fd6 100644 --- a/tests/api_resources/cloud/test_security_groups.py +++ b/tests/api_resources/cloud/test_security_groups.py @@ -14,6 +14,8 @@ SecurityGroup, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,46 +24,51 @@ class TestSecurityGroups: @parametrize def test_method_create(self, client: Gcore) -> None: - security_group = client.cloud.security_groups.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) + with pytest.warns(DeprecationWarning): + security_group = client.cloud.security_groups.create( + project_id=1, + region_id=1, + security_group={"name": "my_security_group"}, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: - security_group = client.cloud.security_groups.create( - project_id=1, - region_id=1, - security_group={ - "name": "my_security_group", - "description": "Some description", - "security_group_rules": [ - { - "direction": "ingress", - "description": "Some description", - "ethertype": "IPv4", - "port_range_max": 80, - "port_range_min": 80, - "protocol": "tcp", - "remote_group_id": "00000000-0000-4000-8000-000000000000", - "remote_ip_prefix": "10.0.0.0/8", - } - ], - "tags": {"my-tag": "my-tag-value"}, - }, - instances=["00000000-0000-4000-8000-000000000000"], - ) + with pytest.warns(DeprecationWarning): + security_group = client.cloud.security_groups.create( + project_id=1, + region_id=1, + security_group={ + "name": "my_security_group", + "description": "Some description", + "security_group_rules": [ + { + "direction": "ingress", + "description": "Some description", + "ethertype": "IPv4", + "port_range_max": 80, + "port_range_min": 80, + "protocol": "tcp", + "remote_group_id": "00000000-0000-4000-8000-000000000000", + "remote_ip_prefix": "10.0.0.0/8", + } + ], + "tags": {"my-tag": "my-tag-value"}, + }, + instances=["00000000-0000-4000-8000-000000000000"], + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: - response = client.cloud.security_groups.with_raw_response.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.security_groups.with_raw_response.create( + project_id=1, + region_id=1, + security_group={"name": "my_security_group"}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -70,60 +77,66 @@ def test_raw_response_create(self, client: Gcore) -> None: @parametrize def test_streaming_response_create(self, client: Gcore) -> None: - with client.cloud.security_groups.with_streaming_response.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.security_groups.with_streaming_response.create( + project_id=1, + region_id=1, + security_group={"name": "my_security_group"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_group = response.parse() - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_update(self, client: Gcore) -> None: - security_group = client.cloud.security_groups.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + security_group = client.cloud.security_groups.update( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: - security_group = client.cloud.security_groups.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - changed_rules=[ - { - "action": "delete", - "description": "Some description", - "direction": "egress", - "ethertype": "IPv4", - "port_range_max": 80, - "port_range_min": 80, - "protocol": "tcp", - "remote_group_id": "00000000-0000-4000-8000-000000000000", - "remote_ip_prefix": "10.0.0.0/8", - "security_group_rule_id": "00000000-0000-4000-8000-000000000000", - } - ], - name="some_name", - tags={"foo": "my-tag-value"}, - ) + with pytest.warns(DeprecationWarning): + security_group = client.cloud.security_groups.update( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + changed_rules=[ + { + "action": "delete", + "description": "Some description", + "direction": "egress", + "ethertype": "IPv4", + "port_range_max": 80, + "port_range_min": 80, + "protocol": "tcp", + "remote_group_id": "00000000-0000-4000-8000-000000000000", + "remote_ip_prefix": "10.0.0.0/8", + "security_group_rule_id": "00000000-0000-4000-8000-000000000000", + } + ], + name="some_name", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: - response = client.cloud.security_groups.with_raw_response.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.security_groups.with_raw_response.update( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -132,27 +145,29 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with client.cloud.security_groups.with_streaming_response.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.security_groups.with_streaming_response.update( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_group = response.parse() - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = response.parse() + assert_matches_type(SecurityGroup, security_group, 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 `group_id` but received ''"): - client.cloud.security_groups.with_raw_response.update( - group_id="", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + client.cloud.security_groups.with_raw_response.update( + group_id="", + project_id=1, + region_id=1, + ) @parametrize def test_method_list(self, client: Gcore) -> None: @@ -168,6 +183,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: project_id=1, region_id=1, limit=10, + name="my_security_group", offset=0, tag_key=["key1", "key2"], tag_key_value="tag_key_value", @@ -396,46 +412,51 @@ class TestAsyncSecurityGroups: @parametrize async def test_method_create(self, async_client: AsyncGcore) -> None: - security_group = await async_client.cloud.security_groups.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) + with pytest.warns(DeprecationWarning): + security_group = await async_client.cloud.security_groups.create( + project_id=1, + region_id=1, + security_group={"name": "my_security_group"}, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: - security_group = await async_client.cloud.security_groups.create( - project_id=1, - region_id=1, - security_group={ - "name": "my_security_group", - "description": "Some description", - "security_group_rules": [ - { - "direction": "ingress", - "description": "Some description", - "ethertype": "IPv4", - "port_range_max": 80, - "port_range_min": 80, - "protocol": "tcp", - "remote_group_id": "00000000-0000-4000-8000-000000000000", - "remote_ip_prefix": "10.0.0.0/8", - } - ], - "tags": {"my-tag": "my-tag-value"}, - }, - instances=["00000000-0000-4000-8000-000000000000"], - ) + with pytest.warns(DeprecationWarning): + security_group = await async_client.cloud.security_groups.create( + project_id=1, + region_id=1, + security_group={ + "name": "my_security_group", + "description": "Some description", + "security_group_rules": [ + { + "direction": "ingress", + "description": "Some description", + "ethertype": "IPv4", + "port_range_max": 80, + "port_range_min": 80, + "protocol": "tcp", + "remote_group_id": "00000000-0000-4000-8000-000000000000", + "remote_ip_prefix": "10.0.0.0/8", + } + ], + "tags": {"my-tag": "my-tag-value"}, + }, + instances=["00000000-0000-4000-8000-000000000000"], + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.security_groups.with_raw_response.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.security_groups.with_raw_response.create( + project_id=1, + region_id=1, + security_group={"name": "my_security_group"}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -444,60 +465,66 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.security_groups.with_streaming_response.create( - project_id=1, - region_id=1, - security_group={"name": "my_security_group"}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.cloud.security_groups.with_streaming_response.create( + project_id=1, + region_id=1, + security_group={"name": "my_security_group"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_group = await response.parse() - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = await response.parse() + assert_matches_type(SecurityGroup, security_group, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - security_group = await async_client.cloud.security_groups.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + security_group = await async_client.cloud.security_groups.update( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - security_group = await async_client.cloud.security_groups.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - changed_rules=[ - { - "action": "delete", - "description": "Some description", - "direction": "egress", - "ethertype": "IPv4", - "port_range_max": 80, - "port_range_min": 80, - "protocol": "tcp", - "remote_group_id": "00000000-0000-4000-8000-000000000000", - "remote_ip_prefix": "10.0.0.0/8", - "security_group_rule_id": "00000000-0000-4000-8000-000000000000", - } - ], - name="some_name", - tags={"foo": "my-tag-value"}, - ) + with pytest.warns(DeprecationWarning): + security_group = await async_client.cloud.security_groups.update( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + changed_rules=[ + { + "action": "delete", + "description": "Some description", + "direction": "egress", + "ethertype": "IPv4", + "port_range_max": 80, + "port_range_min": 80, + "protocol": "tcp", + "remote_group_id": "00000000-0000-4000-8000-000000000000", + "remote_ip_prefix": "10.0.0.0/8", + "security_group_rule_id": "00000000-0000-4000-8000-000000000000", + } + ], + name="some_name", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(SecurityGroup, security_group, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.security_groups.with_raw_response.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.security_groups.with_raw_response.update( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -506,27 +533,29 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.security_groups.with_streaming_response.update( - group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", - project_id=1, - region_id=1, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.cloud.security_groups.with_streaming_response.update( + group_id="024a29e9-b4b7-4c91-9a46-505be123d9f8", + project_id=1, + region_id=1, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - security_group = await response.parse() - assert_matches_type(SecurityGroup, security_group, path=["response"]) + security_group = await response.parse() + assert_matches_type(SecurityGroup, security_group, 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 `group_id` but received ''"): - await async_client.cloud.security_groups.with_raw_response.update( - group_id="", - project_id=1, - region_id=1, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): + await async_client.cloud.security_groups.with_raw_response.update( + group_id="", + project_id=1, + region_id=1, + ) @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: @@ -542,6 +571,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No project_id=1, region_id=1, limit=10, + name="my_security_group", offset=0, tag_key=["key1", "key2"], tag_key_value="tag_key_value", From 3374f91b05a70fbc617ef2e070b8fec96e0b08b8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 15:57:54 +0000 Subject: [PATCH 12/13] fix(cloud)!: rename instance flavor model --- .stats.yml | 2 +- api.md | 4 +-- .../resources/cloud/instances/flavors.py | 10 ++++---- src/gcore/types/cloud/instances/__init__.py | 3 ++- ...esponse.py => instance_flavor_detailed.py} | 25 ++++++------------- .../cloud/instances/instance_flavor_list.py | 16 ++++++++++++ .../cloud/instances/test_flavors.py | 18 ++++++------- 7 files changed, 43 insertions(+), 35 deletions(-) rename src/gcore/types/cloud/instances/{flavor_list_response.py => instance_flavor_detailed.py} (71%) create mode 100644 src/gcore/types/cloud/instances/instance_flavor_list.py diff --git a/.stats.yml b/.stats.yml index 4d118940..a13e8168 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 645 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8d156dce8786b969c408f2d7fecc7b180388f3b0c16800b62a4af4f954cd343b.yml openapi_spec_hash: 0f521c0d26f4dbcce241b9ed80c3c7bb -config_hash: 72dafc786d92b98aa097fd4ec34680ca +config_hash: e81f299feec21ef63a02ee2de1ba99a3 diff --git a/api.md b/api.md index 644fa847..83c5cc04 100644 --- a/api.md +++ b/api.md @@ -977,12 +977,12 @@ Methods: Types: ```python -from gcore.types.cloud.instances import InstanceFlavor, InstanceFlavorList, FlavorListResponse +from gcore.types.cloud.instances import InstanceFlavorDetailed, InstanceFlavorList ``` Methods: -- client.cloud.instances.flavors.list(\*, project_id, region_id, \*\*params) -> FlavorListResponse +- client.cloud.instances.flavors.list(\*, project_id, region_id, \*\*params) -> InstanceFlavorList ### Interfaces diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 69f5eace..23ba0073 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -16,7 +16,7 @@ ) from ...._base_client import make_request_options from ....types.cloud.instances import flavor_list_params -from ....types.cloud.instances.flavor_list_response import FlavorListResponse +from ....types.cloud.instances.instance_flavor_list import InstanceFlavorList __all__ = ["FlavorsResource", "AsyncFlavorsResource"] @@ -56,7 +56,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FlavorListResponse: + ) -> InstanceFlavorList: """Retrieve a list of available instance flavors in the project and region. When @@ -101,7 +101,7 @@ def list( flavor_list_params.FlavorListParams, ), ), - cast_to=FlavorListResponse, + cast_to=InstanceFlavorList, ) @@ -140,7 +140,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FlavorListResponse: + ) -> InstanceFlavorList: """Retrieve a list of available instance flavors in the project and region. When @@ -185,7 +185,7 @@ async def list( flavor_list_params.FlavorListParams, ), ), - cast_to=FlavorListResponse, + cast_to=InstanceFlavorList, ) diff --git a/src/gcore/types/cloud/instances/__init__.py b/src/gcore/types/cloud/instances/__init__.py index 5fc63c97..fb06e51e 100644 --- a/src/gcore/types/cloud/instances/__init__.py +++ b/src/gcore/types/cloud/instances/__init__.py @@ -10,7 +10,8 @@ from .metric_list_params import MetricListParams as MetricListParams from .image_update_params import ImageUpdateParams as ImageUpdateParams from .image_upload_params import ImageUploadParams as ImageUploadParams -from .flavor_list_response import FlavorListResponse as FlavorListResponse +from .instance_flavor_list import InstanceFlavorList as InstanceFlavorList from .interface_attach_params import InterfaceAttachParams as InterfaceAttachParams from .interface_detach_params import InterfaceDetachParams as InterfaceDetachParams +from .instance_flavor_detailed import InstanceFlavorDetailed as InstanceFlavorDetailed from .image_create_from_volume_params import ImageCreateFromVolumeParams as ImageCreateFromVolumeParams diff --git a/src/gcore/types/cloud/instances/flavor_list_response.py b/src/gcore/types/cloud/instances/instance_flavor_detailed.py similarity index 71% rename from src/gcore/types/cloud/instances/flavor_list_response.py rename to src/gcore/types/cloud/instances/instance_flavor_detailed.py index 7b51daf6..b1605b03 100644 --- a/src/gcore/types/cloud/instances/flavor_list_response.py +++ b/src/gcore/types/cloud/instances/instance_flavor_detailed.py @@ -1,19 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import Dict, Union, Optional from typing_extensions import Literal, TypeAlias from ...._models import BaseModel __all__ = [ - "FlavorListResponse", - "Result", - "ResultInstanceFlavorExtendedSerializerWithoutPrice", - "ResultInstanceFlavorExtendedSerializerWithPrice", + "InstanceFlavorDetailed", + "InstanceFlavorExtendedSerializerWithoutPrice", + "InstanceFlavorExtendedSerializerWithPrice", ] -class ResultInstanceFlavorExtendedSerializerWithoutPrice(BaseModel): +class InstanceFlavorExtendedSerializerWithoutPrice(BaseModel): """Instances flavor schema without price information""" architecture: str @@ -41,7 +40,7 @@ class ResultInstanceFlavorExtendedSerializerWithoutPrice(BaseModel): """Virtual CPU count""" -class ResultInstanceFlavorExtendedSerializerWithPrice(BaseModel): +class InstanceFlavorExtendedSerializerWithPrice(BaseModel): """Instances flavor schema with price information""" architecture: str @@ -81,14 +80,6 @@ class ResultInstanceFlavorExtendedSerializerWithPrice(BaseModel): """Virtual CPU count""" -Result: TypeAlias = Union[ - ResultInstanceFlavorExtendedSerializerWithoutPrice, ResultInstanceFlavorExtendedSerializerWithPrice +InstanceFlavorDetailed: TypeAlias = Union[ + InstanceFlavorExtendedSerializerWithoutPrice, InstanceFlavorExtendedSerializerWithPrice ] - - -class FlavorListResponse(BaseModel): - count: int - """Number of objects""" - - results: List[Result] - """Objects""" diff --git a/src/gcore/types/cloud/instances/instance_flavor_list.py b/src/gcore/types/cloud/instances/instance_flavor_list.py new file mode 100644 index 00000000..3977e00c --- /dev/null +++ b/src/gcore/types/cloud/instances/instance_flavor_list.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ...._models import BaseModel +from .instance_flavor_detailed import InstanceFlavorDetailed + +__all__ = ["InstanceFlavorList"] + + +class InstanceFlavorList(BaseModel): + count: int + """Number of objects""" + + results: List[InstanceFlavorDetailed] + """Objects""" diff --git a/tests/api_resources/cloud/instances/test_flavors.py b/tests/api_resources/cloud/instances/test_flavors.py index 1e0aecf5..51ff8119 100644 --- a/tests/api_resources/cloud/instances/test_flavors.py +++ b/tests/api_resources/cloud/instances/test_flavors.py @@ -9,7 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.instances import FlavorListResponse +from gcore.types.cloud.instances import InstanceFlavorList base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_list(self, client: Gcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: @@ -35,7 +35,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: exclude_windows=True, include_prices=True, ) - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) @parametrize def test_raw_response_list(self, client: Gcore) -> None: @@ -47,7 +47,7 @@ def test_raw_response_list(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) @parametrize def test_streaming_response_list(self, client: Gcore) -> None: @@ -59,7 +59,7 @@ def test_streaming_response_list(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = response.parse() - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,7 +75,7 @@ async def test_method_list(self, async_client: AsyncGcore) -> None: project_id=0, region_id=0, ) - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: @@ -87,7 +87,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No exclude_windows=True, include_prices=True, ) - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @@ -99,7 +99,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @@ -111,6 +111,6 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" flavor = await response.parse() - assert_matches_type(FlavorListResponse, flavor, path=["response"]) + assert_matches_type(InstanceFlavorList, flavor, path=["response"]) assert cast(Any, response.is_closed) is True From 7871af3ff1363411fa0f0afe195c6171b15e0c2e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 15:58:18 +0000 Subject: [PATCH 13/13] release: 0.29.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 23 +++++++++++++++++++++++ pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8935e932..b8dda9bf 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.28.0" + ".": "0.29.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 70bc6a1c..a4f113e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## 0.29.0 (2026-01-12) + +Full Changelog: [v0.28.0...v0.29.0](https://github.com/G-Core/gcore-python/compare/v0.28.0...v0.29.0) + +### ⚠ BREAKING CHANGES + +* **cloud:** rename instance flavor model + +### Features + +* **api:** aggregated API specs update ([667f129](https://github.com/G-Core/gcore-python/commit/667f129c821808b2f2a250a90d4fb6adb36195e9)) +* **api:** aggregated API specs update ([e4f64fd](https://github.com/G-Core/gcore-python/commit/e4f64fd76cb32caa28782a171a4cf1cb4c47674d)) +* **api:** aggregated API specs update ([9f567f9](https://github.com/G-Core/gcore-python/commit/9f567f9268490b9c1b403a502ddd5f5e7a617534)) +* **api:** aggregated API specs update ([43225eb](https://github.com/G-Core/gcore-python/commit/43225eb53397a63c3b44c518a20e665561d1a86e)) +* **api:** aggregated API specs update ([3dc71fe](https://github.com/G-Core/gcore-python/commit/3dc71fe42e2466ae8040af28c77153383609e041)) +* **api:** aggregated API specs update ([3c15807](https://github.com/G-Core/gcore-python/commit/3c15807ac8fdc5c0ca42421896f829054eaa82cf)) +* **cloud:** add support for volume snapshots ([19103d9](https://github.com/G-Core/gcore-python/commit/19103d9b95b37e597d545052d957d2593810307c)) + + +### Bug Fixes + +* **cloud:** rename instance flavor model ([3374f91](https://github.com/G-Core/gcore-python/commit/3374f91b05a70fbc617ef2e070b8fec96e0b08b8)) + ## 0.28.0 (2025-12-30) Full Changelog: [v0.27.0...v0.28.0](https://github.com/G-Core/gcore-python/compare/v0.27.0...v0.28.0) diff --git a/pyproject.toml b/pyproject.toml index 65c062eb..89661fbe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.28.0" +version = "0.29.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 6f1dd8f4..606d0626 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.28.0" # x-release-please-version +__version__ = "0.29.0" # x-release-please-version