diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index b4e9013b..6db19b95 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.16.0"
+ ".": "0.17.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index f1cba395..fd2d5539 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 607
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-69cdddee2436ba596d5c966a54c73d4ed4081564ec1c09282e3736bdb9ec6e20.yml
-openapi_spec_hash: 33a4d60dd35c4e8ae937a9b079a25cad
-config_hash: ba133b9b8d6b270153eb6a24c4280262
+configured_endpoints: 609
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-56132999d4ac773438df4415a4bb56c8cf7f067c3c340d80424bf968074f66dc.yml
+openapi_spec_hash: c33cea043ddbfe20778e0774313fa7e6
+config_hash: bb4a27712c30f7a2b52e1f3b31766f24
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f838a6df..3433ecf3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,36 @@
# Changelog
+## 0.17.0 (2025-10-21)
+
+Full Changelog: [v0.16.0...v0.17.0](https://github.com/G-Core/gcore-python/compare/v0.16.0...v0.17.0)
+
+### ⚠ BREAKING CHANGES
+
+* **cloud:** rename to projects update
+* **cloud:** use new PATCH files shares endpoint
+
+### Features
+
+* **api:** aggregated API specs update ([c9d6195](https://github.com/G-Core/gcore-python/commit/c9d6195649fd18c9c32107a978e0d40032b285be))
+* **cdn:** add methods to list aws and alibaba regions ([0d1d290](https://github.com/G-Core/gcore-python/commit/0d1d290d11626ac0128329c005d048f0ab2f25dc))
+* **client:** add client opt for cloud polling timeout ([bad7ecb](https://github.com/G-Core/gcore-python/commit/bad7ecbb58f0decc31e4091c5bdb0585b7471b09))
+* **cloud:** add polling_timeout_seconds parameter to polling methods ([8b556ae](https://github.com/G-Core/gcore-python/commit/8b556aefc279caddaad9782747b2d6f65a523067))
+* **cloud:** enable TF for placement groups ([63abaa7](https://github.com/G-Core/gcore-python/commit/63abaa7156d2a79bf27f9ba0d3fa2abb3a31aafd))
+* **cloud:** support polling timeout in tasks.poll() ([3f8a419](https://github.com/G-Core/gcore-python/commit/3f8a419a48677e5f443248c963e045dd5169979a))
+
+
+### Chores
+
+* bump `httpx-aiohttp` version to 0.1.9 ([e906ee6](https://github.com/G-Core/gcore-python/commit/e906ee6224833181a4618bcd63671d9a131bca94))
+* **cloud:** fix file shares examples ([c5cc6fa](https://github.com/G-Core/gcore-python/commit/c5cc6fa74b5678d08d1ed750872e424edd6f5377))
+* **cloud:** rename to projects update ([f3f52da](https://github.com/G-Core/gcore-python/commit/f3f52da58998f8ce2637b99d1c944fd692861b48))
+* **cloud:** use new PATCH files shares endpoint ([2ac6bce](https://github.com/G-Core/gcore-python/commit/2ac6bce8afbe4783620060964359d01ab105979e))
+
+
+### Refactors
+
+* **spec:** remove CDN deprecated endpoints ([193a257](https://github.com/G-Core/gcore-python/commit/193a257bcf3e00d85179809e63fa47b021323f65))
+
## 0.16.0 (2025-10-17)
Full Changelog: [v0.15.0...v0.16.0](https://github.com/G-Core/gcore-python/compare/v0.15.0...v0.16.0)
diff --git a/api.md b/api.md
index 9aba3b27..01ab7916 100644
--- a/api.md
+++ b/api.md
@@ -67,10 +67,10 @@ from gcore.types.cloud import Project
Methods:
- client.cloud.projects.create(\*\*params) -> Project
+- client.cloud.projects.update(\*, project_id, \*\*params) -> Project
- client.cloud.projects.list(\*\*params) -> SyncOffsetPage[Project]
- client.cloud.projects.delete(\*, project_id) -> TaskIDList
- client.cloud.projects.get(\*, project_id) -> Project
-- client.cloud.projects.replace(\*, project_id, \*\*params) -> Project
## Tasks
@@ -725,7 +725,7 @@ from gcore.types.cloud import FileShare
Methods:
- client.cloud.file_shares.create(\*, project_id, region_id, \*\*params) -> TaskIDList
-- client.cloud.file_shares.update(file_share_id, \*, project_id, region_id, \*\*params) -> FileShare
+- client.cloud.file_shares.update(file_share_id, \*, project_id, region_id, \*\*params) -> TaskIDList
- client.cloud.file_shares.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[FileShare]
- client.cloud.file_shares.delete(file_share_id, \*, project_id, region_id) -> TaskIDList
- client.cloud.file_shares.get(file_share_id, \*, project_id, region_id) -> FileShare
@@ -2082,7 +2082,15 @@ Methods:
Types:
```python
-from gcore.types.cdn import CdnAccount, CdnAccountLimits, CdnAvailableFeatures, PurgeStatus
+from gcore.types.cdn import (
+ AlibabaRegions,
+ AwsRegions,
+ CdnAccount,
+ CdnAccountLimits,
+ CdnAvailableFeatures,
+ PurgeStatus,
+ CdnListPurgeStatusesResponse,
+)
```
Methods:
@@ -2090,7 +2098,9 @@ Methods:
- client.cdn.get_account_limits() -> CdnAccountLimits
- client.cdn.get_account_overview() -> CdnAccount
- client.cdn.get_available_features() -> CdnAvailableFeatures
-- client.cdn.list_purge_statuses(\*\*params) -> SyncOffsetPageCdn[PurgeStatus]
+- client.cdn.list_alibaba_regions() -> AlibabaRegions
+- client.cdn.list_aws_regions() -> AwsRegions
+- client.cdn.list_purge_statuses(\*\*params) -> CdnListPurgeStatusesResponse
- client.cdn.update_account(\*\*params) -> CdnAccount
## Resources
@@ -2247,8 +2257,8 @@ from gcore.types.cdn import CdnLogEntry
Methods:
-- client.cdn.logs.list(\*\*params) -> SyncOffsetPageCdnLogs[Data]
-- client.cdn.logs.download(\*\*params) -> BinaryAPIResponse
+- client.cdn.logs.list(\*\*params) -> SyncOffsetPageCdnLogs[Data]
+- client.cdn.logs.download(\*\*params) -> BinaryAPIResponse
## LogsUploader
diff --git a/examples/cloud/audit_logs.py b/examples/cloud/audit_logs.py
index 1d626ae2..2dbdd2c9 100644
--- a/examples/cloud/audit_logs.py
+++ b/examples/cloud/audit_logs.py
@@ -12,7 +12,6 @@ def main() -> None:
# cloud_region_id = os.environ["GCORE_CLOUD_REGION_ID"]
gcore = Gcore(
- timeout=60.0,
# No need to explicitly pass to Gcore constructor if using environment variables
# api_key=api_key,
# cloud_project_id=cloud_project_id,
diff --git a/examples/cloud/audit_logs_async.py b/examples/cloud/audit_logs_async.py
index 3ebe3bf4..8e56fa8d 100644
--- a/examples/cloud/audit_logs_async.py
+++ b/examples/cloud/audit_logs_async.py
@@ -13,7 +13,6 @@ async def main() -> None:
# cloud_region_id = os.environ["GCORE_CLOUD_REGION_ID"]
gcore = AsyncGcore(
- timeout=60.0,
# No need to explicitly pass to AsyncGcore constructor if using environment variables
# api_key=api_key,
# cloud_project_id=cloud_project_id,
diff --git a/examples/cloud/baremetal.py b/examples/cloud/baremetal.py
index cb175bd9..07cc9966 100644
--- a/examples/cloud/baremetal.py
+++ b/examples/cloud/baremetal.py
@@ -17,7 +17,6 @@ def main() -> None:
# cloud_region_id = os.environ["GCORE_CLOUD_REGION_ID"]
gcore = Gcore(
- timeout=1800.0,
# No need to explicitly pass to Gcore constructor if using environment variables
# api_key=api_key,
# cloud_project_id=cloud_project_id,
diff --git a/examples/cloud/baremetal_async.py b/examples/cloud/baremetal_async.py
index bfb05876..2e1ec482 100644
--- a/examples/cloud/baremetal_async.py
+++ b/examples/cloud/baremetal_async.py
@@ -18,7 +18,6 @@ async def main() -> None:
# cloud_region_id = os.environ["GCORE_CLOUD_REGION_ID"]
gcore = AsyncGcore(
- timeout=1800.0,
# No need to explicitly pass to AsyncGcore constructor if using environment variables
# api_key=api_key,
# cloud_project_id=cloud_project_id,
diff --git a/examples/cloud/file_shares.py b/examples/cloud/file_shares.py
index aa147d12..83b966e2 100644
--- a/examples/cloud/file_shares.py
+++ b/examples/cloud/file_shares.py
@@ -16,7 +16,6 @@ def main() -> None:
cloud_network_id = os.environ["GCORE_CLOUD_NETWORK_ID"]
gcore = Gcore(
- timeout=180.0,
# No need to explicitly pass to Gcore constructor if using environment variables
# api_key=api_key,
# cloud_project_id=cloud_project_id,
@@ -71,7 +70,7 @@ def get_file_share(*, client: Gcore, file_share_id: str) -> None:
def update_file_share(*, client: Gcore, file_share_id: str) -> None:
print("\n=== UPDATE FILE SHARE ===")
- file_share = client.cloud.file_shares.update( # pyright: ignore[reportDeprecated]
+ file_share = client.cloud.file_shares.update_and_poll(
file_share_id=file_share_id,
name="gcore-go-example-updated",
)
diff --git a/examples/cloud/file_shares_async.py b/examples/cloud/file_shares_async.py
index c7d6f81a..90ef6881 100644
--- a/examples/cloud/file_shares_async.py
+++ b/examples/cloud/file_shares_async.py
@@ -17,7 +17,6 @@ async def main() -> None:
cloud_network_id = os.environ["GCORE_CLOUD_NETWORK_ID"]
gcore = AsyncGcore(
- timeout=180.0,
# No need to explicitly pass to AsyncGcore constructor if using environment variables
# api_key=api_key,
# cloud_project_id=cloud_project_id,
@@ -75,7 +74,7 @@ async def get_file_share(*, client: AsyncGcore, file_share_id: str) -> None:
async def update_file_share(*, client: AsyncGcore, file_share_id: str) -> None:
print("\n=== UPDATE FILE SHARE ===")
- file_share = await client.cloud.file_shares.update( # pyright: ignore[reportDeprecated]
+ file_share = await client.cloud.file_shares.update_and_poll(
file_share_id=file_share_id,
name="gcore-go-example-updated",
)
diff --git a/examples/cloud/inference.py b/examples/cloud/inference.py
index ee6593b3..130b64fd 100644
--- a/examples/cloud/inference.py
+++ b/examples/cloud/inference.py
@@ -20,7 +20,6 @@ def main() -> None:
cloud_inference_flavor_name = os.environ["GCORE_CLOUD_INFERENCE_FLAVOR_NAME"]
gcore = Gcore(
- timeout=180.0,
# No need to explicitly pass to Gcore constructor if using environment variables
# api_key=api_key,
# cloud_project_id=cloud_project_id,
diff --git a/examples/cloud/inference_async.py b/examples/cloud/inference_async.py
index 69f0007d..410d473e 100644
--- a/examples/cloud/inference_async.py
+++ b/examples/cloud/inference_async.py
@@ -21,7 +21,6 @@ async def main() -> None:
cloud_inference_flavor_name = os.environ["GCORE_CLOUD_INFERENCE_FLAVOR_NAME"]
gcore = AsyncGcore(
- timeout=180.0,
# No need to explicitly pass to AsyncGcore constructor if using environment variables
# api_key=api_key,
# cloud_project_id=cloud_project_id,
diff --git a/examples/cloud/instances.py b/examples/cloud/instances.py
index cb2d6311..9f8cf217 100644
--- a/examples/cloud/instances.py
+++ b/examples/cloud/instances.py
@@ -23,7 +23,6 @@ def main() -> None:
placement_group_id = os.environ.get("GCORE_CLOUD_PLACEMENT_GROUP_ID")
gcore = Gcore(
- timeout=180.0,
# No need to explicitly pass to Gcore constructor if using environment variables
# api_key=api_key,
# cloud_project_id=cloud_project_id,
diff --git a/examples/cloud/instances_async.py b/examples/cloud/instances_async.py
index 1d427186..5f895ac0 100644
--- a/examples/cloud/instances_async.py
+++ b/examples/cloud/instances_async.py
@@ -24,7 +24,6 @@ async def main() -> None:
placement_group_id = os.environ.get("GCORE_CLOUD_PLACEMENT_GROUP_ID")
gcore = AsyncGcore(
- timeout=180.0,
# No need to explicitly pass to AsyncGcore constructor if using environment variables
# api_key=api_key,
# cloud_project_id=cloud_project_id,
diff --git a/examples/cloud/load_balancers.py b/examples/cloud/load_balancers.py
index ae2f4ff7..7d43c183 100644
--- a/examples/cloud/load_balancers.py
+++ b/examples/cloud/load_balancers.py
@@ -10,7 +10,6 @@ def main() -> None:
# cloud_region_id = os.environ["GCORE_CLOUD_REGION_ID"]
gcore = Gcore(
- timeout=180.0,
# No need to explicitly pass to Gcore constructor if using environment variables
# api_key=api_key,
# cloud_project_id=cloud_project_id,
diff --git a/examples/cloud/load_balancers_async.py b/examples/cloud/load_balancers_async.py
index b4db1cd1..0b673f02 100644
--- a/examples/cloud/load_balancers_async.py
+++ b/examples/cloud/load_balancers_async.py
@@ -14,7 +14,6 @@ async def main() -> None:
# cloud_region_id = os.environ["GCORE_CLOUD_REGION_ID"]
gcore = AsyncGcore(
- timeout=180.0,
# No need to explicitly pass to AsyncGcore constructor if using environment variables
# api_key=api_key,
# cloud_project_id=cloud_project_id,
diff --git a/examples/cloud/projects.py b/examples/cloud/projects.py
index 0fe79699..95f34029 100644
--- a/examples/cloud/projects.py
+++ b/examples/cloud/projects.py
@@ -46,7 +46,7 @@ def get_project_by_id(*, client: Gcore, project_id: int) -> Project:
def update_project(*, client: Gcore, project_id: int) -> Project:
print("\n=== UPDATE PROJECT ===")
- updated_project = client.cloud.projects.replace(project_id=project_id, name="gcore-go-example-updated")
+ updated_project = client.cloud.projects.update(project_id=project_id, name="gcore-go-example-updated")
print(f"Project ID: {updated_project.id}, name: {updated_project.name}")
print("=======================")
return updated_project
diff --git a/examples/cloud/projects_async.py b/examples/cloud/projects_async.py
index 62bff7e1..af534a27 100644
--- a/examples/cloud/projects_async.py
+++ b/examples/cloud/projects_async.py
@@ -50,7 +50,7 @@ async def get_project_by_id(*, client: AsyncGcore, project_id: int) -> Project:
async def update_project(*, client: AsyncGcore, project_id: int) -> Project:
print("\n=== UPDATE PROJECT ===")
- updated_project = await client.cloud.projects.replace(project_id=project_id, name="gcore-go-example-updated")
+ updated_project = await client.cloud.projects.update(project_id=project_id, name="gcore-go-example-updated")
print(f"Project ID: {updated_project.id}, name: {updated_project.name}")
print("=======================")
return updated_project
diff --git a/pyproject.toml b/pyproject.toml
index efdfe116..2b3a98de 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "gcore"
-version = "0.16.0"
+version = "0.17.0"
description = "The official Python library for the gcore API"
dynamic = ["readme"]
license = "Apache-2.0"
@@ -39,7 +39,7 @@ Homepage = "https://github.com/G-Core/gcore-python"
Repository = "https://github.com/G-Core/gcore-python"
[project.optional-dependencies]
-aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"]
+aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"]
[tool.rye]
managed = true
diff --git a/requirements-dev.lock b/requirements-dev.lock
index 329aeee4..558fe7ca 100644
--- a/requirements-dev.lock
+++ b/requirements-dev.lock
@@ -59,7 +59,7 @@ httpx==0.28.1
# via gcore
# via httpx-aiohttp
# via respx
-httpx-aiohttp==0.1.8
+httpx-aiohttp==0.1.9
# via gcore
idna==3.4
# via anyio
diff --git a/requirements.lock b/requirements.lock
index b9e884ce..bdcade78 100644
--- a/requirements.lock
+++ b/requirements.lock
@@ -43,7 +43,7 @@ httpcore==1.0.9
httpx==0.28.1
# via gcore
# via httpx-aiohttp
-httpx-aiohttp==0.1.8
+httpx-aiohttp==0.1.9
# via gcore
idna==3.4
# via anyio
diff --git a/src/gcore/_client.py b/src/gcore/_client.py
index 4df8dcc0..d900f571 100644
--- a/src/gcore/_client.py
+++ b/src/gcore/_client.py
@@ -59,6 +59,7 @@ class Gcore(SyncAPIClient):
cloud_project_id: int | None
cloud_region_id: int | None
cloud_polling_interval_seconds: int | None
+ cloud_polling_timeout_seconds: int | None
def __init__(
self,
@@ -67,6 +68,7 @@ def __init__(
cloud_project_id: int | None = None,
cloud_region_id: int | None = None,
cloud_polling_interval_seconds: int | None = 3,
+ cloud_polling_timeout_seconds: int | None = 7200,
base_url: str | httpx.URL | None = None,
timeout: float | Timeout | None | NotGiven = not_given,
max_retries: int = DEFAULT_MAX_RETRIES,
@@ -113,6 +115,10 @@ def __init__(
cloud_polling_interval_seconds = 3
self.cloud_polling_interval_seconds = cloud_polling_interval_seconds
+ if cloud_polling_timeout_seconds is None:
+ cloud_polling_timeout_seconds = 7200
+ self.cloud_polling_timeout_seconds = cloud_polling_timeout_seconds
+
if base_url is None:
base_url = os.environ.get("GCORE_BASE_URL")
if base_url is None:
@@ -168,6 +174,7 @@ def copy(
cloud_project_id: int | None = None,
cloud_region_id: int | None = None,
cloud_polling_interval_seconds: int | None = None,
+ cloud_polling_timeout_seconds: int | None = None,
base_url: str | httpx.URL | None = None,
timeout: float | Timeout | None | NotGiven = not_given,
http_client: httpx.Client | None = None,
@@ -205,6 +212,7 @@ def copy(
cloud_project_id=cloud_project_id or self.cloud_project_id,
cloud_region_id=cloud_region_id or self.cloud_region_id,
cloud_polling_interval_seconds=cloud_polling_interval_seconds or self.cloud_polling_interval_seconds,
+ cloud_polling_timeout_seconds=cloud_polling_timeout_seconds or self.cloud_polling_timeout_seconds,
base_url=base_url or self.base_url,
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
http_client=http_client,
@@ -288,6 +296,7 @@ class AsyncGcore(AsyncAPIClient):
cloud_project_id: int | None
cloud_region_id: int | None
cloud_polling_interval_seconds: int | None
+ cloud_polling_timeout_seconds: int | None
def __init__(
self,
@@ -296,6 +305,7 @@ def __init__(
cloud_project_id: int | None = None,
cloud_region_id: int | None = None,
cloud_polling_interval_seconds: int | None = 3,
+ cloud_polling_timeout_seconds: int | None = 7200,
base_url: str | httpx.URL | None = None,
timeout: float | Timeout | None | NotGiven = not_given,
max_retries: int = DEFAULT_MAX_RETRIES,
@@ -342,6 +352,10 @@ def __init__(
cloud_polling_interval_seconds = 3
self.cloud_polling_interval_seconds = cloud_polling_interval_seconds
+ if cloud_polling_timeout_seconds is None:
+ cloud_polling_timeout_seconds = 7200
+ self.cloud_polling_timeout_seconds = cloud_polling_timeout_seconds
+
if base_url is None:
base_url = os.environ.get("GCORE_BASE_URL")
if base_url is None:
@@ -397,6 +411,7 @@ def copy(
cloud_project_id: int | None = None,
cloud_region_id: int | None = None,
cloud_polling_interval_seconds: int | None = None,
+ cloud_polling_timeout_seconds: int | None = None,
base_url: str | httpx.URL | None = None,
timeout: float | Timeout | None | NotGiven = not_given,
http_client: httpx.AsyncClient | None = None,
@@ -434,6 +449,7 @@ def copy(
cloud_project_id=cloud_project_id or self.cloud_project_id,
cloud_region_id=cloud_region_id or self.cloud_region_id,
cloud_polling_interval_seconds=cloud_polling_interval_seconds or self.cloud_polling_interval_seconds,
+ cloud_polling_timeout_seconds=cloud_polling_timeout_seconds or self.cloud_polling_timeout_seconds,
base_url=base_url or self.base_url,
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
http_client=http_client,
diff --git a/src/gcore/_version.py b/src/gcore/_version.py
index a0186b0a..4e59998e 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.16.0" # x-release-please-version
+__version__ = "0.17.0" # x-release-please-version
diff --git a/src/gcore/resources/cdn/cdn.py b/src/gcore/resources/cdn/cdn.py
index 152610ba..c08f226c 100644
--- a/src/gcore/resources/cdn/cdn.py
+++ b/src/gcore/resources/cdn/cdn.py
@@ -4,6 +4,14 @@
import httpx
+from .logs import (
+ LogsResource,
+ AsyncLogsResource,
+ LogsResourceWithRawResponse,
+ AsyncLogsResourceWithRawResponse,
+ LogsResourceWithStreamingResponse,
+ AsyncLogsResourceWithStreamingResponse,
+)
from .metrics import (
MetricsResource,
AsyncMetricsResource,
@@ -39,14 +47,6 @@
IPRangesResourceWithStreamingResponse,
AsyncIPRangesResourceWithStreamingResponse,
)
-from .logs.logs import (
- LogsResource,
- AsyncLogsResource,
- LogsResourceWithRawResponse,
- AsyncLogsResourceWithRawResponse,
- LogsResourceWithStreamingResponse,
- AsyncLogsResourceWithStreamingResponse,
-)
from .statistics import (
StatisticsResource,
AsyncStatisticsResource,
@@ -63,7 +63,6 @@
async_to_streamed_response_wrapper,
)
from ...types.cdn import cdn_update_account_params, cdn_list_purge_statuses_params
-from ...pagination import SyncOffsetPageCdn, AsyncOffsetPageCdn
from .certificates import (
CertificatesResource,
AsyncCertificatesResource,
@@ -80,7 +79,7 @@
OriginGroupsResourceWithStreamingResponse,
AsyncOriginGroupsResourceWithStreamingResponse,
)
-from ..._base_client import AsyncPaginator, make_request_options
+from ..._base_client import make_request_options
from .rule_templates import (
RuleTemplatesResource,
AsyncRuleTemplatesResource,
@@ -105,6 +104,7 @@
ResourcesResourceWithStreamingResponse,
AsyncResourcesResourceWithStreamingResponse,
)
+from ...types.cdn.aws_regions import AwsRegions
from ...types.cdn.cdn_account import CdnAccount
from .trusted_ca_certificates import (
TrustedCaCertificatesResource,
@@ -114,7 +114,7 @@
TrustedCaCertificatesResourceWithStreamingResponse,
AsyncTrustedCaCertificatesResourceWithStreamingResponse,
)
-from ...types.cdn.purge_status import PurgeStatus
+from ...types.cdn.alibaba_regions import AlibabaRegions
from .logs_uploader.logs_uploader import (
LogsUploaderResource,
AsyncLogsUploaderResource,
@@ -125,6 +125,7 @@
)
from ...types.cdn.cdn_account_limits import CdnAccountLimits
from ...types.cdn.cdn_available_features import CdnAvailableFeatures
+from ...types.cdn.cdn_list_purge_statuses_response import CdnListPurgeStatusesResponse
__all__ = ["CdnResource", "AsyncCdnResource"]
@@ -258,6 +259,44 @@ def get_available_features(
cast_to=CdnAvailableFeatures,
)
+ def list_alibaba_regions(
+ self,
+ *,
+ # 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,
+ ) -> AlibabaRegions:
+ """Get the list of Alibaba Cloud regions."""
+ return self._get(
+ "/cdn/alibaba_regions",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=AlibabaRegions,
+ )
+
+ def list_aws_regions(
+ self,
+ *,
+ # 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,
+ ) -> AwsRegions:
+ """Get the list of Amazon AWS regions."""
+ return self._get(
+ "/cdn/aws_regions",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=AwsRegions,
+ )
+
def list_purge_statuses(
self,
*,
@@ -274,7 +313,7 @@ def list_purge_statuses(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
- ) -> SyncOffsetPageCdn[PurgeStatus]:
+ ) -> CdnListPurgeStatusesResponse:
"""
Get purges history.
@@ -330,9 +369,8 @@ def list_purge_statuses(
timeout: Override the client-level default timeout for this request, in seconds
"""
- return self._get_api_list(
+ return self._get(
"/cdn/purge_statuses",
- page=SyncOffsetPageCdn[PurgeStatus],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -351,7 +389,7 @@ def list_purge_statuses(
cdn_list_purge_statuses_params.CdnListPurgeStatusesParams,
),
),
- model=PurgeStatus,
+ cast_to=CdnListPurgeStatusesResponse,
)
def update_account(
@@ -522,7 +560,45 @@ async def get_available_features(
cast_to=CdnAvailableFeatures,
)
- def list_purge_statuses(
+ async def list_alibaba_regions(
+ self,
+ *,
+ # 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,
+ ) -> AlibabaRegions:
+ """Get the list of Alibaba Cloud regions."""
+ return await self._get(
+ "/cdn/alibaba_regions",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=AlibabaRegions,
+ )
+
+ async def list_aws_regions(
+ self,
+ *,
+ # 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,
+ ) -> AwsRegions:
+ """Get the list of Amazon AWS regions."""
+ return await self._get(
+ "/cdn/aws_regions",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=AwsRegions,
+ )
+
+ async def list_purge_statuses(
self,
*,
cname: str | Omit = omit,
@@ -538,7 +614,7 @@ def list_purge_statuses(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
- ) -> AsyncPaginator[PurgeStatus, AsyncOffsetPageCdn[PurgeStatus]]:
+ ) -> CdnListPurgeStatusesResponse:
"""
Get purges history.
@@ -594,15 +670,14 @@ def list_purge_statuses(
timeout: Override the client-level default timeout for this request, in seconds
"""
- return self._get_api_list(
+ return await self._get(
"/cdn/purge_statuses",
- page=AsyncOffsetPageCdn[PurgeStatus],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- query=maybe_transform(
+ query=await async_maybe_transform(
{
"cname": cname,
"from_created": from_created,
@@ -615,7 +690,7 @@ def list_purge_statuses(
cdn_list_purge_statuses_params.CdnListPurgeStatusesParams,
),
),
- model=PurgeStatus,
+ cast_to=CdnListPurgeStatusesResponse,
)
async def update_account(
@@ -670,6 +745,12 @@ def __init__(self, cdn: CdnResource) -> None:
self.get_available_features = to_raw_response_wrapper(
cdn.get_available_features,
)
+ self.list_alibaba_regions = to_raw_response_wrapper(
+ cdn.list_alibaba_regions,
+ )
+ self.list_aws_regions = to_raw_response_wrapper(
+ cdn.list_aws_regions,
+ )
self.list_purge_statuses = to_raw_response_wrapper(
cdn.list_purge_statuses,
)
@@ -743,6 +824,12 @@ def __init__(self, cdn: AsyncCdnResource) -> None:
self.get_available_features = async_to_raw_response_wrapper(
cdn.get_available_features,
)
+ self.list_alibaba_regions = async_to_raw_response_wrapper(
+ cdn.list_alibaba_regions,
+ )
+ self.list_aws_regions = async_to_raw_response_wrapper(
+ cdn.list_aws_regions,
+ )
self.list_purge_statuses = async_to_raw_response_wrapper(
cdn.list_purge_statuses,
)
@@ -816,6 +903,12 @@ def __init__(self, cdn: CdnResource) -> None:
self.get_available_features = to_streamed_response_wrapper(
cdn.get_available_features,
)
+ self.list_alibaba_regions = to_streamed_response_wrapper(
+ cdn.list_alibaba_regions,
+ )
+ self.list_aws_regions = to_streamed_response_wrapper(
+ cdn.list_aws_regions,
+ )
self.list_purge_statuses = to_streamed_response_wrapper(
cdn.list_purge_statuses,
)
@@ -889,6 +982,12 @@ def __init__(self, cdn: AsyncCdnResource) -> None:
self.get_available_features = async_to_streamed_response_wrapper(
cdn.get_available_features,
)
+ self.list_alibaba_regions = async_to_streamed_response_wrapper(
+ cdn.list_alibaba_regions,
+ )
+ self.list_aws_regions = async_to_streamed_response_wrapper(
+ cdn.list_aws_regions,
+ )
self.list_purge_statuses = async_to_streamed_response_wrapper(
cdn.list_purge_statuses,
)
diff --git a/src/gcore/resources/cdn/logs/logs.py b/src/gcore/resources/cdn/logs.py
similarity index 99%
rename from src/gcore/resources/cdn/logs/logs.py
rename to src/gcore/resources/cdn/logs.py
index 4a03bc86..7520c6dd 100644
--- a/src/gcore/resources/cdn/logs/logs.py
+++ b/src/gcore/resources/cdn/logs.py
@@ -4,11 +4,11 @@
import httpx
-from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
-from ...._utils import maybe_transform, async_maybe_transform
-from ...._compat import cached_property
-from ...._resource import SyncAPIResource, AsyncAPIResource
-from ...._response import (
+from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
+from ..._utils import maybe_transform, async_maybe_transform
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+from ..._response import (
BinaryAPIResponse,
AsyncBinaryAPIResponse,
StreamedBinaryAPIResponse,
@@ -22,10 +22,10 @@
async_to_custom_raw_response_wrapper,
async_to_custom_streamed_response_wrapper,
)
-from ....types.cdn import log_list_params, log_download_params
-from ....pagination import SyncOffsetPageCdnLogs, AsyncOffsetPageCdnLogs
-from ...._base_client import AsyncPaginator, make_request_options
-from ....types.cdn.cdn_log_entry import Data
+from ...types.cdn import log_list_params, log_download_params
+from ...pagination import SyncOffsetPageCdnLogs, AsyncOffsetPageCdnLogs
+from ..._base_client import AsyncPaginator, make_request_options
+from ...types.cdn.cdn_log_entry import Data
__all__ = ["LogsResource", "AsyncLogsResource"]
diff --git a/src/gcore/resources/cdn/logs/__init__.py b/src/gcore/resources/cdn/logs/__init__.py
deleted file mode 100644
index 30876fab..00000000
--- a/src/gcore/resources/cdn/logs/__init__.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from .logs import (
- LogsResource,
- AsyncLogsResource,
- LogsResourceWithRawResponse,
- AsyncLogsResourceWithRawResponse,
- LogsResourceWithStreamingResponse,
- AsyncLogsResourceWithStreamingResponse,
-)
-
-__all__ = [
- "LogsResource",
- "AsyncLogsResource",
- "LogsResourceWithRawResponse",
- "AsyncLogsResourceWithRawResponse",
- "LogsResourceWithStreamingResponse",
- "AsyncLogsResourceWithStreamingResponse",
-]
diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py
index a41d040d..88ca7fcc 100644
--- a/src/gcore/resources/cloud/baremetal/servers.py
+++ b/src/gcore/resources/cloud/baremetal/servers.py
@@ -415,6 +415,7 @@ def create_and_poll(
user_data: str | Omit = omit,
username: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -450,6 +451,7 @@ def create_and_poll(
response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.instances:
raise ValueError("No server was created")
@@ -475,6 +477,7 @@ def rebuild_and_poll(
image_id: str | Omit = omit,
user_data: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -500,6 +503,7 @@ def rebuild_and_poll(
response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
servers = self.list(
project_id=project_id,
@@ -902,6 +906,7 @@ async def create_and_poll(
user_data: str | Omit = omit,
username: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -937,6 +942,7 @@ async def create_and_poll(
response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.instances:
raise ValueError("No server was created")
@@ -962,6 +968,7 @@ async def rebuild_and_poll(
image_id: str | Omit = omit,
user_data: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -987,6 +994,7 @@ async def rebuild_and_poll(
response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
servers = await self.list(
project_id=project_id,
diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py
index eee5ccd6..7628349c 100644
--- a/src/gcore/resources/cloud/cloud.py
+++ b/src/gcore/resources/cloud/cloud.py
@@ -283,6 +283,9 @@ def inference(self) -> InferenceResource:
@cached_property
def placement_groups(self) -> PlacementGroupsResource:
+ """
+ Placement Groups allow you to specific a policy that determines whether Virtual Machines will be hosted on the same physical server or on different ones.
+ """
return PlacementGroupsResource(self._client)
@cached_property
@@ -412,6 +415,9 @@ def inference(self) -> AsyncInferenceResource:
@cached_property
def placement_groups(self) -> AsyncPlacementGroupsResource:
+ """
+ Placement Groups allow you to specific a policy that determines whether Virtual Machines will be hosted on the same physical server or on different ones.
+ """
return AsyncPlacementGroupsResource(self._client)
@cached_property
@@ -544,6 +550,9 @@ def inference(self) -> InferenceResourceWithRawResponse:
@cached_property
def placement_groups(self) -> PlacementGroupsResourceWithRawResponse:
+ """
+ Placement Groups allow you to specific a policy that determines whether Virtual Machines will be hosted on the same physical server or on different ones.
+ """
return PlacementGroupsResourceWithRawResponse(self._cloud.placement_groups)
@cached_property
@@ -657,6 +666,9 @@ def inference(self) -> AsyncInferenceResourceWithRawResponse:
@cached_property
def placement_groups(self) -> AsyncPlacementGroupsResourceWithRawResponse:
+ """
+ Placement Groups allow you to specific a policy that determines whether Virtual Machines will be hosted on the same physical server or on different ones.
+ """
return AsyncPlacementGroupsResourceWithRawResponse(self._cloud.placement_groups)
@cached_property
@@ -770,6 +782,9 @@ def inference(self) -> InferenceResourceWithStreamingResponse:
@cached_property
def placement_groups(self) -> PlacementGroupsResourceWithStreamingResponse:
+ """
+ Placement Groups allow you to specific a policy that determines whether Virtual Machines will be hosted on the same physical server or on different ones.
+ """
return PlacementGroupsResourceWithStreamingResponse(self._cloud.placement_groups)
@cached_property
@@ -883,6 +898,9 @@ def inference(self) -> AsyncInferenceResourceWithStreamingResponse:
@cached_property
def placement_groups(self) -> AsyncPlacementGroupsResourceWithStreamingResponse:
+ """
+ Placement Groups allow you to specific a policy that determines whether Virtual Machines will be hosted on the same physical server or on different ones.
+ """
return AsyncPlacementGroupsResourceWithStreamingResponse(self._cloud.placement_groups)
@cached_property
diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py
index 463ee013..ac6cd603 100644
--- a/src/gcore/resources/cloud/file_shares/file_shares.py
+++ b/src/gcore/resources/cloud/file_shares/file_shares.py
@@ -2,7 +2,6 @@
from __future__ import annotations
-import typing_extensions
from typing import Dict, Iterable, Optional
from typing_extensions import Literal, overload
@@ -228,7 +227,6 @@ def create(
cast_to=TaskIDList,
)
- @typing_extensions.deprecated("deprecated")
def update(
self,
file_share_id: str,
@@ -244,12 +242,9 @@ def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
- ) -> FileShare:
+ ) -> TaskIDList:
"""
- Rename file share or update tags
-
- **Deprecated**: Use PATCH
- /v3/`file_shares`/{`project_id`}/{`region_id`}/{`file_share_id`} instead
+ Rename file share, update tags or set share specific properties
Args:
project_id: Project ID
@@ -299,7 +294,7 @@ def update(
if not file_share_id:
raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}")
return self._patch(
- f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}",
+ f"/cloud/v3/file_shares/{project_id}/{region_id}/{file_share_id}",
body=maybe_transform(
{
"name": name,
@@ -311,7 +306,55 @@ def update(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=FileShare,
+ cast_to=TaskIDList,
+ )
+
+ def update_and_poll(
+ self,
+ file_share_id: str,
+ *,
+ project_id: int | None = None,
+ region_id: int | None = None,
+ name: str | Omit = omit,
+ share_settings: file_share_update_params.ShareSettings | Omit = omit,
+ tags: Optional[TagUpdateMapParam] | Omit = omit,
+ polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
+ ) -> FileShare:
+ response = self.update(
+ file_share_id,
+ project_id=project_id,
+ region_id=region_id,
+ name=name,
+ share_settings=share_settings,
+ tags=tags,
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ )
+ if not response.tasks:
+ raise ValueError("Expected at least one task to be created")
+ self._client.cloud.tasks.poll(
+ task_id=response.tasks[0],
+ extra_headers=extra_headers,
+ polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
+ )
+ return self.get(
+ file_share_id,
+ project_id=project_id,
+ region_id=region_id,
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
)
def list(
@@ -707,7 +750,6 @@ async def create(
cast_to=TaskIDList,
)
- @typing_extensions.deprecated("deprecated")
async def update(
self,
file_share_id: str,
@@ -723,12 +765,9 @@ async def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
- ) -> FileShare:
+ ) -> TaskIDList:
"""
- Rename file share or update tags
-
- **Deprecated**: Use PATCH
- /v3/`file_shares`/{`project_id`}/{`region_id`}/{`file_share_id`} instead
+ Rename file share, update tags or set share specific properties
Args:
project_id: Project ID
@@ -778,7 +817,7 @@ async def update(
if not file_share_id:
raise ValueError(f"Expected a non-empty value for `file_share_id` but received {file_share_id!r}")
return await self._patch(
- f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}",
+ f"/cloud/v3/file_shares/{project_id}/{region_id}/{file_share_id}",
body=await async_maybe_transform(
{
"name": name,
@@ -790,7 +829,55 @@ async def update(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=FileShare,
+ cast_to=TaskIDList,
+ )
+
+ async def update_and_poll(
+ self,
+ file_share_id: str,
+ *,
+ project_id: int | None = None,
+ region_id: int | None = None,
+ name: str | Omit = omit,
+ share_settings: file_share_update_params.ShareSettings | Omit = omit,
+ tags: Optional[TagUpdateMapParam] | Omit = omit,
+ polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
+ ) -> FileShare:
+ response = await self.update(
+ file_share_id,
+ project_id=project_id,
+ region_id=region_id,
+ name=name,
+ share_settings=share_settings,
+ tags=tags,
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ )
+ if not response.tasks:
+ raise ValueError("Expected at least one task to be created")
+ await self._client.cloud.tasks.poll(
+ task_id=response.tasks[0],
+ extra_headers=extra_headers,
+ polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
+ )
+ return await self.get(
+ file_share_id,
+ project_id=project_id,
+ region_id=region_id,
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
)
def list(
@@ -1006,10 +1093,11 @@ def __init__(self, file_shares: FileSharesResource) -> None:
self.create = to_raw_response_wrapper(
file_shares.create,
)
- self.update = ( # pyright: ignore[reportDeprecated]
- to_raw_response_wrapper(
- file_shares.update, # pyright: ignore[reportDeprecated],
- )
+ self.update = to_raw_response_wrapper(
+ file_shares.update,
+ )
+ self.update_and_poll = to_raw_response_wrapper(
+ file_shares.update_and_poll,
)
self.list = to_raw_response_wrapper(
file_shares.list,
@@ -1036,10 +1124,11 @@ def __init__(self, file_shares: AsyncFileSharesResource) -> None:
self.create = async_to_raw_response_wrapper(
file_shares.create,
)
- self.update = ( # pyright: ignore[reportDeprecated]
- async_to_raw_response_wrapper(
- file_shares.update, # pyright: ignore[reportDeprecated],
- )
+ self.update = async_to_raw_response_wrapper(
+ file_shares.update,
+ )
+ self.update_and_poll = async_to_raw_response_wrapper(
+ file_shares.update_and_poll,
)
self.list = async_to_raw_response_wrapper(
file_shares.list,
@@ -1066,10 +1155,11 @@ def __init__(self, file_shares: FileSharesResource) -> None:
self.create = to_streamed_response_wrapper(
file_shares.create,
)
- self.update = ( # pyright: ignore[reportDeprecated]
- to_streamed_response_wrapper(
- file_shares.update, # pyright: ignore[reportDeprecated],
- )
+ self.update = to_streamed_response_wrapper(
+ file_shares.update,
+ )
+ self.update_and_poll = to_streamed_response_wrapper(
+ file_shares.update_and_poll,
)
self.list = to_streamed_response_wrapper(
file_shares.list,
@@ -1096,10 +1186,11 @@ def __init__(self, file_shares: AsyncFileSharesResource) -> None:
self.create = async_to_streamed_response_wrapper(
file_shares.create,
)
- self.update = ( # pyright: ignore[reportDeprecated]
- async_to_streamed_response_wrapper(
- file_shares.update, # pyright: ignore[reportDeprecated],
- )
+ self.update = async_to_streamed_response_wrapper(
+ file_shares.update,
+ )
+ self.update_and_pol = async_to_streamed_response_wrapper(
+ file_shares.update_and_poll,
)
self.list = async_to_streamed_response_wrapper(
file_shares.list,
diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py
index a359f8f5..d28227ee 100644
--- a/src/gcore/resources/cloud/floating_ips.py
+++ b/src/gcore/resources/cloud/floating_ips.py
@@ -445,6 +445,7 @@ def create_and_poll(
port_id: Optional[str] | Omit = omit,
tags: Dict[str, str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -472,6 +473,7 @@ def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if task.created_resources is None or task.created_resources.floatingips is None:
raise ValueError("Task completed but created_resources or floatingips is missing")
@@ -493,6 +495,7 @@ def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -518,6 +521,7 @@ def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
@@ -934,6 +938,7 @@ async def create_and_poll(
port_id: Optional[str] | Omit = omit,
tags: Dict[str, str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -961,6 +966,7 @@ async def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if task.created_resources is None or task.created_resources.floatingips is None:
raise ValueError("Task completed but created_resources or floatingips is missing")
@@ -982,6 +988,7 @@ async def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1007,6 +1014,7 @@ async def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py
index da31d27c..932484d9 100644
--- a/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py
+++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py
@@ -635,6 +635,7 @@ def create_and_poll(
servers_settings: gpu_baremetal_cluster_create_params.ServersSettings,
tags: Dict[str, str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -667,6 +668,7 @@ def create_and_poll(
extra_query=extra_query,
extra_body=extra_body,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.ai_clusters:
raise ValueError("No cluster was created")
@@ -691,6 +693,7 @@ def rebuild_and_poll(
image_id: Optional[str] | Omit = omit,
user_data: Optional[str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -721,6 +724,7 @@ def rebuild_and_poll(
extra_query=extra_query,
extra_body=extra_body,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return self.get( # pyright: ignore[reportDeprecated]
cluster_id=cluster_id,
@@ -740,6 +744,7 @@ def resize_and_poll(
region_id: int | None = None,
instances_count: int,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -768,6 +773,7 @@ def resize_and_poll(
extra_query=extra_query,
extra_body=extra_body,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return self.get( # pyright: ignore[reportDeprecated]
cluster_id=cluster_id,
@@ -1348,6 +1354,7 @@ async def create_and_poll(
servers_settings: gpu_baremetal_cluster_create_params.ServersSettings,
tags: Dict[str, str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -1380,6 +1387,7 @@ async def create_and_poll(
extra_query=extra_query,
extra_body=extra_body,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.ai_clusters:
raise ValueError("No cluster was created")
@@ -1404,6 +1412,7 @@ async def rebuild_and_poll(
image_id: Optional[str] | Omit = omit,
user_data: Optional[str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -1434,6 +1443,7 @@ async def rebuild_and_poll(
extra_query=extra_query,
extra_body=extra_body,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return await self.get( # pyright: ignore[reportDeprecated]
cluster_id=cluster_id,
@@ -1453,6 +1463,7 @@ async def resize_and_poll(
region_id: int | None = None,
instances_count: int,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -1481,6 +1492,7 @@ async def resize_and_poll(
extra_query=extra_query,
extra_body=extra_body,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return await self.get( # pyright: ignore[reportDeprecated]
cluster_id=cluster_id,
diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py
index 7b550f98..fe8c6f81 100644
--- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py
+++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py
@@ -138,6 +138,7 @@ def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -165,6 +166,7 @@ def delete_and_poll(
extra_query=extra_query,
extra_body=extra_body,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
def get(
@@ -318,6 +320,7 @@ def upload_and_poll(
ssh_key: Literal["allow", "deny", "required"] | Omit = omit,
tags: Dict[str, str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -354,6 +357,7 @@ def upload_and_poll(
extra_query=extra_query,
extra_body=extra_body,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.images:
raise ValueError("No image was created")
@@ -481,6 +485,7 @@ async def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -508,6 +513,7 @@ async def delete_and_poll(
extra_query=extra_query,
extra_body=extra_body,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
async def get(
@@ -661,6 +667,7 @@ async def upload_and_poll(
ssh_key: Literal["allow", "deny", "required"] | Omit = omit,
tags: Dict[str, str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -697,6 +704,7 @@ async def upload_and_poll(
extra_query=extra_query,
extra_body=extra_body,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.images:
raise ValueError("No image was created")
diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py
index cdbce6a7..f2771dff 100644
--- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py
+++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py
@@ -229,6 +229,7 @@ def delete_and_poll(
cluster_id: str,
delete_floatings: bool | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -258,6 +259,7 @@ def delete_and_poll(
extra_query=extra_query,
extra_body=extra_body,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
@overload
@@ -876,6 +878,7 @@ async def delete_and_poll(
cluster_id: str,
delete_floatings: bool | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -905,6 +908,7 @@ async def delete_and_poll(
extra_query=extra_query,
extra_body=extra_body,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
@overload
diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py
index 40f311ba..bc7b8132 100644
--- a/src/gcore/resources/cloud/inference/deployments/deployments.py
+++ b/src/gcore/resources/cloud/inference/deployments/deployments.py
@@ -580,6 +580,7 @@ def create_and_poll(
probes: Optional[deployment_create_params.Probes] | Omit = omit,
api_timeout: Optional[int] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -615,6 +616,7 @@ def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if (
not task.created_resources
@@ -649,6 +651,7 @@ def update_and_poll(
probes: Optional[deployment_update_params.Probes] | Omit = omit,
api_timeout: Optional[int] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -687,6 +690,7 @@ def update_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return self.get(
deployment_name=deployment_name,
@@ -701,6 +705,7 @@ def delete_and_poll(
*,
project_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -725,6 +730,7 @@ def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
@@ -1273,6 +1279,7 @@ async def create_and_poll(
probes: Optional[deployment_create_params.Probes] | Omit = omit,
api_timeout: Optional[int] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1308,6 +1315,7 @@ async def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if (
not task.created_resources
@@ -1342,6 +1350,7 @@ async def update_and_poll(
probes: Optional[deployment_update_params.Probes] | Omit = omit,
api_timeout: Optional[int] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1380,6 +1389,7 @@ async def update_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return await self.get(
deployment_name=deployment_name,
@@ -1394,6 +1404,7 @@ async def delete_and_poll(
*,
project_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1418,6 +1429,7 @@ async def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py
index e863821c..0932052b 100644
--- a/src/gcore/resources/cloud/instances/images.py
+++ b/src/gcore/resources/cloud/instances/images.py
@@ -244,6 +244,7 @@ def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -269,6 +270,7 @@ def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
def create_from_volume(
@@ -374,6 +376,7 @@ def create_from_volume_and_poll(
ssh_key: Literal["allow", "deny", "required"] | Omit = omit,
tags: Dict[str, str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -408,6 +411,7 @@ def create_from_volume_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.images or len(task.created_resources.images) != 1:
raise ValueError(f"Expected exactly one resource to be created in a task")
@@ -578,6 +582,7 @@ def upload_and_poll(
ssh_key: Literal["allow", "deny", "required"] | Omit = omit,
tags: Dict[str, str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -614,6 +619,7 @@ def upload_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.images or len(task.created_resources.images) != 1:
raise ValueError(f"Expected exactly one resource to be created in a task")
@@ -836,6 +842,7 @@ async def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -861,6 +868,7 @@ async def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
async def create_from_volume(
@@ -966,6 +974,7 @@ async def create_from_volume_and_poll(
ssh_key: Literal["allow", "deny", "required"] | Omit = omit,
tags: Dict[str, str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -1000,6 +1009,7 @@ async def create_from_volume_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.images or len(task.created_resources.images) != 1:
raise ValueError(f"Expected exactly one resource to be created in a task")
@@ -1170,6 +1180,7 @@ async def upload_and_poll(
ssh_key: Literal["allow", "deny", "required"] | Omit = omit,
tags: Dict[str, str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -1206,6 +1217,7 @@ async def upload_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.images or len(task.created_resources.images) != 1:
raise ValueError(f"Expected exactly one resource to be created in a task")
diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py
index 1519e9a5..170ad2d9 100644
--- a/src/gcore/resources/cloud/instances/instances.py
+++ b/src/gcore/resources/cloud/instances/instances.py
@@ -282,6 +282,7 @@ def create_and_poll(
user_data: str | Omit = omit,
username: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -318,6 +319,7 @@ def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if (
not task.created_resources
@@ -676,6 +678,7 @@ def delete_and_poll(
reserved_fixed_ips: str | Omit = omit,
volumes: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -705,6 +708,7 @@ def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
@overload
@@ -986,6 +990,7 @@ def add_to_placement_group_and_poll(
region_id: int | None = None,
servergroup_id: str,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -1012,6 +1017,7 @@ def add_to_placement_group_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return self.get(
instance_id=instance_id,
@@ -1306,6 +1312,7 @@ def remove_from_placement_group_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -1331,6 +1338,7 @@ def remove_from_placement_group_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return self.get(
instance_id=instance_id,
@@ -1390,6 +1398,7 @@ def resize_and_poll(
region_id: int | None = None,
flavor_id: str,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -1416,6 +1425,7 @@ def resize_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return self.get(
instance_id=instance_id,
@@ -1690,6 +1700,7 @@ async def create_and_poll(
user_data: str | Omit = omit,
username: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -1726,6 +1737,7 @@ async def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if (
not task.created_resources
@@ -2084,6 +2096,7 @@ async def delete_and_poll(
reserved_fixed_ips: str | Omit = omit,
volumes: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -2113,6 +2126,7 @@ async def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
@overload
@@ -2394,6 +2408,7 @@ async def add_to_placement_group_and_poll(
region_id: int | None = None,
servergroup_id: str,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -2420,6 +2435,7 @@ async def add_to_placement_group_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return await self.get(
instance_id=instance_id,
@@ -2714,6 +2730,7 @@ async def remove_from_placement_group_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -2739,6 +2756,7 @@ async def remove_from_placement_group_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return await self.get(
instance_id=instance_id,
@@ -2798,6 +2816,7 @@ async def resize_and_poll(
region_id: int | None = None,
flavor_id: str,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -2824,6 +2843,7 @@ async def resize_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return await self.get(
instance_id=instance_id,
diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py
index 8336732b..98ef5ec9 100644
--- a/src/gcore/resources/cloud/instances/interfaces.py
+++ b/src/gcore/resources/cloud/instances/interfaces.py
@@ -540,6 +540,7 @@ def attach_and_poll(
network_id: str | Omit = omit,
port_id: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -580,6 +581,7 @@ def attach_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return self.list(instance_id, project_id=project_id, region_id=region_id, extra_headers=extra_headers)
@@ -592,6 +594,7 @@ def detach_and_poll(
ip_address: str,
port_id: str,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -620,6 +623,7 @@ def detach_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return self.list(instance_id, project_id=project_id, region_id=region_id, extra_headers=extra_headers)
@@ -997,6 +1001,7 @@ async def attach_and_poll(
| Omit = omit,
type: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -1025,6 +1030,7 @@ async def attach_and_poll(
| Omit = omit,
type: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -1054,6 +1060,7 @@ async def attach_and_poll(
| Omit = omit,
type: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -1082,6 +1089,7 @@ async def attach_and_poll(
| Omit = omit,
type: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -1113,6 +1121,7 @@ async def attach_and_poll(
network_id: str | Omit = omit,
port_id: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -1153,6 +1162,7 @@ async def attach_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return await self.list(instance_id, project_id=project_id, region_id=region_id, extra_headers=extra_headers)
@@ -1165,6 +1175,7 @@ async def detach_and_poll(
ip_address: str,
port_id: str,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -1193,6 +1204,7 @@ async def detach_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return await self.list(instance_id, project_id=project_id, region_id=region_id, extra_headers=extra_headers)
diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py
index 135534b2..79c839a3 100644
--- a/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py
+++ b/src/gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py
@@ -349,6 +349,7 @@ def create_and_poll(
redirect_url: str | Omit = omit,
tags: SequenceNotStr[str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -379,6 +380,7 @@ def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if (
not task.created_resources
@@ -401,6 +403,7 @@ def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -423,6 +426,7 @@ def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
def replace_and_poll(
@@ -440,6 +444,7 @@ def replace_and_poll(
redirect_url: str | Omit = omit,
tags: SequenceNotStr[str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -470,6 +475,7 @@ def replace_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return self.get(
l7policy_id=l7policy_id,
@@ -796,6 +802,7 @@ async def create_and_poll(
redirect_url: str | Omit = omit,
tags: SequenceNotStr[str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -826,6 +833,7 @@ async def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if (
not task.created_resources
@@ -848,6 +856,7 @@ async def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -870,6 +879,7 @@ async def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
async def replace_and_poll(
@@ -887,6 +897,7 @@ async def replace_and_poll(
redirect_url: str | Omit = omit,
tags: SequenceNotStr[str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -917,6 +928,7 @@ async def replace_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return await self.get(
l7policy_id=l7policy_id,
diff --git a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py
index 023faf7a..c6a33549 100644
--- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py
+++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py
@@ -352,6 +352,7 @@ def create_and_poll(
key: str | Omit = omit,
tags: SequenceNotStr[str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -380,6 +381,7 @@ def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.l7rules or len(task.created_resources.l7rules) != 1:
raise ValueError(f"Expected exactly one resource to be created in a task")
@@ -400,6 +402,7 @@ def delete_and_poll(
region_id: int | None = None,
l7policy_id: str,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -426,6 +429,7 @@ def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
def replace_and_poll(
@@ -451,6 +455,7 @@ def replace_and_poll(
key: str | Omit = omit,
tags: SequenceNotStr[str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -483,6 +488,7 @@ def replace_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return self.get(
l7rule_id=l7rule_id,
@@ -821,6 +827,7 @@ async def create_and_poll(
key: str | Omit = omit,
tags: SequenceNotStr[str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -849,6 +856,7 @@ async def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.l7rules or len(task.created_resources.l7rules) != 1:
raise ValueError(f"Expected exactly one resource to be created in a task")
@@ -869,6 +877,7 @@ async def delete_and_poll(
region_id: int | None = None,
l7policy_id: str,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -895,6 +904,7 @@ async def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
async def replace_and_poll(
@@ -920,6 +930,7 @@ async def replace_and_poll(
key: str | Omit = omit,
tags: SequenceNotStr[str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -952,6 +963,7 @@ async def replace_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return await self.get(
l7rule_id=l7rule_id,
diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py
index 74f33849..0a831988 100644
--- a/src/gcore/resources/cloud/load_balancers/listeners.py
+++ b/src/gcore/resources/cloud/load_balancers/listeners.py
@@ -412,6 +412,7 @@ def create_and_poll(
timeout_member_data: Optional[int] | Omit = omit,
user_list: Iterable[listener_create_params.UserList] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -446,6 +447,7 @@ def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if (
not task.created_resources
@@ -468,6 +470,7 @@ def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -493,6 +496,7 @@ def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
def update_and_poll(
@@ -511,6 +515,7 @@ def update_and_poll(
timeout_member_data: Optional[int] | Omit = omit,
user_list: Optional[Iterable[listener_update_params.UserList]] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -545,6 +550,7 @@ def update_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return self.get(
listener_id=listener_id,
@@ -935,6 +941,7 @@ async def create_and_poll(
timeout_member_data: Optional[int] | Omit = omit,
user_list: Iterable[listener_create_params.UserList] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -969,6 +976,7 @@ async def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if (
not task.created_resources
@@ -991,6 +999,7 @@ async def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1016,6 +1025,7 @@ async def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
async def update_and_poll(
@@ -1034,6 +1044,7 @@ async def update_and_poll(
timeout_member_data: Optional[int] | Omit = omit,
user_list: Optional[Iterable[listener_update_params.UserList]] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1068,6 +1079,7 @@ async def update_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return await self.get(
listener_id=listener_id,
diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py
index 1c896b10..905aef54 100644
--- a/src/gcore/resources/cloud/load_balancers/load_balancers.py
+++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py
@@ -421,6 +421,7 @@ def create_and_poll(
vip_port_id: str | Omit = omit,
vip_subnet_id: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -454,6 +455,7 @@ def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if (
not task.created_resources
@@ -476,6 +478,7 @@ def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -501,6 +504,7 @@ def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
def failover_and_poll(
@@ -511,6 +515,7 @@ def failover_and_poll(
region_id: int | None = None,
force: bool | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -537,6 +542,7 @@ def failover_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return self.get(
load_balancer_id=load_balancer_id,
@@ -554,6 +560,7 @@ def resize_and_poll(
region_id: int | None = None,
flavor: str,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -580,6 +587,7 @@ def resize_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return self.get(
load_balancer_id=load_balancer_id,
@@ -1106,6 +1114,7 @@ async def create_and_poll(
vip_port_id: str | Omit = omit,
vip_subnet_id: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1139,6 +1148,7 @@ async def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if (
not task.created_resources
@@ -1161,6 +1171,7 @@ async def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1186,6 +1197,7 @@ async def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
async def failover_and_poll(
@@ -1196,6 +1208,7 @@ async def failover_and_poll(
region_id: int | None = None,
force: bool | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1222,6 +1235,7 @@ async def failover_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return await self.get(
load_balancer_id=load_balancer_id,
@@ -1239,6 +1253,7 @@ async def resize_and_poll(
region_id: int | None = None,
flavor: str,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1265,6 +1280,7 @@ async def resize_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return await self.get(
load_balancer_id=load_balancer_id,
diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py
index 7d438e05..3d61764f 100644
--- a/src/gcore/resources/cloud/load_balancers/pools/pools.py
+++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py
@@ -459,6 +459,7 @@ def create_and_poll(
timeout_member_connect: Optional[int] | Omit = omit,
timeout_member_data: Optional[int] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -494,6 +495,7 @@ def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.pools or len(task.created_resources.pools) != 1:
raise ValueError(f"Expected exactly one resource to be created in a task")
@@ -512,6 +514,7 @@ def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -537,6 +540,7 @@ def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
def update_and_poll(
@@ -558,6 +562,7 @@ def update_and_poll(
timeout_member_connect: Optional[int] | Omit = omit,
timeout_member_data: Optional[int] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -595,6 +600,7 @@ def update_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return self.get(
pool_id=pool_id,
@@ -1020,6 +1026,7 @@ async def create_and_poll(
timeout_member_connect: Optional[int] | Omit = omit,
timeout_member_data: Optional[int] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1055,6 +1062,7 @@ async def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.pools or len(task.created_resources.pools) != 1:
raise ValueError(f"Expected exactly one resource to be created in a task")
@@ -1073,6 +1081,7 @@ async def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1098,6 +1107,7 @@ async def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
async def update_and_poll(
@@ -1119,6 +1129,7 @@ async def update_and_poll(
timeout_member_connect: Optional[int] | Omit = omit,
timeout_member_data: Optional[int] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1156,6 +1167,7 @@ async def update_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return await self.get(
pool_id=pool_id,
diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py
index d2a7615a..715bdb23 100644
--- a/src/gcore/resources/cloud/networks/networks.py
+++ b/src/gcore/resources/cloud/networks/networks.py
@@ -146,6 +146,7 @@ def create_and_poll(
tags: Dict[str, str] | Omit = omit,
type: Literal["vlan", "vxlan"] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -172,6 +173,7 @@ def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if (
not task.created_resources
@@ -394,6 +396,7 @@ def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -417,6 +420,7 @@ def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
def get(
@@ -568,6 +572,7 @@ async def create_and_poll(
tags: Dict[str, str] | Omit = omit,
type: Literal["vlan", "vxlan"] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -594,6 +599,7 @@ async def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if (
not task.created_resources
@@ -816,6 +822,7 @@ async def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -839,6 +846,7 @@ async def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
async def get(
diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py
index 4d24d7e2..ce14818d 100644
--- a/src/gcore/resources/cloud/networks/subnets.py
+++ b/src/gcore/resources/cloud/networks/subnets.py
@@ -165,6 +165,7 @@ def create_and_poll(
router_id_to_connect: Optional[str] | Omit = omit,
tags: Dict[str, str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -198,6 +199,7 @@ def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.subnets or len(task.created_resources.subnets) != 1:
raise ValueError(f"Expected exactly one resource to be created in a task")
@@ -622,6 +624,7 @@ async def create_and_poll(
router_id_to_connect: Optional[str] | Omit = omit,
tags: Dict[str, str] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -655,6 +658,7 @@ async def create_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.subnets or len(task.created_resources.subnets) != 1:
raise ValueError(f"Expected exactly one resource to be created in a task")
diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py
index bb5119c8..243dd294 100644
--- a/src/gcore/resources/cloud/placement_groups.py
+++ b/src/gcore/resources/cloud/placement_groups.py
@@ -26,6 +26,10 @@
class PlacementGroupsResource(SyncAPIResource):
+ """
+ Placement Groups allow you to specific a policy that determines whether Virtual Machines will be hosted on the same physical server or on different ones.
+ """
+
@cached_property
def with_raw_response(self) -> PlacementGroupsResourceWithRawResponse:
"""
@@ -210,6 +214,10 @@ def get(
class AsyncPlacementGroupsResource(AsyncAPIResource):
+ """
+ Placement Groups allow you to specific a policy that determines whether Virtual Machines will be hosted on the same physical server or on different ones.
+ """
+
@cached_property
def with_raw_response(self) -> AsyncPlacementGroupsResourceWithRawResponse:
"""
diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py
index cb6c69b4..2e5ae929 100644
--- a/src/gcore/resources/cloud/projects.py
+++ b/src/gcore/resources/cloud/projects.py
@@ -18,7 +18,7 @@
async_to_streamed_response_wrapper,
)
from ...pagination import SyncOffsetPage, AsyncOffsetPage
-from ...types.cloud import project_list_params, project_create_params, project_replace_params
+from ...types.cloud import project_list_params, project_create_params, project_update_params
from ..._base_client import AsyncPaginator, make_request_options
from ...types.cloud.project import Project
from ...types.cloud.task_id_list import TaskIDList
@@ -99,6 +99,54 @@ def create(
cast_to=Project,
)
+ def update(
+ self,
+ *,
+ project_id: int | None = None,
+ name: str,
+ description: Optional[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,
+ ) -> Project:
+ """Update project name and description.
+
+ Project management must be enabled to
+ perform this operation.
+
+ Args:
+ name: Name of the entity, following a specific format.
+
+ description: Description of the project.
+
+ 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()
+ return self._put(
+ f"/cloud/v1/projects/{project_id}",
+ body=maybe_transform(
+ {
+ "name": name,
+ "description": description,
+ },
+ project_update_params.ProjectUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=Project,
+ )
+
def list(
self,
*,
@@ -233,54 +281,6 @@ def get(
cast_to=Project,
)
- def replace(
- self,
- *,
- project_id: int | None = None,
- name: str,
- description: Optional[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,
- ) -> Project:
- """Update project name and description.
-
- Project management must be enabled to
- perform this operation.
-
- Args:
- name: Name of the entity, following a specific format.
-
- description: Description of the project.
-
- 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()
- return self._put(
- f"/cloud/v1/projects/{project_id}",
- body=maybe_transform(
- {
- "name": name,
- "description": description,
- },
- project_replace_params.ProjectReplaceParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=Project,
- )
-
class AsyncProjectsResource(AsyncAPIResource):
@cached_property
@@ -355,6 +355,54 @@ async def create(
cast_to=Project,
)
+ async def update(
+ self,
+ *,
+ project_id: int | None = None,
+ name: str,
+ description: Optional[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,
+ ) -> Project:
+ """Update project name and description.
+
+ Project management must be enabled to
+ perform this operation.
+
+ Args:
+ name: Name of the entity, following a specific format.
+
+ description: Description of the project.
+
+ 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()
+ return await self._put(
+ f"/cloud/v1/projects/{project_id}",
+ body=await async_maybe_transform(
+ {
+ "name": name,
+ "description": description,
+ },
+ project_update_params.ProjectUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=Project,
+ )
+
def list(
self,
*,
@@ -489,54 +537,6 @@ async def get(
cast_to=Project,
)
- async def replace(
- self,
- *,
- project_id: int | None = None,
- name: str,
- description: Optional[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,
- ) -> Project:
- """Update project name and description.
-
- Project management must be enabled to
- perform this operation.
-
- Args:
- name: Name of the entity, following a specific format.
-
- description: Description of the project.
-
- 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()
- return await self._put(
- f"/cloud/v1/projects/{project_id}",
- body=await async_maybe_transform(
- {
- "name": name,
- "description": description,
- },
- project_replace_params.ProjectReplaceParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=Project,
- )
-
class ProjectsResourceWithRawResponse:
def __init__(self, projects: ProjectsResource) -> None:
@@ -545,6 +545,9 @@ def __init__(self, projects: ProjectsResource) -> None:
self.create = to_raw_response_wrapper(
projects.create,
)
+ self.update = to_raw_response_wrapper(
+ projects.update,
+ )
self.list = to_raw_response_wrapper(
projects.list,
)
@@ -554,9 +557,6 @@ def __init__(self, projects: ProjectsResource) -> None:
self.get = to_raw_response_wrapper(
projects.get,
)
- self.replace = to_raw_response_wrapper(
- projects.replace,
- )
class AsyncProjectsResourceWithRawResponse:
@@ -566,6 +566,9 @@ def __init__(self, projects: AsyncProjectsResource) -> None:
self.create = async_to_raw_response_wrapper(
projects.create,
)
+ self.update = async_to_raw_response_wrapper(
+ projects.update,
+ )
self.list = async_to_raw_response_wrapper(
projects.list,
)
@@ -575,9 +578,6 @@ def __init__(self, projects: AsyncProjectsResource) -> None:
self.get = async_to_raw_response_wrapper(
projects.get,
)
- self.replace = async_to_raw_response_wrapper(
- projects.replace,
- )
class ProjectsResourceWithStreamingResponse:
@@ -587,6 +587,9 @@ def __init__(self, projects: ProjectsResource) -> None:
self.create = to_streamed_response_wrapper(
projects.create,
)
+ self.update = to_streamed_response_wrapper(
+ projects.update,
+ )
self.list = to_streamed_response_wrapper(
projects.list,
)
@@ -596,9 +599,6 @@ def __init__(self, projects: ProjectsResource) -> None:
self.get = to_streamed_response_wrapper(
projects.get,
)
- self.replace = to_streamed_response_wrapper(
- projects.replace,
- )
class AsyncProjectsResourceWithStreamingResponse:
@@ -608,6 +608,9 @@ def __init__(self, projects: AsyncProjectsResource) -> None:
self.create = async_to_streamed_response_wrapper(
projects.create,
)
+ self.update = async_to_streamed_response_wrapper(
+ projects.update,
+ )
self.list = async_to_streamed_response_wrapper(
projects.list,
)
@@ -617,6 +620,3 @@ def __init__(self, projects: AsyncProjectsResource) -> None:
self.get = async_to_streamed_response_wrapper(
projects.get,
)
- self.replace = async_to_streamed_response_wrapper(
- projects.replace,
- )
diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py
index 03ba48ab..7651922c 100644
--- a/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py
+++ b/src/gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py
@@ -513,6 +513,7 @@ def create_and_poll(
ip_family: Optional[InterfaceIPFamily] | Omit = omit,
is_vip: bool | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -550,6 +551,7 @@ def create_and_poll(
type: Literal["subnet"],
is_vip: bool | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -588,6 +590,7 @@ def create_and_poll(
ip_family: Optional[InterfaceIPFamily] | Omit = omit,
is_vip: bool | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -628,6 +631,7 @@ def create_and_poll(
type: Literal["ip_address"],
is_vip: bool | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -666,6 +670,7 @@ def create_and_poll(
port_id: str,
type: Literal["port"],
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -712,6 +717,7 @@ def create_and_poll(
ip_address: str | Omit = omit,
port_id: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -743,6 +749,7 @@ def create_and_poll(
task_id=response.tasks[0], # type: ignore
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if (
task.created_resources is None
@@ -768,6 +775,7 @@ def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -793,6 +801,7 @@ def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
@@ -1271,6 +1280,7 @@ async def create_and_poll(
ip_family: Optional[InterfaceIPFamily] | Omit = omit,
is_vip: bool | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1308,6 +1318,7 @@ async def create_and_poll(
type: Literal["subnet"],
is_vip: bool | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1346,6 +1357,7 @@ async def create_and_poll(
ip_family: Optional[InterfaceIPFamily] | Omit = omit,
is_vip: bool | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1386,6 +1398,7 @@ async def create_and_poll(
type: Literal["ip_address"],
is_vip: bool | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1424,6 +1437,7 @@ async def create_and_poll(
port_id: str,
type: Literal["port"],
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1470,6 +1484,7 @@ async def create_and_poll(
ip_address: str | Omit = omit,
port_id: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1501,6 +1516,7 @@ async def create_and_poll(
task_id=response.tasks[0], # type: ignore
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if (
task.created_resources is None
@@ -1526,6 +1542,7 @@ async def delete_and_poll(
project_id: int | None = None,
region_id: int | None = None,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1551,6 +1568,7 @@ async def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py
index 9c2020f1..9a6fed1d 100644
--- a/src/gcore/resources/cloud/secrets.py
+++ b/src/gcore/resources/cloud/secrets.py
@@ -260,6 +260,7 @@ def upload_tls_certificate_and_poll(
payload: secret_upload_tls_certificate_params.Payload,
expiration: Union[str, datetime, None] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -282,6 +283,7 @@ def upload_tls_certificate_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.secrets or len(task.created_resources.secrets) != 1:
raise ValueError(f"Expected exactly one resource to be created in a task")
@@ -527,6 +529,7 @@ async def upload_tls_certificate_and_poll(
payload: secret_upload_tls_certificate_params.Payload,
expiration: Union[str, datetime, None] | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -549,6 +552,7 @@ async def upload_tls_certificate_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if not task.created_resources or not task.created_resources.secrets or len(task.created_resources.secrets) != 1:
raise ValueError(f"Expected exactly one resource to be created in a task")
diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py
index adc8ff24..f7cb9972 100644
--- a/src/gcore/resources/cloud/tasks.py
+++ b/src/gcore/resources/cloud/tasks.py
@@ -20,7 +20,6 @@
async_to_streamed_response_wrapper,
)
from ...pagination import SyncOffsetPage, AsyncOffsetPage
-from ...lib.polling import extract_timeout_value
from ...types.cloud import task_list_params, task_acknowledge_all_params
from ..._base_client import AsyncPaginator, make_request_options
from ...types.cloud.task import Task
@@ -53,6 +52,7 @@ def poll(
task_id: str,
*,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -65,16 +65,22 @@ def poll(
# Ensure the polling interval is at least 1 second
polling_interval_seconds = max(1, polling_interval_seconds)
- if not is_given(timeout):
- timeout = extract_timeout_value(self._client.timeout)
+ if not is_given(polling_timeout_seconds):
+ polling_timeout_seconds = cast(int, self._client.cloud_polling_timeout_seconds)
- end_time = time.time() + timeout
+ if polling_timeout_seconds <= polling_interval_seconds:
+ raise ValueError(
+ f"`polling_timeout_seconds` must be greater than `polling_interval_seconds` ({polling_interval_seconds})"
+ )
+
+ end_time = time.time() + polling_timeout_seconds
while time.time() <= end_time:
task = self.get(
task_id,
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
+ timeout=timeout,
)
if task.state == "ERROR":
raise ValueError(task.error or f"Task {task_id} failed")
@@ -364,6 +370,7 @@ async def poll(
task_id: str,
*,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | 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,
@@ -373,17 +380,25 @@ async def poll(
) -> Task:
if not is_given(polling_interval_seconds):
polling_interval_seconds = cast(int, self._client.cloud_polling_interval_seconds)
+ # Ensure the polling interval is at least 1 second
+ polling_interval_seconds = max(1, polling_interval_seconds)
+
+ if not is_given(polling_timeout_seconds):
+ polling_timeout_seconds = cast(int, self._client.cloud_polling_timeout_seconds)
- if not is_given(timeout):
- timeout = extract_timeout_value(self._client.timeout)
+ if polling_timeout_seconds <= polling_interval_seconds:
+ raise ValueError(
+ f"`polling_timeout_seconds` must be greater than `polling_interval_seconds` ({polling_interval_seconds})"
+ )
- end_time = time.time() + timeout
+ end_time = time.time() + polling_timeout_seconds
while time.time() <= end_time:
task = await self.get(
task_id,
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
+ timeout=timeout,
)
if task.state == "ERROR":
raise ValueError(task.error or f"Task {task_id} failed")
diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py
index b1b577eb..0c22d025 100644
--- a/src/gcore/resources/cloud/volumes.py
+++ b/src/gcore/resources/cloud/volumes.py
@@ -859,6 +859,7 @@ def create_and_poll(
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
| Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -929,6 +930,7 @@ def create_and_poll(
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
| Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -999,6 +1001,7 @@ def create_and_poll(
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
| Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1070,6 +1073,7 @@ def create_and_poll(
| Omit = omit,
snapshot_id: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1102,6 +1106,7 @@ def create_and_poll(
task_id=response.tasks[0], # type: ignore
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if task.created_resources is None or task.created_resources.volumes is None or len(task.created_resources.volumes) != 1:
raise ValueError("Task completed but created_resources or volumes is missing or invalid")
@@ -1124,6 +1129,7 @@ def delete_and_poll(
region_id: int | None = None,
snapshots: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1148,6 +1154,7 @@ def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
def attach_to_instance_and_poll(
@@ -1159,6 +1166,7 @@ def attach_to_instance_and_poll(
instance_id: str,
attachment_tag: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1184,6 +1192,7 @@ def attach_to_instance_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
def detach_from_instance_and_poll(
@@ -1194,6 +1203,7 @@ def detach_from_instance_and_poll(
region_id: int | None = None,
instance_id: str,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1218,6 +1228,7 @@ def detach_from_instance_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
def resize_and_poll(
@@ -1228,6 +1239,7 @@ def resize_and_poll(
region_id: int | None = None,
size: int,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -1252,6 +1264,7 @@ def resize_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return self.get(
volume_id=volume_id,
@@ -2089,6 +2102,7 @@ async def create_and_poll(
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
| Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -2159,6 +2173,7 @@ async def create_and_poll(
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
| Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -2229,6 +2244,7 @@ async def create_and_poll(
type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]
| Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -2300,6 +2316,7 @@ async def create_and_poll(
| Omit = omit,
snapshot_id: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -2328,10 +2345,11 @@ async def create_and_poll(
)
if not response.tasks: # type: ignore
raise ValueError("Expected at least one task to be created")
- task = await self._client.cloud.tasks.poll(
+ task = await self._client.cloud.tasks.poll(
task_id=response.tasks[0], # type: ignore
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
if task.created_resources is None or task.created_resources.volumes is None or len(task.created_resources.volumes) != 1:
raise ValueError("Task completed but created_resources or volumes is missing or invalid")
@@ -2354,6 +2372,7 @@ async def delete_and_poll(
region_id: int | None = None,
snapshots: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -2378,6 +2397,7 @@ async def delete_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
async def attach_to_instance_and_poll(
@@ -2389,6 +2409,7 @@ async def attach_to_instance_and_poll(
instance_id: str,
attachment_tag: str | Omit = omit,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -2414,6 +2435,7 @@ async def attach_to_instance_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
async def detach_from_instance_and_poll(
@@ -2424,6 +2446,7 @@ async def detach_from_instance_and_poll(
region_id: int | None = None,
instance_id: str,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -2448,6 +2471,7 @@ async def detach_from_instance_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
async def resize_and_poll(
@@ -2458,6 +2482,7 @@ async def resize_and_poll(
region_id: int | None = None,
size: int,
polling_interval_seconds: int | Omit = omit,
+ polling_timeout_seconds: int | Omit = omit,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
# 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.
@@ -2482,6 +2507,7 @@ async def resize_and_poll(
task_id=response.tasks[0],
extra_headers=extra_headers,
polling_interval_seconds=polling_interval_seconds,
+ polling_timeout_seconds=polling_timeout_seconds,
)
return await self.get(
volume_id=volume_id,
diff --git a/src/gcore/types/cdn/__init__.py b/src/gcore/types/cdn/__init__.py
index 66a8669b..ebb15cf3 100644
--- a/src/gcore/types/cdn/__init__.py
+++ b/src/gcore/types/cdn/__init__.py
@@ -3,6 +3,7 @@
from __future__ import annotations
from .ssl_detail import SslDetail as SslDetail
+from .aws_regions import AwsRegions as AwsRegions
from .cdn_account import CdnAccount as CdnAccount
from .cdn_metrics import CdnMetrics as CdnMetrics
from .cdn_resource import CdnResource as CdnResource
@@ -12,6 +13,7 @@
from .rule_template import RuleTemplate as RuleTemplate
from .ca_certificate import CaCertificate as CaCertificate
from .public_ip_list import PublicIPList as PublicIPList
+from .alibaba_regions import AlibabaRegions as AlibabaRegions
from .log_list_params import LogListParams as LogListParams
from .ssl_detail_list import SslDetailList as SslDetailList
from .network_capacity import NetworkCapacity as NetworkCapacity
@@ -55,6 +57,7 @@
from .rule_template_replace_params import RuleTemplateReplaceParams as RuleTemplateReplaceParams
from .certificate_get_status_params import CertificateGetStatusParams as CertificateGetStatusParams
from .cdn_list_purge_statuses_params import CdnListPurgeStatusesParams as CdnListPurgeStatusesParams
+from .cdn_list_purge_statuses_response import CdnListPurgeStatusesResponse as CdnListPurgeStatusesResponse
from .trusted_ca_certificate_list_params import TrustedCaCertificateListParams as TrustedCaCertificateListParams
from .trusted_ca_certificate_create_params import TrustedCaCertificateCreateParams as TrustedCaCertificateCreateParams
from .trusted_ca_certificate_replace_params import (
diff --git a/src/gcore/types/cdn/alibaba_regions.py b/src/gcore/types/cdn/alibaba_regions.py
new file mode 100644
index 00000000..8be22234
--- /dev/null
+++ b/src/gcore/types/cdn/alibaba_regions.py
@@ -0,0 +1,22 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+from typing_extensions import TypeAlias
+
+from ..._models import BaseModel
+
+__all__ = ["AlibabaRegions", "AlibabaRegionItem"]
+
+
+class AlibabaRegionItem(BaseModel):
+ id: Optional[int] = None
+ """Region ID."""
+
+ code: Optional[str] = None
+ """Region code."""
+
+ name: Optional[str] = None
+ """Region name."""
+
+
+AlibabaRegions: TypeAlias = List[AlibabaRegionItem]
diff --git a/src/gcore/types/cdn/aws_regions.py b/src/gcore/types/cdn/aws_regions.py
new file mode 100644
index 00000000..0dccf9b9
--- /dev/null
+++ b/src/gcore/types/cdn/aws_regions.py
@@ -0,0 +1,22 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+from typing_extensions import TypeAlias
+
+from ..._models import BaseModel
+
+__all__ = ["AwsRegions", "AwsRegionItem"]
+
+
+class AwsRegionItem(BaseModel):
+ id: Optional[int] = None
+ """Region ID."""
+
+ code: Optional[str] = None
+ """Region code."""
+
+ name: Optional[str] = None
+ """Region name."""
+
+
+AwsRegions: TypeAlias = List[AwsRegionItem]
diff --git a/src/gcore/types/cdn/cdn_list_purge_statuses_response.py b/src/gcore/types/cdn/cdn_list_purge_statuses_response.py
new file mode 100644
index 00000000..1dec8100
--- /dev/null
+++ b/src/gcore/types/cdn/cdn_list_purge_statuses_response.py
@@ -0,0 +1,10 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List
+from typing_extensions import TypeAlias
+
+from .purge_status import PurgeStatus
+
+__all__ = ["CdnListPurgeStatusesResponse"]
+
+CdnListPurgeStatusesResponse: TypeAlias = List[PurgeStatus]
diff --git a/src/gcore/types/cdn/cdn_resource.py b/src/gcore/types/cdn/cdn_resource.py
index 6b897448..dd05e44f 100644
--- a/src/gcore/types/cdn/cdn_resource.py
+++ b/src/gcore/types/cdn/cdn_resource.py
@@ -1189,7 +1189,7 @@ class OptionsStaticHeaders(BaseModel):
- **false** - Option is disabled.
"""
- value: Dict[str, str]
+ value: object
"""A MAP for static headers in a format of `header_name: header_value`.
Restrictions:
diff --git a/src/gcore/types/cdn/logs/__init__.py b/src/gcore/types/cdn/logs/__init__.py
deleted file mode 100644
index f8ee8b14..00000000
--- a/src/gcore/types/cdn/logs/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
diff --git a/src/gcore/types/cdn/resource_create_params.py b/src/gcore/types/cdn/resource_create_params.py
index 544e6f4a..f31367c0 100644
--- a/src/gcore/types/cdn/resource_create_params.py
+++ b/src/gcore/types/cdn/resource_create_params.py
@@ -1310,7 +1310,7 @@ class OptionsStaticHeaders(TypedDict, total=False):
- **false** - Option is disabled.
"""
- value: Required[Dict[str, str]]
+ value: Required[object]
"""A MAP for static headers in a format of `header_name: header_value`.
Restrictions:
diff --git a/src/gcore/types/cdn/resource_replace_params.py b/src/gcore/types/cdn/resource_replace_params.py
index 938b1f96..717114a4 100644
--- a/src/gcore/types/cdn/resource_replace_params.py
+++ b/src/gcore/types/cdn/resource_replace_params.py
@@ -1288,7 +1288,7 @@ class OptionsStaticHeaders(TypedDict, total=False):
- **false** - Option is disabled.
"""
- value: Required[Dict[str, str]]
+ value: Required[object]
"""A MAP for static headers in a format of `header_name: header_value`.
Restrictions:
diff --git a/src/gcore/types/cdn/resource_update_params.py b/src/gcore/types/cdn/resource_update_params.py
index 6ee27ee0..d980ad8c 100644
--- a/src/gcore/types/cdn/resource_update_params.py
+++ b/src/gcore/types/cdn/resource_update_params.py
@@ -1279,7 +1279,7 @@ class OptionsStaticHeaders(TypedDict, total=False):
- **false** - Option is disabled.
"""
- value: Required[Dict[str, str]]
+ value: Required[object]
"""A MAP for static headers in a format of `header_name: header_value`.
Restrictions:
diff --git a/src/gcore/types/cdn/resources/cdn_resource_rule.py b/src/gcore/types/cdn/resources/cdn_resource_rule.py
index 4975c21d..28dc2ebf 100644
--- a/src/gcore/types/cdn/resources/cdn_resource_rule.py
+++ b/src/gcore/types/cdn/resources/cdn_resource_rule.py
@@ -1166,7 +1166,7 @@ class OptionsStaticHeaders(BaseModel):
- **false** - Option is disabled.
"""
- value: Dict[str, str]
+ value: object
"""A MAP for static headers in a format of `header_name: header_value`.
Restrictions:
diff --git a/src/gcore/types/cdn/resources/rule_create_params.py b/src/gcore/types/cdn/resources/rule_create_params.py
index 1f1c269f..6c8ab837 100644
--- a/src/gcore/types/cdn/resources/rule_create_params.py
+++ b/src/gcore/types/cdn/resources/rule_create_params.py
@@ -1240,7 +1240,7 @@ class OptionsStaticHeaders(TypedDict, total=False):
- **false** - Option is disabled.
"""
- value: Required[Dict[str, str]]
+ value: Required[object]
"""A MAP for static headers in a format of `header_name: header_value`.
Restrictions:
diff --git a/src/gcore/types/cdn/resources/rule_replace_params.py b/src/gcore/types/cdn/resources/rule_replace_params.py
index 63da2423..6eb3eddc 100644
--- a/src/gcore/types/cdn/resources/rule_replace_params.py
+++ b/src/gcore/types/cdn/resources/rule_replace_params.py
@@ -1242,7 +1242,7 @@ class OptionsStaticHeaders(TypedDict, total=False):
- **false** - Option is disabled.
"""
- value: Required[Dict[str, str]]
+ value: Required[object]
"""A MAP for static headers in a format of `header_name: header_value`.
Restrictions:
diff --git a/src/gcore/types/cdn/resources/rule_update_params.py b/src/gcore/types/cdn/resources/rule_update_params.py
index 6351104f..154c4cef 100644
--- a/src/gcore/types/cdn/resources/rule_update_params.py
+++ b/src/gcore/types/cdn/resources/rule_update_params.py
@@ -1242,7 +1242,7 @@ class OptionsStaticHeaders(TypedDict, total=False):
- **false** - Option is disabled.
"""
- value: Required[Dict[str, str]]
+ value: Required[object]
"""A MAP for static headers in a format of `header_name: header_value`.
Restrictions:
diff --git a/src/gcore/types/cdn/rule_template.py b/src/gcore/types/cdn/rule_template.py
index 4f13a6a2..6d73d4f4 100644
--- a/src/gcore/types/cdn/rule_template.py
+++ b/src/gcore/types/cdn/rule_template.py
@@ -1166,7 +1166,7 @@ class OptionsStaticHeaders(BaseModel):
- **false** - Option is disabled.
"""
- value: Dict[str, str]
+ value: object
"""A MAP for static headers in a format of `header_name: header_value`.
Restrictions:
diff --git a/src/gcore/types/cdn/rule_template_create_params.py b/src/gcore/types/cdn/rule_template_create_params.py
index 529ec2a3..a0e9ea73 100644
--- a/src/gcore/types/cdn/rule_template_create_params.py
+++ b/src/gcore/types/cdn/rule_template_create_params.py
@@ -1224,7 +1224,7 @@ class OptionsStaticHeaders(TypedDict, total=False):
- **false** - Option is disabled.
"""
- value: Required[Dict[str, str]]
+ value: Required[object]
"""A MAP for static headers in a format of `header_name: header_value`.
Restrictions:
diff --git a/src/gcore/types/cdn/rule_template_replace_params.py b/src/gcore/types/cdn/rule_template_replace_params.py
index ca412de2..683bd306 100644
--- a/src/gcore/types/cdn/rule_template_replace_params.py
+++ b/src/gcore/types/cdn/rule_template_replace_params.py
@@ -1224,7 +1224,7 @@ class OptionsStaticHeaders(TypedDict, total=False):
- **false** - Option is disabled.
"""
- value: Required[Dict[str, str]]
+ value: Required[object]
"""A MAP for static headers in a format of `header_name: header_value`.
Restrictions:
diff --git a/src/gcore/types/cdn/rule_template_update_params.py b/src/gcore/types/cdn/rule_template_update_params.py
index 685df7a4..c1e77142 100644
--- a/src/gcore/types/cdn/rule_template_update_params.py
+++ b/src/gcore/types/cdn/rule_template_update_params.py
@@ -1224,7 +1224,7 @@ class OptionsStaticHeaders(TypedDict, total=False):
- **false** - Option is disabled.
"""
- value: Required[Dict[str, str]]
+ value: Required[object]
"""A MAP for static headers in a format of `header_name: header_value`.
Restrictions:
diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py
index 2fd658ef..80b12b29 100644
--- a/src/gcore/types/cloud/__init__.py
+++ b/src/gcore/types/cloud/__init__.py
@@ -95,6 +95,7 @@
from .network_create_params import NetworkCreateParams as NetworkCreateParams
from .network_update_params import NetworkUpdateParams as NetworkUpdateParams
from .project_create_params import ProjectCreateParams as ProjectCreateParams
+from .project_update_params import ProjectUpdateParams as ProjectUpdateParams
from .ssh_key_create_params import SSHKeyCreateParams as SSHKeyCreateParams
from .ssh_key_update_params import SSHKeyUpdateParams as SSHKeyUpdateParams
from .cost_report_aggregated import CostReportAggregated as CostReportAggregated
@@ -106,7 +107,6 @@
from .instance_update_params import InstanceUpdateParams as InstanceUpdateParams
from .lb_health_monitor_type import LbHealthMonitorType as LbHealthMonitorType
from .network_interface_list import NetworkInterfaceList as NetworkInterfaceList
-from .project_replace_params import ProjectReplaceParams as ProjectReplaceParams
from .quota_get_all_response import QuotaGetAllResponse as QuotaGetAllResponse
from .registry_create_params import RegistryCreateParams as RegistryCreateParams
from .registry_resize_params import RegistryResizeParams as RegistryResizeParams
diff --git a/src/gcore/types/cloud/project_replace_params.py b/src/gcore/types/cloud/project_update_params.py
similarity index 81%
rename from src/gcore/types/cloud/project_replace_params.py
rename to src/gcore/types/cloud/project_update_params.py
index c26f1c6f..42489cb1 100644
--- a/src/gcore/types/cloud/project_replace_params.py
+++ b/src/gcore/types/cloud/project_update_params.py
@@ -5,10 +5,10 @@
from typing import Optional
from typing_extensions import Required, TypedDict
-__all__ = ["ProjectReplaceParams"]
+__all__ = ["ProjectUpdateParams"]
-class ProjectReplaceParams(TypedDict, total=False):
+class ProjectUpdateParams(TypedDict, total=False):
project_id: int
name: Required[str]
diff --git a/tests/api_resources/cdn/logs/__init__.py b/tests/api_resources/cdn/logs/__init__.py
deleted file mode 100644
index fd8019a9..00000000
--- a/tests/api_resources/cdn/logs/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
diff --git a/tests/api_resources/cdn/resources/test_rules.py b/tests/api_resources/cdn/resources/test_rules.py
index 9fb7c8b6..63940c96 100644
--- a/tests/api_resources/cdn/resources/test_rules.py
+++ b/tests/api_resources/cdn/resources/test_rules.py
@@ -136,13 +136,13 @@ def test_method_create_with_all_params(self, client: Gcore) -> None:
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -277,7 +277,10 @@ def test_method_create_with_all_params(self, client: Gcore) -> None:
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
@@ -449,13 +452,13 @@ def test_method_update_with_all_params(self, client: Gcore) -> None:
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -590,7 +593,10 @@ def test_method_update_with_all_params(self, client: Gcore) -> None:
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
@@ -863,13 +869,13 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None:
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -1004,7 +1010,10 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None:
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
@@ -1185,13 +1194,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) ->
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -1326,7 +1335,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) ->
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
@@ -1498,13 +1510,13 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) ->
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -1639,7 +1651,10 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) ->
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
@@ -1912,13 +1927,13 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) ->
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -2053,7 +2068,10 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) ->
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
diff --git a/tests/api_resources/cdn/test_resources.py b/tests/api_resources/cdn/test_resources.py
index 97602ddc..aecf0ca9 100644
--- a/tests/api_resources/cdn/test_resources.py
+++ b/tests/api_resources/cdn/test_resources.py
@@ -136,13 +136,13 @@ def test_method_create_with_all_params(self, client: Gcore) -> None:
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -281,7 +281,10 @@ def test_method_create_with_all_params(self, client: Gcore) -> None:
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
@@ -474,13 +477,13 @@ def test_method_update_with_all_params(self, client: Gcore) -> None:
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -619,7 +622,10 @@ def test_method_update_with_all_params(self, client: Gcore) -> None:
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
@@ -1100,13 +1106,13 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None:
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -1245,7 +1251,10 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None:
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
@@ -1443,13 +1452,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) ->
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -1588,7 +1597,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) ->
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
@@ -1781,13 +1793,13 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) ->
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -1926,7 +1938,10 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) ->
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
@@ -2407,13 +2422,13 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) ->
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -2552,7 +2567,10 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) ->
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
diff --git a/tests/api_resources/cdn/test_rule_templates.py b/tests/api_resources/cdn/test_rule_templates.py
index 3ef7dd05..cf4af42c 100644
--- a/tests/api_resources/cdn/test_rule_templates.py
+++ b/tests/api_resources/cdn/test_rule_templates.py
@@ -132,13 +132,13 @@ def test_method_create_with_all_params(self, client: Gcore) -> None:
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -273,7 +273,10 @@ def test_method_create_with_all_params(self, client: Gcore) -> None:
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
@@ -437,13 +440,13 @@ def test_method_update_with_all_params(self, client: Gcore) -> None:
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -578,7 +581,10 @@ def test_method_update_with_all_params(self, client: Gcore) -> None:
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
@@ -833,13 +839,13 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None:
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -974,7 +980,10 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None:
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
@@ -1148,13 +1157,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) ->
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -1289,7 +1298,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) ->
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
@@ -1453,13 +1465,13 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) ->
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -1594,7 +1606,10 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) ->
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
@@ -1849,13 +1864,13 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) ->
"enabled": True,
},
"force_return": {
- "body": "body",
- "code": 100,
+ "body": "http://example.com/redirect_address",
+ "code": 301,
"enabled": True,
"time_interval": {
- "end_time": "18:11:19.117Z",
- "start_time": "18:11:19.117Z",
- "time_zone": "Europe/Luxembourg",
+ "end_time": "20:00",
+ "start_time": "09:00",
+ "time_zone": "CET",
},
},
"forward_host_header": {
@@ -1990,7 +2005,10 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) ->
},
"static_headers": {
"enabled": True,
- "value": {"foo": "string"},
+ "value": {
+ "X-Example": "Value_1",
+ "X-Example-Multiple": ["Value_2", "Value_3"],
+ },
},
"static_request_headers": {
"enabled": True,
diff --git a/tests/api_resources/cloud/test_file_shares.py b/tests/api_resources/cloud/test_file_shares.py
index adc1fc01..055e05d6 100644
--- a/tests/api_resources/cloud/test_file_shares.py
+++ b/tests/api_resources/cloud/test_file_shares.py
@@ -15,8 +15,6 @@
TaskIDList,
)
-# pyright: reportDeprecated=false
-
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -157,72 +155,65 @@ def test_streaming_response_create_overload_2(self, client: Gcore) -> None:
@parametrize
def test_method_update(self, client: Gcore) -> None:
- with pytest.warns(DeprecationWarning):
- file_share = client.cloud.file_shares.update(
- file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08",
- project_id=1,
- region_id=1,
- )
-
- assert_matches_type(FileShare, file_share, path=["response"])
+ file_share = client.cloud.file_shares.update(
+ file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08",
+ project_id=1,
+ region_id=1,
+ )
+ assert_matches_type(TaskIDList, file_share, path=["response"])
@parametrize
def test_method_update_with_all_params(self, client: Gcore) -> None:
- with pytest.warns(DeprecationWarning):
- file_share = client.cloud.file_shares.update(
- file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08",
- project_id=1,
- region_id=1,
- name="some_name",
- share_settings={
- "allowed_characters": "LCD",
- "path_length": "LCD",
- "root_squash": True,
- },
- tags={"foo": "my-tag-value"},
- )
-
- assert_matches_type(FileShare, file_share, path=["response"])
+ file_share = client.cloud.file_shares.update(
+ file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08",
+ project_id=1,
+ region_id=1,
+ name="some_name",
+ share_settings={
+ "allowed_characters": "LCD",
+ "path_length": "LCD",
+ "root_squash": True,
+ },
+ tags={"foo": "my-tag-value"},
+ )
+ assert_matches_type(TaskIDList, file_share, path=["response"])
@parametrize
def test_raw_response_update(self, client: Gcore) -> None:
- with pytest.warns(DeprecationWarning):
- response = client.cloud.file_shares.with_raw_response.update(
- file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08",
- project_id=1,
- region_id=1,
- )
+ response = client.cloud.file_shares.with_raw_response.update(
+ file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08",
+ project_id=1,
+ region_id=1,
+ )
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
file_share = response.parse()
- assert_matches_type(FileShare, file_share, path=["response"])
+ assert_matches_type(TaskIDList, file_share, path=["response"])
@parametrize
def test_streaming_response_update(self, client: Gcore) -> None:
- with pytest.warns(DeprecationWarning):
- with client.cloud.file_shares.with_streaming_response.update(
- file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08",
- project_id=1,
- region_id=1,
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ with client.cloud.file_shares.with_streaming_response.update(
+ file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08",
+ project_id=1,
+ region_id=1,
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- file_share = response.parse()
- assert_matches_type(FileShare, file_share, path=["response"])
+ file_share = response.parse()
+ assert_matches_type(TaskIDList, file_share, path=["response"])
assert cast(Any, response.is_closed) is True
@parametrize
def test_path_params_update(self, client: Gcore) -> None:
- with pytest.warns(DeprecationWarning):
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"):
- client.cloud.file_shares.with_raw_response.update(
- file_share_id="",
- project_id=1,
- region_id=1,
- )
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"):
+ client.cloud.file_shares.with_raw_response.update(
+ file_share_id="",
+ project_id=1,
+ region_id=1,
+ )
@parametrize
def test_method_list(self, client: Gcore) -> None:
@@ -552,72 +543,65 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncGco
@parametrize
async def test_method_update(self, async_client: AsyncGcore) -> None:
- with pytest.warns(DeprecationWarning):
- file_share = await async_client.cloud.file_shares.update(
- file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08",
- project_id=1,
- region_id=1,
- )
-
- assert_matches_type(FileShare, file_share, path=["response"])
+ file_share = await async_client.cloud.file_shares.update(
+ file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08",
+ project_id=1,
+ region_id=1,
+ )
+ assert_matches_type(TaskIDList, file_share, path=["response"])
@parametrize
async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None:
- with pytest.warns(DeprecationWarning):
- file_share = await async_client.cloud.file_shares.update(
- file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08",
- project_id=1,
- region_id=1,
- name="some_name",
- share_settings={
- "allowed_characters": "LCD",
- "path_length": "LCD",
- "root_squash": True,
- },
- tags={"foo": "my-tag-value"},
- )
-
- assert_matches_type(FileShare, file_share, path=["response"])
+ file_share = await async_client.cloud.file_shares.update(
+ file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08",
+ project_id=1,
+ region_id=1,
+ name="some_name",
+ share_settings={
+ "allowed_characters": "LCD",
+ "path_length": "LCD",
+ "root_squash": True,
+ },
+ tags={"foo": "my-tag-value"},
+ )
+ assert_matches_type(TaskIDList, file_share, path=["response"])
@parametrize
async def test_raw_response_update(self, async_client: AsyncGcore) -> None:
- with pytest.warns(DeprecationWarning):
- response = await async_client.cloud.file_shares.with_raw_response.update(
- file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08",
- project_id=1,
- region_id=1,
- )
+ response = await async_client.cloud.file_shares.with_raw_response.update(
+ file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08",
+ project_id=1,
+ region_id=1,
+ )
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
file_share = await response.parse()
- assert_matches_type(FileShare, file_share, path=["response"])
+ assert_matches_type(TaskIDList, file_share, path=["response"])
@parametrize
async def test_streaming_response_update(self, async_client: AsyncGcore) -> None:
- with pytest.warns(DeprecationWarning):
- async with async_client.cloud.file_shares.with_streaming_response.update(
- file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08",
- project_id=1,
- region_id=1,
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ async with async_client.cloud.file_shares.with_streaming_response.update(
+ file_share_id="bd8c47ee-e565-4e26-8840-b537e6827b08",
+ project_id=1,
+ region_id=1,
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- file_share = await response.parse()
- assert_matches_type(FileShare, file_share, path=["response"])
+ file_share = await response.parse()
+ assert_matches_type(TaskIDList, file_share, path=["response"])
assert cast(Any, response.is_closed) is True
@parametrize
async def test_path_params_update(self, async_client: AsyncGcore) -> None:
- with pytest.warns(DeprecationWarning):
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"):
- await async_client.cloud.file_shares.with_raw_response.update(
- file_share_id="",
- project_id=1,
- region_id=1,
- )
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_share_id` but received ''"):
+ await async_client.cloud.file_shares.with_raw_response.update(
+ file_share_id="",
+ project_id=1,
+ region_id=1,
+ )
@parametrize
async def test_method_list(self, async_client: AsyncGcore) -> None:
diff --git a/tests/api_resources/cloud/test_projects.py b/tests/api_resources/cloud/test_projects.py
index b01e5c29..33942a79 100644
--- a/tests/api_resources/cloud/test_projects.py
+++ b/tests/api_resources/cloud/test_projects.py
@@ -59,6 +59,49 @@ def test_streaming_response_create(self, client: Gcore) -> None:
assert cast(Any, response.is_closed) is True
+ @parametrize
+ def test_method_update(self, client: Gcore) -> None:
+ project = client.cloud.projects.update(
+ project_id=0,
+ name="New Project",
+ )
+ assert_matches_type(Project, project, path=["response"])
+
+ @parametrize
+ def test_method_update_with_all_params(self, client: Gcore) -> None:
+ project = client.cloud.projects.update(
+ project_id=0,
+ name="New Project",
+ description="Project description",
+ )
+ assert_matches_type(Project, project, path=["response"])
+
+ @parametrize
+ def test_raw_response_update(self, client: Gcore) -> None:
+ response = client.cloud.projects.with_raw_response.update(
+ project_id=0,
+ name="New Project",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ project = response.parse()
+ assert_matches_type(Project, project, path=["response"])
+
+ @parametrize
+ def test_streaming_response_update(self, client: Gcore) -> None:
+ with client.cloud.projects.with_streaming_response.update(
+ project_id=0,
+ name="New Project",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ project = response.parse()
+ assert_matches_type(Project, project, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
@parametrize
def test_method_list(self, client: Gcore) -> None:
project = client.cloud.projects.list()
@@ -158,75 +201,74 @@ def test_streaming_response_get(self, client: Gcore) -> None:
assert cast(Any, response.is_closed) is True
+
+class TestAsyncProjects:
+ parametrize = pytest.mark.parametrize(
+ "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
+ )
+
@parametrize
- def test_method_replace(self, client: Gcore) -> None:
- project = client.cloud.projects.replace(
- project_id=0,
+ async def test_method_create(self, async_client: AsyncGcore) -> None:
+ project = await async_client.cloud.projects.create(
name="New Project",
)
assert_matches_type(Project, project, path=["response"])
@parametrize
- def test_method_replace_with_all_params(self, client: Gcore) -> None:
- project = client.cloud.projects.replace(
- project_id=0,
+ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None:
+ project = await async_client.cloud.projects.create(
name="New Project",
+ client_id=3,
description="Project description",
+ state="ACTIVE",
)
assert_matches_type(Project, project, path=["response"])
@parametrize
- def test_raw_response_replace(self, client: Gcore) -> None:
- response = client.cloud.projects.with_raw_response.replace(
- project_id=0,
+ async def test_raw_response_create(self, async_client: AsyncGcore) -> None:
+ response = await async_client.cloud.projects.with_raw_response.create(
name="New Project",
)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- project = response.parse()
+ project = await response.parse()
assert_matches_type(Project, project, path=["response"])
@parametrize
- def test_streaming_response_replace(self, client: Gcore) -> None:
- with client.cloud.projects.with_streaming_response.replace(
- project_id=0,
+ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None:
+ async with async_client.cloud.projects.with_streaming_response.create(
name="New Project",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- project = response.parse()
+ project = await response.parse()
assert_matches_type(Project, project, path=["response"])
assert cast(Any, response.is_closed) is True
-
-class TestAsyncProjects:
- 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:
- project = await async_client.cloud.projects.create(
+ async def test_method_update(self, async_client: AsyncGcore) -> None:
+ project = await async_client.cloud.projects.update(
+ project_id=0,
name="New Project",
)
assert_matches_type(Project, project, path=["response"])
@parametrize
- async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None:
- project = await async_client.cloud.projects.create(
+ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None:
+ project = await async_client.cloud.projects.update(
+ project_id=0,
name="New Project",
- client_id=3,
description="Project description",
- state="ACTIVE",
)
assert_matches_type(Project, project, path=["response"])
@parametrize
- async def test_raw_response_create(self, async_client: AsyncGcore) -> None:
- response = await async_client.cloud.projects.with_raw_response.create(
+ async def test_raw_response_update(self, async_client: AsyncGcore) -> None:
+ response = await async_client.cloud.projects.with_raw_response.update(
+ project_id=0,
name="New Project",
)
@@ -236,8 +278,9 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None:
assert_matches_type(Project, project, path=["response"])
@parametrize
- async def test_streaming_response_create(self, async_client: AsyncGcore) -> None:
- async with async_client.cloud.projects.with_streaming_response.create(
+ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None:
+ async with async_client.cloud.projects.with_streaming_response.update(
+ project_id=0,
name="New Project",
) as response:
assert not response.is_closed
@@ -346,46 +389,3 @@ async def test_streaming_response_get(self, async_client: AsyncGcore) -> None:
assert_matches_type(Project, project, path=["response"])
assert cast(Any, response.is_closed) is True
-
- @parametrize
- async def test_method_replace(self, async_client: AsyncGcore) -> None:
- project = await async_client.cloud.projects.replace(
- project_id=0,
- name="New Project",
- )
- assert_matches_type(Project, project, path=["response"])
-
- @parametrize
- async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None:
- project = await async_client.cloud.projects.replace(
- project_id=0,
- name="New Project",
- description="Project description",
- )
- assert_matches_type(Project, project, path=["response"])
-
- @parametrize
- async def test_raw_response_replace(self, async_client: AsyncGcore) -> None:
- response = await async_client.cloud.projects.with_raw_response.replace(
- project_id=0,
- name="New Project",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- project = await response.parse()
- assert_matches_type(Project, project, path=["response"])
-
- @parametrize
- async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None:
- async with async_client.cloud.projects.with_streaming_response.replace(
- project_id=0,
- name="New Project",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- project = await response.parse()
- assert_matches_type(Project, project, path=["response"])
-
- assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/test_cdn.py b/tests/api_resources/test_cdn.py
index 8e256e1f..97c7b598 100644
--- a/tests/api_resources/test_cdn.py
+++ b/tests/api_resources/test_cdn.py
@@ -10,12 +10,13 @@
from gcore import Gcore, AsyncGcore
from tests.utils import assert_matches_type
from gcore.types.cdn import (
+ AwsRegions,
CdnAccount,
- PurgeStatus,
+ AlibabaRegions,
CdnAccountLimits,
CdnAvailableFeatures,
+ CdnListPurgeStatusesResponse,
)
-from gcore.pagination import SyncOffsetPageCdn, AsyncOffsetPageCdn
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -98,10 +99,60 @@ def test_streaming_response_get_available_features(self, client: Gcore) -> None:
assert cast(Any, response.is_closed) is True
+ @parametrize
+ def test_method_list_alibaba_regions(self, client: Gcore) -> None:
+ cdn = client.cdn.list_alibaba_regions()
+ assert_matches_type(AlibabaRegions, cdn, path=["response"])
+
+ @parametrize
+ def test_raw_response_list_alibaba_regions(self, client: Gcore) -> None:
+ response = client.cdn.with_raw_response.list_alibaba_regions()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ cdn = response.parse()
+ assert_matches_type(AlibabaRegions, cdn, path=["response"])
+
+ @parametrize
+ def test_streaming_response_list_alibaba_regions(self, client: Gcore) -> None:
+ with client.cdn.with_streaming_response.list_alibaba_regions() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ cdn = response.parse()
+ assert_matches_type(AlibabaRegions, cdn, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_method_list_aws_regions(self, client: Gcore) -> None:
+ cdn = client.cdn.list_aws_regions()
+ assert_matches_type(AwsRegions, cdn, path=["response"])
+
+ @parametrize
+ def test_raw_response_list_aws_regions(self, client: Gcore) -> None:
+ response = client.cdn.with_raw_response.list_aws_regions()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ cdn = response.parse()
+ assert_matches_type(AwsRegions, cdn, path=["response"])
+
+ @parametrize
+ def test_streaming_response_list_aws_regions(self, client: Gcore) -> None:
+ with client.cdn.with_streaming_response.list_aws_regions() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ cdn = response.parse()
+ assert_matches_type(AwsRegions, cdn, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
@parametrize
def test_method_list_purge_statuses(self, client: Gcore) -> None:
cdn = client.cdn.list_purge_statuses()
- assert_matches_type(SyncOffsetPageCdn[PurgeStatus], cdn, path=["response"])
+ assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"])
@parametrize
def test_method_list_purge_statuses_with_all_params(self, client: Gcore) -> None:
@@ -114,7 +165,7 @@ def test_method_list_purge_statuses_with_all_params(self, client: Gcore) -> None
status="status",
to_created="to_created",
)
- assert_matches_type(SyncOffsetPageCdn[PurgeStatus], cdn, path=["response"])
+ assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"])
@parametrize
def test_raw_response_list_purge_statuses(self, client: Gcore) -> None:
@@ -123,7 +174,7 @@ def test_raw_response_list_purge_statuses(self, client: Gcore) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
cdn = response.parse()
- assert_matches_type(SyncOffsetPageCdn[PurgeStatus], cdn, path=["response"])
+ assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"])
@parametrize
def test_streaming_response_list_purge_statuses(self, client: Gcore) -> None:
@@ -132,7 +183,7 @@ def test_streaming_response_list_purge_statuses(self, client: Gcore) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
cdn = response.parse()
- assert_matches_type(SyncOffsetPageCdn[PurgeStatus], cdn, path=["response"])
+ assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -249,10 +300,60 @@ async def test_streaming_response_get_available_features(self, async_client: Asy
assert cast(Any, response.is_closed) is True
+ @parametrize
+ async def test_method_list_alibaba_regions(self, async_client: AsyncGcore) -> None:
+ cdn = await async_client.cdn.list_alibaba_regions()
+ assert_matches_type(AlibabaRegions, cdn, path=["response"])
+
+ @parametrize
+ async def test_raw_response_list_alibaba_regions(self, async_client: AsyncGcore) -> None:
+ response = await async_client.cdn.with_raw_response.list_alibaba_regions()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ cdn = await response.parse()
+ assert_matches_type(AlibabaRegions, cdn, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_list_alibaba_regions(self, async_client: AsyncGcore) -> None:
+ async with async_client.cdn.with_streaming_response.list_alibaba_regions() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ cdn = await response.parse()
+ assert_matches_type(AlibabaRegions, cdn, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_method_list_aws_regions(self, async_client: AsyncGcore) -> None:
+ cdn = await async_client.cdn.list_aws_regions()
+ assert_matches_type(AwsRegions, cdn, path=["response"])
+
+ @parametrize
+ async def test_raw_response_list_aws_regions(self, async_client: AsyncGcore) -> None:
+ response = await async_client.cdn.with_raw_response.list_aws_regions()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ cdn = await response.parse()
+ assert_matches_type(AwsRegions, cdn, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_list_aws_regions(self, async_client: AsyncGcore) -> None:
+ async with async_client.cdn.with_streaming_response.list_aws_regions() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ cdn = await response.parse()
+ assert_matches_type(AwsRegions, cdn, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
@parametrize
async def test_method_list_purge_statuses(self, async_client: AsyncGcore) -> None:
cdn = await async_client.cdn.list_purge_statuses()
- assert_matches_type(AsyncOffsetPageCdn[PurgeStatus], cdn, path=["response"])
+ assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"])
@parametrize
async def test_method_list_purge_statuses_with_all_params(self, async_client: AsyncGcore) -> None:
@@ -265,7 +366,7 @@ async def test_method_list_purge_statuses_with_all_params(self, async_client: As
status="status",
to_created="to_created",
)
- assert_matches_type(AsyncOffsetPageCdn[PurgeStatus], cdn, path=["response"])
+ assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"])
@parametrize
async def test_raw_response_list_purge_statuses(self, async_client: AsyncGcore) -> None:
@@ -274,7 +375,7 @@ async def test_raw_response_list_purge_statuses(self, async_client: AsyncGcore)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
cdn = await response.parse()
- assert_matches_type(AsyncOffsetPageCdn[PurgeStatus], cdn, path=["response"])
+ assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"])
@parametrize
async def test_streaming_response_list_purge_statuses(self, async_client: AsyncGcore) -> None:
@@ -283,7 +384,7 @@ async def test_streaming_response_list_purge_statuses(self, async_client: AsyncG
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
cdn = await response.parse()
- assert_matches_type(AsyncOffsetPageCdn[PurgeStatus], cdn, path=["response"])
+ assert_matches_type(CdnListPurgeStatusesResponse, cdn, path=["response"])
assert cast(Any, response.is_closed) is True
diff --git a/tests/test_client.py b/tests/test_client.py
index 17903dc2..1ef62fe4 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -367,11 +367,11 @@ def test_cloud_project_id_client_params(self) -> None:
with client as c2:
with pytest.raises(ValueError, match="Missing cloud_project_id argument;"):
- c2.cloud.projects.delete()
+ c2.cloud.projects.update(name="New Project")
client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_project_id=0)
with client as c2:
- c2.cloud.projects.delete()
+ c2.cloud.projects.update(name="New Project")
def test_cloud_region_id_client_params(self) -> None:
client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True)
@@ -1192,11 +1192,11 @@ async def test_cloud_project_id_client_params(self) -> None:
async with client as c2:
with pytest.raises(ValueError, match="Missing cloud_project_id argument;"):
- await c2.cloud.projects.delete()
+ await c2.cloud.projects.update(name="New Project")
client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_project_id=0)
async with client as c2:
- await c2.cloud.projects.delete()
+ await c2.cloud.projects.update(name="New Project")
async def test_cloud_region_id_client_params(self) -> None:
client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True)