From ec4b950b9fe948fb152019b5365441f5f0bf1dc4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 16:11:48 +0000 Subject: [PATCH 01/23] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8d64ea87..4d863aff 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-3721d496395e684887e9ba0386375910a4fe68253893ccfce4e79c2e8a5b84af.yml -openapi_spec_hash: f95b9f70ed1b3b8230ef3a092c6acedd +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1f1d68f6c5fa67afbf457aab0fb67b8494e97339aed4e7865f0dcc86b56bf522.yml +openapi_spec_hash: 53a6dc99201cbcc637dae930ed4b4e45 config_hash: bfac9dcd59fec1e54559dc11fcba758e From adf8df69810c6e978395aefe12b4ba6f88772d16 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 19:15:31 +0000 Subject: [PATCH 02/23] chore(internal): update pydantic dependency --- requirements-dev.lock | 7 +++++-- requirements.lock | 7 +++++-- src/gcore/_models.py | 14 ++++++++++---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index 156d60f1..329aeee4 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -91,9 +91,9 @@ pluggy==1.5.0 propcache==0.3.1 # via aiohttp # via yarl -pydantic==2.10.3 +pydantic==2.11.9 # via gcore -pydantic-core==2.27.1 +pydantic-core==2.33.2 # via pydantic pygments==2.18.0 # via rich @@ -130,6 +130,9 @@ typing-extensions==4.12.2 # via pydantic # via pydantic-core # via pyright + # via typing-inspection +typing-inspection==0.4.1 + # via pydantic virtualenv==20.24.5 # via nox yarl==1.20.0 diff --git a/requirements.lock b/requirements.lock index db09fdd3..b9e884ce 100644 --- a/requirements.lock +++ b/requirements.lock @@ -55,9 +55,9 @@ multidict==6.4.4 propcache==0.3.1 # via aiohttp # via yarl -pydantic==2.10.3 +pydantic==2.11.9 # via gcore -pydantic-core==2.27.1 +pydantic-core==2.33.2 # via pydantic sniffio==1.3.0 # via anyio @@ -68,5 +68,8 @@ typing-extensions==4.12.2 # via multidict # via pydantic # via pydantic-core + # via typing-inspection +typing-inspection==0.4.1 + # via pydantic yarl==1.20.0 # via aiohttp diff --git a/src/gcore/_models.py b/src/gcore/_models.py index 3a6017ef..6a3cd1d2 100644 --- a/src/gcore/_models.py +++ b/src/gcore/_models.py @@ -256,7 +256,7 @@ def model_dump( mode: Literal["json", "python"] | str = "python", include: IncEx | None = None, exclude: IncEx | None = None, - by_alias: bool = False, + by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, @@ -264,6 +264,7 @@ def model_dump( warnings: bool | Literal["none", "warn", "error"] = True, context: dict[str, Any] | None = None, serialize_as_any: bool = False, + fallback: Callable[[Any], Any] | None = None, ) -> dict[str, Any]: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump @@ -295,10 +296,12 @@ def model_dump( raise ValueError("context is only supported in Pydantic v2") if serialize_as_any != False: raise ValueError("serialize_as_any is only supported in Pydantic v2") + if fallback is not None: + raise ValueError("fallback is only supported in Pydantic v2") dumped = super().dict( # pyright: ignore[reportDeprecated] include=include, exclude=exclude, - by_alias=by_alias, + by_alias=by_alias if by_alias is not None else False, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, exclude_none=exclude_none, @@ -313,13 +316,14 @@ def model_dump_json( indent: int | None = None, include: IncEx | None = None, exclude: IncEx | None = None, - by_alias: bool = False, + by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal["none", "warn", "error"] = True, context: dict[str, Any] | None = None, + fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False, ) -> str: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json @@ -348,11 +352,13 @@ def model_dump_json( raise ValueError("context is only supported in Pydantic v2") if serialize_as_any != False: raise ValueError("serialize_as_any is only supported in Pydantic v2") + if fallback is not None: + raise ValueError("fallback is only supported in Pydantic v2") return super().json( # type: ignore[reportDeprecated] indent=indent, include=include, exclude=exclude, - by_alias=by_alias, + by_alias=by_alias if by_alias is not None else False, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, exclude_none=exclude_none, From fc88cbd66531167d50927d4a87c53d5f05fbdce1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 18 Sep 2025 10:10:35 +0000 Subject: [PATCH 03/23] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../cloud/file_shares/file_shares.py | 8 ++++ src/gcore/types/cloud/file_share.py | 4 ++ .../types/cloud/file_share_create_params.py | 20 ++++++++++ .../types/cloud/file_share_update_params.py | 39 ++++++++++++++++++- tests/api_resources/cloud/test_file_shares.py | 22 ++++++++++- 6 files changed, 91 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4d863aff..fea0da28 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-1f1d68f6c5fa67afbf457aab0fb67b8494e97339aed4e7865f0dcc86b56bf522.yml -openapi_spec_hash: 53a6dc99201cbcc637dae930ed4b4e45 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b473743ee0ba83806f1c8fad37c8dc55062a7d64b726e4ce2ee7e6ed679500a0.yml +openapi_spec_hash: 990a444fc9f47cee9b92c1fc8915f6ac config_hash: bfac9dcd59fec1e54559dc11fcba758e diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 99a806d5..ab93dea4 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -234,6 +234,7 @@ def update( project_id: int | None = None, region_id: int | None = None, name: str | NotGiven = NOT_GIVEN, + share_settings: file_share_update_params.ShareSettings | NotGiven = NOT_GIVEN, tags: Optional[TagUpdateMapParam] | 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. @@ -254,6 +255,8 @@ def update( name: Name + share_settings: Configuration settings for the share + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and @@ -293,6 +296,7 @@ def update( body=maybe_transform( { "name": name, + "share_settings": share_settings, "tags": tags, }, file_share_update_params.FileShareUpdateParams, @@ -703,6 +707,7 @@ async def update( project_id: int | None = None, region_id: int | None = None, name: str | NotGiven = NOT_GIVEN, + share_settings: file_share_update_params.ShareSettings | NotGiven = NOT_GIVEN, tags: Optional[TagUpdateMapParam] | 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. @@ -723,6 +728,8 @@ async def update( name: Name + share_settings: Configuration settings for the share + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and @@ -762,6 +769,7 @@ async def update( body=await async_maybe_transform( { "name": name, + "share_settings": share_settings, "tags": tags, }, file_share_update_params.FileShareUpdateParams, diff --git a/src/gcore/types/cloud/file_share.py b/src/gcore/types/cloud/file_share.py index 288e66db..a334740b 100644 --- a/src/gcore/types/cloud/file_share.py +++ b/src/gcore/types/cloud/file_share.py @@ -21,6 +21,10 @@ class ShareSettingsStandardShareSettingsOutputSerializer(BaseModel): class ShareSettingsVastShareSettingsOutputSerializer(BaseModel): + allowed_characters: Optional[Literal["LCD", "NPL"]] = None + + path_length: Optional[Literal["LCD", "NPL"]] = None + root_squash: bool """Enables or disables root squash for NFS clients. diff --git a/src/gcore/types/cloud/file_share_create_params.py b/src/gcore/types/cloud/file_share_create_params.py index 90fb2abc..c1c8624b 100644 --- a/src/gcore/types/cloud/file_share_create_params.py +++ b/src/gcore/types/cloud/file_share_create_params.py @@ -110,6 +110,26 @@ class CreateVastFileShareSerializer(TypedDict, total=False): class CreateVastFileShareSerializerShareSettings(TypedDict, total=False): + allowed_characters: Literal["LCD", "NPL"] + """Determines which characters are allowed in file names. Choose between: + + - Lowest Common Denominator (LCD), allows only characters allowed by all VAST + Cluster-supported protocols + - Native Protocol Limit (NPL), imposes no limitation beyond that of the client + protocol. + """ + + path_length: Literal["LCD", "NPL"] + """Affects the maximum limit of file path component name length. Choose between: + + - Lowest Common Denominator (LCD), imposes the lowest common denominator file + length limit of all VAST Cluster-supported protocols. With this (default) + option, the limitation on the length of a single component of the path is 255 + characters + - Native Protocol Limit (NPL), imposes no limitation beyond that of the client + protocol. + """ + root_squash: bool """Enables or disables root squash for NFS clients. diff --git a/src/gcore/types/cloud/file_share_update_params.py b/src/gcore/types/cloud/file_share_update_params.py index 24e4b9de..a51b8aa0 100644 --- a/src/gcore/types/cloud/file_share_update_params.py +++ b/src/gcore/types/cloud/file_share_update_params.py @@ -3,11 +3,11 @@ from __future__ import annotations from typing import Optional -from typing_extensions import TypedDict +from typing_extensions import Literal, TypedDict from .tag_update_map_param import TagUpdateMapParam -__all__ = ["FileShareUpdateParams"] +__all__ = ["FileShareUpdateParams", "ShareSettings"] class FileShareUpdateParams(TypedDict, total=False): @@ -20,6 +20,9 @@ class FileShareUpdateParams(TypedDict, total=False): name: str """Name""" + share_settings: ShareSettings + """Configuration settings for the share""" + tags: Optional[TagUpdateMapParam] """Update key-value tags using JSON Merge Patch semantics (RFC 7386). @@ -42,3 +45,35 @@ class FileShareUpdateParams(TypedDict, total=False): - **Replace all:** first delete existing tags with null values, then add new ones in the same request. """ + + +class ShareSettings(TypedDict, total=False): + allowed_characters: Literal["LCD", "NPL"] + """Determines which characters are allowed in file names. Choose between: + + - Lowest Common Denominator (LCD), allows only characters allowed by all VAST + Cluster-supported protocols + - Native Protocol Limit (NPL), imposes no limitation beyond that of the client + protocol. + """ + + path_length: Literal["LCD", "NPL"] + """Affects the maximum limit of file path component name length. Choose between: + + - Lowest Common Denominator (LCD), imposes the lowest common denominator file + length limit of all VAST Cluster-supported protocols. With this (default) + option, the limitation on the length of a single component of the path is 255 + characters + - Native Protocol Limit (NPL), imposes no limitation beyond that of the client + protocol. + """ + + root_squash: bool + """Enables or disables root squash for NFS clients. + + - If `true` (default), root squash is enabled: the root user is mapped to nobody + for all file and folder management operations on the export. + - If `false`, root squash is disabled: the NFS client `root` user retains root + privileges. Use this option if you trust the root user not to perform + operations that will corrupt data. + """ diff --git a/tests/api_resources/cloud/test_file_shares.py b/tests/api_resources/cloud/test_file_shares.py index 8e02d137..262d8a4a 100644 --- a/tests/api_resources/cloud/test_file_shares.py +++ b/tests/api_resources/cloud/test_file_shares.py @@ -110,7 +110,11 @@ def test_method_create_with_all_params_overload_2(self, client: Gcore) -> None: name="test-share-file-system", protocol="NFS", size=5, - share_settings={"root_squash": True}, + share_settings={ + "allowed_characters": "LCD", + "path_length": "LCD", + "root_squash": True, + }, tags={"my-tag": "my-tag-value"}, type_name="vast", volume_type="vast_share_type", @@ -165,6 +169,11 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: 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"]) @@ -489,7 +498,11 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn name="test-share-file-system", protocol="NFS", size=5, - share_settings={"root_squash": True}, + share_settings={ + "allowed_characters": "LCD", + "path_length": "LCD", + "root_squash": True, + }, tags={"my-tag": "my-tag-value"}, type_name="vast", volume_type="vast_share_type", @@ -544,6 +557,11 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> 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"]) From 2c7bead09a6bbe680b97e6577e956f24ee3ce7e7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 18 Sep 2025 13:38:22 +0000 Subject: [PATCH 04/23] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index fea0da28..12d70d76 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b473743ee0ba83806f1c8fad37c8dc55062a7d64b726e4ce2ee7e6ed679500a0.yml openapi_spec_hash: 990a444fc9f47cee9b92c1fc8915f6ac -config_hash: bfac9dcd59fec1e54559dc11fcba758e +config_hash: b2097de8bb0184ce4379a853a61ef740 From 24bebe1a809b38732c6b960f5cc6703fa2d6d1be Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 18 Sep 2025 15:01:47 +0000 Subject: [PATCH 05/23] chore(types): change optional parameter type from NotGiven to Omit --- src/gcore/__init__.py | 4 +- src/gcore/_base_client.py | 18 +- src/gcore/_client.py | 16 +- src/gcore/_qs.py | 14 +- src/gcore/_types.py | 29 +- src/gcore/_utils/_transform.py | 4 +- src/gcore/_utils/_utils.py | 8 +- src/gcore/resources/cloud/audit_logs.py | 54 ++-- .../resources/cloud/baremetal/flavors.py | 30 +- src/gcore/resources/cloud/baremetal/images.py | 26 +- .../resources/cloud/baremetal/servers.py | 150 +++++----- .../resources/cloud/billing_reservations.py | 58 ++-- src/gcore/resources/cloud/cost_reports.py | 126 ++++----- .../cloud/file_shares/access_rules.py | 14 +- .../cloud/file_shares/file_shares.py | 118 ++++---- src/gcore/resources/cloud/floating_ips.py | 66 ++--- .../cloud/gpu_baremetal_clusters/flavors.py | 14 +- .../gpu_baremetal_clusters.py | 74 ++--- .../cloud/gpu_baremetal_clusters/images.py | 50 ++-- .../gpu_baremetal_clusters/interfaces.py | 6 +- .../cloud/gpu_baremetal_clusters/servers.py | 214 +++++++------- .../resources/cloud/inference/api_keys.py | 42 +-- .../inference/applications/deployments.py | 40 ++- .../cloud/inference/applications/templates.py | 10 +- .../inference/deployments/deployments.py | 138 ++++----- .../cloud/inference/deployments/logs.py | 22 +- .../resources/cloud/inference/flavors.py | 18 +- .../resources/cloud/inference/inference.py | 6 +- .../cloud/inference/registry_credentials.py | 30 +- .../resources/cloud/inference/secrets.py | 30 +- .../resources/cloud/instances/flavors.py | 22 +- src/gcore/resources/cloud/instances/images.py | 150 +++++----- .../resources/cloud/instances/instances.py | 258 ++++++++--------- .../resources/cloud/instances/interfaces.py | 162 +++++------ .../resources/cloud/instances/metrics.py | 6 +- src/gcore/resources/cloud/ip_ranges.py | 6 +- .../resources/cloud/k8s/clusters/clusters.py | 114 ++++---- .../resources/cloud/k8s/clusters/nodes.py | 14 +- .../cloud/k8s/clusters/pools/nodes.py | 14 +- .../cloud/k8s/clusters/pools/pools.py | 90 +++--- src/gcore/resources/cloud/k8s/flavors.py | 14 +- src/gcore/resources/cloud/k8s/k8s.py | 6 +- .../resources/cloud/load_balancers/flavors.py | 10 +- .../load_balancers/l7_policies/l7_policies.py | 78 +++--- .../cloud/load_balancers/l7_policies/rules.py | 58 ++-- .../cloud/load_balancers/listeners.py | 106 +++---- .../cloud/load_balancers/load_balancers.py | 146 +++++----- .../resources/cloud/load_balancers/metrics.py | 6 +- .../load_balancers/pools/health_monitors.py | 26 +- .../cloud/load_balancers/pools/members.py | 38 +-- .../cloud/load_balancers/pools/pools.py | 126 ++++----- .../cloud/load_balancers/statuses.py | 10 +- .../resources/cloud/networks/networks.py | 66 ++--- src/gcore/resources/cloud/networks/routers.py | 66 ++--- src/gcore/resources/cloud/networks/subnets.py | 102 +++---- src/gcore/resources/cloud/placement_groups.py | 18 +- src/gcore/resources/cloud/projects.py | 62 ++--- src/gcore/resources/cloud/quotas/quotas.py | 14 +- src/gcore/resources/cloud/quotas/requests.py | 34 +-- src/gcore/resources/cloud/regions.py | 36 ++- .../resources/cloud/registries/artifacts.py | 10 +- .../resources/cloud/registries/registries.py | 30 +- .../cloud/registries/repositories.py | 10 +- src/gcore/resources/cloud/registries/tags.py | 6 +- src/gcore/resources/cloud/registries/users.py | 38 +-- .../reserved_fixed_ips/reserved_fixed_ips.py | 122 ++++---- .../resources/cloud/reserved_fixed_ips/vip.py | 30 +- src/gcore/resources/cloud/secrets.py | 30 +- .../resources/cloud/security_groups/rules.py | 74 ++--- .../cloud/security_groups/security_groups.py | 62 ++--- src/gcore/resources/cloud/ssh_keys.py | 42 +-- src/gcore/resources/cloud/tasks.py | 70 ++--- src/gcore/resources/cloud/usage_reports.py | 42 +-- .../resources/cloud/users/role_assignments.py | 50 ++-- src/gcore/resources/cloud/volumes.py | 214 +++++++------- src/gcore/resources/dns/dns.py | 18 +- src/gcore/resources/dns/locations.py | 18 +- src/gcore/resources/dns/metrics.py | 14 +- src/gcore/resources/dns/pickers/pickers.py | 6 +- src/gcore/resources/dns/pickers/presets.py | 6 +- src/gcore/resources/dns/zones/dnssec.py | 14 +- src/gcore/resources/dns/zones/rrsets.py | 74 ++--- src/gcore/resources/dns/zones/zones.py | 206 +++++++------- src/gcore/resources/fastedge/apps/apps.py | 154 +++++----- src/gcore/resources/fastedge/apps/logs.py | 38 +-- src/gcore/resources/fastedge/binaries.py | 18 +- src/gcore/resources/fastedge/fastedge.py | 6 +- src/gcore/resources/fastedge/kv_stores.py | 42 +-- src/gcore/resources/fastedge/secrets.py | 66 ++--- src/gcore/resources/fastedge/statistics.py | 26 +- src/gcore/resources/fastedge/templates.py | 58 ++-- src/gcore/resources/iam/api_tokens.py | 38 +-- src/gcore/resources/iam/iam.py | 6 +- src/gcore/resources/iam/users.py | 66 ++--- src/gcore/resources/security/bgp_announces.py | 30 +- src/gcore/resources/security/events.py | 34 +-- .../resources/security/profile_templates.py | 6 +- src/gcore/resources/security/profiles.py | 66 ++--- .../resources/storage/buckets/buckets.py | 22 +- src/gcore/resources/storage/buckets/cors.py | 14 +- .../resources/storage/buckets/lifecycle.py | 14 +- src/gcore/resources/storage/buckets/policy.py | 14 +- src/gcore/resources/storage/credentials.py | 26 +- src/gcore/resources/storage/locations.py | 14 +- src/gcore/resources/storage/statistics.py | 54 ++-- src/gcore/resources/storage/storage.py | 94 +++---- src/gcore/resources/streaming/ai_tasks.py | 84 +++--- src/gcore/resources/streaming/broadcasts.py | 38 +-- src/gcore/resources/streaming/directories.py | 34 +-- src/gcore/resources/streaming/players.py | 38 +-- src/gcore/resources/streaming/playlists.py | 142 +++++----- src/gcore/resources/streaming/quality_sets.py | 18 +- src/gcore/resources/streaming/restreams.py | 34 +-- src/gcore/resources/streaming/statistics.py | 262 +++++++++--------- .../resources/streaming/streams/overlays.py | 58 ++-- .../resources/streaming/streams/streams.py | 126 ++++----- .../resources/streaming/videos/subtitles.py | 34 +-- .../resources/streaming/videos/videos.py | 158 +++++------ src/gcore/resources/waap/advanced_rules.py | 6 +- src/gcore/resources/waap/custom_page_sets.py | 126 ++++----- .../resources/waap/domains/advanced_rules.py | 90 +++--- .../resources/waap/domains/api_discovery.py | 70 ++--- .../resources/waap/domains/api_path_groups.py | 6 +- src/gcore/resources/waap/domains/api_paths.py | 98 ++++--- .../resources/waap/domains/custom_rules.py | 82 +++--- src/gcore/resources/waap/domains/domains.py | 56 ++-- .../resources/waap/domains/firewall_rules.py | 82 +++--- .../waap/domains/insight_silences.py | 58 ++-- src/gcore/resources/waap/domains/insights.py | 42 +-- src/gcore/resources/waap/domains/settings.py | 18 +- .../resources/waap/domains/statistics.py | 126 ++++----- src/gcore/resources/waap/insights.py | 32 +-- src/gcore/resources/waap/ip_info/ip_info.py | 34 +-- src/gcore/resources/waap/ip_info/metrics.py | 10 +- src/gcore/resources/waap/organizations.py | 22 +- src/gcore/resources/waap/statistics.py | 6 +- src/gcore/resources/waap/tags.py | 30 +- src/gcore/resources/waap/waap.py | 6 +- tests/test_transform.py | 11 +- 139 files changed, 3697 insertions(+), 3719 deletions(-) diff --git a/src/gcore/__init__.py b/src/gcore/__init__.py index 83786fb8..833abff8 100644 --- a/src/gcore/__init__.py +++ b/src/gcore/__init__.py @@ -3,7 +3,7 @@ import typing as _t from . import types -from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes +from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given from ._utils import file_from_path from ._client import Gcore, Client, Stream, Timeout, Transport, AsyncGcore, AsyncClient, AsyncStream, RequestOptions from ._models import BaseModel @@ -38,7 +38,9 @@ "ProxiesTypes", "NotGiven", "NOT_GIVEN", + "not_given", "Omit", + "omit", "GcoreError", "APIError", "APIStatusError", diff --git a/src/gcore/_base_client.py b/src/gcore/_base_client.py index b4fe9249..b68aa376 100644 --- a/src/gcore/_base_client.py +++ b/src/gcore/_base_client.py @@ -42,7 +42,6 @@ from ._qs import Querystring from ._files import to_httpx_files, async_to_httpx_files from ._types import ( - NOT_GIVEN, Body, Omit, Query, @@ -57,6 +56,7 @@ RequestOptions, HttpxRequestFiles, ModelBuilderProtocol, + not_given, ) from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping from ._compat import PYDANTIC_V1, model_copy, model_dump @@ -145,9 +145,9 @@ def __init__( def __init__( self, *, - url: URL | NotGiven = NOT_GIVEN, - json: Body | NotGiven = NOT_GIVEN, - params: Query | NotGiven = NOT_GIVEN, + url: URL | NotGiven = not_given, + json: Body | NotGiven = not_given, + params: Query | NotGiven = not_given, ) -> None: self.url = url self.json = json @@ -595,7 +595,7 @@ def _maybe_override_cast_to(self, cast_to: type[ResponseT], options: FinalReques # we internally support defining a temporary header to override the # default `cast_to` type for use with `.with_raw_response` and `.with_streaming_response` # see _response.py for implementation details - override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, NOT_GIVEN) + override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, not_given) if is_given(override_cast_to): options.headers = headers return cast(Type[ResponseT], override_cast_to) @@ -825,7 +825,7 @@ def __init__( version: str, base_url: str | URL, max_retries: int = DEFAULT_MAX_RETRIES, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, @@ -1356,7 +1356,7 @@ def __init__( base_url: str | URL, _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, @@ -1818,8 +1818,8 @@ def make_request_options( extra_query: Query | None = None, extra_body: Body | None = None, idempotency_key: str | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - post_parser: PostParser | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + post_parser: PostParser | NotGiven = not_given, ) -> RequestOptions: """Create a dict of type RequestOptions without keys of NotGiven values.""" options: RequestOptions = {} diff --git a/src/gcore/_client.py b/src/gcore/_client.py index fb66fd59..837f0881 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Union, Mapping +from typing import Any, Mapping from typing_extensions import Self, override import httpx @@ -11,13 +11,13 @@ from . import _exceptions from ._qs import Querystring from ._types import ( - NOT_GIVEN, Omit, Timeout, NotGiven, Transport, ProxiesTypes, RequestOptions, + not_given, ) from ._utils import is_given, get_async_library, maybe_coerce_integer from ._version import __version__ @@ -66,7 +66,7 @@ def __init__( cloud_region_id: int | None = None, cloud_polling_interval_seconds: int | None = 3, base_url: str | httpx.URL | None = None, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -166,9 +166,9 @@ def copy( cloud_region_id: int | None = None, cloud_polling_interval_seconds: int | None = None, base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, - max_retries: int | NotGiven = NOT_GIVEN, + max_retries: int | NotGiven = not_given, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -293,7 +293,7 @@ def __init__( cloud_region_id: int | None = None, cloud_polling_interval_seconds: int | None = 3, base_url: str | httpx.URL | None = None, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -393,9 +393,9 @@ def copy( cloud_region_id: int | None = None, cloud_polling_interval_seconds: int | None = None, base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, - max_retries: int | NotGiven = NOT_GIVEN, + max_retries: int | NotGiven = not_given, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, diff --git a/src/gcore/_qs.py b/src/gcore/_qs.py index 274320ca..ada6fd3f 100644 --- a/src/gcore/_qs.py +++ b/src/gcore/_qs.py @@ -4,7 +4,7 @@ from urllib.parse import parse_qs, urlencode from typing_extensions import Literal, get_args -from ._types import NOT_GIVEN, NotGiven, NotGivenOr +from ._types import NotGiven, not_given from ._utils import flatten _T = TypeVar("_T") @@ -41,8 +41,8 @@ def stringify( self, params: Params, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> str: return urlencode( self.stringify_items( @@ -56,8 +56,8 @@ def stringify_items( self, params: Params, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> list[tuple[str, str]]: opts = Options( qs=self, @@ -143,8 +143,8 @@ def __init__( self, qs: Querystring = _qs, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> None: self.array_format = qs.array_format if isinstance(array_format, NotGiven) else array_format self.nested_format = qs.nested_format if isinstance(nested_format, NotGiven) else nested_format diff --git a/src/gcore/_types.py b/src/gcore/_types.py index 078ad89a..7ed4155b 100644 --- a/src/gcore/_types.py +++ b/src/gcore/_types.py @@ -117,18 +117,21 @@ class RequestOptions(TypedDict, total=False): # Sentinel class used until PEP 0661 is accepted class NotGiven: """ - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different behavior). + For parameters with a meaningful None value, we need to distinguish between + the user explicitly passing None, and the user not passing the parameter at + all. + + User code shouldn't need to use not_given directly. For example: ```py - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ... + def create(timeout: Timeout | None | NotGiven = not_given): ... - get(timeout=1) # 1s timeout - get(timeout=None) # No timeout - get() # Default timeout behavior, which may not be statically known at the method definition. + create(timeout=1) # 1s timeout + create(timeout=None) # No timeout + create() # Default timeout behavior ``` """ @@ -140,13 +143,14 @@ def __repr__(self) -> str: return "NOT_GIVEN" -NotGivenOr = Union[_T, NotGiven] +not_given = NotGiven() +# for backwards compatibility: NOT_GIVEN = NotGiven() class Omit: - """In certain situations you need to be able to represent a case where a default value has - to be explicitly removed and `None` is not an appropriate substitute, for example: + """ + To explicitly omit something from being sent in a request, use `omit`. ```py # as the default `Content-Type` header is `application/json` that will be sent @@ -156,8 +160,8 @@ class Omit: # to look something like: 'multipart/form-data; boundary=0d8382fcf5f8c3be01ca2e11002d2983' client.post(..., headers={"Content-Type": "multipart/form-data"}) - # instead you can remove the default `application/json` header by passing Omit - client.post(..., headers={"Content-Type": Omit()}) + # instead you can remove the default `application/json` header by passing omit + client.post(..., headers={"Content-Type": omit}) ``` """ @@ -165,6 +169,9 @@ def __bool__(self) -> Literal[False]: return False +omit = Omit() + + @runtime_checkable class ModelBuilderProtocol(Protocol): @classmethod diff --git a/src/gcore/_utils/_transform.py b/src/gcore/_utils/_transform.py index c19124f0..52075492 100644 --- a/src/gcore/_utils/_transform.py +++ b/src/gcore/_utils/_transform.py @@ -268,7 +268,7 @@ def _transform_typeddict( annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): if not is_given(value): - # we don't need to include `NotGiven` values here as they'll + # we don't need to include omitted values here as they'll # be stripped out before the request is sent anyway continue @@ -434,7 +434,7 @@ async def _async_transform_typeddict( annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): if not is_given(value): - # we don't need to include `NotGiven` values here as they'll + # we don't need to include omitted values here as they'll # be stripped out before the request is sent anyway continue diff --git a/src/gcore/_utils/_utils.py b/src/gcore/_utils/_utils.py index f0818595..50d59269 100644 --- a/src/gcore/_utils/_utils.py +++ b/src/gcore/_utils/_utils.py @@ -21,7 +21,7 @@ import sniffio -from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike +from .._types import Omit, NotGiven, FileTypes, HeadersLike _T = TypeVar("_T") _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...]) @@ -63,7 +63,7 @@ def _extract_items( try: key = path[index] except IndexError: - if isinstance(obj, NotGiven): + if not is_given(obj): # no value was provided - we can safely ignore return [] @@ -126,8 +126,8 @@ def _extract_items( return [] -def is_given(obj: NotGivenOr[_T]) -> TypeGuard[_T]: - return not isinstance(obj, NotGiven) +def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]: + return not isinstance(obj, NotGiven) and not isinstance(obj, Omit) # Type safe methods for narrowing types with TypeVars. diff --git a/src/gcore/resources/cloud/audit_logs.py b/src/gcore/resources/cloud/audit_logs.py index 1dad329f..0e942e4e 100644 --- a/src/gcore/resources/cloud/audit_logs.py +++ b/src/gcore/resources/cloud/audit_logs.py @@ -8,7 +8,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -88,7 +88,7 @@ def list( "upgrade", ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, api_group: List[ Literal[ "ai_cluster", @@ -146,23 +146,23 @@ def list( "volume", ] ] - | NotGiven = NOT_GIVEN, - from_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - project_id: Iterable[int] | NotGiven = NOT_GIVEN, - region_id: Iterable[int] | NotGiven = NOT_GIVEN, - resource_id: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - search_field: str | NotGiven = NOT_GIVEN, - sorting: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - to_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN, + | Omit = omit, + from_timestamp: Union[str, datetime] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["asc", "desc"] | Omit = omit, + project_id: Iterable[int] | Omit = omit, + region_id: Iterable[int] | Omit = omit, + resource_id: SequenceNotStr[str] | Omit = omit, + search_field: str | Omit = omit, + sorting: Literal["asc", "desc"] | Omit = omit, + to_timestamp: Union[str, datetime] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[AuditLogEntry]: """ Retrieve user action log for one client or a set of projects @@ -297,7 +297,7 @@ def list( "upgrade", ] ] - | NotGiven = NOT_GIVEN, + | Omit = omit, api_group: List[ Literal[ "ai_cluster", @@ -355,23 +355,23 @@ def list( "volume", ] ] - | NotGiven = NOT_GIVEN, - from_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - project_id: Iterable[int] | NotGiven = NOT_GIVEN, - region_id: Iterable[int] | NotGiven = NOT_GIVEN, - resource_id: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - search_field: str | NotGiven = NOT_GIVEN, - sorting: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - to_timestamp: Union[str, datetime] | NotGiven = NOT_GIVEN, + | Omit = omit, + from_timestamp: Union[str, datetime] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["asc", "desc"] | Omit = omit, + project_id: Iterable[int] | Omit = omit, + region_id: Iterable[int] | Omit = omit, + resource_id: SequenceNotStr[str] | Omit = omit, + search_field: str | Omit = omit, + sorting: Literal["asc", "desc"] | Omit = omit, + to_timestamp: Union[str, datetime] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[AuditLogEntry, AsyncOffsetPage[AuditLogEntry]]: """ Retrieve user action log for one client or a set of projects diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py index 1645b30b..454b0c7f 100644 --- a/src/gcore/resources/cloud/baremetal/flavors.py +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -46,18 +46,18 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - disabled: bool | NotGiven = NOT_GIVEN, - exclude_linux: bool | NotGiven = NOT_GIVEN, - exclude_windows: bool | NotGiven = NOT_GIVEN, - include_capacity: bool | NotGiven = NOT_GIVEN, - include_prices: bool | NotGiven = NOT_GIVEN, - include_reservation_stock: bool | NotGiven = NOT_GIVEN, + disabled: bool | Omit = omit, + exclude_linux: bool | Omit = omit, + exclude_windows: bool | Omit = omit, + include_capacity: bool | Omit = omit, + include_prices: bool | Omit = omit, + include_reservation_stock: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BaremetalFlavorList: """List all available bare metal flavors in the specified project and region. @@ -140,18 +140,18 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - disabled: bool | NotGiven = NOT_GIVEN, - exclude_linux: bool | NotGiven = NOT_GIVEN, - exclude_windows: bool | NotGiven = NOT_GIVEN, - include_capacity: bool | NotGiven = NOT_GIVEN, - include_prices: bool | NotGiven = NOT_GIVEN, - include_reservation_stock: bool | NotGiven = NOT_GIVEN, + disabled: bool | Omit = omit, + exclude_linux: bool | Omit = omit, + exclude_windows: bool | Omit = omit, + include_capacity: bool | Omit = omit, + include_prices: bool | Omit = omit, + include_reservation_stock: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BaremetalFlavorList: """List all available bare metal flavors in the specified project and region. diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index a6a22954..16f4d22c 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -6,7 +6,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -48,17 +48,17 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, - private: str | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, + include_prices: bool | Omit = omit, + private: str | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, + visibility: Literal["private", "public", "shared"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ImageList: """Retrieve a list of available images for bare metal servers. @@ -136,17 +136,17 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, - private: str | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, + include_prices: bool | Omit = omit, + private: str | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, + visibility: Literal["private", "public", "shared"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ImageList: """Retrieve a list of available images for bare metal servers. diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index d9120d43..195832fb 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -8,7 +8,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -54,23 +54,23 @@ def create( region_id: int | None = None, flavor: str, interfaces: Iterable[server_create_params.Interface], - app_config: Optional[object] | NotGiven = NOT_GIVEN, - apptemplate_id: str | NotGiven = NOT_GIVEN, - ddos_profile: server_create_params.DDOSProfile | NotGiven = NOT_GIVEN, - image_id: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - password: str | NotGiven = NOT_GIVEN, - ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - username: str | NotGiven = NOT_GIVEN, + app_config: Optional[object] | Omit = omit, + apptemplate_id: str | Omit = omit, + ddos_profile: server_create_params.DDOSProfile | Omit = omit, + image_id: str | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + password: str | Omit = omit, + ssh_key_name: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + user_data: str | Omit = omit, + username: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new bare metal server with the specified configuration. @@ -186,37 +186,37 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - changes_before: Union[str, datetime] | NotGiven = NOT_GIVEN, - changes_since: Union[str, datetime] | NotGiven = NOT_GIVEN, - flavor_id: str | NotGiven = NOT_GIVEN, - flavor_prefix: str | NotGiven = NOT_GIVEN, - include_k8s: bool | NotGiven = NOT_GIVEN, - ip: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - only_isolated: bool | NotGiven = NOT_GIVEN, - only_with_fixed_external_ip: bool | NotGiven = NOT_GIVEN, + changes_before: Union[str, datetime] | Omit = omit, + changes_since: Union[str, datetime] | Omit = omit, + flavor_id: str | Omit = omit, + flavor_prefix: str | Omit = omit, + include_k8s: bool | Omit = omit, + ip: str | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + only_isolated: bool | Omit = omit, + only_with_fixed_external_ip: bool | Omit = omit, order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc", "status.asc", "status.desc"] - | NotGiven = NOT_GIVEN, - profile_name: str | NotGiven = NOT_GIVEN, - protection_status: Literal["Active", "Queued", "Error"] | NotGiven = NOT_GIVEN, + | Omit = omit, + profile_name: str | Omit = omit, + protection_status: Literal["Active", "Queued", "Error"] | Omit = omit, status: Literal[ "ACTIVE", "BUILD", "ERROR", "HARD_REBOOT", "REBOOT", "REBUILD", "RESCUE", "SHUTOFF", "SUSPENDED" ] - | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - tag_value: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, - uuid: str | NotGiven = NOT_GIVEN, - with_ddos: bool | NotGiven = NOT_GIVEN, - with_interfaces_name: bool | NotGiven = NOT_GIVEN, + | Omit = omit, + tag_key_value: str | Omit = omit, + tag_value: SequenceNotStr[str] | Omit = omit, + type_ddos_profile: Literal["basic", "advanced"] | Omit = omit, + uuid: str | Omit = omit, + with_ddos: bool | Omit = omit, + with_interfaces_name: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[BaremetalServer]: """List all bare metal servers in the specified project and region. @@ -337,14 +337,14 @@ def rebuild( *, project_id: int | None = None, region_id: int | None = None, - image_id: str | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, + image_id: str | Omit = omit, + user_data: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Rebuild a bare metal server with a new image while preserving its configuration. @@ -536,23 +536,23 @@ async def create( region_id: int | None = None, flavor: str, interfaces: Iterable[server_create_params.Interface], - app_config: Optional[object] | NotGiven = NOT_GIVEN, - apptemplate_id: str | NotGiven = NOT_GIVEN, - ddos_profile: server_create_params.DDOSProfile | NotGiven = NOT_GIVEN, - image_id: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - password: str | NotGiven = NOT_GIVEN, - ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - username: str | NotGiven = NOT_GIVEN, + app_config: Optional[object] | Omit = omit, + apptemplate_id: str | Omit = omit, + ddos_profile: server_create_params.DDOSProfile | Omit = omit, + image_id: str | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + password: str | Omit = omit, + ssh_key_name: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + user_data: str | Omit = omit, + username: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new bare metal server with the specified configuration. @@ -668,37 +668,37 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - changes_before: Union[str, datetime] | NotGiven = NOT_GIVEN, - changes_since: Union[str, datetime] | NotGiven = NOT_GIVEN, - flavor_id: str | NotGiven = NOT_GIVEN, - flavor_prefix: str | NotGiven = NOT_GIVEN, - include_k8s: bool | NotGiven = NOT_GIVEN, - ip: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - only_isolated: bool | NotGiven = NOT_GIVEN, - only_with_fixed_external_ip: bool | NotGiven = NOT_GIVEN, + changes_before: Union[str, datetime] | Omit = omit, + changes_since: Union[str, datetime] | Omit = omit, + flavor_id: str | Omit = omit, + flavor_prefix: str | Omit = omit, + include_k8s: bool | Omit = omit, + ip: str | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + only_isolated: bool | Omit = omit, + only_with_fixed_external_ip: bool | Omit = omit, order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc", "status.asc", "status.desc"] - | NotGiven = NOT_GIVEN, - profile_name: str | NotGiven = NOT_GIVEN, - protection_status: Literal["Active", "Queued", "Error"] | NotGiven = NOT_GIVEN, + | Omit = omit, + profile_name: str | Omit = omit, + protection_status: Literal["Active", "Queued", "Error"] | Omit = omit, status: Literal[ "ACTIVE", "BUILD", "ERROR", "HARD_REBOOT", "REBOOT", "REBUILD", "RESCUE", "SHUTOFF", "SUSPENDED" ] - | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - tag_value: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, - uuid: str | NotGiven = NOT_GIVEN, - with_ddos: bool | NotGiven = NOT_GIVEN, - with_interfaces_name: bool | NotGiven = NOT_GIVEN, + | Omit = omit, + tag_key_value: str | Omit = omit, + tag_value: SequenceNotStr[str] | Omit = omit, + type_ddos_profile: Literal["basic", "advanced"] | Omit = omit, + uuid: str | Omit = omit, + with_ddos: bool | Omit = omit, + with_interfaces_name: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[BaremetalServer, AsyncOffsetPage[BaremetalServer]]: """List all bare metal servers in the specified project and region. @@ -819,14 +819,14 @@ async def rebuild( *, project_id: int | None = None, region_id: int | None = None, - image_id: str | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, + image_id: str | Omit = omit, + user_data: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Rebuild a bare metal server with a new image while preserving its configuration. diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index 0d9df747..c25bd06c 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -8,7 +8,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -49,15 +49,15 @@ def with_streaming_response(self) -> BillingReservationsResourceWithStreamingRes def list( self, *, - activated_from: Union[str, date] | NotGiven = NOT_GIVEN, - activated_to: Union[str, date] | NotGiven = NOT_GIVEN, - created_from: Union[str, datetime] | NotGiven = NOT_GIVEN, - created_to: Union[str, datetime] | NotGiven = NOT_GIVEN, - deactivated_from: Union[str, date] | NotGiven = NOT_GIVEN, - deactivated_to: Union[str, date] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - metric_name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + activated_from: Union[str, date] | Omit = omit, + activated_to: Union[str, date] | Omit = omit, + created_from: Union[str, datetime] | Omit = omit, + created_to: Union[str, datetime] | Omit = omit, + deactivated_from: Union[str, date] | Omit = omit, + deactivated_to: Union[str, date] | Omit = omit, + limit: int | Omit = omit, + metric_name: str | Omit = omit, + offset: int | Omit = omit, order_by: Literal[ "active_from.asc", "active_from.desc", @@ -66,20 +66,20 @@ def list( "created_at.asc", "created_at.desc", ] - | NotGiven = NOT_GIVEN, - region_id: int | NotGiven = NOT_GIVEN, + | Omit = omit, + region_id: int | Omit = omit, status: List[ Literal[ "ACTIVATED", "APPROVED", "COPIED", "CREATED", "EXPIRED", "REJECTED", "RESERVED", "WAITING_FOR_PAYMENT" ] ] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[BillingReservation]: """ List reservations @@ -157,7 +157,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BillingReservation: """ Get reservation @@ -205,15 +205,15 @@ def with_streaming_response(self) -> AsyncBillingReservationsResourceWithStreami def list( self, *, - activated_from: Union[str, date] | NotGiven = NOT_GIVEN, - activated_to: Union[str, date] | NotGiven = NOT_GIVEN, - created_from: Union[str, datetime] | NotGiven = NOT_GIVEN, - created_to: Union[str, datetime] | NotGiven = NOT_GIVEN, - deactivated_from: Union[str, date] | NotGiven = NOT_GIVEN, - deactivated_to: Union[str, date] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - metric_name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + activated_from: Union[str, date] | Omit = omit, + activated_to: Union[str, date] | Omit = omit, + created_from: Union[str, datetime] | Omit = omit, + created_to: Union[str, datetime] | Omit = omit, + deactivated_from: Union[str, date] | Omit = omit, + deactivated_to: Union[str, date] | Omit = omit, + limit: int | Omit = omit, + metric_name: str | Omit = omit, + offset: int | Omit = omit, order_by: Literal[ "active_from.asc", "active_from.desc", @@ -222,20 +222,20 @@ def list( "created_at.asc", "created_at.desc", ] - | NotGiven = NOT_GIVEN, - region_id: int | NotGiven = NOT_GIVEN, + | Omit = omit, + region_id: int | Omit = omit, status: List[ Literal[ "ACTIVATED", "APPROVED", "COPIED", "CREATED", "EXPIRED", "REJECTED", "RESERVED", "WAITING_FOR_PAYMENT" ] ] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[BillingReservation, AsyncOffsetPage[BillingReservation]]: """ List reservations @@ -313,7 +313,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BillingReservation: """ Get reservation diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index 36075dd6..d5bb66c1 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -8,7 +8,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -56,13 +56,13 @@ def get_aggregated( *, time_from: Union[str, datetime], time_to: Union[str, datetime], - enable_last_day: bool | NotGiven = NOT_GIVEN, - projects: Iterable[int] | NotGiven = NOT_GIVEN, - regions: Iterable[int] | NotGiven = NOT_GIVEN, - response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, - rounding: bool | NotGiven = NOT_GIVEN, - schema_filter: cost_report_get_aggregated_params.SchemaFilter | NotGiven = NOT_GIVEN, - tags: cost_report_get_aggregated_params.Tags | NotGiven = NOT_GIVEN, + enable_last_day: bool | Omit = omit, + projects: Iterable[int] | Omit = omit, + regions: Iterable[int] | Omit = omit, + response_format: Literal["csv_totals", "json"] | Omit = omit, + rounding: bool | Omit = omit, + schema_filter: cost_report_get_aggregated_params.SchemaFilter | Omit = omit, + tags: cost_report_get_aggregated_params.Tags | Omit = omit, types: List[ Literal[ "ai_cluster", @@ -92,13 +92,13 @@ def get_aggregated( "volume", ] ] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CostReportAggregated: """Get cost report totals (aggregated costs) for a given period. @@ -171,13 +171,13 @@ def get_aggregated( def get_aggregated_monthly( self, *, - regions: Iterable[int] | NotGiven = NOT_GIVEN, - response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, - rounding: bool | NotGiven = NOT_GIVEN, - schema_filter: cost_report_get_aggregated_monthly_params.SchemaFilter | NotGiven = NOT_GIVEN, - tags: cost_report_get_aggregated_monthly_params.Tags | NotGiven = NOT_GIVEN, - time_from: Union[str, datetime] | NotGiven = NOT_GIVEN, - time_to: Union[str, datetime] | NotGiven = NOT_GIVEN, + regions: Iterable[int] | Omit = omit, + response_format: Literal["csv_totals", "json"] | Omit = omit, + rounding: bool | Omit = omit, + schema_filter: cost_report_get_aggregated_monthly_params.SchemaFilter | Omit = omit, + tags: cost_report_get_aggregated_monthly_params.Tags | Omit = omit, + time_from: Union[str, datetime] | Omit = omit, + time_to: Union[str, datetime] | Omit = omit, types: List[ Literal[ "ai_cluster", @@ -207,14 +207,14 @@ def get_aggregated_monthly( "volume", ] ] - | NotGiven = NOT_GIVEN, - year_month: str | NotGiven = NOT_GIVEN, + | Omit = omit, + year_month: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CostReportAggregatedMonthly: """ Retrieve a detailed cost report totals for a specified month, which includes @@ -281,16 +281,16 @@ def get_detailed( *, time_from: Union[str, datetime], time_to: Union[str, datetime], - enable_last_day: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - projects: Iterable[int] | NotGiven = NOT_GIVEN, - regions: Iterable[int] | NotGiven = NOT_GIVEN, - response_format: Literal["csv_records", "json"] | NotGiven = NOT_GIVEN, - rounding: bool | NotGiven = NOT_GIVEN, - schema_filter: cost_report_get_detailed_params.SchemaFilter | NotGiven = NOT_GIVEN, - sorting: Iterable[cost_report_get_detailed_params.Sorting] | NotGiven = NOT_GIVEN, - tags: cost_report_get_detailed_params.Tags | NotGiven = NOT_GIVEN, + enable_last_day: bool | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + projects: Iterable[int] | Omit = omit, + regions: Iterable[int] | Omit = omit, + response_format: Literal["csv_records", "json"] | Omit = omit, + rounding: bool | Omit = omit, + schema_filter: cost_report_get_detailed_params.SchemaFilter | Omit = omit, + sorting: Iterable[cost_report_get_detailed_params.Sorting] | Omit = omit, + tags: cost_report_get_detailed_params.Tags | Omit = omit, types: List[ Literal[ "ai_cluster", @@ -320,13 +320,13 @@ def get_detailed( "volume", ] ] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CostReportDetailed: """Get a detailed cost report for a given period and specific resources. @@ -432,13 +432,13 @@ async def get_aggregated( *, time_from: Union[str, datetime], time_to: Union[str, datetime], - enable_last_day: bool | NotGiven = NOT_GIVEN, - projects: Iterable[int] | NotGiven = NOT_GIVEN, - regions: Iterable[int] | NotGiven = NOT_GIVEN, - response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, - rounding: bool | NotGiven = NOT_GIVEN, - schema_filter: cost_report_get_aggregated_params.SchemaFilter | NotGiven = NOT_GIVEN, - tags: cost_report_get_aggregated_params.Tags | NotGiven = NOT_GIVEN, + enable_last_day: bool | Omit = omit, + projects: Iterable[int] | Omit = omit, + regions: Iterable[int] | Omit = omit, + response_format: Literal["csv_totals", "json"] | Omit = omit, + rounding: bool | Omit = omit, + schema_filter: cost_report_get_aggregated_params.SchemaFilter | Omit = omit, + tags: cost_report_get_aggregated_params.Tags | Omit = omit, types: List[ Literal[ "ai_cluster", @@ -468,13 +468,13 @@ async def get_aggregated( "volume", ] ] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CostReportAggregated: """Get cost report totals (aggregated costs) for a given period. @@ -547,13 +547,13 @@ async def get_aggregated( async def get_aggregated_monthly( self, *, - regions: Iterable[int] | NotGiven = NOT_GIVEN, - response_format: Literal["csv_totals", "json"] | NotGiven = NOT_GIVEN, - rounding: bool | NotGiven = NOT_GIVEN, - schema_filter: cost_report_get_aggregated_monthly_params.SchemaFilter | NotGiven = NOT_GIVEN, - tags: cost_report_get_aggregated_monthly_params.Tags | NotGiven = NOT_GIVEN, - time_from: Union[str, datetime] | NotGiven = NOT_GIVEN, - time_to: Union[str, datetime] | NotGiven = NOT_GIVEN, + regions: Iterable[int] | Omit = omit, + response_format: Literal["csv_totals", "json"] | Omit = omit, + rounding: bool | Omit = omit, + schema_filter: cost_report_get_aggregated_monthly_params.SchemaFilter | Omit = omit, + tags: cost_report_get_aggregated_monthly_params.Tags | Omit = omit, + time_from: Union[str, datetime] | Omit = omit, + time_to: Union[str, datetime] | Omit = omit, types: List[ Literal[ "ai_cluster", @@ -583,14 +583,14 @@ async def get_aggregated_monthly( "volume", ] ] - | NotGiven = NOT_GIVEN, - year_month: str | NotGiven = NOT_GIVEN, + | Omit = omit, + year_month: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CostReportAggregatedMonthly: """ Retrieve a detailed cost report totals for a specified month, which includes @@ -657,16 +657,16 @@ async def get_detailed( *, time_from: Union[str, datetime], time_to: Union[str, datetime], - enable_last_day: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - projects: Iterable[int] | NotGiven = NOT_GIVEN, - regions: Iterable[int] | NotGiven = NOT_GIVEN, - response_format: Literal["csv_records", "json"] | NotGiven = NOT_GIVEN, - rounding: bool | NotGiven = NOT_GIVEN, - schema_filter: cost_report_get_detailed_params.SchemaFilter | NotGiven = NOT_GIVEN, - sorting: Iterable[cost_report_get_detailed_params.Sorting] | NotGiven = NOT_GIVEN, - tags: cost_report_get_detailed_params.Tags | NotGiven = NOT_GIVEN, + enable_last_day: bool | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + projects: Iterable[int] | Omit = omit, + regions: Iterable[int] | Omit = omit, + response_format: Literal["csv_records", "json"] | Omit = omit, + rounding: bool | Omit = omit, + schema_filter: cost_report_get_detailed_params.SchemaFilter | Omit = omit, + sorting: Iterable[cost_report_get_detailed_params.Sorting] | Omit = omit, + tags: cost_report_get_detailed_params.Tags | Omit = omit, types: List[ Literal[ "ai_cluster", @@ -696,13 +696,13 @@ async def get_detailed( "volume", ] ] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CostReportDetailed: """Get a detailed cost report for a given period and specific resources. diff --git a/src/gcore/resources/cloud/file_shares/access_rules.py b/src/gcore/resources/cloud/file_shares/access_rules.py index 34cc65ee..6750a7c5 100644 --- a/src/gcore/resources/cloud/file_shares/access_rules.py +++ b/src/gcore/resources/cloud/file_shares/access_rules.py @@ -6,7 +6,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Query, Headers, NoneType, NotGiven, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -57,7 +57,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccessRule: """ Create file share access rule @@ -113,7 +113,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccessRuleList: """ List file share access rules @@ -159,7 +159,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete file share access rule @@ -232,7 +232,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccessRule: """ Create file share access rule @@ -288,7 +288,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccessRuleList: """ List file share access rules @@ -334,7 +334,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete file share access rule diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index ab93dea4..3d18dec1 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import required_args, maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -74,16 +74,16 @@ def create( network: file_share_create_params.CreateStandardFileShareSerializerNetwork, protocol: Literal["NFS"], size: int, - access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type_name: Literal["standard"] | NotGiven = NOT_GIVEN, - volume_type: Literal["default_share_type"] | NotGiven = NOT_GIVEN, + access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type_name: Literal["standard"] | Omit = omit, + volume_type: Literal["default_share_type"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create file share @@ -132,16 +132,16 @@ def create( name: str, protocol: Literal["NFS"], size: int, - share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type_name: Literal["vast"] | NotGiven = NOT_GIVEN, - volume_type: Literal["vast_share_type"] | NotGiven = NOT_GIVEN, + share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type_name: Literal["vast"] | Omit = omit, + volume_type: Literal["vast_share_type"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create file share @@ -186,20 +186,20 @@ def create( project_id: int | None = None, region_id: int | None = None, name: str, - network: file_share_create_params.CreateStandardFileShareSerializerNetwork | NotGiven = NOT_GIVEN, + network: file_share_create_params.CreateStandardFileShareSerializerNetwork | Omit = omit, protocol: Literal["NFS"], size: int, - access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type_name: Literal["standard"] | Literal["vast"] | NotGiven = NOT_GIVEN, - volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, - share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | NotGiven = NOT_GIVEN, + access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type_name: Literal["standard"] | Literal["vast"] | Omit = omit, + volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | Omit = omit, + share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -233,15 +233,15 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, - share_settings: file_share_update_params.ShareSettings | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + share_settings: file_share_update_params.ShareSettings | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FileShare: """ Rename file share or update tags @@ -312,16 +312,16 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - type_name: Literal["standard", "vast"] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + type_name: Literal["standard", "vast"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[FileShare]: """ List file shares @@ -384,7 +384,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete file share @@ -429,7 +429,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FileShare: """ Get file share @@ -475,7 +475,7 @@ def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Resize file share @@ -547,16 +547,16 @@ async def create( network: file_share_create_params.CreateStandardFileShareSerializerNetwork, protocol: Literal["NFS"], size: int, - access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type_name: Literal["standard"] | NotGiven = NOT_GIVEN, - volume_type: Literal["default_share_type"] | NotGiven = NOT_GIVEN, + access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type_name: Literal["standard"] | Omit = omit, + volume_type: Literal["default_share_type"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create file share @@ -605,16 +605,16 @@ async def create( name: str, protocol: Literal["NFS"], size: int, - share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type_name: Literal["vast"] | NotGiven = NOT_GIVEN, - volume_type: Literal["vast_share_type"] | NotGiven = NOT_GIVEN, + share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type_name: Literal["vast"] | Omit = omit, + volume_type: Literal["vast_share_type"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create file share @@ -659,20 +659,20 @@ async def create( project_id: int | None = None, region_id: int | None = None, name: str, - network: file_share_create_params.CreateStandardFileShareSerializerNetwork | NotGiven = NOT_GIVEN, + network: file_share_create_params.CreateStandardFileShareSerializerNetwork | Omit = omit, protocol: Literal["NFS"], size: int, - access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type_name: Literal["standard"] | Literal["vast"] | NotGiven = NOT_GIVEN, - volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | NotGiven = NOT_GIVEN, - share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | NotGiven = NOT_GIVEN, + access: Iterable[file_share_create_params.CreateStandardFileShareSerializerAccess] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type_name: Literal["standard"] | Literal["vast"] | Omit = omit, + volume_type: Literal["default_share_type"] | Literal["vast_share_type"] | Omit = omit, + share_settings: file_share_create_params.CreateVastFileShareSerializerShareSettings | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -706,15 +706,15 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, - share_settings: file_share_update_params.ShareSettings | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + share_settings: file_share_update_params.ShareSettings | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FileShare: """ Rename file share or update tags @@ -785,16 +785,16 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - type_name: Literal["standard", "vast"] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + type_name: Literal["standard", "vast"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[FileShare, AsyncOffsetPage[FileShare]]: """ List file shares @@ -857,7 +857,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete file share @@ -902,7 +902,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FileShare: """ Get file share @@ -948,7 +948,7 @@ async def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Resize file share diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 1ed214df..7f00da43 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -57,15 +57,15 @@ def create( *, project_id: int | None = None, region_id: int | None = None, - fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, - port_id: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + fixed_ip_address: Optional[str] | Omit = omit, + port_id: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create floating IP @@ -121,13 +121,13 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ Update floating IP @@ -187,16 +187,16 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[FloatingIPDetailed]: """ List floating IPs @@ -259,7 +259,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete floating IP @@ -300,13 +300,13 @@ def assign( project_id: int | None = None, region_id: int | None = None, port_id: str, - fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, + fixed_ip_address: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ Assign floating IP to instance or loadbalancer @@ -356,7 +356,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ Get floating IP @@ -401,7 +401,7 @@ def unassign( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ Unassign floating IP @@ -539,15 +539,15 @@ async def create( *, project_id: int | None = None, region_id: int | None = None, - fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, - port_id: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + fixed_ip_address: Optional[str] | Omit = omit, + port_id: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create floating IP @@ -603,13 +603,13 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ Update floating IP @@ -669,16 +669,16 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[FloatingIPDetailed, AsyncOffsetPage[FloatingIPDetailed]]: """ List floating IPs @@ -741,7 +741,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete floating IP @@ -782,13 +782,13 @@ async def assign( project_id: int | None = None, region_id: int | None = None, port_id: str, - fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, + fixed_ip_address: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ Assign floating IP to instance or loadbalancer @@ -838,7 +838,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ Get floating IP @@ -883,7 +883,7 @@ async def unassign( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FloatingIP: """ Unassign floating IP diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py index 2c4563b5..19df3189 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -46,14 +46,14 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - hide_disabled: bool | NotGiven = NOT_GIVEN, - include_prices: bool | NotGiven = NOT_GIVEN, + hide_disabled: bool | Omit = omit, + include_prices: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalFlavorList: """ List bare metal GPU flavors @@ -123,14 +123,14 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - hide_disabled: bool | NotGiven = NOT_GIVEN, - include_prices: bool | NotGiven = NOT_GIVEN, + hide_disabled: bool | Omit = omit, + include_prices: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalFlavorList: """ List bare metal GPU flavors 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 6a040f84..c036650d 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 @@ -31,7 +31,7 @@ ServersResourceWithStreamingResponse, AsyncServersResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from .interfaces import ( @@ -111,13 +111,13 @@ def create( name: str, servers_count: int, servers_settings: gpu_baremetal_cluster_create_params.ServersSettings, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new bare metal GPU cluster with the specified configuration. @@ -179,15 +179,15 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - managed_by: List[Literal["k8s", "user"]] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + managed_by: List[Literal["k8s", "user"]] | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[GPUBaremetalCluster]: """ List all bare metal GPU clusters in the specified project and region. @@ -245,16 +245,16 @@ def delete( *, project_id: int | None = None, region_id: int | None = None, - all_floating_ips: bool | NotGiven = NOT_GIVEN, - all_reserved_fixed_ips: bool | NotGiven = NOT_GIVEN, - floating_ip_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - reserved_fixed_ip_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + all_floating_ips: bool | Omit = omit, + all_reserved_fixed_ips: bool | Omit = omit, + floating_ip_ids: SequenceNotStr[str] | Omit = omit, + reserved_fixed_ip_ids: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete a bare metal GPU cluster and all its associated resources. @@ -321,7 +321,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalCluster: """ Get detailed information about a specific bare metal GPU cluster. @@ -366,7 +366,7 @@ def powercycle_all_servers( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalClusterServerV1List: """ Stops and then starts all cluster servers, effectively performing a hard reboot. @@ -405,7 +405,7 @@ def reboot_all_servers( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalClusterServerV1List: """ Reboot all bare metal GPU cluster servers @@ -440,14 +440,14 @@ def rebuild( project_id: int | None = None, region_id: int | None = None, nodes: SequenceNotStr[str], - image_id: Optional[str] | NotGiven = NOT_GIVEN, - user_data: Optional[str] | NotGiven = NOT_GIVEN, + image_id: Optional[str] | Omit = omit, + user_data: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Rebuild one or more nodes in a GPU cluster. @@ -505,7 +505,7 @@ def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Change the number of nodes in a GPU cluster. @@ -744,13 +744,13 @@ async def create( name: str, servers_count: int, servers_settings: gpu_baremetal_cluster_create_params.ServersSettings, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new bare metal GPU cluster with the specified configuration. @@ -812,15 +812,15 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - managed_by: List[Literal["k8s", "user"]] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + managed_by: List[Literal["k8s", "user"]] | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[GPUBaremetalCluster, AsyncOffsetPage[GPUBaremetalCluster]]: """ List all bare metal GPU clusters in the specified project and region. @@ -878,16 +878,16 @@ async def delete( *, project_id: int | None = None, region_id: int | None = None, - all_floating_ips: bool | NotGiven = NOT_GIVEN, - all_reserved_fixed_ips: bool | NotGiven = NOT_GIVEN, - floating_ip_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - reserved_fixed_ip_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + all_floating_ips: bool | Omit = omit, + all_reserved_fixed_ips: bool | Omit = omit, + floating_ip_ids: SequenceNotStr[str] | Omit = omit, + reserved_fixed_ip_ids: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete a bare metal GPU cluster and all its associated resources. @@ -954,7 +954,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalCluster: """ Get detailed information about a specific bare metal GPU cluster. @@ -999,7 +999,7 @@ async def powercycle_all_servers( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalClusterServerV1List: """ Stops and then starts all cluster servers, effectively performing a hard reboot. @@ -1038,7 +1038,7 @@ async def reboot_all_servers( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalClusterServerV1List: """ Reboot all bare metal GPU cluster servers @@ -1073,14 +1073,14 @@ async def rebuild( project_id: int | None = None, region_id: int | None = None, nodes: SequenceNotStr[str], - image_id: Optional[str] | NotGiven = NOT_GIVEN, - user_data: Optional[str] | NotGiven = NOT_GIVEN, + image_id: Optional[str] | Omit = omit, + user_data: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Rebuild one or more nodes in a GPU cluster. @@ -1138,7 +1138,7 @@ async def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Change the number of nodes in a GPU cluster. diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index 4d1aa992..834ed8cc 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -56,7 +56,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUImageList: """ List bare metal GPU images @@ -97,7 +97,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete bare metal GPU image @@ -178,7 +178,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUImage: """ Get bare metal GPU image @@ -219,20 +219,20 @@ def upload( region_id: int | None = None, name: str, url: str, - architecture: Optional[Literal["aarch64", "x86_64"]] | NotGiven = NOT_GIVEN, - cow_format: bool | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - os_distro: Optional[str] | NotGiven = NOT_GIVEN, - os_type: Optional[Literal["linux", "windows"]] | NotGiven = NOT_GIVEN, - os_version: Optional[str] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + architecture: Optional[Literal["aarch64", "x86_64"]] | Omit = omit, + cow_format: bool | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + os_distro: Optional[str] | Omit = omit, + os_type: Optional[Literal["linux", "windows"]] | Omit = omit, + os_version: Optional[str] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Upload new bare metal GPU image @@ -399,7 +399,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUImageList: """ List bare metal GPU images @@ -440,7 +440,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete bare metal GPU image @@ -521,7 +521,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUImage: """ Get bare metal GPU image @@ -562,20 +562,20 @@ async def upload( region_id: int | None = None, name: str, url: str, - architecture: Optional[Literal["aarch64", "x86_64"]] | NotGiven = NOT_GIVEN, - cow_format: bool | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - os_distro: Optional[str] | NotGiven = NOT_GIVEN, - os_type: Optional[Literal["linux", "windows"]] | NotGiven = NOT_GIVEN, - os_version: Optional[str] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + architecture: Optional[Literal["aarch64", "x86_64"]] | Omit = omit, + cow_format: bool | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + os_distro: Optional[str] | Omit = omit, + os_type: Optional[Literal["linux", "windows"]] | Omit = omit, + os_version: Optional[str] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Upload new bare metal GPU image diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py index 863ffde8..63371d8e 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -50,7 +50,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> NetworkInterfaceList: """ Retrieve a list of network interfaces attached to the GPU cluster servers. @@ -110,7 +110,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> NetworkInterfaceList: """ Retrieve a list of network interfaces attached to the GPU cluster servers. diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index 5943860d..d3249b07 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -8,7 +8,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -60,13 +60,13 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - changed_before: Union[str, datetime] | NotGiven = NOT_GIVEN, - changed_since: Union[str, datetime] | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "status.asc", "status.desc"] | NotGiven = NOT_GIVEN, + changed_before: Union[str, datetime] | Omit = omit, + changed_since: Union[str, datetime] | Omit = omit, + ip_address: str | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "status.asc", "status.desc"] | Omit = omit, status: Literal[ "ACTIVE", "BUILD", @@ -85,14 +85,14 @@ def list( "SUSPENDED", "VERIFY_RESIZE", ] - | NotGiven = NOT_GIVEN, - uuids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + uuids: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[GPUBaremetalClusterServer]: """List all servers in a bare metal GPU cluster. @@ -175,13 +175,13 @@ def delete( project_id: int | None = None, region_id: int | None = None, cluster_id: str, - delete_floatings: bool | NotGiven = NOT_GIVEN, + delete_floatings: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Delete a specific node from a GPU cluster. @@ -267,20 +267,19 @@ def attach_interface( *, project_id: int | None = None, region_id: int | None = None, - ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to bare metal GPU cluster server @@ -316,18 +315,18 @@ def attach_interface( project_id: int | None = None, region_id: int | None = None, subnet_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to bare metal GPU cluster server @@ -363,19 +362,19 @@ def attach_interface( project_id: int | None = None, region_id: int | None = None, network_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to bare metal GPU cluster server @@ -413,19 +412,18 @@ def attach_interface( project_id: int | None = None, region_id: int | None = None, port_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to bare metal GPU cluster server @@ -463,25 +461,25 @@ def attach_interface( | server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] | Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] | Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] | Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - subnet_id: str | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - port_id: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + port_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -524,7 +522,7 @@ def detach_interface( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Detach interface from bare metal GPU cluster server @@ -574,7 +572,7 @@ def get_console( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Console: """ Get bare metal GPU cluster server console URL @@ -613,7 +611,7 @@ def powercycle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalClusterServerV1: """ Stops and then starts the server, effectively performing a hard reboot. @@ -652,7 +650,7 @@ def reboot( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalClusterServerV1: """ Reboot one bare metal GPU cluster server @@ -707,13 +705,13 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - changed_before: Union[str, datetime] | NotGiven = NOT_GIVEN, - changed_since: Union[str, datetime] | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "status.asc", "status.desc"] | NotGiven = NOT_GIVEN, + changed_before: Union[str, datetime] | Omit = omit, + changed_since: Union[str, datetime] | Omit = omit, + ip_address: str | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "status.asc", "status.desc"] | Omit = omit, status: Literal[ "ACTIVE", "BUILD", @@ -732,14 +730,14 @@ def list( "SUSPENDED", "VERIFY_RESIZE", ] - | NotGiven = NOT_GIVEN, - uuids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + uuids: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[GPUBaremetalClusterServer, AsyncOffsetPage[GPUBaremetalClusterServer]]: """List all servers in a bare metal GPU cluster. @@ -822,13 +820,13 @@ async def delete( project_id: int | None = None, region_id: int | None = None, cluster_id: str, - delete_floatings: bool | NotGiven = NOT_GIVEN, + delete_floatings: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Delete a specific node from a GPU cluster. @@ -916,20 +914,19 @@ async def attach_interface( *, project_id: int | None = None, region_id: int | None = None, - ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to bare metal GPU cluster server @@ -965,18 +962,18 @@ async def attach_interface( project_id: int | None = None, region_id: int | None = None, subnet_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to bare metal GPU cluster server @@ -1012,19 +1009,19 @@ async def attach_interface( project_id: int | None = None, region_id: int | None = None, network_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to bare metal GPU cluster server @@ -1062,19 +1059,18 @@ async def attach_interface( project_id: int | None = None, region_id: int | None = None, port_id: str, - ddos_profile: server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to bare metal GPU cluster server @@ -1112,25 +1108,25 @@ async def attach_interface( | server_attach_interface_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | server_attach_interface_params.NewInterfaceAnySubnetSchemaDDOSProfile | server_attach_interface_params.NewInterfaceReservedFixedIPSchemaDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[server_attach_interface_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] | Iterable[server_attach_interface_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] | Iterable[server_attach_interface_params.NewInterfaceAnySubnetSchemaSecurityGroup] | Iterable[server_attach_interface_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - subnet_id: str | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - port_id: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + port_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -1173,7 +1169,7 @@ async def detach_interface( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Detach interface from bare metal GPU cluster server @@ -1223,7 +1219,7 @@ async def get_console( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Console: """ Get bare metal GPU cluster server console URL @@ -1262,7 +1258,7 @@ async def powercycle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalClusterServerV1: """ Stops and then starts the server, effectively performing a hard reboot. @@ -1301,7 +1297,7 @@ async def reboot( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> GPUBaremetalClusterServerV1: """ Reboot one bare metal GPU cluster server diff --git a/src/gcore/resources/cloud/inference/api_keys.py b/src/gcore/resources/cloud/inference/api_keys.py index 98238c19..fcd8860c 100644 --- a/src/gcore/resources/cloud/inference/api_keys.py +++ b/src/gcore/resources/cloud/inference/api_keys.py @@ -6,7 +6,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -50,14 +50,14 @@ def create( *, project_id: int | None = None, name: str, - description: str | NotGiven = NOT_GIVEN, - expires_at: str | NotGiven = NOT_GIVEN, + description: str | Omit = omit, + expires_at: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceAPIKeyCreate: """This endpoint creates a new API key for everywhere inference. @@ -104,13 +104,13 @@ def update( api_key_name: str, *, project_id: int | None = None, - description: Optional[str] | NotGiven = NOT_GIVEN, + 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceAPIKey: """ This endpoint updates a specific API key for everywhere inference. @@ -147,14 +147,14 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[InferenceAPIKey]: """ This endpoint retrieves a list of API keys for everywhere inference. @@ -206,7 +206,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """This endpoint deletes a specific API key for everywhere inference. @@ -250,7 +250,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceAPIKey: """ This endpoint retrieves a specific API key for everywhere inference. @@ -306,14 +306,14 @@ async def create( *, project_id: int | None = None, name: str, - description: str | NotGiven = NOT_GIVEN, - expires_at: str | NotGiven = NOT_GIVEN, + description: str | Omit = omit, + expires_at: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceAPIKeyCreate: """This endpoint creates a new API key for everywhere inference. @@ -360,13 +360,13 @@ async def update( api_key_name: str, *, project_id: int | None = None, - description: Optional[str] | NotGiven = NOT_GIVEN, + 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceAPIKey: """ This endpoint updates a specific API key for everywhere inference. @@ -403,14 +403,14 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[InferenceAPIKey, AsyncOffsetPage[InferenceAPIKey]]: """ This endpoint retrieves a list of API keys for everywhere inference. @@ -462,7 +462,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """This endpoint deletes a specific API key for everywhere inference. @@ -506,7 +506,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceAPIKey: """ This endpoint retrieves a specific API key for everywhere inference. diff --git a/src/gcore/resources/cloud/inference/applications/deployments.py b/src/gcore/resources/cloud/inference/applications/deployments.py index 845bffce..7b62f2c2 100644 --- a/src/gcore/resources/cloud/inference/applications/deployments.py +++ b/src/gcore/resources/cloud/inference/applications/deployments.py @@ -6,7 +6,7 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -55,13 +55,13 @@ def create( components_configuration: Dict[str, deployment_create_params.ComponentsConfiguration], name: str, regions: Iterable[int], - api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Creates a new application deployment based on a selected catalog application. @@ -119,7 +119,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceApplicationDeploymentList: """ Returns a list of your application deployments, including deployment names, @@ -157,7 +157,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Deletes an existing application deployment along with all associated resources. @@ -199,7 +199,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceApplicationDeployment: """Retrieves detailed information about a specific application deployment. @@ -238,16 +238,15 @@ def patch( deployment_name: str, *, project_id: int | None = None, - api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - components_configuration: Dict[str, Optional[deployment_patch_params.ComponentsConfiguration]] - | NotGiven = NOT_GIVEN, - regions: Iterable[int] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | Omit = omit, + components_configuration: Dict[str, Optional[deployment_patch_params.ComponentsConfiguration]] | Omit = omit, + regions: Iterable[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Updates an existing application deployment. @@ -324,13 +323,13 @@ async def create( components_configuration: Dict[str, deployment_create_params.ComponentsConfiguration], name: str, regions: Iterable[int], - api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Creates a new application deployment based on a selected catalog application. @@ -388,7 +387,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceApplicationDeploymentList: """ Returns a list of your application deployments, including deployment names, @@ -426,7 +425,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Deletes an existing application deployment along with all associated resources. @@ -468,7 +467,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceApplicationDeployment: """Retrieves detailed information about a specific application deployment. @@ -507,16 +506,15 @@ async def patch( deployment_name: str, *, project_id: int | None = None, - api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - components_configuration: Dict[str, Optional[deployment_patch_params.ComponentsConfiguration]] - | NotGiven = NOT_GIVEN, - regions: Iterable[int] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | Omit = omit, + components_configuration: Dict[str, Optional[deployment_patch_params.ComponentsConfiguration]] | Omit = omit, + regions: Iterable[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Updates an existing application deployment. diff --git a/src/gcore/resources/cloud/inference/applications/templates.py b/src/gcore/resources/cloud/inference/applications/templates.py index 1c475cb8..d888a399 100644 --- a/src/gcore/resources/cloud/inference/applications/templates.py +++ b/src/gcore/resources/cloud/inference/applications/templates.py @@ -4,7 +4,7 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._types import Body, Query, Headers, NotGiven, not_given from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource from ....._response import ( @@ -48,7 +48,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceApplicationTemplateList: """ Returns a list of available machine learning application templates from the @@ -74,7 +74,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceApplicationTemplate: """ Retrieves detailed information about a specific machine learning application @@ -133,7 +133,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceApplicationTemplateList: """ Returns a list of available machine learning application templates from the @@ -159,7 +159,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceApplicationTemplate: """ Retrieves detailed information about a specific machine learning application diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 533883c2..889ebf69 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -15,7 +15,7 @@ LogsResourceWithStreamingResponse, AsyncLogsResourceWithStreamingResponse, ) -from ....._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ....._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -68,22 +68,22 @@ def create( image: str, listening_port: int, name: str, - api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - auth_enabled: bool | NotGiven = NOT_GIVEN, - command: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - credentials_name: Optional[str] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - envs: Dict[str, str] | NotGiven = NOT_GIVEN, - ingress_opts: Optional[deployment_create_params.IngressOpts] | NotGiven = NOT_GIVEN, - logging: Optional[deployment_create_params.Logging] | NotGiven = NOT_GIVEN, - probes: Optional[deployment_create_params.Probes] | NotGiven = NOT_GIVEN, - api_timeout: Optional[int] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | Omit = omit, + auth_enabled: bool | Omit = omit, + command: Optional[SequenceNotStr[str]] | Omit = omit, + credentials_name: Optional[str] | Omit = omit, + description: Optional[str] | Omit = omit, + envs: Dict[str, str] | Omit = omit, + ingress_opts: Optional[deployment_create_params.IngressOpts] | Omit = omit, + logging: Optional[deployment_create_params.Logging] | Omit = omit, + probes: Optional[deployment_create_params.Probes] | Omit = omit, + api_timeout: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create inference deployment @@ -179,26 +179,26 @@ def update( deployment_name: str, *, project_id: int | None = None, - api_keys: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - auth_enabled: bool | NotGiven = NOT_GIVEN, - command: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN, - credentials_name: Optional[str] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - flavor_name: str | NotGiven = NOT_GIVEN, - image: Optional[str] | NotGiven = NOT_GIVEN, - ingress_opts: Optional[deployment_update_params.IngressOpts] | NotGiven = NOT_GIVEN, - listening_port: Optional[int] | NotGiven = NOT_GIVEN, - logging: Optional[deployment_update_params.Logging] | NotGiven = NOT_GIVEN, - probes: Optional[deployment_update_params.Probes] | NotGiven = NOT_GIVEN, - api_timeout: Optional[int] | NotGiven = NOT_GIVEN, + api_keys: Optional[SequenceNotStr[str]] | Omit = omit, + auth_enabled: bool | Omit = omit, + command: Optional[SequenceNotStr[str]] | Omit = omit, + containers: Optional[Iterable[deployment_update_params.Container]] | Omit = omit, + credentials_name: Optional[str] | Omit = omit, + description: Optional[str] | Omit = omit, + envs: Optional[Dict[str, str]] | Omit = omit, + flavor_name: str | Omit = omit, + image: Optional[str] | Omit = omit, + ingress_opts: Optional[deployment_update_params.IngressOpts] | Omit = omit, + listening_port: Optional[int] | Omit = omit, + logging: Optional[deployment_update_params.Logging] | Omit = omit, + probes: Optional[deployment_update_params.Probes] | Omit = omit, + api_timeout: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Update inference deployment @@ -293,14 +293,14 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[InferenceDeployment]: """List inference deployments @@ -353,7 +353,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete inference deployment @@ -393,7 +393,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceDeployment: """ Get inference deployment @@ -434,7 +434,7 @@ def get_api_key( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceDeploymentAPIKey: """ Get inference deployment API key @@ -474,7 +474,7 @@ def start( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ This operation initializes an inference deployment after it was stopped, making @@ -522,7 +522,7 @@ def stop( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ This operation shuts down an inference deployment, making it unavailable for @@ -761,22 +761,22 @@ async def create( image: str, listening_port: int, name: str, - api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - auth_enabled: bool | NotGiven = NOT_GIVEN, - command: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - credentials_name: Optional[str] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - envs: Dict[str, str] | NotGiven = NOT_GIVEN, - ingress_opts: Optional[deployment_create_params.IngressOpts] | NotGiven = NOT_GIVEN, - logging: Optional[deployment_create_params.Logging] | NotGiven = NOT_GIVEN, - probes: Optional[deployment_create_params.Probes] | NotGiven = NOT_GIVEN, - api_timeout: Optional[int] | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | Omit = omit, + auth_enabled: bool | Omit = omit, + command: Optional[SequenceNotStr[str]] | Omit = omit, + credentials_name: Optional[str] | Omit = omit, + description: Optional[str] | Omit = omit, + envs: Dict[str, str] | Omit = omit, + ingress_opts: Optional[deployment_create_params.IngressOpts] | Omit = omit, + logging: Optional[deployment_create_params.Logging] | Omit = omit, + probes: Optional[deployment_create_params.Probes] | Omit = omit, + api_timeout: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create inference deployment @@ -872,26 +872,26 @@ async def update( deployment_name: str, *, project_id: int | None = None, - api_keys: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - auth_enabled: bool | NotGiven = NOT_GIVEN, - command: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN, - credentials_name: Optional[str] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - flavor_name: str | NotGiven = NOT_GIVEN, - image: Optional[str] | NotGiven = NOT_GIVEN, - ingress_opts: Optional[deployment_update_params.IngressOpts] | NotGiven = NOT_GIVEN, - listening_port: Optional[int] | NotGiven = NOT_GIVEN, - logging: Optional[deployment_update_params.Logging] | NotGiven = NOT_GIVEN, - probes: Optional[deployment_update_params.Probes] | NotGiven = NOT_GIVEN, - api_timeout: Optional[int] | NotGiven = NOT_GIVEN, + api_keys: Optional[SequenceNotStr[str]] | Omit = omit, + auth_enabled: bool | Omit = omit, + command: Optional[SequenceNotStr[str]] | Omit = omit, + containers: Optional[Iterable[deployment_update_params.Container]] | Omit = omit, + credentials_name: Optional[str] | Omit = omit, + description: Optional[str] | Omit = omit, + envs: Optional[Dict[str, str]] | Omit = omit, + flavor_name: str | Omit = omit, + image: Optional[str] | Omit = omit, + ingress_opts: Optional[deployment_update_params.IngressOpts] | Omit = omit, + listening_port: Optional[int] | Omit = omit, + logging: Optional[deployment_update_params.Logging] | Omit = omit, + probes: Optional[deployment_update_params.Probes] | Omit = omit, + api_timeout: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Update inference deployment @@ -986,14 +986,14 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[InferenceDeployment, AsyncOffsetPage[InferenceDeployment]]: """List inference deployments @@ -1046,7 +1046,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete inference deployment @@ -1086,7 +1086,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceDeployment: """ Get inference deployment @@ -1127,7 +1127,7 @@ async def get_api_key( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceDeploymentAPIKey: """ Get inference deployment API key @@ -1167,7 +1167,7 @@ async def start( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ This operation initializes an inference deployment after it was stopped, making @@ -1215,7 +1215,7 @@ async def stop( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ This operation shuts down an inference deployment, making it unavailable for diff --git a/src/gcore/resources/cloud/inference/deployments/logs.py b/src/gcore/resources/cloud/inference/deployments/logs.py index 1cc65006..3a46cbd0 100644 --- a/src/gcore/resources/cloud/inference/deployments/logs.py +++ b/src/gcore/resources/cloud/inference/deployments/logs.py @@ -7,7 +7,7 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ....._utils import maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -50,16 +50,16 @@ def list( deployment_name: str, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["time.asc", "time.desc"] | NotGiven = NOT_GIVEN, - region_id: Optional[int] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["time.asc", "time.desc"] | Omit = omit, + region_id: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[InferenceDeploymentLog]: """ Get inference deployment logs @@ -137,16 +137,16 @@ def list( deployment_name: str, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["time.asc", "time.desc"] | NotGiven = NOT_GIVEN, - region_id: Optional[int] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["time.asc", "time.desc"] | Omit = omit, + region_id: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[InferenceDeploymentLog, AsyncOffsetPage[InferenceDeploymentLog]]: """ Get inference deployment logs diff --git a/src/gcore/resources/cloud/inference/flavors.py b/src/gcore/resources/cloud/inference/flavors.py index d273b19b..c9934320 100644 --- a/src/gcore/resources/cloud/inference/flavors.py +++ b/src/gcore/resources/cloud/inference/flavors.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -45,14 +45,14 @@ def with_streaming_response(self) -> FlavorsResourceWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[InferenceFlavor]: """List inference flavors @@ -100,7 +100,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceFlavor: """ Get inference flavor @@ -150,14 +150,14 @@ def with_streaming_response(self) -> AsyncFlavorsResourceWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[InferenceFlavor, AsyncOffsetPage[InferenceFlavor]]: """List inference flavors @@ -205,7 +205,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceFlavor: """ Get inference flavor diff --git a/src/gcore/resources/cloud/inference/inference.py b/src/gcore/resources/cloud/inference/inference.py index 103c70f1..86dd2f3c 100644 --- a/src/gcore/resources/cloud/inference/inference.py +++ b/src/gcore/resources/cloud/inference/inference.py @@ -28,7 +28,7 @@ APIKeysResourceWithStreamingResponse, AsyncAPIKeysResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -119,7 +119,7 @@ def get_capacity_by_region( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return self._get( @@ -183,7 +183,7 @@ async def get_capacity_by_region( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return await self._get( diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py index 6dd78f70..c34dfc0a 100644 --- a/src/gcore/resources/cloud/inference/registry_credentials.py +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -59,7 +59,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceRegistryCredentials: """ Create inference registry credential @@ -106,14 +106,14 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[InferenceRegistryCredentials]: """ List inference registry credentials @@ -165,7 +165,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete inference registry credential @@ -206,7 +206,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceRegistryCredentials: """ Get inference registry credential @@ -249,7 +249,7 @@ def replace( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceRegistryCredentials: """ Replace inference registry credential @@ -327,7 +327,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceRegistryCredentials: """ Create inference registry credential @@ -374,14 +374,14 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[InferenceRegistryCredentials, AsyncOffsetPage[InferenceRegistryCredentials]]: """ List inference registry credentials @@ -433,7 +433,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete inference registry credential @@ -474,7 +474,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceRegistryCredentials: """ Get inference registry credential @@ -517,7 +517,7 @@ async def replace( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceRegistryCredentials: """ Replace inference registry credential diff --git a/src/gcore/resources/cloud/inference/secrets.py b/src/gcore/resources/cloud/inference/secrets.py index 275ec3f2..6b168d22 100644 --- a/src/gcore/resources/cloud/inference/secrets.py +++ b/src/gcore/resources/cloud/inference/secrets.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -54,7 +54,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceSecret: """ Create inference secret @@ -98,14 +98,14 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[InferenceSecret]: """List inference secrets @@ -158,7 +158,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete Inference Secret @@ -199,7 +199,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceSecret: """ Get inference secret @@ -241,7 +241,7 @@ def replace( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceSecret: """ Replace inference secret @@ -315,7 +315,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceSecret: """ Create inference secret @@ -359,14 +359,14 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[InferenceSecret, AsyncOffsetPage[InferenceSecret]]: """List inference secrets @@ -419,7 +419,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete Inference Secret @@ -460,7 +460,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceSecret: """ Get inference secret @@ -502,7 +502,7 @@ async def replace( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InferenceSecret: """ Replace inference secret diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 9bd7f38f..23ba0073 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -46,16 +46,16 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - disabled: bool | NotGiven = NOT_GIVEN, - exclude_linux: bool | NotGiven = NOT_GIVEN, - exclude_windows: bool | NotGiven = NOT_GIVEN, - include_prices: bool | NotGiven = NOT_GIVEN, + disabled: bool | Omit = omit, + exclude_linux: bool | Omit = omit, + exclude_windows: bool | Omit = omit, + include_prices: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceFlavorList: """Retrieve a list of available instance flavors in the project and region. @@ -130,16 +130,16 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - disabled: bool | NotGiven = NOT_GIVEN, - exclude_linux: bool | NotGiven = NOT_GIVEN, - exclude_windows: bool | NotGiven = NOT_GIVEN, - include_prices: bool | NotGiven = NOT_GIVEN, + disabled: bool | Omit = omit, + exclude_linux: bool | Omit = omit, + exclude_windows: bool | Omit = omit, + include_prices: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceFlavorList: """Retrieve a list of available instance flavors in the project and region. diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index 7b13a49a..341ecc47 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -59,19 +59,19 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - hw_firmware_type: Literal["bios", "uefi"] | NotGiven = NOT_GIVEN, - hw_machine_type: Literal["pc", "q35"] | NotGiven = NOT_GIVEN, - is_baremetal: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + hw_firmware_type: Literal["bios", "uefi"] | Omit = omit, + hw_machine_type: Literal["pc", "q35"] | Omit = omit, + is_baremetal: bool | Omit = omit, + name: str | Omit = omit, + os_type: Literal["linux", "windows"] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Image: """ Update image properties and tags. @@ -134,17 +134,17 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, - private: str | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, + include_prices: bool | Omit = omit, + private: str | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, + visibility: Literal["private", "public", "shared"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ImageList: """Retrieve a list of available images in the project and region. @@ -207,7 +207,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Delete a specific image. @@ -278,20 +278,20 @@ def create_from_volume( region_id: int | None = None, name: str, volume_id: str, - architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN, - is_baremetal: bool | NotGiven = NOT_GIVEN, - os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - source: Literal["volume"] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + architecture: Literal["aarch64", "x86_64"] | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + hw_machine_type: Optional[Literal["pc", "q35"]] | Omit = omit, + is_baremetal: bool | Omit = omit, + os_type: Literal["linux", "windows"] | Omit = omit, + source: Literal["volume"] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new image from a bootable volume. @@ -424,13 +424,13 @@ def get( *, project_id: int | None = None, region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, + include_prices: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Image: """ Retrieve detailed information about a specific image. @@ -471,22 +471,22 @@ def upload( region_id: int | None = None, name: str, url: str, - architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, - cow_format: bool | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN, - is_baremetal: bool | NotGiven = NOT_GIVEN, - os_distro: Optional[str] | NotGiven = NOT_GIVEN, - os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - os_version: Optional[str] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + architecture: Literal["aarch64", "x86_64"] | Omit = omit, + cow_format: bool | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + hw_machine_type: Optional[Literal["pc", "q35"]] | Omit = omit, + is_baremetal: bool | Omit = omit, + os_distro: Optional[str] | Omit = omit, + os_type: Literal["linux", "windows"] | Omit = omit, + os_version: Optional[str] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Upload an image from a URL. @@ -651,19 +651,19 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - hw_firmware_type: Literal["bios", "uefi"] | NotGiven = NOT_GIVEN, - hw_machine_type: Literal["pc", "q35"] | NotGiven = NOT_GIVEN, - is_baremetal: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + hw_firmware_type: Literal["bios", "uefi"] | Omit = omit, + hw_machine_type: Literal["pc", "q35"] | Omit = omit, + is_baremetal: bool | Omit = omit, + name: str | Omit = omit, + os_type: Literal["linux", "windows"] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Image: """ Update image properties and tags. @@ -726,17 +726,17 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, - private: str | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - visibility: Literal["private", "public", "shared"] | NotGiven = NOT_GIVEN, + include_prices: bool | Omit = omit, + private: str | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, + visibility: Literal["private", "public", "shared"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ImageList: """Retrieve a list of available images in the project and region. @@ -799,7 +799,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Delete a specific image. @@ -870,20 +870,20 @@ async def create_from_volume( region_id: int | None = None, name: str, volume_id: str, - architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN, - is_baremetal: bool | NotGiven = NOT_GIVEN, - os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - source: Literal["volume"] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + architecture: Literal["aarch64", "x86_64"] | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + hw_machine_type: Optional[Literal["pc", "q35"]] | Omit = omit, + is_baremetal: bool | Omit = omit, + os_type: Literal["linux", "windows"] | Omit = omit, + source: Literal["volume"] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new image from a bootable volume. @@ -1016,13 +1016,13 @@ async def get( *, project_id: int | None = None, region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, + include_prices: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Image: """ Retrieve detailed information about a specific image. @@ -1063,22 +1063,22 @@ async def upload( region_id: int | None = None, name: str, url: str, - architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, - cow_format: bool | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN, - is_baremetal: bool | NotGiven = NOT_GIVEN, - os_distro: Optional[str] | NotGiven = NOT_GIVEN, - os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - os_version: Optional[str] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + architecture: Literal["aarch64", "x86_64"] | Omit = omit, + cow_format: bool | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + hw_machine_type: Optional[Literal["pc", "q35"]] | Omit = omit, + is_baremetal: bool | Omit = omit, + os_distro: Optional[str] | Omit = omit, + os_type: Literal["linux", "windows"] | Omit = omit, + os_version: Optional[str] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Upload an image from a URL. diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 6cb7f865..01bc8444 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -32,7 +32,7 @@ MetricsResourceWithStreamingResponse, AsyncMetricsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ...._utils import required_args, maybe_transform, async_maybe_transform from ...._compat import cached_property from .interfaces import ( @@ -116,23 +116,23 @@ def create( flavor: str, interfaces: Iterable[instance_create_params.Interface], volumes: Iterable[instance_create_params.Volume], - allow_app_ports: bool | NotGiven = NOT_GIVEN, - configuration: Optional[object] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - password: str | NotGiven = NOT_GIVEN, - security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, - servergroup_id: str | NotGiven = NOT_GIVEN, - ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - username: str | NotGiven = NOT_GIVEN, + allow_app_ports: bool | Omit = omit, + configuration: Optional[object] | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + password: str | Omit = omit, + security_groups: Iterable[instance_create_params.SecurityGroup] | Omit = omit, + servergroup_id: str | Omit = omit, + ssh_key_name: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + user_data: str | Omit = omit, + username: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create an instance with specified configuration. @@ -336,7 +336,7 @@ def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Instance: """ Rename instance @@ -378,25 +378,25 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - available_floating: bool | NotGiven = NOT_GIVEN, - changes_before: Union[str, datetime] | NotGiven = NOT_GIVEN, - changes_since: Union[str, datetime] | NotGiven = NOT_GIVEN, - exclude_flavor_prefix: str | NotGiven = NOT_GIVEN, - exclude_secgroup: str | NotGiven = NOT_GIVEN, - flavor_id: str | NotGiven = NOT_GIVEN, - flavor_prefix: str | NotGiven = NOT_GIVEN, - include_ai: bool | NotGiven = NOT_GIVEN, - include_baremetal: bool | NotGiven = NOT_GIVEN, - include_k8s: bool | NotGiven = NOT_GIVEN, - ip: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - only_isolated: bool | NotGiven = NOT_GIVEN, - only_with_fixed_external_ip: bool | NotGiven = NOT_GIVEN, - order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, - profile_name: str | NotGiven = NOT_GIVEN, - protection_status: Literal["Active", "Queued", "Error"] | NotGiven = NOT_GIVEN, + available_floating: bool | Omit = omit, + changes_before: Union[str, datetime] | Omit = omit, + changes_since: Union[str, datetime] | Omit = omit, + exclude_flavor_prefix: str | Omit = omit, + exclude_secgroup: str | Omit = omit, + flavor_id: str | Omit = omit, + flavor_prefix: str | Omit = omit, + include_ai: bool | Omit = omit, + include_baremetal: bool | Omit = omit, + include_k8s: bool | Omit = omit, + ip: str | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + only_isolated: bool | Omit = omit, + only_with_fixed_external_ip: bool | Omit = omit, + order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] | Omit = omit, + profile_name: str | Omit = omit, + protection_status: Literal["Active", "Queued", "Error"] | Omit = omit, status: Literal[ "ACTIVE", "BUILD", @@ -415,19 +415,19 @@ def list( "SUSPENDED", "VERIFY_RESIZE", ] - | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - tag_value: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, - uuid: str | NotGiven = NOT_GIVEN, - with_ddos: bool | NotGiven = NOT_GIVEN, - with_interfaces_name: bool | NotGiven = NOT_GIVEN, + | Omit = omit, + tag_key_value: str | Omit = omit, + tag_value: SequenceNotStr[str] | Omit = omit, + type_ddos_profile: Literal["basic", "advanced"] | Omit = omit, + uuid: str | Omit = omit, + with_ddos: bool | Omit = omit, + with_interfaces_name: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Instance]: """List all instances in the specified project and region. @@ -562,16 +562,16 @@ def delete( *, project_id: int | None = None, region_id: int | None = None, - delete_floatings: bool | NotGiven = NOT_GIVEN, - floatings: str | NotGiven = NOT_GIVEN, - reserved_fixed_ips: str | NotGiven = NOT_GIVEN, - volumes: str | NotGiven = NOT_GIVEN, + delete_floatings: bool | Omit = omit, + floatings: str | Omit = omit, + reserved_fixed_ips: str | Omit = omit, + volumes: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete instance @@ -677,13 +677,13 @@ def action( project_id: int | None = None, region_id: int | None = None, action: Literal["start"], - activate_profile: Optional[bool] | NotGiven = NOT_GIVEN, + activate_profile: Optional[bool] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ The action can be one of: start, stop, reboot, powercycle, suspend or resume. @@ -717,7 +717,7 @@ def action( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ The action can be one of: start, stop, reboot, powercycle, suspend or resume. @@ -744,13 +744,13 @@ def action( project_id: int | None = None, region_id: int | None = None, action: Literal["start"] | Literal["reboot", "reboot_hard", "resume", "stop", "suspend"], - activate_profile: Optional[bool] | NotGiven = NOT_GIVEN, + activate_profile: Optional[bool] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -904,7 +904,7 @@ def add_to_placement_group( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Add an instance to a server group. @@ -988,15 +988,15 @@ def assign_security_group( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, + name: str | Omit = omit, ports_security_group_names: Iterable[instance_assign_security_group_params.PortsSecurityGroupName] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Assign the security group to the server. @@ -1049,7 +1049,7 @@ def disable_port_security( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceInterface: """ Disable port security for instance interface @@ -1088,7 +1088,7 @@ def enable_port_security( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceInterface: """ Enable port security for instance interface @@ -1127,7 +1127,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Instance: """Retrieve detailed information about a specific instance. @@ -1176,13 +1176,13 @@ def get_console( *, project_id: int | None = None, region_id: int | None = None, - console_type: str | NotGiven = NOT_GIVEN, + console_type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Console: """ Get instance console URL @@ -1229,7 +1229,7 @@ def remove_from_placement_group( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Remove an instance from its current server group. @@ -1311,7 +1311,7 @@ def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Change flavor of the instance @@ -1390,15 +1390,15 @@ def unassign_security_group( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, + name: str | Omit = omit, ports_security_group_names: Iterable[instance_unassign_security_group_params.PortsSecurityGroupName] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Un-assign the security group to the server. @@ -1485,23 +1485,23 @@ async def create( flavor: str, interfaces: Iterable[instance_create_params.Interface], volumes: Iterable[instance_create_params.Volume], - allow_app_ports: bool | NotGiven = NOT_GIVEN, - configuration: Optional[object] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - password: str | NotGiven = NOT_GIVEN, - security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, - servergroup_id: str | NotGiven = NOT_GIVEN, - ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - username: str | NotGiven = NOT_GIVEN, + allow_app_ports: bool | Omit = omit, + configuration: Optional[object] | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + password: str | Omit = omit, + security_groups: Iterable[instance_create_params.SecurityGroup] | Omit = omit, + servergroup_id: str | Omit = omit, + ssh_key_name: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + user_data: str | Omit = omit, + username: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create an instance with specified configuration. @@ -1705,7 +1705,7 @@ async def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Instance: """ Rename instance @@ -1747,25 +1747,25 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - available_floating: bool | NotGiven = NOT_GIVEN, - changes_before: Union[str, datetime] | NotGiven = NOT_GIVEN, - changes_since: Union[str, datetime] | NotGiven = NOT_GIVEN, - exclude_flavor_prefix: str | NotGiven = NOT_GIVEN, - exclude_secgroup: str | NotGiven = NOT_GIVEN, - flavor_id: str | NotGiven = NOT_GIVEN, - flavor_prefix: str | NotGiven = NOT_GIVEN, - include_ai: bool | NotGiven = NOT_GIVEN, - include_baremetal: bool | NotGiven = NOT_GIVEN, - include_k8s: bool | NotGiven = NOT_GIVEN, - ip: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - only_isolated: bool | NotGiven = NOT_GIVEN, - only_with_fixed_external_ip: bool | NotGiven = NOT_GIVEN, - order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, - profile_name: str | NotGiven = NOT_GIVEN, - protection_status: Literal["Active", "Queued", "Error"] | NotGiven = NOT_GIVEN, + available_floating: bool | Omit = omit, + changes_before: Union[str, datetime] | Omit = omit, + changes_since: Union[str, datetime] | Omit = omit, + exclude_flavor_prefix: str | Omit = omit, + exclude_secgroup: str | Omit = omit, + flavor_id: str | Omit = omit, + flavor_prefix: str | Omit = omit, + include_ai: bool | Omit = omit, + include_baremetal: bool | Omit = omit, + include_k8s: bool | Omit = omit, + ip: str | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + only_isolated: bool | Omit = omit, + only_with_fixed_external_ip: bool | Omit = omit, + order_by: Literal["created.asc", "created.desc", "name.asc", "name.desc"] | Omit = omit, + profile_name: str | Omit = omit, + protection_status: Literal["Active", "Queued", "Error"] | Omit = omit, status: Literal[ "ACTIVE", "BUILD", @@ -1784,19 +1784,19 @@ def list( "SUSPENDED", "VERIFY_RESIZE", ] - | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - tag_value: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - type_ddos_profile: Literal["basic", "advanced"] | NotGiven = NOT_GIVEN, - uuid: str | NotGiven = NOT_GIVEN, - with_ddos: bool | NotGiven = NOT_GIVEN, - with_interfaces_name: bool | NotGiven = NOT_GIVEN, + | Omit = omit, + tag_key_value: str | Omit = omit, + tag_value: SequenceNotStr[str] | Omit = omit, + type_ddos_profile: Literal["basic", "advanced"] | Omit = omit, + uuid: str | Omit = omit, + with_ddos: bool | Omit = omit, + with_interfaces_name: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Instance, AsyncOffsetPage[Instance]]: """List all instances in the specified project and region. @@ -1931,16 +1931,16 @@ async def delete( *, project_id: int | None = None, region_id: int | None = None, - delete_floatings: bool | NotGiven = NOT_GIVEN, - floatings: str | NotGiven = NOT_GIVEN, - reserved_fixed_ips: str | NotGiven = NOT_GIVEN, - volumes: str | NotGiven = NOT_GIVEN, + delete_floatings: bool | Omit = omit, + floatings: str | Omit = omit, + reserved_fixed_ips: str | Omit = omit, + volumes: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete instance @@ -2046,13 +2046,13 @@ async def action( project_id: int | None = None, region_id: int | None = None, action: Literal["start"], - activate_profile: Optional[bool] | NotGiven = NOT_GIVEN, + activate_profile: Optional[bool] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ The action can be one of: start, stop, reboot, powercycle, suspend or resume. @@ -2086,7 +2086,7 @@ async def action( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ The action can be one of: start, stop, reboot, powercycle, suspend or resume. @@ -2113,13 +2113,13 @@ async def action( project_id: int | None = None, region_id: int | None = None, action: Literal["start"] | Literal["reboot", "reboot_hard", "resume", "stop", "suspend"], - activate_profile: Optional[bool] | NotGiven = NOT_GIVEN, + activate_profile: Optional[bool] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -2273,7 +2273,7 @@ async def add_to_placement_group( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Add an instance to a server group. @@ -2357,15 +2357,15 @@ async def assign_security_group( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, + name: str | Omit = omit, ports_security_group_names: Iterable[instance_assign_security_group_params.PortsSecurityGroupName] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Assign the security group to the server. @@ -2418,7 +2418,7 @@ async def disable_port_security( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceInterface: """ Disable port security for instance interface @@ -2457,7 +2457,7 @@ async def enable_port_security( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceInterface: """ Enable port security for instance interface @@ -2496,7 +2496,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Instance: """Retrieve detailed information about a specific instance. @@ -2545,13 +2545,13 @@ async def get_console( *, project_id: int | None = None, region_id: int | None = None, - console_type: str | NotGiven = NOT_GIVEN, + console_type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Console: """ Get instance console URL @@ -2598,7 +2598,7 @@ async def remove_from_placement_group( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Remove an instance from its current server group. @@ -2680,7 +2680,7 @@ async def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Change flavor of the instance @@ -2759,15 +2759,15 @@ async def unassign_security_group( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, + name: str | Omit = omit, ports_security_group_names: Iterable[instance_unassign_security_group_params.PortsSecurityGroupName] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Un-assign the security group to the server. diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index 5d1c5c35..fb39a7fc 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -56,7 +56,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> NetworkInterfaceList: """ List all network interfaces attached to the specified instance. @@ -91,20 +91,19 @@ def attach( *, project_id: int | None = None, region_id: int | None = None, - ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to instance @@ -140,18 +139,17 @@ def attach( project_id: int | None = None, region_id: int | None = None, subnet_id: str, - ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, - security_groups: Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to instance @@ -187,19 +185,18 @@ def attach( project_id: int | None = None, region_id: int | None = None, network_id: str, - ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, - security_groups: Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to instance @@ -237,18 +234,17 @@ def attach( project_id: int | None = None, region_id: int | None = None, port_id: str, - ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, - security_groups: Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to instance @@ -286,25 +282,25 @@ def attach( | interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] | Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] | Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] | Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - subnet_id: str | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - port_id: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + port_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -640,7 +636,7 @@ def detach( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Detach interface from instance @@ -711,7 +707,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> NetworkInterfaceList: """ List all network interfaces attached to the specified instance. @@ -746,20 +742,19 @@ async def attach( *, project_id: int | None = None, region_id: int | None = None, - ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to instance @@ -795,18 +790,17 @@ async def attach( project_id: int | None = None, region_id: int | None = None, subnet_id: str, - ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, - security_groups: Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to instance @@ -842,19 +836,18 @@ async def attach( project_id: int | None = None, region_id: int | None = None, network_id: str, - ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, - security_groups: Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to instance @@ -892,18 +885,17 @@ async def attach( project_id: int | None = None, region_id: int | None = None, port_id: str, - ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, - security_groups: Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, + security_groups: Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Attach interface to instance @@ -941,25 +933,25 @@ async def attach( | interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] | Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] | Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] | Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - subnet_id: str | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - port_id: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + port_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -1217,7 +1209,7 @@ async def detach( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Detach interface from instance diff --git a/src/gcore/resources/cloud/instances/metrics.py b/src/gcore/resources/cloud/instances/metrics.py index fa058434..c24b208c 100644 --- a/src/gcore/resources/cloud/instances/metrics.py +++ b/src/gcore/resources/cloud/instances/metrics.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -56,7 +56,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> MetricsList: """ Get instance metrics, including cpu, memory, network and disk metrics @@ -135,7 +135,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> MetricsList: """ Get instance metrics, including cpu, memory, network and disk metrics diff --git a/src/gcore/resources/cloud/ip_ranges.py b/src/gcore/resources/cloud/ip_ranges.py index 12024d04..fe7f9a68 100644 --- a/src/gcore/resources/cloud/ip_ranges.py +++ b/src/gcore/resources/cloud/ip_ranges.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -47,7 +47,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPRanges: """ Returns the complete list of IPv4 and IPv6 address ranges that Cloud uses for @@ -103,7 +103,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPRanges: """ Returns the complete list of IPv4 and IPv6 address ranges that Cloud uses for diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index a778a3b9..2ab3669e 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -14,7 +14,7 @@ NodesResourceWithStreamingResponse, AsyncNodesResourceWithStreamingResponse, ) -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 .pools.pools import ( @@ -86,25 +86,25 @@ def create( name: str, pools: Iterable[cluster_create_params.Pool], version: str, - authentication: Optional[cluster_create_params.Authentication] | NotGiven = NOT_GIVEN, - autoscaler_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - cni: Optional[cluster_create_params.Cni] | NotGiven = NOT_GIVEN, - csi: cluster_create_params.Csi | NotGiven = NOT_GIVEN, - ddos_profile: Optional[cluster_create_params.DDOSProfile] | NotGiven = NOT_GIVEN, - fixed_network: Optional[str] | NotGiven = NOT_GIVEN, - fixed_subnet: Optional[str] | NotGiven = NOT_GIVEN, - is_ipv6: Optional[bool] | NotGiven = NOT_GIVEN, - logging: Optional[cluster_create_params.Logging] | NotGiven = NOT_GIVEN, - pods_ip_pool: Optional[str] | NotGiven = NOT_GIVEN, - pods_ipv6_pool: Optional[str] | NotGiven = NOT_GIVEN, - services_ip_pool: Optional[str] | NotGiven = NOT_GIVEN, - services_ipv6_pool: Optional[str] | NotGiven = NOT_GIVEN, + authentication: Optional[cluster_create_params.Authentication] | Omit = omit, + autoscaler_config: Optional[Dict[str, str]] | Omit = omit, + cni: Optional[cluster_create_params.Cni] | Omit = omit, + csi: cluster_create_params.Csi | Omit = omit, + ddos_profile: Optional[cluster_create_params.DDOSProfile] | Omit = omit, + fixed_network: Optional[str] | Omit = omit, + fixed_subnet: Optional[str] | Omit = omit, + is_ipv6: Optional[bool] | Omit = omit, + logging: Optional[cluster_create_params.Logging] | Omit = omit, + pods_ip_pool: Optional[str] | Omit = omit, + pods_ipv6_pool: Optional[str] | Omit = omit, + services_ip_pool: Optional[str] | Omit = omit, + services_ipv6_pool: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create k8s cluster @@ -245,17 +245,17 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - authentication: Optional[cluster_update_params.Authentication] | NotGiven = NOT_GIVEN, - autoscaler_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - cni: Optional[cluster_update_params.Cni] | NotGiven = NOT_GIVEN, - ddos_profile: Optional[cluster_update_params.DDOSProfile] | NotGiven = NOT_GIVEN, - logging: Optional[cluster_update_params.Logging] | NotGiven = NOT_GIVEN, + authentication: Optional[cluster_update_params.Authentication] | Omit = omit, + autoscaler_config: Optional[Dict[str, str]] | Omit = omit, + cni: Optional[cluster_update_params.Cni] | Omit = omit, + ddos_profile: Optional[cluster_update_params.DDOSProfile] | Omit = omit, + logging: Optional[cluster_update_params.Logging] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Update k8s cluster @@ -366,7 +366,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterList: """ List k8s clusters @@ -398,13 +398,13 @@ def delete( *, project_id: int | None = None, region_id: int | None = None, - volumes: str | NotGiven = NOT_GIVEN, + volumes: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete k8s cluster @@ -449,7 +449,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sCluster: """ Get k8s cluster @@ -488,7 +488,7 @@ def get_certificate( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterCertificate: """ Get k8s cluster CA certificate @@ -527,7 +527,7 @@ def get_kubeconfig( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterKubeconfig: """ Get k8s cluster kubeconfig @@ -566,7 +566,7 @@ def list_versions_for_upgrade( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterVersionList: """ List available k8s cluster versions for upgrade @@ -606,7 +606,7 @@ def upgrade( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Upgrade k8s cluster @@ -675,25 +675,25 @@ async def create( name: str, pools: Iterable[cluster_create_params.Pool], version: str, - authentication: Optional[cluster_create_params.Authentication] | NotGiven = NOT_GIVEN, - autoscaler_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - cni: Optional[cluster_create_params.Cni] | NotGiven = NOT_GIVEN, - csi: cluster_create_params.Csi | NotGiven = NOT_GIVEN, - ddos_profile: Optional[cluster_create_params.DDOSProfile] | NotGiven = NOT_GIVEN, - fixed_network: Optional[str] | NotGiven = NOT_GIVEN, - fixed_subnet: Optional[str] | NotGiven = NOT_GIVEN, - is_ipv6: Optional[bool] | NotGiven = NOT_GIVEN, - logging: Optional[cluster_create_params.Logging] | NotGiven = NOT_GIVEN, - pods_ip_pool: Optional[str] | NotGiven = NOT_GIVEN, - pods_ipv6_pool: Optional[str] | NotGiven = NOT_GIVEN, - services_ip_pool: Optional[str] | NotGiven = NOT_GIVEN, - services_ipv6_pool: Optional[str] | NotGiven = NOT_GIVEN, + authentication: Optional[cluster_create_params.Authentication] | Omit = omit, + autoscaler_config: Optional[Dict[str, str]] | Omit = omit, + cni: Optional[cluster_create_params.Cni] | Omit = omit, + csi: cluster_create_params.Csi | Omit = omit, + ddos_profile: Optional[cluster_create_params.DDOSProfile] | Omit = omit, + fixed_network: Optional[str] | Omit = omit, + fixed_subnet: Optional[str] | Omit = omit, + is_ipv6: Optional[bool] | Omit = omit, + logging: Optional[cluster_create_params.Logging] | Omit = omit, + pods_ip_pool: Optional[str] | Omit = omit, + pods_ipv6_pool: Optional[str] | Omit = omit, + services_ip_pool: Optional[str] | Omit = omit, + services_ipv6_pool: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create k8s cluster @@ -834,17 +834,17 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - authentication: Optional[cluster_update_params.Authentication] | NotGiven = NOT_GIVEN, - autoscaler_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - cni: Optional[cluster_update_params.Cni] | NotGiven = NOT_GIVEN, - ddos_profile: Optional[cluster_update_params.DDOSProfile] | NotGiven = NOT_GIVEN, - logging: Optional[cluster_update_params.Logging] | NotGiven = NOT_GIVEN, + authentication: Optional[cluster_update_params.Authentication] | Omit = omit, + autoscaler_config: Optional[Dict[str, str]] | Omit = omit, + cni: Optional[cluster_update_params.Cni] | Omit = omit, + ddos_profile: Optional[cluster_update_params.DDOSProfile] | Omit = omit, + logging: Optional[cluster_update_params.Logging] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Update k8s cluster @@ -955,7 +955,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterList: """ List k8s clusters @@ -987,13 +987,13 @@ async def delete( *, project_id: int | None = None, region_id: int | None = None, - volumes: str | NotGiven = NOT_GIVEN, + volumes: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete k8s cluster @@ -1038,7 +1038,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sCluster: """ Get k8s cluster @@ -1077,7 +1077,7 @@ async def get_certificate( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterCertificate: """ Get k8s cluster CA certificate @@ -1116,7 +1116,7 @@ async def get_kubeconfig( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterKubeconfig: """ Get k8s cluster kubeconfig @@ -1155,7 +1155,7 @@ async def list_versions_for_upgrade( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterVersionList: """ List available k8s cluster versions for upgrade @@ -1195,7 +1195,7 @@ async def upgrade( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Upgrade k8s cluster diff --git a/src/gcore/resources/cloud/k8s/clusters/nodes.py b/src/gcore/resources/cloud/k8s/clusters/nodes.py index b3bd95d8..4518d8b9 100644 --- a/src/gcore/resources/cloud/k8s/clusters/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/nodes.py @@ -4,7 +4,7 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ....._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -47,13 +47,13 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - with_ddos: bool | NotGiven = NOT_GIVEN, + with_ddos: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceList: """ List k8s cluster nodes @@ -99,7 +99,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ After deletion, the node will be automatically recreated to maintain the desired @@ -158,13 +158,13 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - with_ddos: bool | NotGiven = NOT_GIVEN, + with_ddos: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceList: """ List k8s cluster nodes @@ -210,7 +210,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ After deletion, the node will be automatically recreated to maintain the desired diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py index 903c428e..797c0e6e 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py @@ -4,7 +4,7 @@ import httpx -from ......_types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ......_types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ......_utils import maybe_transform, async_maybe_transform from ......_compat import cached_property from ......_resource import SyncAPIResource, AsyncAPIResource @@ -48,13 +48,13 @@ def list( project_id: int | None = None, region_id: int | None = None, cluster_name: str, - with_ddos: bool | NotGiven = NOT_GIVEN, + with_ddos: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceList: """ List k8s cluster pool nodes @@ -103,7 +103,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ After deletion, the node will be automatically recreated to maintain the desired @@ -165,13 +165,13 @@ async def list( project_id: int | None = None, region_id: int | None = None, cluster_name: str, - with_ddos: bool | NotGiven = NOT_GIVEN, + with_ddos: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InstanceList: """ List k8s cluster pool nodes @@ -220,7 +220,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ After deletion, the node will be automatically recreated to maintain the desired diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index 0cb81d5a..18e410c3 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -15,7 +15,7 @@ NodesResourceWithStreamingResponse, AsyncNodesResourceWithStreamingResponse, ) -from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -67,23 +67,23 @@ def create( flavor_id: str, min_node_count: int, name: str, - auto_healing_enabled: Optional[bool] | NotGiven = NOT_GIVEN, - boot_volume_size: Optional[int] | NotGiven = NOT_GIVEN, + auto_healing_enabled: Optional[bool] | Omit = omit, + boot_volume_size: Optional[int] | Omit = omit, boot_volume_type: Optional[Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]] - | NotGiven = NOT_GIVEN, - crio_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - is_public_ipv4: Optional[bool] | NotGiven = NOT_GIVEN, - kubelet_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - labels: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - max_node_count: Optional[int] | NotGiven = NOT_GIVEN, - servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] | NotGiven = NOT_GIVEN, - taints: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + | Omit = omit, + crio_config: Optional[Dict[str, str]] | Omit = omit, + is_public_ipv4: Optional[bool] | Omit = omit, + kubelet_config: Optional[Dict[str, str]] | Omit = omit, + labels: Optional[Dict[str, str]] | Omit = omit, + max_node_count: Optional[int] | Omit = omit, + servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] | Omit = omit, + taints: Optional[Dict[str, str]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create k8s cluster pool @@ -162,18 +162,18 @@ def update( project_id: int | None = None, region_id: int | None = None, cluster_name: str, - auto_healing_enabled: Optional[bool] | NotGiven = NOT_GIVEN, - labels: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - max_node_count: Optional[int] | NotGiven = NOT_GIVEN, - min_node_count: Optional[int] | NotGiven = NOT_GIVEN, - node_count: Optional[int] | NotGiven = NOT_GIVEN, - taints: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + auto_healing_enabled: Optional[bool] | Omit = omit, + labels: Optional[Dict[str, str]] | Omit = omit, + max_node_count: Optional[int] | Omit = omit, + min_node_count: Optional[int] | Omit = omit, + node_count: Optional[int] | Omit = omit, + taints: Optional[Dict[str, str]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterPool: """ Update k8s cluster pool @@ -237,7 +237,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterPoolList: """ List k8s cluster pools @@ -277,7 +277,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete k8s cluster pool @@ -319,7 +319,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterPool: """ Get k8s cluster pool @@ -362,7 +362,7 @@ def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Resize k8s cluster pool @@ -429,23 +429,23 @@ async def create( flavor_id: str, min_node_count: int, name: str, - auto_healing_enabled: Optional[bool] | NotGiven = NOT_GIVEN, - boot_volume_size: Optional[int] | NotGiven = NOT_GIVEN, + auto_healing_enabled: Optional[bool] | Omit = omit, + boot_volume_size: Optional[int] | Omit = omit, boot_volume_type: Optional[Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"]] - | NotGiven = NOT_GIVEN, - crio_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - is_public_ipv4: Optional[bool] | NotGiven = NOT_GIVEN, - kubelet_config: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - labels: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - max_node_count: Optional[int] | NotGiven = NOT_GIVEN, - servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] | NotGiven = NOT_GIVEN, - taints: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + | Omit = omit, + crio_config: Optional[Dict[str, str]] | Omit = omit, + is_public_ipv4: Optional[bool] | Omit = omit, + kubelet_config: Optional[Dict[str, str]] | Omit = omit, + labels: Optional[Dict[str, str]] | Omit = omit, + max_node_count: Optional[int] | Omit = omit, + servergroup_policy: Optional[Literal["affinity", "anti-affinity", "soft-anti-affinity"]] | Omit = omit, + taints: Optional[Dict[str, str]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create k8s cluster pool @@ -524,18 +524,18 @@ async def update( project_id: int | None = None, region_id: int | None = None, cluster_name: str, - auto_healing_enabled: Optional[bool] | NotGiven = NOT_GIVEN, - labels: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - max_node_count: Optional[int] | NotGiven = NOT_GIVEN, - min_node_count: Optional[int] | NotGiven = NOT_GIVEN, - node_count: Optional[int] | NotGiven = NOT_GIVEN, - taints: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + auto_healing_enabled: Optional[bool] | Omit = omit, + labels: Optional[Dict[str, str]] | Omit = omit, + max_node_count: Optional[int] | Omit = omit, + min_node_count: Optional[int] | Omit = omit, + node_count: Optional[int] | Omit = omit, + taints: Optional[Dict[str, str]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterPool: """ Update k8s cluster pool @@ -599,7 +599,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterPoolList: """ List k8s cluster pools @@ -639,7 +639,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete k8s cluster pool @@ -681,7 +681,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterPool: """ Get k8s cluster pool @@ -724,7 +724,7 @@ async def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Resize k8s cluster pool diff --git a/src/gcore/resources/cloud/k8s/flavors.py b/src/gcore/resources/cloud/k8s/flavors.py index 71781231..0823633e 100644 --- a/src/gcore/resources/cloud/k8s/flavors.py +++ b/src/gcore/resources/cloud/k8s/flavors.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -46,14 +46,14 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - exclude_gpu: bool | NotGiven = NOT_GIVEN, - include_prices: bool | NotGiven = NOT_GIVEN, + exclude_gpu: bool | Omit = omit, + include_prices: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BaremetalFlavorList: """Retrieve a list of flavors for k8s pool. @@ -122,14 +122,14 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - exclude_gpu: bool | NotGiven = NOT_GIVEN, - include_prices: bool | NotGiven = NOT_GIVEN, + exclude_gpu: bool | Omit = omit, + include_prices: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BaremetalFlavorList: """Retrieve a list of flavors for k8s pool. diff --git a/src/gcore/resources/cloud/k8s/k8s.py b/src/gcore/resources/cloud/k8s/k8s.py index ad74c5fd..f3ac5aff 100644 --- a/src/gcore/resources/cloud/k8s/k8s.py +++ b/src/gcore/resources/cloud/k8s/k8s.py @@ -12,7 +12,7 @@ FlavorsResourceWithStreamingResponse, AsyncFlavorsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -73,7 +73,7 @@ def list_versions( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterVersionList: """ List available k8s cluster versions for creation @@ -138,7 +138,7 @@ async def list_versions( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> K8sClusterVersionList: """ List available k8s cluster versions for creation diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index 48ba2c61..8d126cd7 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -46,13 +46,13 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, + include_prices: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerFlavorList: """Retrieve a list of load balancer flavors. @@ -113,13 +113,13 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - include_prices: bool | NotGiven = NOT_GIVEN, + include_prices: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerFlavorList: """Retrieve a list of load balancer flavors. 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 fdecdef4..595113f4 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 @@ -14,7 +14,7 @@ RulesResourceWithStreamingResponse, AsyncRulesResourceWithStreamingResponse, ) -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -64,19 +64,19 @@ def create( region_id: int | None = None, action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], listener_id: str, - name: str | NotGiven = NOT_GIVEN, - position: int | NotGiven = NOT_GIVEN, - redirect_http_code: int | NotGiven = NOT_GIVEN, - redirect_pool_id: str | NotGiven = NOT_GIVEN, - redirect_prefix: str | NotGiven = NOT_GIVEN, - redirect_url: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | Omit = omit, + redirect_pool_id: str | Omit = omit, + redirect_prefix: str | Omit = omit, + redirect_url: str | Omit = omit, + tags: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer L7 policy @@ -149,7 +149,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerL7PolicyList: """ List load balancer L7 policies @@ -186,7 +186,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer L7 policy @@ -225,7 +225,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerL7Policy: """ Get load balancer L7 policy @@ -260,19 +260,19 @@ def replace( project_id: int | None = None, region_id: int | None = None, action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], - name: str | NotGiven = NOT_GIVEN, - position: int | NotGiven = NOT_GIVEN, - redirect_http_code: int | NotGiven = NOT_GIVEN, - redirect_pool_id: str | NotGiven = NOT_GIVEN, - redirect_prefix: str | NotGiven = NOT_GIVEN, - redirect_url: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | Omit = omit, + redirect_pool_id: str | Omit = omit, + redirect_prefix: str | Omit = omit, + redirect_url: str | Omit = omit, + tags: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Replace load balancer L7 policy @@ -511,19 +511,19 @@ async def create( region_id: int | None = None, action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], listener_id: str, - name: str | NotGiven = NOT_GIVEN, - position: int | NotGiven = NOT_GIVEN, - redirect_http_code: int | NotGiven = NOT_GIVEN, - redirect_pool_id: str | NotGiven = NOT_GIVEN, - redirect_prefix: str | NotGiven = NOT_GIVEN, - redirect_url: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | Omit = omit, + redirect_pool_id: str | Omit = omit, + redirect_prefix: str | Omit = omit, + redirect_url: str | Omit = omit, + tags: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer L7 policy @@ -596,7 +596,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerL7PolicyList: """ List load balancer L7 policies @@ -633,7 +633,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer L7 policy @@ -672,7 +672,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerL7Policy: """ Get load balancer L7 policy @@ -707,19 +707,19 @@ async def replace( project_id: int | None = None, region_id: int | None = None, action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], - name: str | NotGiven = NOT_GIVEN, - position: int | NotGiven = NOT_GIVEN, - redirect_http_code: int | NotGiven = NOT_GIVEN, - redirect_pool_id: str | NotGiven = NOT_GIVEN, - redirect_prefix: str | NotGiven = NOT_GIVEN, - redirect_url: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | Omit = omit, + redirect_pool_id: str | Omit = omit, + redirect_prefix: str | Omit = omit, + redirect_url: str | Omit = omit, + tags: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Replace load balancer L7 policy 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 626bddc8..cbae12d9 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -6,7 +6,7 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -63,15 +63,15 @@ def create( "SSL_VERIFY_RESULT", ], value: str, - invert: bool | NotGiven = NOT_GIVEN, - key: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + invert: bool | Omit = omit, + key: str | Omit = omit, + tags: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer L7 rule @@ -135,7 +135,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerL7RuleList: """ List load balancer L7 policy rules @@ -175,7 +175,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer L7 rule @@ -217,7 +217,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerL7Rule: """ Get load balancer L7 rule @@ -254,10 +254,10 @@ def replace( project_id: int | None = None, region_id: int | None = None, l7policy_id: str, - compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] | NotGiven = NOT_GIVEN, - invert: bool | NotGiven = NOT_GIVEN, - key: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] | Omit = omit, + invert: bool | Omit = omit, + key: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, type: Literal[ "COOKIE", "FILE_TYPE", @@ -268,14 +268,14 @@ def replace( "SSL_DN_FIELD", "SSL_VERIFY_RESULT", ] - | NotGiven = NOT_GIVEN, - value: str | NotGiven = NOT_GIVEN, + | Omit = omit, + value: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Replace load balancer L7 rule properties @@ -532,15 +532,15 @@ async def create( "SSL_VERIFY_RESULT", ], value: str, - invert: bool | NotGiven = NOT_GIVEN, - key: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + invert: bool | Omit = omit, + key: str | Omit = omit, + tags: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer L7 rule @@ -604,7 +604,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerL7RuleList: """ List load balancer L7 policy rules @@ -644,7 +644,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer L7 rule @@ -686,7 +686,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerL7Rule: """ Get load balancer L7 rule @@ -723,10 +723,10 @@ async def replace( project_id: int | None = None, region_id: int | None = None, l7policy_id: str, - compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] | NotGiven = NOT_GIVEN, - invert: bool | NotGiven = NOT_GIVEN, - key: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + compare_type: Literal["CONTAINS", "ENDS_WITH", "EQUAL_TO", "REGEX", "STARTS_WITH"] | Omit = omit, + invert: bool | Omit = omit, + key: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, type: Literal[ "COOKIE", "FILE_TYPE", @@ -737,14 +737,14 @@ async def replace( "SSL_DN_FIELD", "SSL_VERIFY_RESULT", ] - | NotGiven = NOT_GIVEN, - value: str | NotGiven = NOT_GIVEN, + | Omit = omit, + value: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Replace load balancer L7 rule properties diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 729fe7fe..84de9e4d 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -6,7 +6,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -61,21 +61,21 @@ def create( name: str, protocol: LbListenerProtocol, protocol_port: int, - allowed_cidrs: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - connection_limit: int | NotGiven = NOT_GIVEN, - insert_x_forwarded: bool | NotGiven = NOT_GIVEN, - secret_id: str | NotGiven = NOT_GIVEN, - sni_secret_id: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, - user_list: Iterable[listener_create_params.UserList] | NotGiven = NOT_GIVEN, + allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, + connection_limit: int | Omit = omit, + insert_x_forwarded: bool | Omit = omit, + secret_id: str | Omit = omit, + sni_secret_id: SequenceNotStr[str] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, + user_list: Iterable[listener_create_params.UserList] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer listener @@ -158,21 +158,21 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - allowed_cidrs: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - connection_limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - sni_secret_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, - user_list: Optional[Iterable[listener_update_params.UserList]] | NotGiven = NOT_GIVEN, + allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, + connection_limit: int | Omit = omit, + name: str | Omit = omit, + secret_id: Optional[str] | Omit = omit, + sni_secret_id: Optional[SequenceNotStr[str]] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, + user_list: Optional[Iterable[listener_update_params.UserList]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Update load balancer listener @@ -245,14 +245,14 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - loadbalancer_id: str | NotGiven = NOT_GIVEN, - show_stats: bool | NotGiven = NOT_GIVEN, + loadbalancer_id: str | Omit = omit, + show_stats: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerListenerList: """ List load balancer listeners @@ -307,7 +307,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer listener @@ -347,13 +347,13 @@ def get( *, project_id: int | None = None, region_id: int | None = None, - show_stats: bool | NotGiven = NOT_GIVEN, + show_stats: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerListenerDetail: """ Get load balancer listener @@ -584,21 +584,21 @@ async def create( name: str, protocol: LbListenerProtocol, protocol_port: int, - allowed_cidrs: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - connection_limit: int | NotGiven = NOT_GIVEN, - insert_x_forwarded: bool | NotGiven = NOT_GIVEN, - secret_id: str | NotGiven = NOT_GIVEN, - sni_secret_id: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, - user_list: Iterable[listener_create_params.UserList] | NotGiven = NOT_GIVEN, + allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, + connection_limit: int | Omit = omit, + insert_x_forwarded: bool | Omit = omit, + secret_id: str | Omit = omit, + sni_secret_id: SequenceNotStr[str] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, + user_list: Iterable[listener_create_params.UserList] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer listener @@ -681,21 +681,21 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - allowed_cidrs: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - connection_limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - sni_secret_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, - user_list: Optional[Iterable[listener_update_params.UserList]] | NotGiven = NOT_GIVEN, + allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, + connection_limit: int | Omit = omit, + name: str | Omit = omit, + secret_id: Optional[str] | Omit = omit, + sni_secret_id: Optional[SequenceNotStr[str]] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, + user_list: Optional[Iterable[listener_update_params.UserList]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Update load balancer listener @@ -768,14 +768,14 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - loadbalancer_id: str | NotGiven = NOT_GIVEN, - show_stats: bool | NotGiven = NOT_GIVEN, + loadbalancer_id: str | Omit = omit, + show_stats: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerListenerList: """ List load balancer listeners @@ -830,7 +830,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer listener @@ -870,13 +870,13 @@ async def get( *, project_id: int | None = None, region_id: int | None = None, - show_stats: bool | NotGiven = NOT_GIVEN, + show_stats: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerListenerDetail: """ Get load balancer listener diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 9f5f7bce..a8031808 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -30,7 +30,7 @@ StatusesResourceWithStreamingResponse, AsyncStatusesResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from .listeners import ( ListenersResource, @@ -134,24 +134,24 @@ def create( *, project_id: int | None = None, region_id: int | None = None, - flavor: str | NotGiven = NOT_GIVEN, - floating_ip: load_balancer_create_params.FloatingIP | NotGiven = NOT_GIVEN, - listeners: Iterable[load_balancer_create_params.Listener] | NotGiven = NOT_GIVEN, - logging: load_balancer_create_params.Logging | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - vip_ip_family: InterfaceIPFamily | NotGiven = NOT_GIVEN, - vip_network_id: str | NotGiven = NOT_GIVEN, - vip_port_id: str | NotGiven = NOT_GIVEN, - vip_subnet_id: str | NotGiven = NOT_GIVEN, + flavor: str | Omit = omit, + floating_ip: load_balancer_create_params.FloatingIP | Omit = omit, + listeners: Iterable[load_balancer_create_params.Listener] | Omit = omit, + logging: load_balancer_create_params.Logging | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, + tags: Dict[str, str] | Omit = omit, + vip_ip_family: InterfaceIPFamily | Omit = omit, + vip_network_id: str | Omit = omit, + vip_port_id: str | Omit = omit, + vip_subnet_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer @@ -237,16 +237,16 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - logging: load_balancer_update_params.Logging | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + logging: load_balancer_update_params.Logging | Omit = omit, + name: str | Omit = omit, + preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancer: """ Rename load balancer, activate/deactivate logging, update preferred connectivity @@ -318,22 +318,22 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - assigned_floating: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - logging_enabled: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - show_stats: bool | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - with_ddos: bool | NotGiven = NOT_GIVEN, + assigned_floating: bool | Omit = omit, + limit: int | Omit = omit, + logging_enabled: bool | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + show_stats: bool | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, + with_ddos: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[LoadBalancer]: """ List load balancers @@ -412,7 +412,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer @@ -446,13 +446,13 @@ def failover( *, project_id: int | None = None, region_id: int | None = None, - force: bool | NotGiven = NOT_GIVEN, + force: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Failover load balancer @@ -489,14 +489,14 @@ def get( *, project_id: int | None = None, region_id: int | None = None, - show_stats: bool | NotGiven = NOT_GIVEN, - with_ddos: bool | NotGiven = NOT_GIVEN, + show_stats: bool | Omit = omit, + with_ddos: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancer: """ Get load balancer @@ -550,7 +550,7 @@ def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Resize load balancer @@ -817,24 +817,24 @@ async def create( *, project_id: int | None = None, region_id: int | None = None, - flavor: str | NotGiven = NOT_GIVEN, - floating_ip: load_balancer_create_params.FloatingIP | NotGiven = NOT_GIVEN, - listeners: Iterable[load_balancer_create_params.Listener] | NotGiven = NOT_GIVEN, - logging: load_balancer_create_params.Logging | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - vip_ip_family: InterfaceIPFamily | NotGiven = NOT_GIVEN, - vip_network_id: str | NotGiven = NOT_GIVEN, - vip_port_id: str | NotGiven = NOT_GIVEN, - vip_subnet_id: str | NotGiven = NOT_GIVEN, + flavor: str | Omit = omit, + floating_ip: load_balancer_create_params.FloatingIP | Omit = omit, + listeners: Iterable[load_balancer_create_params.Listener] | Omit = omit, + logging: load_balancer_create_params.Logging | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, + tags: Dict[str, str] | Omit = omit, + vip_ip_family: InterfaceIPFamily | Omit = omit, + vip_network_id: str | Omit = omit, + vip_port_id: str | Omit = omit, + vip_subnet_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer @@ -920,16 +920,16 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - logging: load_balancer_update_params.Logging | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + logging: load_balancer_update_params.Logging | Omit = omit, + name: str | Omit = omit, + preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancer: """ Rename load balancer, activate/deactivate logging, update preferred connectivity @@ -1001,22 +1001,22 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - assigned_floating: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - logging_enabled: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - show_stats: bool | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, - with_ddos: bool | NotGiven = NOT_GIVEN, + assigned_floating: bool | Omit = omit, + limit: int | Omit = omit, + logging_enabled: bool | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + show_stats: bool | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: str | Omit = omit, + with_ddos: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[LoadBalancer, AsyncOffsetPage[LoadBalancer]]: """ List load balancers @@ -1095,7 +1095,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer @@ -1129,13 +1129,13 @@ async def failover( *, project_id: int | None = None, region_id: int | None = None, - force: bool | NotGiven = NOT_GIVEN, + force: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Failover load balancer @@ -1174,14 +1174,14 @@ async def get( *, project_id: int | None = None, region_id: int | None = None, - show_stats: bool | NotGiven = NOT_GIVEN, - with_ddos: bool | NotGiven = NOT_GIVEN, + show_stats: bool | Omit = omit, + with_ddos: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancer: """ Get load balancer @@ -1235,7 +1235,7 @@ async def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Resize load balancer diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index 59df8038..38ecf843 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -56,7 +56,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerMetricsList: """ Get load balancer metrics, including cpu, memory and network @@ -129,7 +129,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerMetricsList: """ Get load balancer metrics, including cpu, memory and network diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index bae1858c..cc1baa93 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -6,7 +6,7 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ....._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -56,16 +56,16 @@ def create( max_retries: int, api_timeout: int, type: LbHealthMonitorType, - expected_codes: Optional[str] | NotGiven = NOT_GIVEN, - http_method: Optional[HTTPMethod] | NotGiven = NOT_GIVEN, - max_retries_down: int | NotGiven = NOT_GIVEN, - url_path: Optional[str] | NotGiven = NOT_GIVEN, + expected_codes: Optional[str] | Omit = omit, + http_method: Optional[HTTPMethod] | Omit = omit, + max_retries_down: int | Omit = omit, + url_path: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Creates a health monitor for a load balancer pool to automatically check the @@ -146,7 +146,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Removes the health monitor from a load balancer pool. @@ -215,16 +215,16 @@ async def create( max_retries: int, api_timeout: int, type: LbHealthMonitorType, - expected_codes: Optional[str] | NotGiven = NOT_GIVEN, - http_method: Optional[HTTPMethod] | NotGiven = NOT_GIVEN, - max_retries_down: int | NotGiven = NOT_GIVEN, - url_path: Optional[str] | NotGiven = NOT_GIVEN, + expected_codes: Optional[str] | Omit = omit, + http_method: Optional[HTTPMethod] | Omit = omit, + max_retries_down: int | Omit = omit, + url_path: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Creates a health monitor for a load balancer pool to automatically check the @@ -305,7 +305,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Removes the health monitor from a load balancer pool. diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 05091a8b..29d440f7 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -6,7 +6,7 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -51,19 +51,19 @@ def add( region_id: int | None = None, address: str, protocol_port: int, - admin_state_up: bool | NotGiven = NOT_GIVEN, - backup: bool | NotGiven = NOT_GIVEN, - instance_id: Optional[str] | NotGiven = NOT_GIVEN, - monitor_address: Optional[str] | NotGiven = NOT_GIVEN, - monitor_port: Optional[int] | NotGiven = NOT_GIVEN, - subnet_id: Optional[str] | NotGiven = NOT_GIVEN, - weight: int | NotGiven = NOT_GIVEN, + admin_state_up: bool | Omit = omit, + backup: bool | Omit = omit, + instance_id: Optional[str] | Omit = omit, + monitor_address: Optional[str] | Omit = omit, + monitor_port: Optional[int] | Omit = omit, + subnet_id: Optional[str] | Omit = omit, + weight: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer pool member @@ -164,7 +164,7 @@ def remove( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer pool member @@ -231,19 +231,19 @@ async def add( region_id: int | None = None, address: str, protocol_port: int, - admin_state_up: bool | NotGiven = NOT_GIVEN, - backup: bool | NotGiven = NOT_GIVEN, - instance_id: Optional[str] | NotGiven = NOT_GIVEN, - monitor_address: Optional[str] | NotGiven = NOT_GIVEN, - monitor_port: Optional[int] | NotGiven = NOT_GIVEN, - subnet_id: Optional[str] | NotGiven = NOT_GIVEN, - weight: int | NotGiven = NOT_GIVEN, + admin_state_up: bool | Omit = omit, + backup: bool | Omit = omit, + instance_id: Optional[str] | Omit = omit, + monitor_address: Optional[str] | Omit = omit, + monitor_port: Optional[int] | Omit = omit, + subnet_id: Optional[str] | Omit = omit, + weight: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer pool member @@ -344,7 +344,7 @@ async def remove( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer pool member diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index e15c696f..387b4b18 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -14,7 +14,7 @@ MembersResourceWithStreamingResponse, AsyncMembersResourceWithStreamingResponse, ) -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -80,23 +80,23 @@ def create( lb_algorithm: LbAlgorithm, name: str, protocol: LbPoolProtocol, - ca_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - crl_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - healthmonitor: Optional[pool_create_params.Healthmonitor] | NotGiven = NOT_GIVEN, - listener_id: Optional[str] | NotGiven = NOT_GIVEN, - loadbalancer_id: Optional[str] | NotGiven = NOT_GIVEN, - members: Optional[Iterable[pool_create_params.Member]] | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - session_persistence: Optional[pool_create_params.SessionPersistence] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, + ca_secret_id: Optional[str] | Omit = omit, + crl_secret_id: Optional[str] | Omit = omit, + healthmonitor: Optional[pool_create_params.Healthmonitor] | Omit = omit, + listener_id: Optional[str] | Omit = omit, + loadbalancer_id: Optional[str] | Omit = omit, + members: Optional[Iterable[pool_create_params.Member]] | Omit = omit, + secret_id: Optional[str] | Omit = omit, + session_persistence: Optional[pool_create_params.SessionPersistence] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer pool @@ -179,24 +179,24 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - ca_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - crl_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - healthmonitor: Optional[pool_update_params.Healthmonitor] | NotGiven = NOT_GIVEN, - lb_algorithm: LbAlgorithm | NotGiven = NOT_GIVEN, - members: Optional[Iterable[pool_update_params.Member]] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - protocol: LbPoolProtocol | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - session_persistence: Optional[pool_update_params.SessionPersistence] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, + ca_secret_id: Optional[str] | Omit = omit, + crl_secret_id: Optional[str] | Omit = omit, + healthmonitor: Optional[pool_update_params.Healthmonitor] | Omit = omit, + lb_algorithm: LbAlgorithm | Omit = omit, + members: Optional[Iterable[pool_update_params.Member]] | Omit = omit, + name: str | Omit = omit, + protocol: LbPoolProtocol | Omit = omit, + secret_id: Optional[str] | Omit = omit, + session_persistence: Optional[pool_update_params.SessionPersistence] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Updates the specified load balancer pool with the provided changes. @@ -291,15 +291,15 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - details: bool | NotGiven = NOT_GIVEN, - listener_id: str | NotGiven = NOT_GIVEN, - loadbalancer_id: str | NotGiven = NOT_GIVEN, + details: bool | Omit = omit, + listener_id: str | Omit = omit, + loadbalancer_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerPoolList: """ List load balancer pools @@ -357,7 +357,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer pool @@ -402,7 +402,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerPool: """ Get load balancer pool @@ -638,23 +638,23 @@ async def create( lb_algorithm: LbAlgorithm, name: str, protocol: LbPoolProtocol, - ca_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - crl_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - healthmonitor: Optional[pool_create_params.Healthmonitor] | NotGiven = NOT_GIVEN, - listener_id: Optional[str] | NotGiven = NOT_GIVEN, - loadbalancer_id: Optional[str] | NotGiven = NOT_GIVEN, - members: Optional[Iterable[pool_create_params.Member]] | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - session_persistence: Optional[pool_create_params.SessionPersistence] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, + ca_secret_id: Optional[str] | Omit = omit, + crl_secret_id: Optional[str] | Omit = omit, + healthmonitor: Optional[pool_create_params.Healthmonitor] | Omit = omit, + listener_id: Optional[str] | Omit = omit, + loadbalancer_id: Optional[str] | Omit = omit, + members: Optional[Iterable[pool_create_params.Member]] | Omit = omit, + secret_id: Optional[str] | Omit = omit, + session_persistence: Optional[pool_create_params.SessionPersistence] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create load balancer pool @@ -737,24 +737,24 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - ca_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - crl_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - healthmonitor: Optional[pool_update_params.Healthmonitor] | NotGiven = NOT_GIVEN, - lb_algorithm: LbAlgorithm | NotGiven = NOT_GIVEN, - members: Optional[Iterable[pool_update_params.Member]] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - protocol: LbPoolProtocol | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - session_persistence: Optional[pool_update_params.SessionPersistence] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, + ca_secret_id: Optional[str] | Omit = omit, + crl_secret_id: Optional[str] | Omit = omit, + healthmonitor: Optional[pool_update_params.Healthmonitor] | Omit = omit, + lb_algorithm: LbAlgorithm | Omit = omit, + members: Optional[Iterable[pool_update_params.Member]] | Omit = omit, + name: str | Omit = omit, + protocol: LbPoolProtocol | Omit = omit, + secret_id: Optional[str] | Omit = omit, + session_persistence: Optional[pool_update_params.SessionPersistence] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Updates the specified load balancer pool with the provided changes. @@ -849,15 +849,15 @@ async def list( *, project_id: int | None = None, region_id: int | None = None, - details: bool | NotGiven = NOT_GIVEN, - listener_id: str | NotGiven = NOT_GIVEN, - loadbalancer_id: str | NotGiven = NOT_GIVEN, + details: bool | Omit = omit, + listener_id: str | Omit = omit, + loadbalancer_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerPoolList: """ List load balancer pools @@ -915,7 +915,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete load balancer pool @@ -960,7 +960,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerPool: """ Get load balancer pool diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index 5579e857..624132ba 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -50,7 +50,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerStatusList: """ List load balancers statuses @@ -87,7 +87,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerStatus: """ Get load balancer status @@ -146,7 +146,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerStatusList: """ List load balancers statuses @@ -183,7 +183,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LoadBalancerStatus: """ Get load balancer status diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 09de9d55..da98158e 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -23,7 +23,7 @@ SubnetsResourceWithStreamingResponse, AsyncSubnetsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -77,15 +77,15 @@ def create( project_id: int | None = None, region_id: int | None = None, name: str, - create_router: bool | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type: Literal["vlan", "vxlan"] | NotGiven = NOT_GIVEN, + create_router: bool | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type: Literal["vlan", "vxlan"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create network @@ -192,14 +192,14 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Network: """Rename network and/or update network tags. @@ -270,18 +270,18 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Network]: """ List networks @@ -351,7 +351,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete network @@ -428,7 +428,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Network: """ Get network @@ -497,15 +497,15 @@ async def create( project_id: int | None = None, region_id: int | None = None, name: str, - create_router: bool | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type: Literal["vlan", "vxlan"] | NotGiven = NOT_GIVEN, + create_router: bool | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type: Literal["vlan", "vxlan"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create network @@ -612,14 +612,14 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Network: """Rename network and/or update network tags. @@ -690,18 +690,18 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Network, AsyncOffsetPage[Network]]: """ List networks @@ -771,7 +771,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete network @@ -848,7 +848,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Network: """ Get network diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 657982bd..52cf6cf8 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -6,7 +6,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -57,15 +57,15 @@ def create( project_id: int | None = None, region_id: int | None = None, name: str, - external_gateway_info: Optional[router_create_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, - interfaces: Optional[Iterable[router_create_params.Interface]] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[router_create_params.Route]] | NotGiven = NOT_GIVEN, + external_gateway_info: Optional[router_create_params.ExternalGatewayInfo] | Omit = omit, + interfaces: Optional[Iterable[router_create_params.Interface]] | Omit = omit, + routes: Optional[Iterable[router_create_params.Route]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new router with the specified configuration. @@ -114,15 +114,15 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - external_gateway_info: Optional[router_update_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[router_update_params.Route]] | NotGiven = NOT_GIVEN, + external_gateway_info: Optional[router_update_params.ExternalGatewayInfo] | Omit = omit, + name: Optional[str] | Omit = omit, + routes: Optional[Iterable[router_update_params.Route]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: """ Update the configuration of an existing router. @@ -169,14 +169,14 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Router]: """ List all routers in the specified project and region. @@ -228,7 +228,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete a specific router and all its associated resources. @@ -263,13 +263,13 @@ def attach_subnet( project_id: int | None = None, region_id: int | None = None, subnet_id: str, - ip_address: str | NotGiven = NOT_GIVEN, + ip_address: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: """ Attach a subnet to an existing router. @@ -327,7 +327,7 @@ def detach_subnet( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: """ Detach a subnet from an existing router. @@ -369,7 +369,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: """ Get detailed information about a specific router. @@ -424,15 +424,15 @@ async def create( project_id: int | None = None, region_id: int | None = None, name: str, - external_gateway_info: Optional[router_create_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, - interfaces: Optional[Iterable[router_create_params.Interface]] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[router_create_params.Route]] | NotGiven = NOT_GIVEN, + external_gateway_info: Optional[router_create_params.ExternalGatewayInfo] | Omit = omit, + interfaces: Optional[Iterable[router_create_params.Interface]] | Omit = omit, + routes: Optional[Iterable[router_create_params.Route]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new router with the specified configuration. @@ -481,15 +481,15 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - external_gateway_info: Optional[router_update_params.ExternalGatewayInfo] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - routes: Optional[Iterable[router_update_params.Route]] | NotGiven = NOT_GIVEN, + external_gateway_info: Optional[router_update_params.ExternalGatewayInfo] | Omit = omit, + name: Optional[str] | Omit = omit, + routes: Optional[Iterable[router_update_params.Route]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: """ Update the configuration of an existing router. @@ -536,14 +536,14 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Router, AsyncOffsetPage[Router]]: """ List all routers in the specified project and region. @@ -595,7 +595,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete a specific router and all its associated resources. @@ -630,13 +630,13 @@ async def attach_subnet( project_id: int | None = None, region_id: int | None = None, subnet_id: str, - ip_address: str | NotGiven = NOT_GIVEN, + ip_address: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: """ Attach a subnet to an existing router. @@ -694,7 +694,7 @@ async def detach_subnet( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: """ Detach a subnet from an existing router. @@ -738,7 +738,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Router: """ Get detailed information about a specific router. diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index 1b66df06..12f04056 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -57,20 +57,20 @@ def create( cidr: str, name: str, network_id: str, - connect_to_network_router: bool | NotGiven = NOT_GIVEN, - dns_nameservers: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - enable_dhcp: bool | NotGiven = NOT_GIVEN, - gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, - ip_version: IPVersion | NotGiven = NOT_GIVEN, - router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + connect_to_network_router: bool | Omit = omit, + dns_nameservers: Optional[SequenceNotStr[str]] | Omit = omit, + enable_dhcp: bool | Omit = omit, + gateway_ip: Optional[str] | Omit = omit, + host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | Omit = omit, + ip_version: IPVersion | Omit = omit, + router_id_to_connect: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create subnet @@ -214,18 +214,18 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - dns_nameservers: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - enable_dhcp: Optional[bool] | NotGiven = NOT_GIVEN, - gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + dns_nameservers: Optional[SequenceNotStr[str]] | Omit = omit, + enable_dhcp: Optional[bool] | Omit = omit, + gateway_ip: Optional[str] | Omit = omit, + host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | Omit = omit, + name: Optional[str] | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Subnet: """ Update subnet @@ -308,9 +308,9 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + network_id: str | Omit = omit, + offset: int | Omit = omit, order_by: Literal[ "available_ips.asc", "available_ips.desc", @@ -325,15 +325,15 @@ def list( "updated_at.asc", "updated_at.desc", ] - | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Subnet]: """ List subnets @@ -404,7 +404,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete subnet @@ -450,7 +450,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Subnet: """ Get subnet @@ -513,20 +513,20 @@ async def create( cidr: str, name: str, network_id: str, - connect_to_network_router: bool | NotGiven = NOT_GIVEN, - dns_nameservers: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - enable_dhcp: bool | NotGiven = NOT_GIVEN, - gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, - ip_version: IPVersion | NotGiven = NOT_GIVEN, - router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, + connect_to_network_router: bool | Omit = omit, + dns_nameservers: Optional[SequenceNotStr[str]] | Omit = omit, + enable_dhcp: bool | Omit = omit, + gateway_ip: Optional[str] | Omit = omit, + host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | Omit = omit, + ip_version: IPVersion | Omit = omit, + router_id_to_connect: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create subnet @@ -670,18 +670,18 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - dns_nameservers: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - enable_dhcp: Optional[bool] | NotGiven = NOT_GIVEN, - gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + dns_nameservers: Optional[SequenceNotStr[str]] | Omit = omit, + enable_dhcp: Optional[bool] | Omit = omit, + gateway_ip: Optional[str] | Omit = omit, + host_routes: Optional[Iterable[subnet_update_params.HostRoute]] | Omit = omit, + name: Optional[str] | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Subnet: """ Update subnet @@ -764,9 +764,9 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + network_id: str | Omit = omit, + offset: int | Omit = omit, order_by: Literal[ "available_ips.asc", "available_ips.desc", @@ -781,15 +781,15 @@ def list( "updated_at.asc", "updated_at.desc", ] - | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Subnet, AsyncOffsetPage[Subnet]]: """ List subnets @@ -860,7 +860,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete subnet @@ -906,7 +906,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Subnet: """ Get subnet diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py index 31777c13..bb5119c8 100644 --- a/src/gcore/resources/cloud/placement_groups.py +++ b/src/gcore/resources/cloud/placement_groups.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -57,7 +57,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlacementGroup: """ Create an affinity or anti-affinity or soft-anti-affinity placement group @@ -104,7 +104,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlacementGroupList: """ List placement groups @@ -141,7 +141,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete placement group @@ -180,7 +180,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlacementGroup: """ Get placement group @@ -241,7 +241,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlacementGroup: """ Create an affinity or anti-affinity or soft-anti-affinity placement group @@ -288,7 +288,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlacementGroupList: """ List placement groups @@ -325,7 +325,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete placement group @@ -364,7 +364,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlacementGroup: """ Get placement group diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index 383f3c3b..cb6c69b4 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -50,15 +50,15 @@ def create( self, *, name: str, - client_id: Optional[int] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - state: Optional[str] | NotGiven = NOT_GIVEN, + client_id: Optional[int] | Omit = omit, + description: Optional[str] | Omit = omit, + state: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """Create a new project for a client. @@ -102,18 +102,18 @@ def create( def list( self, *, - client_id: int | NotGiven = NOT_GIVEN, - include_deleted: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, + client_id: int | Omit = omit, + include_deleted: bool | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Project]: """Retrieve a list of projects for a client. @@ -173,7 +173,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Delete a project and all its associated cloud resources across all regions. @@ -209,7 +209,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """ Retrieve detailed information about a specific project. @@ -238,13 +238,13 @@ def replace( *, project_id: int | None = None, name: str, - description: Optional[str] | NotGiven = NOT_GIVEN, + 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """Update project name and description. @@ -306,15 +306,15 @@ async def create( self, *, name: str, - client_id: Optional[int] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - state: Optional[str] | NotGiven = NOT_GIVEN, + client_id: Optional[int] | Omit = omit, + description: Optional[str] | Omit = omit, + state: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """Create a new project for a client. @@ -358,18 +358,18 @@ async def create( def list( self, *, - client_id: int | NotGiven = NOT_GIVEN, - include_deleted: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, + client_id: int | Omit = omit, + include_deleted: bool | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Project, AsyncOffsetPage[Project]]: """Retrieve a list of projects for a client. @@ -429,7 +429,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Delete a project and all its associated cloud resources across all regions. @@ -465,7 +465,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """ Retrieve detailed information about a specific project. @@ -494,13 +494,13 @@ async def replace( *, project_id: int | None = None, name: str, - description: Optional[str] | NotGiven = NOT_GIVEN, + 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """Update project name and description. diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py index 9a9f9c82..915d900d 100644 --- a/src/gcore/resources/cloud/quotas/quotas.py +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -12,7 +12,7 @@ RequestsResourceWithStreamingResponse, AsyncRequestsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -61,7 +61,7 @@ def get_all( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return self._get( @@ -82,7 +82,7 @@ def get_by_region( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QuotaGetByRegionResponse: """ Get quotas for a specific region and client. @@ -119,7 +119,7 @@ def get_global( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QuotaGetGlobalResponse: """ Get global quotas for a specific client. @@ -176,7 +176,7 @@ async def get_all( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return await self._get( @@ -197,7 +197,7 @@ async def get_by_region( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QuotaGetByRegionResponse: """ Get quotas for a specific region and client. @@ -234,7 +234,7 @@ async def get_global( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QuotaGetGlobalResponse: """ Get global quotas for a specific client. diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index 79d4febe..6857110a 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -51,13 +51,13 @@ def create( *, description: str, requested_limits: request_create_params.RequestedLimits, - client_id: int | NotGiven = NOT_GIVEN, + client_id: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Create a request to change current quotas. @@ -97,15 +97,15 @@ def create( def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - status: List[Literal["done", "in progress", "rejected"]] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + status: List[Literal["done", "in progress", "rejected"]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[RequestListResponse]: """ Get a list of sent requests to change current quotas and their statuses. @@ -155,7 +155,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific quota limit request. @@ -189,7 +189,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RequestGetResponse: """ Get detailed information about a specific quota limit request. @@ -239,13 +239,13 @@ async def create( *, description: str, requested_limits: request_create_params.RequestedLimits, - client_id: int | NotGiven = NOT_GIVEN, + client_id: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Create a request to change current quotas. @@ -285,15 +285,15 @@ async def create( def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - status: List[Literal["done", "in progress", "rejected"]] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + status: List[Literal["done", "in progress", "rejected"]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[RequestListResponse, AsyncOffsetPage[RequestListResponse]]: """ Get a list of sent requests to change current quotas and their statuses. @@ -343,7 +343,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific quota limit request. @@ -377,7 +377,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RequestGetResponse: """ Get detailed information about a specific quota limit request. diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py index b49adfcd..b9d06835 100644 --- a/src/gcore/resources/cloud/regions.py +++ b/src/gcore/resources/cloud/regions.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -47,18 +47,17 @@ def with_streaming_response(self) -> RegionsResourceWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "display_name.asc", "display_name.desc"] - | NotGiven = NOT_GIVEN, - product: Literal["containers", "inference"] | NotGiven = NOT_GIVEN, - show_volume_types: bool | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "display_name.asc", "display_name.desc"] | Omit = omit, + product: Literal["containers", "inference"] | Omit = omit, + show_volume_types: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Region]: """List regions @@ -111,13 +110,13 @@ def get( self, *, region_id: int | None = None, - show_volume_types: bool | NotGiven = NOT_GIVEN, + show_volume_types: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Region: """ Get region @@ -174,18 +173,17 @@ def with_streaming_response(self) -> AsyncRegionsResourceWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "display_name.asc", "display_name.desc"] - | NotGiven = NOT_GIVEN, - product: Literal["containers", "inference"] | NotGiven = NOT_GIVEN, - show_volume_types: bool | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "display_name.asc", "display_name.desc"] | Omit = omit, + product: Literal["containers", "inference"] | Omit = omit, + show_volume_types: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Region, AsyncOffsetPage[Region]]: """List regions @@ -238,13 +236,13 @@ async def get( self, *, region_id: int | None = None, - show_volume_types: bool | NotGiven = NOT_GIVEN, + show_volume_types: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Region: """ Get region diff --git a/src/gcore/resources/cloud/registries/artifacts.py b/src/gcore/resources/cloud/registries/artifacts.py index 0b579ba5..4b07607a 100644 --- a/src/gcore/resources/cloud/registries/artifacts.py +++ b/src/gcore/resources/cloud/registries/artifacts.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Query, Headers, NoneType, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -51,7 +51,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryArtifactList: """ List all artifacts in a specific repository. @@ -92,7 +92,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific artifact from a repository. @@ -156,7 +156,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryArtifactList: """ List all artifacts in a specific repository. @@ -197,7 +197,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific artifact from a repository. diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py index 8889d473..9ed4f0ec 100644 --- a/src/gcore/resources/cloud/registries/registries.py +++ b/src/gcore/resources/cloud/registries/registries.py @@ -20,7 +20,7 @@ UsersResourceWithStreamingResponse, AsyncUsersResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from .artifacts import ( ArtifactsResource, @@ -96,13 +96,13 @@ def create( project_id: int | None = None, region_id: int | None = None, name: str, - storage_limit: int | NotGiven = NOT_GIVEN, + storage_limit: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Registry: """ Create a new container registry with the specified configuration. @@ -150,7 +150,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryList: """ List all container registries in the specified project and region. @@ -187,7 +187,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific container registry and all its associated resources. @@ -225,7 +225,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Registry: """ Get detailed information about a specific container registry. @@ -257,13 +257,13 @@ def resize( *, project_id: int | None = None, region_id: int | None = None, - storage_limit: int | NotGiven = NOT_GIVEN, + storage_limit: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Registry: """ Update the size of a container registry. @@ -335,13 +335,13 @@ async def create( project_id: int | None = None, region_id: int | None = None, name: str, - storage_limit: int | NotGiven = NOT_GIVEN, + storage_limit: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Registry: """ Create a new container registry with the specified configuration. @@ -389,7 +389,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryList: """ List all container registries in the specified project and region. @@ -426,7 +426,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific container registry and all its associated resources. @@ -464,7 +464,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Registry: """ Get detailed information about a specific container registry. @@ -496,13 +496,13 @@ async def resize( *, project_id: int | None = None, region_id: int | None = None, - storage_limit: int | NotGiven = NOT_GIVEN, + storage_limit: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Registry: """ Update the size of a container registry. diff --git a/src/gcore/resources/cloud/registries/repositories.py b/src/gcore/resources/cloud/registries/repositories.py index 74377052..d0c860a9 100644 --- a/src/gcore/resources/cloud/registries/repositories.py +++ b/src/gcore/resources/cloud/registries/repositories.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Query, Headers, NoneType, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -50,7 +50,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryRepositoryList: """ List all repositories in the container registry. @@ -88,7 +88,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific repository from the container registry. @@ -149,7 +149,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryRepositoryList: """ List all repositories in the container registry. @@ -187,7 +187,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific repository from the container registry. diff --git a/src/gcore/resources/cloud/registries/tags.py b/src/gcore/resources/cloud/registries/tags.py index ab35828c..74f68017 100644 --- a/src/gcore/resources/cloud/registries/tags.py +++ b/src/gcore/resources/cloud/registries/tags.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Query, Headers, NoneType, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -52,7 +52,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific tag from an artifact. @@ -120,7 +120,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific tag from an artifact. diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index f535c7dd..110b6d2b 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -6,7 +6,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -54,14 +54,14 @@ def create( region_id: int | None = None, duration: int, name: str, - read_only: bool | NotGiven = NOT_GIVEN, - secret: str | NotGiven = NOT_GIVEN, + read_only: bool | Omit = omit, + secret: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryUserCreated: """ Create a new user for accessing the container registry. @@ -113,13 +113,13 @@ def update( region_id: int | None = None, registry_id: int, duration: int, - read_only: bool | NotGiven = NOT_GIVEN, + read_only: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryUser: """ Update the configuration of a specific registry user. @@ -167,7 +167,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryUserList: """ List all users with access to the container registry. @@ -205,7 +205,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific user from the container registry. @@ -244,7 +244,7 @@ def create_multiple( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryUserCreated: """ Create multiple users for accessing the container registry in a single request. @@ -285,7 +285,7 @@ def refresh_secret( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserRefreshSecretResponse: """ Generate a new secret for a specific registry user. @@ -340,14 +340,14 @@ async def create( region_id: int | None = None, duration: int, name: str, - read_only: bool | NotGiven = NOT_GIVEN, - secret: str | NotGiven = NOT_GIVEN, + read_only: bool | Omit = omit, + secret: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryUserCreated: """ Create a new user for accessing the container registry. @@ -399,13 +399,13 @@ async def update( region_id: int | None = None, registry_id: int, duration: int, - read_only: bool | NotGiven = NOT_GIVEN, + read_only: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryUser: """ Update the configuration of a specific registry user. @@ -453,7 +453,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryUserList: """ List all users with access to the container registry. @@ -491,7 +491,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific user from the container registry. @@ -530,7 +530,7 @@ async def create_multiple( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RegistryUserCreated: """ Create multiple users for accessing the container registry in a single request. @@ -571,7 +571,7 @@ async def refresh_secret( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserRefreshSecretResponse: """ Generate a new secret for a specific registry user. 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 5acd6b62..19bdb0c4 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 @@ -15,7 +15,7 @@ VipResourceWithStreamingResponse, AsyncVipResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import required_args, maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -66,14 +66,14 @@ def create( project_id: int | None = None, region_id: int | None = None, type: Literal["external"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -103,13 +103,13 @@ def create( region_id: int | None = None, subnet_id: str, type: Literal["subnet"], - is_vip: bool | NotGiven = NOT_GIVEN, + is_vip: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -139,14 +139,14 @@ def create( region_id: int | None = None, network_id: str, type: Literal["any_subnet"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -179,13 +179,13 @@ def create( ip_address: str, network_id: str, type: Literal["ip_address"], - is_vip: bool | NotGiven = NOT_GIVEN, + is_vip: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -222,7 +222,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -256,18 +256,18 @@ def create( project_id: int | None = None, region_id: int | None = None, type: Literal["external"] | Literal["subnet"] | Literal["any_subnet"] | Literal["ip_address"] | Literal["port"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, - subnet_id: str | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - port_id: str | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + ip_address: str | Omit = omit, + port_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -298,21 +298,21 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - available_only: bool | NotGiven = NOT_GIVEN, - device_id: str | NotGiven = NOT_GIVEN, - external_only: bool | NotGiven = NOT_GIVEN, - internal_only: bool | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - vip_only: bool | NotGiven = NOT_GIVEN, + available_only: bool | Omit = omit, + device_id: str | Omit = omit, + external_only: bool | Omit = omit, + internal_only: bool | Omit = omit, + ip_address: str | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + vip_only: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[ReservedFixedIP]: """ List all reserved fixed IPs in the specified project and region. @@ -388,7 +388,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete a specific reserved fixed IP and all its associated resources. @@ -427,7 +427,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ReservedFixedIP: """ Get detailed information about a specific reserved fixed IP. @@ -779,14 +779,14 @@ async def create( project_id: int | None = None, region_id: int | None = None, type: Literal["external"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -816,13 +816,13 @@ async def create( region_id: int | None = None, subnet_id: str, type: Literal["subnet"], - is_vip: bool | NotGiven = NOT_GIVEN, + is_vip: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -852,14 +852,14 @@ async def create( region_id: int | None = None, network_id: str, type: Literal["any_subnet"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -892,13 +892,13 @@ async def create( ip_address: str, network_id: str, type: Literal["ip_address"], - is_vip: bool | NotGiven = NOT_GIVEN, + is_vip: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -935,7 +935,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create a new reserved fixed IP with the specified configuration. @@ -969,18 +969,18 @@ async def create( project_id: int | None = None, region_id: int | None = None, type: Literal["external"] | Literal["subnet"] | Literal["any_subnet"] | Literal["ip_address"] | Literal["port"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, - subnet_id: str | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - port_id: str | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + ip_address: str | Omit = omit, + port_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -1011,21 +1011,21 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - available_only: bool | NotGiven = NOT_GIVEN, - device_id: str | NotGiven = NOT_GIVEN, - external_only: bool | NotGiven = NOT_GIVEN, - internal_only: bool | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - vip_only: bool | NotGiven = NOT_GIVEN, + available_only: bool | Omit = omit, + device_id: str | Omit = omit, + external_only: bool | Omit = omit, + internal_only: bool | Omit = omit, + ip_address: str | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + vip_only: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[ReservedFixedIP, AsyncOffsetPage[ReservedFixedIP]]: """ List all reserved fixed IPs in the specified project and region. @@ -1101,7 +1101,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete a specific reserved fixed IP and all its associated resources. @@ -1140,7 +1140,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ReservedFixedIP: """ Get detailed information about a specific reserved fixed IP. diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py index 1d6c76e2..966a51e0 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -58,7 +58,7 @@ def list_candidate_ports( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CandidatePortList: """ List all instance ports that are available for connecting to a VIP. @@ -97,7 +97,7 @@ def list_connected_ports( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectedPortList: """ List all instance ports that share a VIP. @@ -131,13 +131,13 @@ def replace_connected_ports( *, project_id: int | None = None, region_id: int | None = None, - port_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + port_ids: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectedPortList: """ Replace the list of instance ports that share a VIP. @@ -182,7 +182,7 @@ def toggle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ReservedFixedIP: """ Update the VIP status of a reserved fixed IP. @@ -219,13 +219,13 @@ def update_connected_ports( *, project_id: int | None = None, region_id: int | None = None, - port_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + port_ids: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectedPortList: """ Add instance ports to share a VIP. @@ -290,7 +290,7 @@ async def list_candidate_ports( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CandidatePortList: """ List all instance ports that are available for connecting to a VIP. @@ -329,7 +329,7 @@ async def list_connected_ports( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectedPortList: """ List all instance ports that share a VIP. @@ -363,13 +363,13 @@ async def replace_connected_ports( *, project_id: int | None = None, region_id: int | None = None, - port_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + port_ids: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectedPortList: """ Replace the list of instance ports that share a VIP. @@ -414,7 +414,7 @@ async def toggle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ReservedFixedIP: """ Update the VIP status of a reserved fixed IP. @@ -451,13 +451,13 @@ async def update_connected_ports( *, project_id: int | None = None, region_id: int | None = None, - port_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + port_ids: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectedPortList: """ Add instance ports to share a VIP. diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index b1c6a224..71d8f982 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -51,14 +51,14 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Secret]: """ List secrets @@ -115,7 +115,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete secret @@ -160,7 +160,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Secret: """ Get secret @@ -201,13 +201,13 @@ def upload_tls_certificate( region_id: int | None = None, name: str, payload: secret_upload_tls_certificate_params.Payload, - expiration: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + expiration: Union[str, datetime, None] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create secret @@ -318,14 +318,14 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Secret, AsyncOffsetPage[Secret]]: """ List secrets @@ -382,7 +382,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Delete secret @@ -427,7 +427,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Secret: """ Get secret @@ -468,13 +468,13 @@ async def upload_tls_certificate( region_id: int | None = None, name: str, payload: secret_upload_tls_certificate_params.Payload, - expiration: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + expiration: Union[str, datetime, None] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Create secret diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index 89b27a23..aacd3921 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -50,11 +50,11 @@ def create( *, project_id: int | None = None, region_id: int | None = None, - description: str | NotGiven = NOT_GIVEN, - direction: Literal["egress", "ingress"] | NotGiven = NOT_GIVEN, - ethertype: Literal["IPv4", "IPv6"] | NotGiven = NOT_GIVEN, - port_range_max: Optional[int] | NotGiven = NOT_GIVEN, - port_range_min: Optional[int] | NotGiven = NOT_GIVEN, + description: str | Omit = omit, + direction: Literal["egress", "ingress"] | Omit = omit, + ethertype: Literal["IPv4", "IPv6"] | Omit = omit, + port_range_max: Optional[int] | Omit = omit, + port_range_min: Optional[int] | Omit = omit, protocol: Literal[ "ah", "any", @@ -81,15 +81,15 @@ def create( "udplite", "vrrp", ] - | NotGiven = NOT_GIVEN, - remote_group_id: str | NotGiven = NOT_GIVEN, - remote_ip_prefix: Optional[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + remote_group_id: str | Omit = omit, + remote_ip_prefix: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroupRule: """ Add a new rule to an existing security group. @@ -157,7 +157,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific rule from a security group. @@ -194,10 +194,10 @@ def replace( region_id: int | None = None, direction: Literal["egress", "ingress"], security_group_id: str, - description: str | NotGiven = NOT_GIVEN, - ethertype: Optional[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, - port_range_max: Optional[int] | NotGiven = NOT_GIVEN, - port_range_min: Optional[int] | NotGiven = NOT_GIVEN, + description: str | Omit = omit, + ethertype: Optional[Literal["IPv4", "IPv6"]] | Omit = omit, + port_range_max: Optional[int] | Omit = omit, + port_range_min: Optional[int] | Omit = omit, protocol: Literal[ "ah", "any", @@ -224,15 +224,15 @@ def replace( "udplite", "vrrp", ] - | NotGiven = NOT_GIVEN, - remote_group_id: Optional[str] | NotGiven = NOT_GIVEN, - remote_ip_prefix: Optional[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + remote_group_id: Optional[str] | Omit = omit, + remote_ip_prefix: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroupRule: """ Update the configuration of an existing security group rule. @@ -321,11 +321,11 @@ async def create( *, project_id: int | None = None, region_id: int | None = None, - description: str | NotGiven = NOT_GIVEN, - direction: Literal["egress", "ingress"] | NotGiven = NOT_GIVEN, - ethertype: Literal["IPv4", "IPv6"] | NotGiven = NOT_GIVEN, - port_range_max: Optional[int] | NotGiven = NOT_GIVEN, - port_range_min: Optional[int] | NotGiven = NOT_GIVEN, + description: str | Omit = omit, + direction: Literal["egress", "ingress"] | Omit = omit, + ethertype: Literal["IPv4", "IPv6"] | Omit = omit, + port_range_max: Optional[int] | Omit = omit, + port_range_min: Optional[int] | Omit = omit, protocol: Literal[ "ah", "any", @@ -352,15 +352,15 @@ async def create( "udplite", "vrrp", ] - | NotGiven = NOT_GIVEN, - remote_group_id: str | NotGiven = NOT_GIVEN, - remote_ip_prefix: Optional[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + remote_group_id: str | Omit = omit, + remote_ip_prefix: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroupRule: """ Add a new rule to an existing security group. @@ -428,7 +428,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific rule from a security group. @@ -465,10 +465,10 @@ async def replace( region_id: int | None = None, direction: Literal["egress", "ingress"], security_group_id: str, - description: str | NotGiven = NOT_GIVEN, - ethertype: Optional[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, - port_range_max: Optional[int] | NotGiven = NOT_GIVEN, - port_range_min: Optional[int] | NotGiven = NOT_GIVEN, + description: str | Omit = omit, + ethertype: Optional[Literal["IPv4", "IPv6"]] | Omit = omit, + port_range_max: Optional[int] | Omit = omit, + port_range_min: Optional[int] | Omit = omit, protocol: Literal[ "ah", "any", @@ -495,15 +495,15 @@ async def replace( "udplite", "vrrp", ] - | NotGiven = NOT_GIVEN, - remote_group_id: Optional[str] | NotGiven = NOT_GIVEN, - remote_ip_prefix: Optional[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + remote_group_id: Optional[str] | Omit = omit, + remote_ip_prefix: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroupRule: """ Update the configuration of an existing security group rule. diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index ac4d9bc3..52c3c958 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -14,7 +14,7 @@ RulesResourceWithStreamingResponse, AsyncRulesResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -68,13 +68,13 @@ def create( project_id: int | None = None, region_id: int | None = None, security_group: security_group_create_params.SecurityGroup, - instances: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + instances: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Create a new security group with the specified configuration. @@ -117,15 +117,15 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - changed_rules: Iterable[security_group_update_params.ChangedRule] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + changed_rules: Iterable[security_group_update_params.ChangedRule] | Omit = omit, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Update the configuration of an existing security group. @@ -190,16 +190,16 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[SecurityGroup]: """ List all security groups in the specified project and region. @@ -257,7 +257,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific security group and all its associated rules. @@ -298,7 +298,7 @@ def copy( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Create a deep copy of an existing security group. @@ -340,7 +340,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Get detailed information about a specific security group. @@ -379,7 +379,7 @@ def revert_to_default( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Revert a security group to its previous state. @@ -438,13 +438,13 @@ async def create( project_id: int | None = None, region_id: int | None = None, security_group: security_group_create_params.SecurityGroup, - instances: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + instances: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Create a new security group with the specified configuration. @@ -487,15 +487,15 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - changed_rules: Iterable[security_group_update_params.ChangedRule] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + changed_rules: Iterable[security_group_update_params.ChangedRule] | Omit = omit, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Update the configuration of an existing security group. @@ -560,16 +560,16 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[SecurityGroup, AsyncOffsetPage[SecurityGroup]]: """ List all security groups in the specified project and region. @@ -627,7 +627,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific security group and all its associated rules. @@ -668,7 +668,7 @@ async def copy( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Create a deep copy of an existing security group. @@ -710,7 +710,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Get detailed information about a specific security group. @@ -749,7 +749,7 @@ async def revert_to_default( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecurityGroup: """ Revert a security group to its previous state. diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index 788d415c..061b0876 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -50,14 +50,14 @@ def create( *, project_id: int | None = None, name: str, - public_key: str | NotGiven = NOT_GIVEN, - shared_in_project: bool | NotGiven = NOT_GIVEN, + public_key: str | Omit = omit, + shared_in_project: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SSHKeyCreated: """ To generate a key, omit the `public_key` parameter from the request body @@ -116,7 +116,7 @@ def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SSHKey: """ Share or unshare SSH key with users @@ -153,15 +153,15 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[SSHKey]: """ List SSH keys @@ -215,7 +215,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete SSH key @@ -256,7 +256,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SSHKey: """ Get SSH key @@ -312,14 +312,14 @@ async def create( *, project_id: int | None = None, name: str, - public_key: str | NotGiven = NOT_GIVEN, - shared_in_project: bool | NotGiven = NOT_GIVEN, + public_key: str | Omit = omit, + shared_in_project: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SSHKeyCreated: """ To generate a key, omit the `public_key` parameter from the request body @@ -378,7 +378,7 @@ async def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SSHKey: """ Share or unshare SSH key with users @@ -417,15 +417,15 @@ def list( self, *, project_id: int | None = None, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["created_at.asc", "created_at.desc", "name.asc", "name.desc"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[SSHKey, AsyncOffsetPage[SSHKey]]: """ List SSH keys @@ -479,7 +479,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete SSH key @@ -520,7 +520,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SSHKey: """ Get SSH key diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 2fbc8d91..31af102f 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -9,7 +9,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import is_given, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -87,23 +87,23 @@ def poll( def list( self, *, - from_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - is_acknowledged: Optional[bool] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - project_id: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - region_id: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - sorting: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - state: Optional[List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]]] | NotGiven = NOT_GIVEN, - task_type: Optional[str] | NotGiven = NOT_GIVEN, - to_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + from_timestamp: Union[str, datetime, None] | Omit = omit, + is_acknowledged: Optional[bool] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["asc", "desc"] | Omit = omit, + project_id: Optional[Iterable[int]] | Omit = omit, + region_id: Optional[Iterable[int]] | Omit = omit, + sorting: Literal["asc", "desc"] | Omit = omit, + state: Optional[List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]]] | Omit = omit, + task_type: Optional[str] | Omit = omit, + to_timestamp: Union[str, datetime, None] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Task]: """List tasks @@ -224,14 +224,14 @@ def list( def acknowledge_all( self, *, - project_id: Optional[int] | NotGiven = NOT_GIVEN, - region_id: Optional[int] | NotGiven = NOT_GIVEN, + project_id: Optional[int] | Omit = omit, + region_id: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Acknowledge all tasks @@ -277,7 +277,7 @@ def acknowledge_one( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Task: """ Acknowledge one task @@ -312,7 +312,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Task: """ Get task @@ -396,23 +396,23 @@ async def poll( def list( self, *, - from_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - is_acknowledged: Optional[bool] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - project_id: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - region_id: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - sorting: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - state: Optional[List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]]] | NotGiven = NOT_GIVEN, - task_type: Optional[str] | NotGiven = NOT_GIVEN, - to_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + from_timestamp: Union[str, datetime, None] | Omit = omit, + is_acknowledged: Optional[bool] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: Literal["asc", "desc"] | Omit = omit, + project_id: Optional[Iterable[int]] | Omit = omit, + region_id: Optional[Iterable[int]] | Omit = omit, + sorting: Literal["asc", "desc"] | Omit = omit, + state: Optional[List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]]] | Omit = omit, + task_type: Optional[str] | Omit = omit, + to_timestamp: Union[str, datetime, None] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Task, AsyncOffsetPage[Task]]: """List tasks @@ -533,14 +533,14 @@ def list( async def acknowledge_all( self, *, - project_id: Optional[int] | NotGiven = NOT_GIVEN, - region_id: Optional[int] | NotGiven = NOT_GIVEN, + project_id: Optional[int] | Omit = omit, + region_id: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Acknowledge all tasks @@ -586,7 +586,7 @@ async def acknowledge_one( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Task: """ Acknowledge one task @@ -621,7 +621,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Task: """ Get task diff --git a/src/gcore/resources/cloud/usage_reports.py b/src/gcore/resources/cloud/usage_reports.py index 0adc0809..8758b3ab 100644 --- a/src/gcore/resources/cloud/usage_reports.py +++ b/src/gcore/resources/cloud/usage_reports.py @@ -8,7 +8,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -50,14 +50,14 @@ def get( *, time_from: Union[str, datetime], time_to: Union[str, datetime], - enable_last_day: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - projects: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - regions: Iterable[int] | NotGiven = NOT_GIVEN, - schema_filter: usage_report_get_params.SchemaFilter | NotGiven = NOT_GIVEN, - sorting: Iterable[usage_report_get_params.Sorting] | NotGiven = NOT_GIVEN, - tags: usage_report_get_params.Tags | NotGiven = NOT_GIVEN, + enable_last_day: bool | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + projects: Optional[Iterable[int]] | Omit = omit, + regions: Iterable[int] | Omit = omit, + schema_filter: usage_report_get_params.SchemaFilter | Omit = omit, + sorting: Iterable[usage_report_get_params.Sorting] | Omit = omit, + tags: usage_report_get_params.Tags | Omit = omit, types: List[ Literal[ "ai_cluster", @@ -87,13 +87,13 @@ def get( "volume", ] ] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UsageReport: """Receiving data from the past hour might lead to incomplete statistics. @@ -188,14 +188,14 @@ async def get( *, time_from: Union[str, datetime], time_to: Union[str, datetime], - enable_last_day: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - projects: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - regions: Iterable[int] | NotGiven = NOT_GIVEN, - schema_filter: usage_report_get_params.SchemaFilter | NotGiven = NOT_GIVEN, - sorting: Iterable[usage_report_get_params.Sorting] | NotGiven = NOT_GIVEN, - tags: usage_report_get_params.Tags | NotGiven = NOT_GIVEN, + enable_last_day: bool | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + projects: Optional[Iterable[int]] | Omit = omit, + regions: Iterable[int] | Omit = omit, + schema_filter: usage_report_get_params.SchemaFilter | Omit = omit, + sorting: Iterable[usage_report_get_params.Sorting] | Omit = omit, + tags: usage_report_get_params.Tags | Omit = omit, types: List[ Literal[ "ai_cluster", @@ -225,13 +225,13 @@ async def get( "volume", ] ] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UsageReport: """Receiving data from the past hour might lead to incomplete statistics. diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py index 5294d3a7..2f16d40d 100644 --- a/src/gcore/resources/cloud/users/role_assignments.py +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -55,14 +55,14 @@ def create( *, role: Literal["ClientAdministrator", "InternalNetworkOnlyUser", "Observer", "ProjectAdministrator", "User"], user_id: int, - client_id: Optional[int] | NotGiven = NOT_GIVEN, - project_id: Optional[int] | NotGiven = NOT_GIVEN, + client_id: Optional[int] | Omit = omit, + project_id: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleAssignment: """ Assign a role to an existing user in the specified scope. @@ -107,14 +107,14 @@ def update( *, role: Literal["ClientAdministrator", "InternalNetworkOnlyUser", "Observer", "ProjectAdministrator", "User"], user_id: int, - client_id: Optional[int] | NotGiven = NOT_GIVEN, - project_id: Optional[int] | NotGiven = NOT_GIVEN, + client_id: Optional[int] | Omit = omit, + project_id: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleAssignmentUpdateDelete: """ Modify an existing role assignment for a user. @@ -158,16 +158,16 @@ def update( def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - project_id: int | NotGiven = NOT_GIVEN, - user_id: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + project_id: int | Omit = omit, + user_id: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[RoleAssignment]: """ List all role assignments in the specified scope. @@ -220,7 +220,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleAssignmentUpdateDelete: """ Delete an existing role assignment. @@ -270,14 +270,14 @@ async def create( *, role: Literal["ClientAdministrator", "InternalNetworkOnlyUser", "Observer", "ProjectAdministrator", "User"], user_id: int, - client_id: Optional[int] | NotGiven = NOT_GIVEN, - project_id: Optional[int] | NotGiven = NOT_GIVEN, + client_id: Optional[int] | Omit = omit, + project_id: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleAssignment: """ Assign a role to an existing user in the specified scope. @@ -322,14 +322,14 @@ async def update( *, role: Literal["ClientAdministrator", "InternalNetworkOnlyUser", "Observer", "ProjectAdministrator", "User"], user_id: int, - client_id: Optional[int] | NotGiven = NOT_GIVEN, - project_id: Optional[int] | NotGiven = NOT_GIVEN, + client_id: Optional[int] | Omit = omit, + project_id: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleAssignmentUpdateDelete: """ Modify an existing role assignment for a user. @@ -373,16 +373,16 @@ async def update( def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - project_id: int | NotGiven = NOT_GIVEN, - user_id: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + project_id: int | Omit = omit, + user_id: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[RoleAssignment, AsyncOffsetPage[RoleAssignment]]: """ List all role assignments in the specified scope. @@ -435,7 +435,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleAssignmentUpdateDelete: """ Delete an existing role assignment. diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 60784300..615bb8e7 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ..._utils import required_args, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -66,18 +66,17 @@ def create( name: str, size: int, source: Literal["image"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, - type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new volume in the project and region. @@ -134,19 +133,18 @@ def create( name: str, snapshot_id: str, source: Literal["snapshot"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, - type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + size: int | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new volume in the project and region. @@ -204,18 +202,17 @@ def create( name: str, size: int, source: Literal["new-volume"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, - type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new volume in the project and region. @@ -269,23 +266,22 @@ def create( *, project_id: int | None = None, region_id: int | None = None, - image_id: str | NotGiven = NOT_GIVEN, + image_id: str | Omit = omit, name: str, - size: int | NotGiven = NOT_GIVEN, + size: int | Omit = omit, source: Literal["image"] | Literal["snapshot"] | Literal["new-volume"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, - type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, - snapshot_id: str | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | Omit = omit, + snapshot_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -320,14 +316,14 @@ def update( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Volume: """ Rename a volume or update tags @@ -395,22 +391,22 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - bootable: bool | NotGiven = NOT_GIVEN, - cluster_id: str | NotGiven = NOT_GIVEN, - has_attachments: bool | NotGiven = NOT_GIVEN, - id_part: str | NotGiven = NOT_GIVEN, - instance_id: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name_part: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + bootable: bool | Omit = omit, + cluster_id: str | Omit = omit, + has_attachments: bool | Omit = omit, + id_part: str | Omit = omit, + instance_id: str | Omit = omit, + limit: int | Omit = omit, + name_part: str | Omit = omit, + offset: int | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Volume]: """Retrieve a list of volumes in the project and region. @@ -490,13 +486,13 @@ def delete( *, project_id: int | None = None, region_id: int | None = None, - snapshots: str | NotGiven = NOT_GIVEN, + snapshots: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Delete a volume and all its snapshots. @@ -545,13 +541,13 @@ def attach_to_instance( project_id: int | None = None, region_id: int | None = None, instance_id: str, - attachment_tag: str | NotGiven = NOT_GIVEN, + attachment_tag: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Attach the volume to instance. @@ -610,7 +606,7 @@ def change_type( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Volume: """Change the type of a volume. @@ -661,7 +657,7 @@ def detach_from_instance( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Detach the volume from instance @@ -711,7 +707,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Volume: """ Retrieve detailed information about a specific volume. @@ -757,7 +753,7 @@ def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Increase the size of a volume. @@ -807,7 +803,7 @@ def revert_to_last_snapshot( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Revert a volume to its last snapshot. @@ -1296,18 +1292,17 @@ async def create( name: str, size: int, source: Literal["image"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, - type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new volume in the project and region. @@ -1364,19 +1359,18 @@ async def create( name: str, snapshot_id: str, source: Literal["snapshot"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, - type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + size: int | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new volume in the project and region. @@ -1434,18 +1428,17 @@ async def create( name: str, size: int, source: Literal["new-volume"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, - type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Create a new volume in the project and region. @@ -1499,23 +1492,22 @@ async def create( *, project_id: int | None = None, region_id: int | None = None, - image_id: str | NotGiven = NOT_GIVEN, + image_id: str | Omit = omit, name: str, - size: int | NotGiven = NOT_GIVEN, + size: int | Omit = omit, source: Literal["image"] | Literal["snapshot"] | Literal["new-volume"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, - type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, - snapshot_id: str | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, + type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] | Omit = omit, + snapshot_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: if project_id is None: project_id = self._client._get_cloud_project_id_path_param() @@ -1550,14 +1542,14 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, - name: str | NotGiven = NOT_GIVEN, - tags: Optional[TagUpdateMapParam] | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + tags: Optional[TagUpdateMapParam] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Volume: """ Rename a volume or update tags @@ -1625,22 +1617,22 @@ def list( *, project_id: int | None = None, region_id: int | None = None, - bootable: bool | NotGiven = NOT_GIVEN, - cluster_id: str | NotGiven = NOT_GIVEN, - has_attachments: bool | NotGiven = NOT_GIVEN, - id_part: str | NotGiven = NOT_GIVEN, - instance_id: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name_part: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - tag_key: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - tag_key_value: str | NotGiven = NOT_GIVEN, + bootable: bool | Omit = omit, + cluster_id: str | Omit = omit, + has_attachments: bool | Omit = omit, + id_part: str | Omit = omit, + instance_id: str | Omit = omit, + limit: int | Omit = omit, + name_part: str | Omit = omit, + offset: int | Omit = omit, + tag_key: SequenceNotStr[str] | Omit = omit, + tag_key_value: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Volume, AsyncOffsetPage[Volume]]: """Retrieve a list of volumes in the project and region. @@ -1720,13 +1712,13 @@ async def delete( *, project_id: int | None = None, region_id: int | None = None, - snapshots: str | NotGiven = NOT_GIVEN, + snapshots: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Delete a volume and all its snapshots. @@ -1775,13 +1767,13 @@ async def attach_to_instance( project_id: int | None = None, region_id: int | None = None, instance_id: str, - attachment_tag: str | NotGiven = NOT_GIVEN, + attachment_tag: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Attach the volume to instance. @@ -1840,7 +1832,7 @@ async def change_type( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Volume: """Change the type of a volume. @@ -1893,7 +1885,7 @@ async def detach_from_instance( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """ Detach the volume from instance @@ -1943,7 +1935,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Volume: """ Retrieve detailed information about a specific volume. @@ -1989,7 +1981,7 @@ async def resize( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: """Increase the size of a volume. @@ -2039,7 +2031,7 @@ async def revert_to_last_snapshot( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Revert a volume to its last snapshot. diff --git a/src/gcore/resources/dns/dns.py b/src/gcore/resources/dns/dns.py index 3e6485d0..099fe2fd 100644 --- a/src/gcore/resources/dns/dns.py +++ b/src/gcore/resources/dns/dns.py @@ -14,7 +14,7 @@ MetricsResourceWithStreamingResponse, AsyncMetricsResourceWithStreamingResponse, ) -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 .locations import ( @@ -100,7 +100,7 @@ def get_account_overview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSGetAccountOverviewResponse: """Get info about client""" return self._get( @@ -114,15 +114,15 @@ def get_account_overview( def lookup( self, *, - name: str | NotGiven = NOT_GIVEN, + name: str | Omit = omit, request_server: Literal["authoritative_dns", "google", "cloudflare", "open_dns", "quad9", "gcore"] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSLookupResponse: """ Get the dns records from a specific domain or ip. @@ -203,7 +203,7 @@ async def get_account_overview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSGetAccountOverviewResponse: """Get info about client""" return await self._get( @@ -217,15 +217,15 @@ async def get_account_overview( async def lookup( self, *, - name: str | NotGiven = NOT_GIVEN, + name: str | Omit = omit, request_server: Literal["authoritative_dns", "google", "cloudflare", "open_dns", "quad9", "gcore"] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSLookupResponse: """ Get the dns records from a specific domain or ip. diff --git a/src/gcore/resources/dns/locations.py b/src/gcore/resources/dns/locations.py index 20dcea5a..3b571e04 100644 --- a/src/gcore/resources/dns/locations.py +++ b/src/gcore/resources/dns/locations.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -50,7 +50,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return self._get( @@ -69,7 +69,7 @@ def list_continents( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LocationListContinentsResponse: """List of All locations continents.""" return self._get( @@ -88,7 +88,7 @@ def list_countries( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LocationListCountriesResponse: """List of All locations countries.""" return self._get( @@ -107,7 +107,7 @@ def list_regions( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LocationListRegionsResponse: """List of All locations regions.""" return self._get( @@ -147,7 +147,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return await self._get( @@ -166,7 +166,7 @@ async def list_continents( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LocationListContinentsResponse: """List of All locations continents.""" return await self._get( @@ -185,7 +185,7 @@ async def list_countries( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LocationListCountriesResponse: """List of All locations countries.""" return await self._get( @@ -204,7 +204,7 @@ async def list_regions( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LocationListRegionsResponse: """List of All locations regions.""" return await self._get( diff --git a/src/gcore/resources/dns/metrics.py b/src/gcore/resources/dns/metrics.py index 8eef7aeb..3359b610 100644 --- a/src/gcore/resources/dns/metrics.py +++ b/src/gcore/resources/dns/metrics.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -45,14 +45,14 @@ def with_streaming_response(self) -> MetricsResourceWithStreamingResponse: def list( self, *, - client_ids: Iterable[int] | NotGiven = NOT_GIVEN, - zone_names: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + client_ids: Iterable[int] | Omit = omit, + zone_names: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> str: """ Example of success response: @@ -123,14 +123,14 @@ def with_streaming_response(self) -> AsyncMetricsResourceWithStreamingResponse: async def list( self, *, - client_ids: Iterable[int] | NotGiven = NOT_GIVEN, - zone_names: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + client_ids: Iterable[int] | Omit = omit, + zone_names: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> str: """ Example of success response: diff --git a/src/gcore/resources/dns/pickers/pickers.py b/src/gcore/resources/dns/pickers/pickers.py index 3078c7f2..c08f6586 100644 --- a/src/gcore/resources/dns/pickers/pickers.py +++ b/src/gcore/resources/dns/pickers/pickers.py @@ -12,7 +12,7 @@ PresetsResourceWithStreamingResponse, AsyncPresetsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -59,7 +59,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PickerListResponse: """Returns list of picker""" return self._get( @@ -103,7 +103,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PickerListResponse: """Returns list of picker""" return await self._get( diff --git a/src/gcore/resources/dns/pickers/presets.py b/src/gcore/resources/dns/pickers/presets.py index aebd10ff..a816c8cc 100644 --- a/src/gcore/resources/dns/pickers/presets.py +++ b/src/gcore/resources/dns/pickers/presets.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -47,7 +47,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PresetListResponse: """Returns list of picker preset""" return self._get( @@ -87,7 +87,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PresetListResponse: """Returns list of picker preset""" return await self._get( diff --git a/src/gcore/resources/dns/zones/dnssec.py b/src/gcore/resources/dns/zones/dnssec.py index 8c747071..e91a9d09 100644 --- a/src/gcore/resources/dns/zones/dnssec.py +++ b/src/gcore/resources/dns/zones/dnssec.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -46,13 +46,13 @@ def update( self, name: str, *, - enabled: bool | NotGiven = NOT_GIVEN, + enabled: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DnssecUpdateResponse: """ Enable or disable DNSSEC for a DNS zone. @@ -86,7 +86,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DnssecGetResponse: """ Get DNSSEC DS for a DNS zone. @@ -135,13 +135,13 @@ async def update( self, name: str, *, - enabled: bool | NotGiven = NOT_GIVEN, + enabled: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DnssecUpdateResponse: """ Enable or disable DNSSEC for a DNS zone. @@ -175,7 +175,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DnssecGetResponse: """ Get DNSSEC DS for a DNS zone. diff --git a/src/gcore/resources/dns/zones/rrsets.py b/src/gcore/resources/dns/zones/rrsets.py index e1d136b1..bba8e773 100644 --- a/src/gcore/resources/dns/zones/rrsets.py +++ b/src/gcore/resources/dns/zones/rrsets.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -58,15 +58,15 @@ def create( zone_name: str, rrset_name: str, resource_records: Iterable[rrset_create_params.ResourceRecord], - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - pickers: Iterable[rrset_create_params.Picker] | NotGiven = NOT_GIVEN, - ttl: int | NotGiven = NOT_GIVEN, + meta: Dict[str, object] | Omit = omit, + pickers: Iterable[rrset_create_params.Picker] | Omit = omit, + ttl: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSOutputRrset: """ Add the RRSet to the zone specified by zoneName, RRSets can be configured to be @@ -225,16 +225,16 @@ def list( self, zone_name: str, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + order_direction: Literal["asc", "desc"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RrsetListResponse: """ List of RRset. @@ -289,7 +289,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Delete RRset. @@ -328,7 +328,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSOutputRrset: """ Particular RRset item info @@ -362,14 +362,14 @@ def get_failover_logs( *, zone_name: str, rrset_name: str, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RrsetGetFailoverLogsResponse: """ Get failover history for the RRset @@ -418,15 +418,15 @@ def replace( zone_name: str, rrset_name: str, resource_records: Iterable[rrset_replace_params.ResourceRecord], - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - pickers: Iterable[rrset_replace_params.Picker] | NotGiven = NOT_GIVEN, - ttl: int | NotGiven = NOT_GIVEN, + meta: Dict[str, object] | Omit = omit, + pickers: Iterable[rrset_replace_params.Picker] | Omit = omit, + ttl: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSOutputRrset: """ Create/update RRset. @@ -497,15 +497,15 @@ async def create( zone_name: str, rrset_name: str, resource_records: Iterable[rrset_create_params.ResourceRecord], - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - pickers: Iterable[rrset_create_params.Picker] | NotGiven = NOT_GIVEN, - ttl: int | NotGiven = NOT_GIVEN, + meta: Dict[str, object] | Omit = omit, + pickers: Iterable[rrset_create_params.Picker] | Omit = omit, + ttl: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSOutputRrset: """ Add the RRSet to the zone specified by zoneName, RRSets can be configured to be @@ -664,16 +664,16 @@ async def list( self, zone_name: str, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + order_direction: Literal["asc", "desc"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RrsetListResponse: """ List of RRset. @@ -728,7 +728,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Delete RRset. @@ -767,7 +767,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSOutputRrset: """ Particular RRset item info @@ -801,14 +801,14 @@ async def get_failover_logs( *, zone_name: str, rrset_name: str, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RrsetGetFailoverLogsResponse: """ Get failover history for the RRset @@ -857,15 +857,15 @@ async def replace( zone_name: str, rrset_name: str, resource_records: Iterable[rrset_replace_params.ResourceRecord], - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - pickers: Iterable[rrset_replace_params.Picker] | NotGiven = NOT_GIVEN, - ttl: int | NotGiven = NOT_GIVEN, + meta: Dict[str, object] | Omit = omit, + pickers: Iterable[rrset_replace_params.Picker] | Omit = omit, + ttl: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DNSOutputRrset: """ Create/update RRset. diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index 2bef8d84..0a5e9535 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -24,7 +24,7 @@ RrsetsResourceWithStreamingResponse, AsyncRrsetsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -85,21 +85,21 @@ def create( self, *, name: str, - contact: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expiry: int | NotGiven = NOT_GIVEN, - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - nx_ttl: int | NotGiven = NOT_GIVEN, - primary_server: str | NotGiven = NOT_GIVEN, - refresh: int | NotGiven = NOT_GIVEN, - retry: int | NotGiven = NOT_GIVEN, - serial: int | NotGiven = NOT_GIVEN, + contact: str | Omit = omit, + enabled: bool | Omit = omit, + expiry: int | Omit = omit, + meta: Dict[str, object] | Omit = omit, + nx_ttl: int | Omit = omit, + primary_server: str | Omit = omit, + refresh: int | Omit = omit, + retry: int | Omit = omit, + serial: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneCreateResponse: """ Add DNS zone. @@ -168,29 +168,29 @@ def create( def list( self, *, - id: Iterable[int] | NotGiven = NOT_GIVEN, - case_sensitive: bool | NotGiven = NOT_GIVEN, - client_id: Iterable[int] | NotGiven = NOT_GIVEN, - dynamic: bool | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - exact_match: bool | NotGiven = NOT_GIVEN, - healthcheck: bool | NotGiven = NOT_GIVEN, - iam_reseller_id: Iterable[int] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - reseller_id: Iterable[int] | NotGiven = NOT_GIVEN, - status: str | NotGiven = NOT_GIVEN, - updated_at_from: Union[str, datetime] | NotGiven = NOT_GIVEN, - updated_at_to: Union[str, datetime] | NotGiven = NOT_GIVEN, + id: Iterable[int] | Omit = omit, + case_sensitive: bool | Omit = omit, + client_id: Iterable[int] | Omit = omit, + dynamic: bool | Omit = omit, + enabled: bool | Omit = omit, + exact_match: bool | Omit = omit, + healthcheck: bool | Omit = omit, + iam_reseller_id: Iterable[int] | Omit = omit, + limit: int | Omit = omit, + name: SequenceNotStr[str] | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + order_direction: Literal["asc", "desc"] | Omit = omit, + reseller_id: Iterable[int] | Omit = omit, + status: str | Omit = omit, + updated_at_from: Union[str, datetime] | Omit = omit, + updated_at_to: Union[str, datetime] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneListResponse: """Show created zones with pagination managed by limit and offset params. @@ -266,7 +266,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Delete DNS zone and its records and raws. @@ -299,7 +299,7 @@ def check_delegation_status( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneCheckDelegationStatusResponse: """Returns delegation status for specified domain name. @@ -334,7 +334,7 @@ def disable( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Disable DNS zone. @@ -367,7 +367,7 @@ def enable( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Enable DNS zone. @@ -400,7 +400,7 @@ def export( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneExportResponse: """ Export zone to bind9 format. @@ -433,7 +433,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneGetResponse: """ Zone info by zone name. @@ -461,16 +461,16 @@ def get_statistics( self, name: str, *, - from_: int | NotGiven = NOT_GIVEN, - granularity: str | NotGiven = NOT_GIVEN, - record_type: str | NotGiven = NOT_GIVEN, - to: int | NotGiven = NOT_GIVEN, + from_: int | Omit = omit, + granularity: str | Omit = omit, + record_type: str | Omit = omit, + to: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneGetStatisticsResponse: """Statistics of DNS zone in common and by record types. @@ -540,13 +540,13 @@ def import_( self, zone_name: str, *, - body: object | NotGiven = NOT_GIVEN, + body: object | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneImportResponse: """Import zone in bind9 format. @@ -596,21 +596,21 @@ def replace( path_name: str, *, body_name: str, - contact: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expiry: int | NotGiven = NOT_GIVEN, - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - nx_ttl: int | NotGiven = NOT_GIVEN, - primary_server: str | NotGiven = NOT_GIVEN, - refresh: int | NotGiven = NOT_GIVEN, - retry: int | NotGiven = NOT_GIVEN, - serial: int | NotGiven = NOT_GIVEN, + contact: str | Omit = omit, + enabled: bool | Omit = omit, + expiry: int | Omit = omit, + meta: Dict[str, object] | Omit = omit, + nx_ttl: int | Omit = omit, + primary_server: str | Omit = omit, + refresh: int | Omit = omit, + retry: int | Omit = omit, + serial: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Update DNS zone and SOA record. @@ -711,21 +711,21 @@ async def create( self, *, name: str, - contact: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expiry: int | NotGiven = NOT_GIVEN, - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - nx_ttl: int | NotGiven = NOT_GIVEN, - primary_server: str | NotGiven = NOT_GIVEN, - refresh: int | NotGiven = NOT_GIVEN, - retry: int | NotGiven = NOT_GIVEN, - serial: int | NotGiven = NOT_GIVEN, + contact: str | Omit = omit, + enabled: bool | Omit = omit, + expiry: int | Omit = omit, + meta: Dict[str, object] | Omit = omit, + nx_ttl: int | Omit = omit, + primary_server: str | Omit = omit, + refresh: int | Omit = omit, + retry: int | Omit = omit, + serial: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneCreateResponse: """ Add DNS zone. @@ -794,29 +794,29 @@ async def create( async def list( self, *, - id: Iterable[int] | NotGiven = NOT_GIVEN, - case_sensitive: bool | NotGiven = NOT_GIVEN, - client_id: Iterable[int] | NotGiven = NOT_GIVEN, - dynamic: bool | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - exact_match: bool | NotGiven = NOT_GIVEN, - healthcheck: bool | NotGiven = NOT_GIVEN, - iam_reseller_id: Iterable[int] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - reseller_id: Iterable[int] | NotGiven = NOT_GIVEN, - status: str | NotGiven = NOT_GIVEN, - updated_at_from: Union[str, datetime] | NotGiven = NOT_GIVEN, - updated_at_to: Union[str, datetime] | NotGiven = NOT_GIVEN, + id: Iterable[int] | Omit = omit, + case_sensitive: bool | Omit = omit, + client_id: Iterable[int] | Omit = omit, + dynamic: bool | Omit = omit, + enabled: bool | Omit = omit, + exact_match: bool | Omit = omit, + healthcheck: bool | Omit = omit, + iam_reseller_id: Iterable[int] | Omit = omit, + limit: int | Omit = omit, + name: SequenceNotStr[str] | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + order_direction: Literal["asc", "desc"] | Omit = omit, + reseller_id: Iterable[int] | Omit = omit, + status: str | Omit = omit, + updated_at_from: Union[str, datetime] | Omit = omit, + updated_at_to: Union[str, datetime] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneListResponse: """Show created zones with pagination managed by limit and offset params. @@ -892,7 +892,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Delete DNS zone and its records and raws. @@ -925,7 +925,7 @@ async def check_delegation_status( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneCheckDelegationStatusResponse: """Returns delegation status for specified domain name. @@ -960,7 +960,7 @@ async def disable( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Disable DNS zone. @@ -993,7 +993,7 @@ async def enable( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Enable DNS zone. @@ -1026,7 +1026,7 @@ async def export( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneExportResponse: """ Export zone to bind9 format. @@ -1059,7 +1059,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneGetResponse: """ Zone info by zone name. @@ -1087,16 +1087,16 @@ async def get_statistics( self, name: str, *, - from_: int | NotGiven = NOT_GIVEN, - granularity: str | NotGiven = NOT_GIVEN, - record_type: str | NotGiven = NOT_GIVEN, - to: int | NotGiven = NOT_GIVEN, + from_: int | Omit = omit, + granularity: str | Omit = omit, + record_type: str | Omit = omit, + to: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneGetStatisticsResponse: """Statistics of DNS zone in common and by record types. @@ -1166,13 +1166,13 @@ async def import_( self, zone_name: str, *, - body: object | NotGiven = NOT_GIVEN, + body: object | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneImportResponse: """Import zone in bind9 format. @@ -1222,21 +1222,21 @@ async def replace( path_name: str, *, body_name: str, - contact: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expiry: int | NotGiven = NOT_GIVEN, - meta: Dict[str, object] | NotGiven = NOT_GIVEN, - nx_ttl: int | NotGiven = NOT_GIVEN, - primary_server: str | NotGiven = NOT_GIVEN, - refresh: int | NotGiven = NOT_GIVEN, - retry: int | NotGiven = NOT_GIVEN, - serial: int | NotGiven = NOT_GIVEN, + contact: str | Omit = omit, + enabled: bool | Omit = omit, + expiry: int | Omit = omit, + meta: Dict[str, object] | Omit = omit, + nx_ttl: int | Omit = omit, + primary_server: str | Omit = omit, + refresh: int | Omit = omit, + retry: int | Omit = omit, + serial: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Update DNS zone and SOA record. diff --git a/src/gcore/resources/fastedge/apps/apps.py b/src/gcore/resources/fastedge/apps/apps.py index 92d2662a..21e9fb4c 100644 --- a/src/gcore/resources/fastedge/apps/apps.py +++ b/src/gcore/resources/fastedge/apps/apps.py @@ -15,7 +15,7 @@ LogsResourceWithStreamingResponse, AsyncLogsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -61,23 +61,23 @@ def with_streaming_response(self) -> AppsResourceWithStreamingResponse: def create( self, *, - binary: int | NotGiven = NOT_GIVEN, - comment: str | NotGiven = NOT_GIVEN, - debug: bool | NotGiven = NOT_GIVEN, - env: Dict[str, str] | NotGiven = NOT_GIVEN, - log: Optional[Literal["kafka", "none"]] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - rsp_headers: Dict[str, str] | NotGiven = NOT_GIVEN, - secrets: Dict[str, app_create_params.Secrets] | NotGiven = NOT_GIVEN, - status: int | NotGiven = NOT_GIVEN, - stores: Dict[str, int] | NotGiven = NOT_GIVEN, - template: int | NotGiven = NOT_GIVEN, + binary: int | Omit = omit, + comment: str | Omit = omit, + debug: bool | Omit = omit, + env: Dict[str, str] | Omit = omit, + log: Optional[Literal["kafka", "none"]] | Omit = omit, + name: str | Omit = omit, + rsp_headers: Dict[str, str] | Omit = omit, + secrets: Dict[str, app_create_params.Secrets] | Omit = omit, + status: int | Omit = omit, + stores: Dict[str, int] | Omit = omit, + template: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AppShort: """ Add a new app @@ -148,23 +148,23 @@ def update( self, id: int, *, - binary: int | NotGiven = NOT_GIVEN, - comment: str | NotGiven = NOT_GIVEN, - debug: bool | NotGiven = NOT_GIVEN, - env: Dict[str, str] | NotGiven = NOT_GIVEN, - log: Optional[Literal["kafka", "none"]] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - rsp_headers: Dict[str, str] | NotGiven = NOT_GIVEN, - secrets: Dict[str, app_update_params.Secrets] | NotGiven = NOT_GIVEN, - status: int | NotGiven = NOT_GIVEN, - stores: Dict[str, int] | NotGiven = NOT_GIVEN, - template: int | NotGiven = NOT_GIVEN, + binary: int | Omit = omit, + comment: str | Omit = omit, + debug: bool | Omit = omit, + env: Dict[str, str] | Omit = omit, + log: Optional[Literal["kafka", "none"]] | Omit = omit, + name: str | Omit = omit, + rsp_headers: Dict[str, str] | Omit = omit, + secrets: Dict[str, app_update_params.Secrets] | Omit = omit, + status: int | Omit = omit, + stores: Dict[str, int] | Omit = omit, + template: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AppShort: """ Update app @@ -234,11 +234,11 @@ def update( def list( self, *, - api_type: Literal["wasi-http", "proxy-wasm"] | NotGiven = NOT_GIVEN, - binary: int | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + api_type: Literal["wasi-http", "proxy-wasm"] | Omit = omit, + binary: int | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "name", "-name", @@ -253,16 +253,16 @@ def list( "plan", "-plan", ] - | NotGiven = NOT_GIVEN, - plan: int | NotGiven = NOT_GIVEN, - status: int | NotGiven = NOT_GIVEN, - template: int | NotGiven = NOT_GIVEN, + | Omit = omit, + plan: int | Omit = omit, + status: int | Omit = omit, + template: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPageFastedgeApps[AppShort]: """ List client's apps @@ -339,7 +339,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete app @@ -371,7 +371,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> App: """ Get app details @@ -397,13 +397,13 @@ def replace( self, id: int, *, - body: app_replace_params.Body | NotGiven = NOT_GIVEN, + body: app_replace_params.Body | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AppShort: """ Update an app @@ -454,23 +454,23 @@ def with_streaming_response(self) -> AsyncAppsResourceWithStreamingResponse: async def create( self, *, - binary: int | NotGiven = NOT_GIVEN, - comment: str | NotGiven = NOT_GIVEN, - debug: bool | NotGiven = NOT_GIVEN, - env: Dict[str, str] | NotGiven = NOT_GIVEN, - log: Optional[Literal["kafka", "none"]] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - rsp_headers: Dict[str, str] | NotGiven = NOT_GIVEN, - secrets: Dict[str, app_create_params.Secrets] | NotGiven = NOT_GIVEN, - status: int | NotGiven = NOT_GIVEN, - stores: Dict[str, int] | NotGiven = NOT_GIVEN, - template: int | NotGiven = NOT_GIVEN, + binary: int | Omit = omit, + comment: str | Omit = omit, + debug: bool | Omit = omit, + env: Dict[str, str] | Omit = omit, + log: Optional[Literal["kafka", "none"]] | Omit = omit, + name: str | Omit = omit, + rsp_headers: Dict[str, str] | Omit = omit, + secrets: Dict[str, app_create_params.Secrets] | Omit = omit, + status: int | Omit = omit, + stores: Dict[str, int] | Omit = omit, + template: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AppShort: """ Add a new app @@ -541,23 +541,23 @@ async def update( self, id: int, *, - binary: int | NotGiven = NOT_GIVEN, - comment: str | NotGiven = NOT_GIVEN, - debug: bool | NotGiven = NOT_GIVEN, - env: Dict[str, str] | NotGiven = NOT_GIVEN, - log: Optional[Literal["kafka", "none"]] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - rsp_headers: Dict[str, str] | NotGiven = NOT_GIVEN, - secrets: Dict[str, app_update_params.Secrets] | NotGiven = NOT_GIVEN, - status: int | NotGiven = NOT_GIVEN, - stores: Dict[str, int] | NotGiven = NOT_GIVEN, - template: int | NotGiven = NOT_GIVEN, + binary: int | Omit = omit, + comment: str | Omit = omit, + debug: bool | Omit = omit, + env: Dict[str, str] | Omit = omit, + log: Optional[Literal["kafka", "none"]] | Omit = omit, + name: str | Omit = omit, + rsp_headers: Dict[str, str] | Omit = omit, + secrets: Dict[str, app_update_params.Secrets] | Omit = omit, + status: int | Omit = omit, + stores: Dict[str, int] | Omit = omit, + template: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AppShort: """ Update app @@ -627,11 +627,11 @@ async def update( def list( self, *, - api_type: Literal["wasi-http", "proxy-wasm"] | NotGiven = NOT_GIVEN, - binary: int | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + api_type: Literal["wasi-http", "proxy-wasm"] | Omit = omit, + binary: int | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "name", "-name", @@ -646,16 +646,16 @@ def list( "plan", "-plan", ] - | NotGiven = NOT_GIVEN, - plan: int | NotGiven = NOT_GIVEN, - status: int | NotGiven = NOT_GIVEN, - template: int | NotGiven = NOT_GIVEN, + | Omit = omit, + plan: int | Omit = omit, + status: int | Omit = omit, + template: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[AppShort, AsyncOffsetPageFastedgeApps[AppShort]]: """ List client's apps @@ -732,7 +732,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete app @@ -764,7 +764,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> App: """ Get app details @@ -790,13 +790,13 @@ async def replace( self, id: int, *, - body: app_replace_params.Body | NotGiven = NOT_GIVEN, + body: app_replace_params.Body | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AppShort: """ Update an app diff --git a/src/gcore/resources/fastedge/apps/logs.py b/src/gcore/resources/fastedge/apps/logs.py index f43d121c..8f589ab0 100644 --- a/src/gcore/resources/fastedge/apps/logs.py +++ b/src/gcore/resources/fastedge/apps/logs.py @@ -8,7 +8,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -50,20 +50,20 @@ def list( self, id: int, *, - client_ip: str | NotGiven = NOT_GIVEN, - edge: str | NotGiven = NOT_GIVEN, - from_: Union[str, datetime] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - search: str | NotGiven = NOT_GIVEN, - sort: Literal["desc", "asc"] | NotGiven = NOT_GIVEN, - to: Union[str, datetime] | NotGiven = NOT_GIVEN, + client_ip: str | Omit = omit, + edge: str | Omit = omit, + from_: Union[str, datetime] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + search: str | Omit = omit, + sort: Literal["desc", "asc"] | Omit = omit, + to: Union[str, datetime] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPageFastedgeAppLogs[Log]: """ List logs for the app @@ -143,20 +143,20 @@ def list( self, id: int, *, - client_ip: str | NotGiven = NOT_GIVEN, - edge: str | NotGiven = NOT_GIVEN, - from_: Union[str, datetime] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - search: str | NotGiven = NOT_GIVEN, - sort: Literal["desc", "asc"] | NotGiven = NOT_GIVEN, - to: Union[str, datetime] | NotGiven = NOT_GIVEN, + client_ip: str | Omit = omit, + edge: str | Omit = omit, + from_: Union[str, datetime] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + search: str | Omit = omit, + sort: Literal["desc", "asc"] | Omit = omit, + to: Union[str, datetime] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Log, AsyncOffsetPageFastedgeAppLogs[Log]]: """ List logs for the app diff --git a/src/gcore/resources/fastedge/binaries.py b/src/gcore/resources/fastedge/binaries.py index 8323efb1..c88f90da 100644 --- a/src/gcore/resources/fastedge/binaries.py +++ b/src/gcore/resources/fastedge/binaries.py @@ -5,7 +5,7 @@ import httpx from ..._files import read_file_content, async_read_file_content -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileContent +from ..._types import Body, Query, Headers, NoneType, NotGiven, FileContent, not_given from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -51,7 +51,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BinaryShort: """ Store compiled WASM binary @@ -83,7 +83,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BinaryListResponse: """List binaries""" return self._get( @@ -103,7 +103,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a binary @@ -135,7 +135,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Binary: """ Get binary @@ -187,7 +187,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BinaryShort: """ Store compiled WASM binary @@ -219,7 +219,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BinaryListResponse: """List binaries""" return await self._get( @@ -239,7 +239,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a binary @@ -271,7 +271,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Binary: """ Get binary diff --git a/src/gcore/resources/fastedge/fastedge.py b/src/gcore/resources/fastedge/fastedge.py index 9b052788..d4ba7cf3 100644 --- a/src/gcore/resources/fastedge/fastedge.py +++ b/src/gcore/resources/fastedge/fastedge.py @@ -12,7 +12,7 @@ SecretsResourceWithStreamingResponse, AsyncSecretsResourceWithStreamingResponse, ) -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from .binaries import ( BinariesResource, AsyncBinariesResource, @@ -119,7 +119,7 @@ def get_account_overview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Client: """Get status and limits for the client""" return self._get( @@ -183,7 +183,7 @@ async def get_account_overview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Client: """Get status and limits for the client""" return await self._get( diff --git a/src/gcore/resources/fastedge/kv_stores.py b/src/gcore/resources/fastedge/kv_stores.py index cb007bbc..42193e54 100644 --- a/src/gcore/resources/fastedge/kv_stores.py +++ b/src/gcore/resources/fastedge/kv_stores.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -46,14 +46,14 @@ def with_streaming_response(self) -> KvStoresResourceWithStreamingResponse: def create( self, *, - byod: kv_store_create_params.Byod | NotGiven = NOT_GIVEN, - comment: str | NotGiven = NOT_GIVEN, + byod: kv_store_create_params.Byod | Omit = omit, + comment: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStore: """ Add a new KV store @@ -89,13 +89,13 @@ def create( def list( self, *, - app_id: int | NotGiven = NOT_GIVEN, + app_id: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStoreListResponse: """ List available stores @@ -132,7 +132,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a store @@ -164,7 +164,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStoreGetResponse: """ Get store by id @@ -190,14 +190,14 @@ def replace( self, id: int, *, - byod: kv_store_replace_params.Byod | NotGiven = NOT_GIVEN, - comment: str | NotGiven = NOT_GIVEN, + byod: kv_store_replace_params.Byod | Omit = omit, + comment: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStore: """ Update a store @@ -254,14 +254,14 @@ def with_streaming_response(self) -> AsyncKvStoresResourceWithStreamingResponse: async def create( self, *, - byod: kv_store_create_params.Byod | NotGiven = NOT_GIVEN, - comment: str | NotGiven = NOT_GIVEN, + byod: kv_store_create_params.Byod | Omit = omit, + comment: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStore: """ Add a new KV store @@ -297,13 +297,13 @@ async def create( async def list( self, *, - app_id: int | NotGiven = NOT_GIVEN, + app_id: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStoreListResponse: """ List available stores @@ -340,7 +340,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a store @@ -372,7 +372,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStoreGetResponse: """ Get store by id @@ -398,14 +398,14 @@ async def replace( self, id: int, *, - byod: kv_store_replace_params.Byod | NotGiven = NOT_GIVEN, - comment: str | NotGiven = NOT_GIVEN, + byod: kv_store_replace_params.Byod | Omit = omit, + comment: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> KvStore: """ Update a store diff --git a/src/gcore/resources/fastedge/secrets.py b/src/gcore/resources/fastedge/secrets.py index 8b1e97e2..81685e61 100644 --- a/src/gcore/resources/fastedge/secrets.py +++ b/src/gcore/resources/fastedge/secrets.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -55,14 +55,14 @@ def create( self, *, name: str, - comment: str | NotGiven = NOT_GIVEN, - secret_slots: Iterable[secret_create_params.SecretSlot] | NotGiven = NOT_GIVEN, + comment: str | Omit = omit, + secret_slots: Iterable[secret_create_params.SecretSlot] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecretCreateResponse: """ Add a new secret @@ -102,15 +102,15 @@ def update( self, id: int, *, - comment: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - secret_slots: Iterable[secret_update_params.SecretSlot] | NotGiven = NOT_GIVEN, + comment: str | Omit = omit, + name: str | Omit = omit, + secret_slots: Iterable[secret_update_params.SecretSlot] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Secret: """ Update a secret @@ -149,14 +149,14 @@ def update( def list( self, *, - app_id: int | NotGiven = NOT_GIVEN, - secret_name: str | NotGiven = NOT_GIVEN, + app_id: int | Omit = omit, + secret_name: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecretListResponse: """ List available secrets @@ -196,13 +196,13 @@ def delete( self, id: int, *, - force: bool | NotGiven = NOT_GIVEN, + force: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a secret @@ -240,7 +240,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Secret: """ Get secret by id @@ -267,14 +267,14 @@ def replace( id: int, *, name: str, - comment: str | NotGiven = NOT_GIVEN, - secret_slots: Iterable[secret_replace_params.SecretSlot] | NotGiven = NOT_GIVEN, + comment: str | Omit = omit, + secret_slots: Iterable[secret_replace_params.SecretSlot] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Secret: """ Update a secret @@ -335,14 +335,14 @@ async def create( self, *, name: str, - comment: str | NotGiven = NOT_GIVEN, - secret_slots: Iterable[secret_create_params.SecretSlot] | NotGiven = NOT_GIVEN, + comment: str | Omit = omit, + secret_slots: Iterable[secret_create_params.SecretSlot] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecretCreateResponse: """ Add a new secret @@ -382,15 +382,15 @@ async def update( self, id: int, *, - comment: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - secret_slots: Iterable[secret_update_params.SecretSlot] | NotGiven = NOT_GIVEN, + comment: str | Omit = omit, + name: str | Omit = omit, + secret_slots: Iterable[secret_update_params.SecretSlot] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Secret: """ Update a secret @@ -429,14 +429,14 @@ async def update( async def list( self, *, - app_id: int | NotGiven = NOT_GIVEN, - secret_name: str | NotGiven = NOT_GIVEN, + app_id: int | Omit = omit, + secret_name: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecretListResponse: """ List available secrets @@ -476,13 +476,13 @@ async def delete( self, id: int, *, - force: bool | NotGiven = NOT_GIVEN, + force: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a secret @@ -520,7 +520,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Secret: """ Get secret by id @@ -547,14 +547,14 @@ async def replace( id: int, *, name: str, - comment: str | NotGiven = NOT_GIVEN, - secret_slots: Iterable[secret_replace_params.SecretSlot] | NotGiven = NOT_GIVEN, + comment: str | Omit = omit, + secret_slots: Iterable[secret_replace_params.SecretSlot] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Secret: """ Update a secret diff --git a/src/gcore/resources/fastedge/statistics.py b/src/gcore/resources/fastedge/statistics.py index 1958aafc..4b344931 100644 --- a/src/gcore/resources/fastedge/statistics.py +++ b/src/gcore/resources/fastedge/statistics.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -51,14 +51,14 @@ def get_call_series( from_: Union[str, datetime], step: int, to: Union[str, datetime], - id: int | NotGiven = NOT_GIVEN, - network: str | NotGiven = NOT_GIVEN, + id: int | Omit = omit, + network: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetCallSeriesResponse: """ Call statistics @@ -109,14 +109,14 @@ def get_duration_series( from_: Union[str, datetime], step: int, to: Union[str, datetime], - id: int | NotGiven = NOT_GIVEN, - network: str | NotGiven = NOT_GIVEN, + id: int | Omit = omit, + network: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetDurationSeriesResponse: """ Execution duration statistics @@ -188,14 +188,14 @@ async def get_call_series( from_: Union[str, datetime], step: int, to: Union[str, datetime], - id: int | NotGiven = NOT_GIVEN, - network: str | NotGiven = NOT_GIVEN, + id: int | Omit = omit, + network: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetCallSeriesResponse: """ Call statistics @@ -246,14 +246,14 @@ async def get_duration_series( from_: Union[str, datetime], step: int, to: Union[str, datetime], - id: int | NotGiven = NOT_GIVEN, - network: str | NotGiven = NOT_GIVEN, + id: int | Omit = omit, + network: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetDurationSeriesResponse: """ Execution duration statistics diff --git a/src/gcore/resources/fastedge/templates.py b/src/gcore/resources/fastedge/templates.py index a39e2757..d58d3110 100644 --- a/src/gcore/resources/fastedge/templates.py +++ b/src/gcore/resources/fastedge/templates.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -59,14 +59,14 @@ def create( name: str, owned: bool, params: Iterable[TemplateParameterParam], - long_descr: str | NotGiven = NOT_GIVEN, - short_descr: str | NotGiven = NOT_GIVEN, + long_descr: str | Omit = omit, + short_descr: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TemplateShort: """ Add template @@ -114,16 +114,16 @@ def create( def list( self, *, - api_type: Literal["wasi-http", "proxy-wasm"] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - only_mine: bool | NotGiven = NOT_GIVEN, + api_type: Literal["wasi-http", "proxy-wasm"] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + only_mine: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPageFastedgeTemplates[TemplateShort]: """ List app templates @@ -173,13 +173,13 @@ def delete( self, id: int, *, - force: bool | NotGiven = NOT_GIVEN, + force: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete template @@ -217,7 +217,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Template: """ Get template details @@ -247,14 +247,14 @@ def replace( name: str, owned: bool, params: Iterable[TemplateParameterParam], - long_descr: str | NotGiven = NOT_GIVEN, - short_descr: str | NotGiven = NOT_GIVEN, + long_descr: str | Omit = omit, + short_descr: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TemplateShort: """ Update template @@ -327,14 +327,14 @@ async def create( name: str, owned: bool, params: Iterable[TemplateParameterParam], - long_descr: str | NotGiven = NOT_GIVEN, - short_descr: str | NotGiven = NOT_GIVEN, + long_descr: str | Omit = omit, + short_descr: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TemplateShort: """ Add template @@ -382,16 +382,16 @@ async def create( def list( self, *, - api_type: Literal["wasi-http", "proxy-wasm"] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - only_mine: bool | NotGiven = NOT_GIVEN, + api_type: Literal["wasi-http", "proxy-wasm"] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + only_mine: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[TemplateShort, AsyncOffsetPageFastedgeTemplates[TemplateShort]]: """ List app templates @@ -441,13 +441,13 @@ async def delete( self, id: int, *, - force: bool | NotGiven = NOT_GIVEN, + force: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete template @@ -485,7 +485,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Template: """ Get template details @@ -515,14 +515,14 @@ async def replace( name: str, owned: bool, params: Iterable[TemplateParameterParam], - long_descr: str | NotGiven = NOT_GIVEN, - short_descr: str | NotGiven = NOT_GIVEN, + long_descr: str | Omit = omit, + short_descr: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TemplateShort: """ Update template diff --git a/src/gcore/resources/iam/api_tokens.py b/src/gcore/resources/iam/api_tokens.py index ecd59cb6..e99827be 100644 --- a/src/gcore/resources/iam/api_tokens.py +++ b/src/gcore/resources/iam/api_tokens.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -50,13 +50,13 @@ def create( client_user: api_token_create_params.ClientUser, exp_date: str, name: str, - description: str | NotGiven = NOT_GIVEN, + description: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APITokenCreate: """ Create an API token in the current account. @@ -100,16 +100,16 @@ def list( self, client_id: int, *, - deleted: bool | NotGiven = NOT_GIVEN, - issued_by: int | NotGiven = NOT_GIVEN, - not_issued_by: int | NotGiven = NOT_GIVEN, - role: str | NotGiven = NOT_GIVEN, + deleted: bool | Omit = omit, + issued_by: int | Omit = omit, + not_issued_by: int | Omit = omit, + role: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APITokenList: """Get information about your permanent API tokens in the account. @@ -176,7 +176,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Delete API token from current account. @@ -213,7 +213,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APIToken: """ Get API Token @@ -263,13 +263,13 @@ async def create( client_user: api_token_create_params.ClientUser, exp_date: str, name: str, - description: str | NotGiven = NOT_GIVEN, + description: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APITokenCreate: """ Create an API token in the current account. @@ -313,16 +313,16 @@ async def list( self, client_id: int, *, - deleted: bool | NotGiven = NOT_GIVEN, - issued_by: int | NotGiven = NOT_GIVEN, - not_issued_by: int | NotGiven = NOT_GIVEN, - role: str | NotGiven = NOT_GIVEN, + deleted: bool | Omit = omit, + issued_by: int | Omit = omit, + not_issued_by: int | Omit = omit, + role: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APITokenList: """Get information about your permanent API tokens in the account. @@ -389,7 +389,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Delete API token from current account. @@ -426,7 +426,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APIToken: """ Get API Token diff --git a/src/gcore/resources/iam/iam.py b/src/gcore/resources/iam/iam.py index 54b4653f..7f409c61 100644 --- a/src/gcore/resources/iam/iam.py +++ b/src/gcore/resources/iam/iam.py @@ -12,7 +12,7 @@ UsersResourceWithStreamingResponse, AsyncUsersResourceWithStreamingResponse, ) -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from ..._compat import cached_property from .api_tokens import ( APITokensResource, @@ -71,7 +71,7 @@ def get_account_overview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccountOverview: """Get information about your profile, users and other account details.""" return self._get( @@ -119,7 +119,7 @@ async def get_account_overview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccountOverview: """Get information about your profile, users and other account details.""" return await self._get( diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index a27021c1..bbb9e413 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -52,19 +52,19 @@ def update( self, user_id: int, *, - auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] | NotGiven = NOT_GIVEN, - company: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - groups: Iterable[user_update_params.Group] | NotGiven = NOT_GIVEN, - lang: Literal["de", "en", "ru", "zh", "az"] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - phone: Optional[str] | NotGiven = NOT_GIVEN, + auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] | Omit = omit, + company: str | Omit = omit, + email: str | Omit = omit, + groups: Iterable[user_update_params.Group] | Omit = omit, + lang: Literal["de", "en", "ru", "zh", "az"] | Omit = omit, + name: Optional[str] | Omit = omit, + phone: Optional[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserUpdate: """This method updates user's details. @@ -123,14 +123,14 @@ def update( def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[User]: """Get a list of users. @@ -180,7 +180,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Revokes user's access to the specified account. @@ -214,7 +214,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserDetailed: """ Get user's details @@ -242,14 +242,14 @@ def invite( client_id: int, email: str, user_role: user_invite_params.UserRole, - lang: Literal["de", "en", "ru", "zh", "az"] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, + lang: Literal["de", "en", "ru", "zh", "az"] | Omit = omit, + name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserInvite: """Invite a user to the account. @@ -317,19 +317,19 @@ async def update( self, user_id: int, *, - auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] | NotGiven = NOT_GIVEN, - company: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - groups: Iterable[user_update_params.Group] | NotGiven = NOT_GIVEN, - lang: Literal["de", "en", "ru", "zh", "az"] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - phone: Optional[str] | NotGiven = NOT_GIVEN, + auth_types: List[Literal["password", "sso", "github", "google-oauth2"]] | Omit = omit, + company: str | Omit = omit, + email: str | Omit = omit, + groups: Iterable[user_update_params.Group] | Omit = omit, + lang: Literal["de", "en", "ru", "zh", "az"] | Omit = omit, + name: Optional[str] | Omit = omit, + phone: Optional[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserUpdate: """This method updates user's details. @@ -388,14 +388,14 @@ async def update( def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[User, AsyncOffsetPage[User]]: """Get a list of users. @@ -445,7 +445,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Revokes user's access to the specified account. @@ -479,7 +479,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserDetailed: """ Get user's details @@ -507,14 +507,14 @@ async def invite( client_id: int, email: str, user_role: user_invite_params.UserRole, - lang: Literal["de", "en", "ru", "zh", "az"] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, + lang: Literal["de", "en", "ru", "zh", "az"] | Omit = omit, + name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserInvite: """Invite a user to the account. diff --git a/src/gcore/resources/security/bgp_announces.py b/src/gcore/resources/security/bgp_announces.py index 43947fab..26b3bc96 100644 --- a/src/gcore/resources/security/bgp_announces.py +++ b/src/gcore/resources/security/bgp_announces.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -47,16 +47,16 @@ def with_streaming_response(self) -> BgpAnnouncesResourceWithStreamingResponse: def list( self, *, - announced: Optional[bool] | NotGiven = NOT_GIVEN, - client_id: Optional[int] | NotGiven = NOT_GIVEN, - origin: Optional[Literal["STATIC", "DYNAMIC"]] | NotGiven = NOT_GIVEN, - site: Optional[str] | NotGiven = NOT_GIVEN, + announced: Optional[bool] | Omit = omit, + client_id: Optional[int] | Omit = omit, + origin: Optional[Literal["STATIC", "DYNAMIC"]] | Omit = omit, + site: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BgpAnnounceListResponse: """Get BGP announces filtered by parameters. @@ -98,13 +98,13 @@ def toggle( *, announce: str, enabled: bool, - client_id: Optional[int] | NotGiven = NOT_GIVEN, + client_id: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """Change BGP announces (it can be enabled or disabled, but not created or updated). @@ -164,16 +164,16 @@ def with_streaming_response(self) -> AsyncBgpAnnouncesResourceWithStreamingRespo async def list( self, *, - announced: Optional[bool] | NotGiven = NOT_GIVEN, - client_id: Optional[int] | NotGiven = NOT_GIVEN, - origin: Optional[Literal["STATIC", "DYNAMIC"]] | NotGiven = NOT_GIVEN, - site: Optional[str] | NotGiven = NOT_GIVEN, + announced: Optional[bool] | Omit = omit, + client_id: Optional[int] | Omit = omit, + origin: Optional[Literal["STATIC", "DYNAMIC"]] | Omit = omit, + site: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BgpAnnounceListResponse: """Get BGP announces filtered by parameters. @@ -215,13 +215,13 @@ async def toggle( *, announce: str, enabled: bool, - client_id: Optional[int] | NotGiven = NOT_GIVEN, + client_id: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """Change BGP announces (it can be enabled or disabled, but not created or updated). diff --git a/src/gcore/resources/security/events.py b/src/gcore/resources/security/events.py index 86d387bb..e0699398 100644 --- a/src/gcore/resources/security/events.py +++ b/src/gcore/resources/security/events.py @@ -8,7 +8,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -49,11 +49,11 @@ def with_streaming_response(self) -> EventsResourceWithStreamingResponse: def list( self, *, - alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] | NotGiven = NOT_GIVEN, - date_from: Union[Union[str, datetime], str] | NotGiven = NOT_GIVEN, - date_to: Union[Union[str, datetime], str] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] | Omit = omit, + date_from: Union[Union[str, datetime], str] | Omit = omit, + date_to: Union[Union[str, datetime], str] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "attack_start_time", "-attack_start_time", @@ -66,14 +66,14 @@ def list( "alert_type", "-alert_type", ] - | NotGiven = NOT_GIVEN, - targeted_ip_addresses: Optional[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + targeted_ip_addresses: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[ClientView]: """ Event Logs Clients View @@ -135,11 +135,11 @@ def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse: def list( self, *, - alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] | NotGiven = NOT_GIVEN, - date_from: Union[Union[str, datetime], str] | NotGiven = NOT_GIVEN, - date_to: Union[Union[str, datetime], str] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] | Omit = omit, + date_from: Union[Union[str, datetime], str] | Omit = omit, + date_to: Union[Union[str, datetime], str] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "attack_start_time", "-attack_start_time", @@ -152,14 +152,14 @@ def list( "alert_type", "-alert_type", ] - | NotGiven = NOT_GIVEN, - targeted_ip_addresses: Optional[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + targeted_ip_addresses: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[ClientView, AsyncOffsetPage[ClientView]]: """ Event Logs Clients View diff --git a/src/gcore/resources/security/profile_templates.py b/src/gcore/resources/security/profile_templates.py index 85b84ad8..307f3c0d 100644 --- a/src/gcore/resources/security/profile_templates.py +++ b/src/gcore/resources/security/profile_templates.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -47,7 +47,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProfileTemplateListResponse: """Get list of profile templates. @@ -91,7 +91,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProfileTemplateListResponse: """Get list of profile templates. diff --git a/src/gcore/resources/security/profiles.py b/src/gcore/resources/security/profiles.py index 16668afa..8394bd69 100644 --- a/src/gcore/resources/security/profiles.py +++ b/src/gcore/resources/security/profiles.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -54,14 +54,14 @@ def create( *, fields: Iterable[profile_create_params.Field], profile_template: int, - ip_address: Optional[str] | NotGiven = NOT_GIVEN, - site: str | NotGiven = NOT_GIVEN, + ip_address: Optional[str] | Omit = omit, + site: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ClientProfile: """Create protection profile. @@ -97,16 +97,16 @@ def create( def list( self, *, - exclude_empty_address: bool | NotGiven = NOT_GIVEN, - include_deleted: bool | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - site: str | NotGiven = NOT_GIVEN, + exclude_empty_address: bool | Omit = omit, + include_deleted: bool | Omit = omit, + ip_address: str | Omit = omit, + site: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProfileListResponse: """Get list of protection profiles. @@ -150,7 +150,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Delete protection profile. @@ -184,7 +184,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ClientProfile: """ Get profile by id @@ -212,14 +212,14 @@ def recreate( *, fields: Iterable[profile_recreate_params.Field], profile_template: int, - ip_address: Optional[str] | NotGiven = NOT_GIVEN, - site: str | NotGiven = NOT_GIVEN, + ip_address: Optional[str] | Omit = omit, + site: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ClientProfile: """ Recreate profile with another profile template (for other cases use detail API) @@ -256,14 +256,14 @@ def replace( *, fields: Iterable[profile_replace_params.Field], profile_template: int, - ip_address: Optional[str] | NotGiven = NOT_GIVEN, - site: str | NotGiven = NOT_GIVEN, + ip_address: Optional[str] | Omit = omit, + site: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ClientProfile: """Update profile. @@ -322,14 +322,14 @@ async def create( *, fields: Iterable[profile_create_params.Field], profile_template: int, - ip_address: Optional[str] | NotGiven = NOT_GIVEN, - site: str | NotGiven = NOT_GIVEN, + ip_address: Optional[str] | Omit = omit, + site: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ClientProfile: """Create protection profile. @@ -365,16 +365,16 @@ async def create( async def list( self, *, - exclude_empty_address: bool | NotGiven = NOT_GIVEN, - include_deleted: bool | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - site: str | NotGiven = NOT_GIVEN, + exclude_empty_address: bool | Omit = omit, + include_deleted: bool | Omit = omit, + ip_address: str | Omit = omit, + site: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProfileListResponse: """Get list of protection profiles. @@ -418,7 +418,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Delete protection profile. @@ -452,7 +452,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ClientProfile: """ Get profile by id @@ -480,14 +480,14 @@ async def recreate( *, fields: Iterable[profile_recreate_params.Field], profile_template: int, - ip_address: Optional[str] | NotGiven = NOT_GIVEN, - site: str | NotGiven = NOT_GIVEN, + ip_address: Optional[str] | Omit = omit, + site: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ClientProfile: """ Recreate profile with another profile template (for other cases use detail API) @@ -524,14 +524,14 @@ async def replace( *, fields: Iterable[profile_replace_params.Field], profile_template: int, - ip_address: Optional[str] | NotGiven = NOT_GIVEN, - site: str | NotGiven = NOT_GIVEN, + ip_address: Optional[str] | Omit = omit, + site: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ClientProfile: """Update profile. diff --git a/src/gcore/resources/storage/buckets/buckets.py b/src/gcore/resources/storage/buckets/buckets.py index d8c41393..66c28797 100644 --- a/src/gcore/resources/storage/buckets/buckets.py +++ b/src/gcore/resources/storage/buckets/buckets.py @@ -20,7 +20,7 @@ PolicyResourceWithStreamingResponse, AsyncPolicyResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform from .lifecycle import ( LifecycleResource, @@ -88,7 +88,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Creates a new bucket within an S3 storage. @@ -119,14 +119,14 @@ def list( self, storage_id: int, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Bucket]: """Returns the list of buckets for the storage in a wrapped response. @@ -176,7 +176,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Removes a bucket from an S3 storage. @@ -246,7 +246,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Creates a new bucket within an S3 storage. @@ -277,14 +277,14 @@ def list( self, storage_id: int, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Bucket, AsyncOffsetPage[Bucket]]: """Returns the list of buckets for the storage in a wrapped response. @@ -334,7 +334,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Removes a bucket from an S3 storage. diff --git a/src/gcore/resources/storage/buckets/cors.py b/src/gcore/resources/storage/buckets/cors.py index 3869e78e..77a3e045 100644 --- a/src/gcore/resources/storage/buckets/cors.py +++ b/src/gcore/resources/storage/buckets/cors.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -46,13 +46,13 @@ def create( bucket_name: str, *, storage_id: int, - allowed_origins: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + allowed_origins: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Configures Cross-Origin Resource Sharing (CORS) rules for an S3 bucket, allowing @@ -92,7 +92,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BucketCors: """ Retrieves the current Cross-Origin Resource Sharing (CORS) configuration for an @@ -144,13 +144,13 @@ async def create( bucket_name: str, *, storage_id: int, - allowed_origins: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + allowed_origins: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Configures Cross-Origin Resource Sharing (CORS) rules for an S3 bucket, allowing @@ -190,7 +190,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BucketCors: """ Retrieves the current Cross-Origin Resource Sharing (CORS) configuration for an diff --git a/src/gcore/resources/storage/buckets/lifecycle.py b/src/gcore/resources/storage/buckets/lifecycle.py index a4940ef7..b80dffaf 100644 --- a/src/gcore/resources/storage/buckets/lifecycle.py +++ b/src/gcore/resources/storage/buckets/lifecycle.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -45,13 +45,13 @@ def create( bucket_name: str, *, storage_id: int, - expiration_days: int | NotGiven = NOT_GIVEN, + expiration_days: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Sets up automatic object expiration for an S3 bucket. @@ -96,7 +96,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Removes all lifecycle rules from an S3 bucket, disabling automatic object @@ -148,13 +148,13 @@ async def create( bucket_name: str, *, storage_id: int, - expiration_days: int | NotGiven = NOT_GIVEN, + expiration_days: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Sets up automatic object expiration for an S3 bucket. @@ -201,7 +201,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Removes all lifecycle rules from an S3 bucket, disabling automatic object diff --git a/src/gcore/resources/storage/buckets/policy.py b/src/gcore/resources/storage/buckets/policy.py index f84d2653..cca549f9 100644 --- a/src/gcore/resources/storage/buckets/policy.py +++ b/src/gcore/resources/storage/buckets/policy.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Query, Headers, NoneType, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -49,7 +49,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Applies a public read policy to the S3 bucket, allowing anonymous users to @@ -88,7 +88,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Removes the public read policy from an S3 bucket, making all objects private and @@ -126,7 +126,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PolicyGetResponse: """ Returns whether the S3 bucket is currently configured for public read access. @@ -182,7 +182,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Applies a public read policy to the S3 bucket, allowing anonymous users to @@ -221,7 +221,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Removes the public read policy from an S3 bucket, making all objects private and @@ -259,7 +259,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PolicyGetResponse: """ Returns whether the S3 bucket is currently configured for public read access. diff --git a/src/gcore/resources/storage/credentials.py b/src/gcore/resources/storage/credentials.py index 5cc7224a..1db372ae 100644 --- a/src/gcore/resources/storage/credentials.py +++ b/src/gcore/resources/storage/credentials.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -45,17 +45,17 @@ def recreate( self, storage_id: int, *, - delete_sftp_password: bool | NotGiven = NOT_GIVEN, - generate_s3_keys: bool | NotGiven = NOT_GIVEN, - generate_sftp_password: bool | NotGiven = NOT_GIVEN, - reset_sftp_keys: bool | NotGiven = NOT_GIVEN, - sftp_password: str | NotGiven = NOT_GIVEN, + delete_sftp_password: bool | Omit = omit, + generate_s3_keys: bool | Omit = omit, + generate_sftp_password: bool | Omit = omit, + reset_sftp_keys: bool | Omit = omit, + sftp_password: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: """ Generates new access credentials for the storage (S3 keys for S3 storage, SFTP @@ -127,17 +127,17 @@ async def recreate( self, storage_id: int, *, - delete_sftp_password: bool | NotGiven = NOT_GIVEN, - generate_s3_keys: bool | NotGiven = NOT_GIVEN, - generate_sftp_password: bool | NotGiven = NOT_GIVEN, - reset_sftp_keys: bool | NotGiven = NOT_GIVEN, - sftp_password: str | NotGiven = NOT_GIVEN, + delete_sftp_password: bool | Omit = omit, + generate_s3_keys: bool | Omit = omit, + generate_sftp_password: bool | Omit = omit, + reset_sftp_keys: bool | Omit = omit, + sftp_password: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: """ Generates new access credentials for the storage (S3 keys for S3 storage, SFTP diff --git a/src/gcore/resources/storage/locations.py b/src/gcore/resources/storage/locations.py index 5e2a2d96..bce1aa37 100644 --- a/src/gcore/resources/storage/locations.py +++ b/src/gcore/resources/storage/locations.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -45,14 +45,14 @@ def with_streaming_response(self) -> LocationsResourceWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Location]: """Returns available storage locations where you can create storages. @@ -111,14 +111,14 @@ def with_streaming_response(self) -> AsyncLocationsResourceWithStreamingResponse def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Location, AsyncOffsetPage[Location]]: """Returns available storage locations where you can create storages. diff --git a/src/gcore/resources/storage/statistics.py b/src/gcore/resources/storage/statistics.py index 980c1410..dbaf7b6e 100644 --- a/src/gcore/resources/storage/statistics.py +++ b/src/gcore/resources/storage/statistics.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -45,16 +45,16 @@ def with_streaming_response(self) -> StatisticsResourceWithStreamingResponse: def get_usage_aggregated( self, *, - from_: str | NotGiven = NOT_GIVEN, - locations: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - storages: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + from_: str | Omit = omit, + locations: SequenceNotStr[str] | Omit = omit, + storages: SequenceNotStr[str] | Omit = omit, + to: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UsageTotal: """ Consumption statistics is updated in near real-time as a standard practice. @@ -101,19 +101,19 @@ def get_usage_aggregated( def get_usage_series( self, *, - from_: str | NotGiven = NOT_GIVEN, - granularity: str | NotGiven = NOT_GIVEN, - locations: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - source: int | NotGiven = NOT_GIVEN, - storages: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, - ts_string: bool | NotGiven = NOT_GIVEN, + from_: str | Omit = omit, + granularity: str | Omit = omit, + locations: SequenceNotStr[str] | Omit = omit, + source: int | Omit = omit, + storages: SequenceNotStr[str] | Omit = omit, + to: str | Omit = omit, + ts_string: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetUsageSeriesResponse: """ Consumption statistics is updated in near real-time as a standard practice. @@ -192,16 +192,16 @@ def with_streaming_response(self) -> AsyncStatisticsResourceWithStreamingRespons async def get_usage_aggregated( self, *, - from_: str | NotGiven = NOT_GIVEN, - locations: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - storages: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + from_: str | Omit = omit, + locations: SequenceNotStr[str] | Omit = omit, + storages: SequenceNotStr[str] | Omit = omit, + to: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UsageTotal: """ Consumption statistics is updated in near real-time as a standard practice. @@ -248,19 +248,19 @@ async def get_usage_aggregated( async def get_usage_series( self, *, - from_: str | NotGiven = NOT_GIVEN, - granularity: str | NotGiven = NOT_GIVEN, - locations: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - source: int | NotGiven = NOT_GIVEN, - storages: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, - ts_string: bool | NotGiven = NOT_GIVEN, + from_: str | Omit = omit, + granularity: str | Omit = omit, + locations: SequenceNotStr[str] | Omit = omit, + source: int | Omit = omit, + storages: SequenceNotStr[str] | Omit = omit, + to: str | Omit = omit, + ts_string: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetUsageSeriesResponse: """ Consumption statistics is updated in near real-time as a standard practice. diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index 9326bb88..7b5d0039 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from .locations import ( @@ -98,14 +98,14 @@ def create( location: Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"], name: str, type: Literal["sftp", "s3"], - generate_sftp_password: bool | NotGiven = NOT_GIVEN, - sftp_password: str | NotGiven = NOT_GIVEN, + generate_sftp_password: bool | Omit = omit, + sftp_password: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: """ Creates a new storage instance (S3 or SFTP) in the specified location and @@ -159,14 +159,14 @@ def update( self, storage_id: int, *, - expires: str | NotGiven = NOT_GIVEN, - server_alias: str | NotGiven = NOT_GIVEN, + expires: str | Omit = omit, + server_alias: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: """Updates storage configuration such as expiration date and server alias. @@ -205,22 +205,22 @@ def update( def list( self, *, - id: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - location: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - show_deleted: bool | NotGiven = NOT_GIVEN, - status: Literal["active", "suspended", "deleted", "pending"] | NotGiven = NOT_GIVEN, - type: Literal["s3", "sftp"] | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + limit: int | Omit = omit, + location: str | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + order_direction: Literal["asc", "desc"] | Omit = omit, + show_deleted: bool | Omit = omit, + status: Literal["active", "suspended", "deleted", "pending"] | Omit = omit, + type: Literal["s3", "sftp"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Storage]: """ Returns storages with the same filtering and pagination as v2, but in a @@ -293,7 +293,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Permanently deletes a storage and all its data. @@ -326,7 +326,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: """ Retrieves detailed information about a specific storage including its @@ -359,7 +359,7 @@ def link_ssh_key( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Associates an SSH public key with an SFTP storage, enabling passwordless @@ -388,13 +388,13 @@ def restore( self, storage_id: int, *, - client_id: int | NotGiven = NOT_GIVEN, + client_id: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Restores a previously deleted S3 storage if it was deleted within the last 2 @@ -432,7 +432,7 @@ def unlink_ssh_key( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Removes SSH key association from an SFTP storage, disabling passwordless @@ -500,14 +500,14 @@ async def create( location: Literal["s-ed1", "s-drc2", "s-sgc1", "s-nhn2", "s-darz", "s-ws1", "ams", "sin", "fra", "mia"], name: str, type: Literal["sftp", "s3"], - generate_sftp_password: bool | NotGiven = NOT_GIVEN, - sftp_password: str | NotGiven = NOT_GIVEN, + generate_sftp_password: bool | Omit = omit, + sftp_password: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: """ Creates a new storage instance (S3 or SFTP) in the specified location and @@ -561,14 +561,14 @@ async def update( self, storage_id: int, *, - expires: str | NotGiven = NOT_GIVEN, - server_alias: str | NotGiven = NOT_GIVEN, + expires: str | Omit = omit, + server_alias: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: """Updates storage configuration such as expiration date and server alias. @@ -607,22 +607,22 @@ async def update( def list( self, *, - id: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - location: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - order_by: str | NotGiven = NOT_GIVEN, - order_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - show_deleted: bool | NotGiven = NOT_GIVEN, - status: Literal["active", "suspended", "deleted", "pending"] | NotGiven = NOT_GIVEN, - type: Literal["s3", "sftp"] | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + limit: int | Omit = omit, + location: str | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + order_by: str | Omit = omit, + order_direction: Literal["asc", "desc"] | Omit = omit, + show_deleted: bool | Omit = omit, + status: Literal["active", "suspended", "deleted", "pending"] | Omit = omit, + type: Literal["s3", "sftp"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Storage, AsyncOffsetPage[Storage]]: """ Returns storages with the same filtering and pagination as v2, but in a @@ -695,7 +695,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Permanently deletes a storage and all its data. @@ -728,7 +728,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Storage: """ Retrieves detailed information about a specific storage including its @@ -761,7 +761,7 @@ async def link_ssh_key( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Associates an SSH public key with an SFTP storage, enabling passwordless @@ -790,13 +790,13 @@ async def restore( self, storage_id: int, *, - client_id: int | NotGiven = NOT_GIVEN, + client_id: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Restores a previously deleted S3 storage if it was deleted within the last 2 @@ -836,7 +836,7 @@ async def unlink_ssh_key( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Removes SSH key association from an SFTP storage, disabling passwordless diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index 0b63144c..5fef8653 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -53,17 +53,17 @@ def create( *, task_name: Literal["transcription", "content-moderation"], url: str, - audio_language: str | NotGiven = NOT_GIVEN, - category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] | NotGiven = NOT_GIVEN, - client_entity_data: str | NotGiven = NOT_GIVEN, - client_user_id: str | NotGiven = NOT_GIVEN, - subtitles_language: str | NotGiven = NOT_GIVEN, + audio_language: str | Omit = omit, + category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] | Omit = omit, + client_entity_data: str | Omit = omit, + client_user_id: str | Omit = omit, + subtitles_language: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskCreateResponse: """Creating an AI task. @@ -341,21 +341,20 @@ def create( def list( self, *, - date_created: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - ordering: Literal["task_id", "status", "task_name", "started_at"] | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - search: str | NotGiven = NOT_GIVEN, - status: Literal["FAILURE", "PENDING", "RECEIVED", "RETRY", "REVOKED", "STARTED", "SUCCESS"] - | NotGiven = NOT_GIVEN, - task_id: str | NotGiven = NOT_GIVEN, - task_name: Literal["transcription", "content-moderation"] | NotGiven = NOT_GIVEN, + date_created: str | Omit = omit, + limit: int | Omit = omit, + ordering: Literal["task_id", "status", "task_name", "started_at"] | Omit = omit, + page: int | Omit = omit, + search: str | Omit = omit, + status: Literal["FAILURE", "PENDING", "RECEIVED", "RETRY", "REVOKED", "STARTED", "SUCCESS"] | Omit = omit, + task_id: str | Omit = omit, + task_name: Literal["transcription", "content-moderation"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPageStreamingAI[AITask]: """Returns a list of previously created and processed AI tasks. @@ -433,7 +432,7 @@ def cancel( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskCancelResponse: """ Stopping a previously launched AI-task without waiting for it to be fully @@ -467,7 +466,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskGetResponse: """ This is the single method to check the execution status of an AI task, and @@ -529,14 +528,14 @@ def get_ai_settings( self, *, type: Literal["language_support"], - audio_language: str | NotGiven = NOT_GIVEN, - subtitles_language: str | NotGiven = NOT_GIVEN, + audio_language: str | Omit = omit, + subtitles_language: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskGetAISettingsResponse: """ The method for revealing basic information and advanced underlying settings that @@ -634,17 +633,17 @@ async def create( *, task_name: Literal["transcription", "content-moderation"], url: str, - audio_language: str | NotGiven = NOT_GIVEN, - category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] | NotGiven = NOT_GIVEN, - client_entity_data: str | NotGiven = NOT_GIVEN, - client_user_id: str | NotGiven = NOT_GIVEN, - subtitles_language: str | NotGiven = NOT_GIVEN, + audio_language: str | Omit = omit, + category: Literal["sport", "nsfw", "hard_nudity", "soft_nudity"] | Omit = omit, + client_entity_data: str | Omit = omit, + client_user_id: str | Omit = omit, + subtitles_language: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskCreateResponse: """Creating an AI task. @@ -922,21 +921,20 @@ async def create( def list( self, *, - date_created: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - ordering: Literal["task_id", "status", "task_name", "started_at"] | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - search: str | NotGiven = NOT_GIVEN, - status: Literal["FAILURE", "PENDING", "RECEIVED", "RETRY", "REVOKED", "STARTED", "SUCCESS"] - | NotGiven = NOT_GIVEN, - task_id: str | NotGiven = NOT_GIVEN, - task_name: Literal["transcription", "content-moderation"] | NotGiven = NOT_GIVEN, + date_created: str | Omit = omit, + limit: int | Omit = omit, + ordering: Literal["task_id", "status", "task_name", "started_at"] | Omit = omit, + page: int | Omit = omit, + search: str | Omit = omit, + status: Literal["FAILURE", "PENDING", "RECEIVED", "RETRY", "REVOKED", "STARTED", "SUCCESS"] | Omit = omit, + task_id: str | Omit = omit, + task_name: Literal["transcription", "content-moderation"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[AITask, AsyncPageStreamingAI[AITask]]: """Returns a list of previously created and processed AI tasks. @@ -1014,7 +1012,7 @@ async def cancel( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskCancelResponse: """ Stopping a previously launched AI-task without waiting for it to be fully @@ -1048,7 +1046,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskGetResponse: """ This is the single method to check the execution status of an AI task, and @@ -1110,14 +1108,14 @@ async def get_ai_settings( self, *, type: Literal["language_support"], - audio_language: str | NotGiven = NOT_GIVEN, - subtitles_language: str | NotGiven = NOT_GIVEN, + audio_language: str | Omit = omit, + subtitles_language: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskGetAISettingsResponse: """ The method for revealing basic information and advanced underlying settings that diff --git a/src/gcore/resources/streaming/broadcasts.py b/src/gcore/resources/streaming/broadcasts.py index d8ef434b..bb9803bb 100644 --- a/src/gcore/resources/streaming/broadcasts.py +++ b/src/gcore/resources/streaming/broadcasts.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -46,13 +46,13 @@ def with_streaming_response(self) -> BroadcastsResourceWithStreamingResponse: def create( self, *, - broadcast: broadcast_create_params.Broadcast | NotGiven = NOT_GIVEN, + broadcast: broadcast_create_params.Broadcast | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Broadcast entity is for setting up HTML video player, which serves to combine: @@ -88,13 +88,13 @@ def update( self, broadcast_id: int, *, - broadcast: broadcast_update_params.Broadcast | NotGiven = NOT_GIVEN, + broadcast: broadcast_update_params.Broadcast | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Broadcast: """ Updates broadcast settings @@ -120,13 +120,13 @@ def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, + page: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPageStreaming[Broadcast]: """ Note: Feature "Broadcast" is outdated, soon it will be replaced by @@ -167,7 +167,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete broadcast @@ -199,7 +199,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Broadcast: """ Returns broadcast details @@ -230,7 +230,7 @@ def get_spectators_count( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BroadcastSpectatorsCount: """ Returns number of simultaneous broadcast viewers at the current moment @@ -276,13 +276,13 @@ def with_streaming_response(self) -> AsyncBroadcastsResourceWithStreamingRespons async def create( self, *, - broadcast: broadcast_create_params.Broadcast | NotGiven = NOT_GIVEN, + broadcast: broadcast_create_params.Broadcast | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Broadcast entity is for setting up HTML video player, which serves to combine: @@ -318,13 +318,13 @@ async def update( self, broadcast_id: int, *, - broadcast: broadcast_update_params.Broadcast | NotGiven = NOT_GIVEN, + broadcast: broadcast_update_params.Broadcast | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Broadcast: """ Updates broadcast settings @@ -350,13 +350,13 @@ async def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, + page: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Broadcast, AsyncPageStreaming[Broadcast]]: """ Note: Feature "Broadcast" is outdated, soon it will be replaced by @@ -397,7 +397,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete broadcast @@ -429,7 +429,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Broadcast: """ Returns broadcast details @@ -460,7 +460,7 @@ async def get_spectators_count( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BroadcastSpectatorsCount: """ Returns number of simultaneous broadcast viewers at the current moment diff --git a/src/gcore/resources/streaming/directories.py b/src/gcore/resources/streaming/directories.py index 438d9de8..0f70207a 100644 --- a/src/gcore/resources/streaming/directories.py +++ b/src/gcore/resources/streaming/directories.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -47,13 +47,13 @@ def create( self, *, name: str, - parent_id: int | NotGiven = NOT_GIVEN, + parent_id: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoryBase: """ Use this method to create a new directory entity. @@ -90,14 +90,14 @@ def update( self, directory_id: int, *, - name: str | NotGiven = NOT_GIVEN, - parent_id: int | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + parent_id: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoryBase: """ Change a directory name or move to another "`parent_id`". @@ -140,7 +140,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a directory **and all entities inside**. @@ -179,7 +179,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoryGetResponse: """Complete directory structure with contents. @@ -211,7 +211,7 @@ def get_tree( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoriesTree: """Tree structure of directories. @@ -251,13 +251,13 @@ async def create( self, *, name: str, - parent_id: int | NotGiven = NOT_GIVEN, + parent_id: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoryBase: """ Use this method to create a new directory entity. @@ -294,14 +294,14 @@ async def update( self, directory_id: int, *, - name: str | NotGiven = NOT_GIVEN, - parent_id: int | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + parent_id: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoryBase: """ Change a directory name or move to another "`parent_id`". @@ -344,7 +344,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a directory **and all entities inside**. @@ -383,7 +383,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoryGetResponse: """Complete directory structure with contents. @@ -415,7 +415,7 @@ async def get_tree( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoriesTree: """Tree structure of directories. diff --git a/src/gcore/resources/streaming/players.py b/src/gcore/resources/streaming/players.py index 826e015a..b2590c29 100644 --- a/src/gcore/resources/streaming/players.py +++ b/src/gcore/resources/streaming/players.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -46,13 +46,13 @@ def with_streaming_response(self) -> PlayersResourceWithStreamingResponse: def create( self, *, - player: PlayerParam | NotGiven = NOT_GIVEN, + player: PlayerParam | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Create player @@ -84,13 +84,13 @@ def update( self, player_id: int, *, - player: PlayerParam | NotGiven = NOT_GIVEN, + player: PlayerParam | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Player: """Updates player settings @@ -120,13 +120,13 @@ def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, + page: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPageStreaming[Player]: """Returns a list of created players @@ -165,7 +165,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete player @@ -197,7 +197,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Player: """ Returns player settings @@ -228,7 +228,7 @@ def preview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Returns player configuration in HTML @@ -275,13 +275,13 @@ def with_streaming_response(self) -> AsyncPlayersResourceWithStreamingResponse: async def create( self, *, - player: PlayerParam | NotGiven = NOT_GIVEN, + player: PlayerParam | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Create player @@ -313,13 +313,13 @@ async def update( self, player_id: int, *, - player: PlayerParam | NotGiven = NOT_GIVEN, + player: PlayerParam | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Player: """Updates player settings @@ -349,13 +349,13 @@ async def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, + page: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Player, AsyncPageStreaming[Player]]: """Returns a list of created players @@ -394,7 +394,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete player @@ -426,7 +426,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Player: """ Returns player settings @@ -457,7 +457,7 @@ async def preview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Returns player configuration in HTML diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index fba76526..bb2036fc 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -50,26 +50,26 @@ def with_streaming_response(self) -> PlaylistsResourceWithStreamingResponse: def create( self, *, - active: bool | NotGiven = NOT_GIVEN, - ad_id: int | NotGiven = NOT_GIVEN, - client_id: int | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - countdown: bool | NotGiven = NOT_GIVEN, - hls_cmaf_url: str | NotGiven = NOT_GIVEN, - hls_url: str | NotGiven = NOT_GIVEN, - iframe_url: str | NotGiven = NOT_GIVEN, - loop: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - player_id: int | NotGiven = NOT_GIVEN, - playlist_type: Literal["live", "vod"] | NotGiven = NOT_GIVEN, - start_time: str | NotGiven = NOT_GIVEN, - video_ids: Iterable[int] | NotGiven = NOT_GIVEN, + active: bool | Omit = omit, + ad_id: int | Omit = omit, + client_id: int | Omit = omit, + client_user_id: int | Omit = omit, + countdown: bool | Omit = omit, + hls_cmaf_url: str | Omit = omit, + hls_url: str | Omit = omit, + iframe_url: str | Omit = omit, + loop: bool | Omit = omit, + name: str | Omit = omit, + player_id: int | Omit = omit, + playlist_type: Literal["live", "vod"] | Omit = omit, + start_time: str | Omit = omit, + video_ids: Iterable[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlaylistCreate: """ Playlist is a curated collection of video content organized in a sequential @@ -234,26 +234,26 @@ def update( self, playlist_id: int, *, - active: bool | NotGiven = NOT_GIVEN, - ad_id: int | NotGiven = NOT_GIVEN, - client_id: int | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - countdown: bool | NotGiven = NOT_GIVEN, - hls_cmaf_url: str | NotGiven = NOT_GIVEN, - hls_url: str | NotGiven = NOT_GIVEN, - iframe_url: str | NotGiven = NOT_GIVEN, - loop: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - player_id: int | NotGiven = NOT_GIVEN, - playlist_type: Literal["live", "vod"] | NotGiven = NOT_GIVEN, - start_time: str | NotGiven = NOT_GIVEN, - video_ids: Iterable[int] | NotGiven = NOT_GIVEN, + active: bool | Omit = omit, + ad_id: int | Omit = omit, + client_id: int | Omit = omit, + client_user_id: int | Omit = omit, + countdown: bool | Omit = omit, + hls_cmaf_url: str | Omit = omit, + hls_url: str | Omit = omit, + iframe_url: str | Omit = omit, + loop: bool | Omit = omit, + name: str | Omit = omit, + player_id: int | Omit = omit, + playlist_type: Literal["live", "vod"] | Omit = omit, + start_time: str | Omit = omit, + video_ids: Iterable[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Playlist: """Change playlist @@ -364,13 +364,13 @@ def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, + page: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPageStreaming[Playlist]: """Returns a list of created playlists @@ -409,7 +409,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete playlist @@ -441,7 +441,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Playlist: """ Returns a playlist details @@ -472,7 +472,7 @@ def list_videos( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlaylistListVideosResponse: """ Shows ordered array of playlist videos @@ -518,26 +518,26 @@ def with_streaming_response(self) -> AsyncPlaylistsResourceWithStreamingResponse async def create( self, *, - active: bool | NotGiven = NOT_GIVEN, - ad_id: int | NotGiven = NOT_GIVEN, - client_id: int | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - countdown: bool | NotGiven = NOT_GIVEN, - hls_cmaf_url: str | NotGiven = NOT_GIVEN, - hls_url: str | NotGiven = NOT_GIVEN, - iframe_url: str | NotGiven = NOT_GIVEN, - loop: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - player_id: int | NotGiven = NOT_GIVEN, - playlist_type: Literal["live", "vod"] | NotGiven = NOT_GIVEN, - start_time: str | NotGiven = NOT_GIVEN, - video_ids: Iterable[int] | NotGiven = NOT_GIVEN, + active: bool | Omit = omit, + ad_id: int | Omit = omit, + client_id: int | Omit = omit, + client_user_id: int | Omit = omit, + countdown: bool | Omit = omit, + hls_cmaf_url: str | Omit = omit, + hls_url: str | Omit = omit, + iframe_url: str | Omit = omit, + loop: bool | Omit = omit, + name: str | Omit = omit, + player_id: int | Omit = omit, + playlist_type: Literal["live", "vod"] | Omit = omit, + start_time: str | Omit = omit, + video_ids: Iterable[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlaylistCreate: """ Playlist is a curated collection of video content organized in a sequential @@ -702,26 +702,26 @@ async def update( self, playlist_id: int, *, - active: bool | NotGiven = NOT_GIVEN, - ad_id: int | NotGiven = NOT_GIVEN, - client_id: int | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - countdown: bool | NotGiven = NOT_GIVEN, - hls_cmaf_url: str | NotGiven = NOT_GIVEN, - hls_url: str | NotGiven = NOT_GIVEN, - iframe_url: str | NotGiven = NOT_GIVEN, - loop: bool | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - player_id: int | NotGiven = NOT_GIVEN, - playlist_type: Literal["live", "vod"] | NotGiven = NOT_GIVEN, - start_time: str | NotGiven = NOT_GIVEN, - video_ids: Iterable[int] | NotGiven = NOT_GIVEN, + active: bool | Omit = omit, + ad_id: int | Omit = omit, + client_id: int | Omit = omit, + client_user_id: int | Omit = omit, + countdown: bool | Omit = omit, + hls_cmaf_url: str | Omit = omit, + hls_url: str | Omit = omit, + iframe_url: str | Omit = omit, + loop: bool | Omit = omit, + name: str | Omit = omit, + player_id: int | Omit = omit, + playlist_type: Literal["live", "vod"] | Omit = omit, + start_time: str | Omit = omit, + video_ids: Iterable[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Playlist: """Change playlist @@ -832,13 +832,13 @@ async def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, + page: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Playlist, AsyncPageStreaming[Playlist]]: """Returns a list of created playlists @@ -877,7 +877,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete playlist @@ -909,7 +909,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Playlist: """ Returns a playlist details @@ -940,7 +940,7 @@ async def list_videos( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PlaylistListVideosResponse: """ Shows ordered array of playlist videos diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py index 825c12da..5343d5c5 100644 --- a/src/gcore/resources/streaming/quality_sets.py +++ b/src/gcore/resources/streaming/quality_sets.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -49,7 +49,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QualitySets: """ Method returns a list of all custom quality sets. @@ -101,14 +101,14 @@ def list( def set_default( self, *, - live: quality_set_set_default_params.Live | NotGiven = NOT_GIVEN, - vod: quality_set_set_default_params.Vod | NotGiven = NOT_GIVEN, + live: quality_set_set_default_params.Live | Omit = omit, + vod: quality_set_set_default_params.Vod | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QualitySets: """Method to set default quality set for VOD and Live transcoding. @@ -180,7 +180,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QualitySets: """ Method returns a list of all custom quality sets. @@ -232,14 +232,14 @@ async def list( async def set_default( self, *, - live: quality_set_set_default_params.Live | NotGiven = NOT_GIVEN, - vod: quality_set_set_default_params.Vod | NotGiven = NOT_GIVEN, + live: quality_set_set_default_params.Live | Omit = omit, + vod: quality_set_set_default_params.Vod | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QualitySets: """Method to set default quality set for VOD and Live transcoding. diff --git a/src/gcore/resources/streaming/restreams.py b/src/gcore/resources/streaming/restreams.py index 78880ed4..91f24ab2 100644 --- a/src/gcore/resources/streaming/restreams.py +++ b/src/gcore/resources/streaming/restreams.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -45,13 +45,13 @@ def with_streaming_response(self) -> RestreamsResourceWithStreamingResponse: def create( self, *, - restream: restream_create_params.Restream | NotGiven = NOT_GIVEN, + restream: restream_create_params.Restream | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Create restream @@ -79,13 +79,13 @@ def update( self, restream_id: int, *, - restream: restream_update_params.Restream | NotGiven = NOT_GIVEN, + restream: restream_update_params.Restream | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Restream: """ Updates restream settings @@ -111,13 +111,13 @@ def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, + page: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPageStreaming[Restream]: """Returns a list of created restreams @@ -156,7 +156,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete restream @@ -188,7 +188,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Restream: """ Returns restream details @@ -234,13 +234,13 @@ def with_streaming_response(self) -> AsyncRestreamsResourceWithStreamingResponse async def create( self, *, - restream: restream_create_params.Restream | NotGiven = NOT_GIVEN, + restream: restream_create_params.Restream | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Create restream @@ -268,13 +268,13 @@ async def update( self, restream_id: int, *, - restream: restream_update_params.Restream | NotGiven = NOT_GIVEN, + restream: restream_update_params.Restream | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Restream: """ Updates restream settings @@ -300,13 +300,13 @@ async def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, + page: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Restream, AsyncPageStreaming[Restream]]: """Returns a list of created restreams @@ -345,7 +345,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete restream @@ -377,7 +377,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Restream: """ Returns restream details diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py index 4e8cb182..b252b848 100644 --- a/src/gcore/resources/streaming/statistics.py +++ b/src/gcore/resources/streaming/statistics.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -92,14 +92,14 @@ def get_ffprobes( date_from: str, date_to: str, stream_id: str, - interval: int | NotGiven = NOT_GIVEN, - units: Literal["second", "minute", "hour", "day", "week", "month"] | NotGiven = NOT_GIVEN, + interval: int | Omit = omit, + units: Literal["second", "minute", "hour", "day", "week", "month"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Ffprobes: """ Aggregates data for the specified video stream in the specified time interval. @@ -148,15 +148,15 @@ def get_live_unique_viewers( *, from_: str, to: str, - client_user_id: int | NotGiven = NOT_GIVEN, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, - stream_id: int | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | Omit = omit, + stream_id: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetLiveUniqueViewersResponse: """Calculates time series of unique viewers of Live streams via CDN. @@ -212,16 +212,16 @@ def get_live_watch_time_cdn( self, *, from_: str, - client_user_id: int | NotGiven = NOT_GIVEN, - granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | NotGiven = NOT_GIVEN, - stream_id: int | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | Omit = omit, + stream_id: int | Omit = omit, + to: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamSeries: """Calculates a time series of live streams watching duration in minutes. @@ -277,16 +277,16 @@ def get_live_watch_time_cdn( def get_live_watch_time_total_cdn( self, *, - client_user_id: int | NotGiven = NOT_GIVEN, - from_: str | NotGiven = NOT_GIVEN, - stream_id: int | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + from_: str | Omit = omit, + stream_id: int | Omit = omit, + to: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodTotalStreamDurationSeries: """Calculates the total duration of live streams watching in minutes. @@ -339,13 +339,13 @@ def get_max_streams_series( *, from_: str, to: str, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> MaxStreamSeries: """Calculates time series of the amount of simultaneous streams. @@ -396,7 +396,7 @@ def get_popular_videos( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PopularVideos: """ Aggregates the number of views for all client videos, grouping them by id and @@ -443,13 +443,13 @@ def get_storage_series( *, from_: str, to: str, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StorageSeries: """ Calculates time series of the size of disk space in bytes for all processed and @@ -495,13 +495,13 @@ def get_stream_series( *, from_: str, to: str, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamSeries: """Calculates time series of the transcoding minutes of all streams. @@ -547,19 +547,18 @@ def get_unique_viewers( *, date_from: str, date_to: str, - id: str | NotGiven = NOT_GIVEN, - country: str | NotGiven = NOT_GIVEN, - event: Literal["init", "start", "watch"] | NotGiven = NOT_GIVEN, - group: List[Literal["date", "host", "os", "browser", "platform", "ip", "country", "event", "id"]] - | NotGiven = NOT_GIVEN, - host: str | NotGiven = NOT_GIVEN, - type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + country: str | Omit = omit, + event: Literal["init", "start", "watch"] | Omit = omit, + group: List[Literal["date", "host", "os", "browser", "platform", "ip", "country", "event", "id"]] | Omit = omit, + host: str | Omit = omit, + type: Literal["live", "vod", "playlist"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UniqueViewers: """Get the number of unique viewers in the built-in player. @@ -625,14 +624,14 @@ def get_unique_viewers_cdn( *, date_from: str, date_to: str, - id: str | NotGiven = NOT_GIVEN, - type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + type: Literal["live", "vod", "playlist"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UniqueViewersCdn: """Сounts the number of unique viewers of a video entity over CDN. @@ -708,19 +707,18 @@ def get_views( *, date_from: str, date_to: str, - id: str | NotGiven = NOT_GIVEN, - country: str | NotGiven = NOT_GIVEN, - event: Literal["init", "start", "watch"] | NotGiven = NOT_GIVEN, - group: List[Literal["host", "os", "browser", "platform", "ip", "country", "event", "id"]] - | NotGiven = NOT_GIVEN, - host: str | NotGiven = NOT_GIVEN, - type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + country: str | Omit = omit, + event: Literal["init", "start", "watch"] | Omit = omit, + group: List[Literal["host", "os", "browser", "platform", "ip", "country", "event", "id"]] | Omit = omit, + host: str | Omit = omit, + type: Literal["live", "vod", "playlist"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Views: """Get the number of views in the built-in player. @@ -791,7 +789,7 @@ def get_views_by_browsers( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByBrowser: """ Aggregates the number of views for all client videos, grouping them by browsers @@ -842,7 +840,7 @@ def get_views_by_country( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByCountry: """ Aggregates the number of views grouping them by country in the built-in player. @@ -893,7 +891,7 @@ def get_views_by_hostname( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByHostname: """ Aggregates the number of views, grouping them by "host" domain name the built-in @@ -944,7 +942,7 @@ def get_views_by_operating_system( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByOperatingSystem: """ Aggregates the number of views for all client videos, grouping them by device @@ -995,7 +993,7 @@ def get_views_by_referer( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByReferer: """ Aggregates the number of views, grouping them by "referer" URL of pages the @@ -1046,7 +1044,7 @@ def get_views_by_region( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByRegion: """ Aggregates the number of views grouping them by regions of countries in the @@ -1099,7 +1097,7 @@ def get_views_heatmap( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsHeatmap: """ Shows information about what part of the video your viewers watched in the @@ -1159,7 +1157,7 @@ def get_vod_storage_volume( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: """ Calculates time series of the duration in minutes for all processed and @@ -1207,7 +1205,7 @@ def get_vod_transcoding_duration( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: """ Calculates time series of the transcoding time in minutes for all processed @@ -1250,15 +1248,15 @@ def get_vod_unique_viewers_cdn( *, from_: str, to: str, - client_user_id: int | NotGiven = NOT_GIVEN, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, - slug: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | Omit = omit, + slug: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: """Calculates time series of unique viewers of VOD via CDN. @@ -1313,16 +1311,16 @@ def get_vod_watch_time_cdn( self, *, from_: str, - client_user_id: int | NotGiven = NOT_GIVEN, - granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | NotGiven = NOT_GIVEN, - slug: str | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | Omit = omit, + slug: str | Omit = omit, + to: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: """Calculates a time series of video watching duration in minutes. @@ -1378,16 +1376,16 @@ def get_vod_watch_time_cdn( def get_vod_watch_time_total_cdn( self, *, - client_user_id: int | NotGiven = NOT_GIVEN, - from_: str | NotGiven = NOT_GIVEN, - slug: str | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + from_: str | Omit = omit, + slug: str | Omit = omit, + to: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetVodWatchTimeTotalCdnResponse: """Calculates the total duration of video watching in minutes. @@ -1462,14 +1460,14 @@ async def get_ffprobes( date_from: str, date_to: str, stream_id: str, - interval: int | NotGiven = NOT_GIVEN, - units: Literal["second", "minute", "hour", "day", "week", "month"] | NotGiven = NOT_GIVEN, + interval: int | Omit = omit, + units: Literal["second", "minute", "hour", "day", "week", "month"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Ffprobes: """ Aggregates data for the specified video stream in the specified time interval. @@ -1518,15 +1516,15 @@ async def get_live_unique_viewers( *, from_: str, to: str, - client_user_id: int | NotGiven = NOT_GIVEN, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, - stream_id: int | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | Omit = omit, + stream_id: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetLiveUniqueViewersResponse: """Calculates time series of unique viewers of Live streams via CDN. @@ -1582,16 +1580,16 @@ async def get_live_watch_time_cdn( self, *, from_: str, - client_user_id: int | NotGiven = NOT_GIVEN, - granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | NotGiven = NOT_GIVEN, - stream_id: int | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | Omit = omit, + stream_id: int | Omit = omit, + to: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamSeries: """Calculates a time series of live streams watching duration in minutes. @@ -1647,16 +1645,16 @@ async def get_live_watch_time_cdn( async def get_live_watch_time_total_cdn( self, *, - client_user_id: int | NotGiven = NOT_GIVEN, - from_: str | NotGiven = NOT_GIVEN, - stream_id: int | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + from_: str | Omit = omit, + stream_id: int | Omit = omit, + to: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodTotalStreamDurationSeries: """Calculates the total duration of live streams watching in minutes. @@ -1709,13 +1707,13 @@ async def get_max_streams_series( *, from_: str, to: str, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> MaxStreamSeries: """Calculates time series of the amount of simultaneous streams. @@ -1766,7 +1764,7 @@ async def get_popular_videos( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PopularVideos: """ Aggregates the number of views for all client videos, grouping them by id and @@ -1813,13 +1811,13 @@ async def get_storage_series( *, from_: str, to: str, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StorageSeries: """ Calculates time series of the size of disk space in bytes for all processed and @@ -1865,13 +1863,13 @@ async def get_stream_series( *, from_: str, to: str, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamSeries: """Calculates time series of the transcoding minutes of all streams. @@ -1917,19 +1915,18 @@ async def get_unique_viewers( *, date_from: str, date_to: str, - id: str | NotGiven = NOT_GIVEN, - country: str | NotGiven = NOT_GIVEN, - event: Literal["init", "start", "watch"] | NotGiven = NOT_GIVEN, - group: List[Literal["date", "host", "os", "browser", "platform", "ip", "country", "event", "id"]] - | NotGiven = NOT_GIVEN, - host: str | NotGiven = NOT_GIVEN, - type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + country: str | Omit = omit, + event: Literal["init", "start", "watch"] | Omit = omit, + group: List[Literal["date", "host", "os", "browser", "platform", "ip", "country", "event", "id"]] | Omit = omit, + host: str | Omit = omit, + type: Literal["live", "vod", "playlist"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UniqueViewers: """Get the number of unique viewers in the built-in player. @@ -1995,14 +1992,14 @@ async def get_unique_viewers_cdn( *, date_from: str, date_to: str, - id: str | NotGiven = NOT_GIVEN, - type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + type: Literal["live", "vod", "playlist"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UniqueViewersCdn: """Сounts the number of unique viewers of a video entity over CDN. @@ -2078,19 +2075,18 @@ async def get_views( *, date_from: str, date_to: str, - id: str | NotGiven = NOT_GIVEN, - country: str | NotGiven = NOT_GIVEN, - event: Literal["init", "start", "watch"] | NotGiven = NOT_GIVEN, - group: List[Literal["host", "os", "browser", "platform", "ip", "country", "event", "id"]] - | NotGiven = NOT_GIVEN, - host: str | NotGiven = NOT_GIVEN, - type: Literal["live", "vod", "playlist"] | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + country: str | Omit = omit, + event: Literal["init", "start", "watch"] | Omit = omit, + group: List[Literal["host", "os", "browser", "platform", "ip", "country", "event", "id"]] | Omit = omit, + host: str | Omit = omit, + type: Literal["live", "vod", "playlist"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Views: """Get the number of views in the built-in player. @@ -2161,7 +2157,7 @@ async def get_views_by_browsers( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByBrowser: """ Aggregates the number of views for all client videos, grouping them by browsers @@ -2212,7 +2208,7 @@ async def get_views_by_country( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByCountry: """ Aggregates the number of views grouping them by country in the built-in player. @@ -2263,7 +2259,7 @@ async def get_views_by_hostname( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByHostname: """ Aggregates the number of views, grouping them by "host" domain name the built-in @@ -2314,7 +2310,7 @@ async def get_views_by_operating_system( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByOperatingSystem: """ Aggregates the number of views for all client videos, grouping them by device @@ -2365,7 +2361,7 @@ async def get_views_by_referer( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByReferer: """ Aggregates the number of views, grouping them by "referer" URL of pages the @@ -2416,7 +2412,7 @@ async def get_views_by_region( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsByRegion: """ Aggregates the number of views grouping them by regions of countries in the @@ -2469,7 +2465,7 @@ async def get_views_heatmap( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ViewsHeatmap: """ Shows information about what part of the video your viewers watched in the @@ -2529,7 +2525,7 @@ async def get_vod_storage_volume( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: """ Calculates time series of the duration in minutes for all processed and @@ -2577,7 +2573,7 @@ async def get_vod_transcoding_duration( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: """ Calculates time series of the transcoding time in minutes for all processed @@ -2620,15 +2616,15 @@ async def get_vod_unique_viewers_cdn( *, from_: str, to: str, - client_user_id: int | NotGiven = NOT_GIVEN, - granularity: Literal["1m", "5m", "15m", "1h", "1d"] | NotGiven = NOT_GIVEN, - slug: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + granularity: Literal["1m", "5m", "15m", "1h", "1d"] | Omit = omit, + slug: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: """Calculates time series of unique viewers of VOD via CDN. @@ -2683,16 +2679,16 @@ async def get_vod_watch_time_cdn( self, *, from_: str, - client_user_id: int | NotGiven = NOT_GIVEN, - granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | NotGiven = NOT_GIVEN, - slug: str | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + granularity: Literal["1m", "5m", "15m", "1h", "1d", "1mo"] | Omit = omit, + slug: str | Omit = omit, + to: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: """Calculates a time series of video watching duration in minutes. @@ -2748,16 +2744,16 @@ async def get_vod_watch_time_cdn( async def get_vod_watch_time_total_cdn( self, *, - client_user_id: int | NotGiven = NOT_GIVEN, - from_: str | NotGiven = NOT_GIVEN, - slug: str | NotGiven = NOT_GIVEN, - to: str | NotGiven = NOT_GIVEN, + client_user_id: int | Omit = omit, + from_: str | Omit = omit, + slug: str | Omit = omit, + to: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetVodWatchTimeTotalCdnResponse: """Calculates the total duration of video watching in minutes. diff --git a/src/gcore/resources/streaming/streams/overlays.py b/src/gcore/resources/streaming/streams/overlays.py index f52cfee4..b6f1b4fd 100644 --- a/src/gcore/resources/streaming/streams/overlays.py +++ b/src/gcore/resources/streaming/streams/overlays.py @@ -6,7 +6,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -50,13 +50,13 @@ def create( self, stream_id: int, *, - body: Iterable[overlay_create_params.Body] | NotGiven = NOT_GIVEN, + body: Iterable[overlay_create_params.Body] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OverlayCreateResponse: """ "Overlay" is a live HTML widget, which rendered and inserted over the live @@ -136,18 +136,18 @@ def update( overlay_id: int, *, stream_id: int, - height: int | NotGiven = NOT_GIVEN, - stretch: bool | NotGiven = NOT_GIVEN, - url: str | NotGiven = NOT_GIVEN, - width: int | NotGiven = NOT_GIVEN, - x: int | NotGiven = NOT_GIVEN, - y: int | NotGiven = NOT_GIVEN, + height: int | Omit = omit, + stretch: bool | Omit = omit, + url: str | Omit = omit, + width: int | Omit = omit, + x: int | Omit = omit, + y: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Overlay: """ Updates overlay settings @@ -202,7 +202,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OverlayListResponse: """ Returns a list of HTML overlay widgets which are attached to a stream @@ -234,7 +234,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete an overlay @@ -267,7 +267,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Overlay: """ Get overlay details @@ -293,13 +293,13 @@ def update_multiple( self, stream_id: int, *, - body: Iterable[overlay_update_multiple_params.Body] | NotGiven = NOT_GIVEN, + body: Iterable[overlay_update_multiple_params.Body] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OverlayUpdateMultipleResponse: """ Updates settings for set of overlays @@ -347,13 +347,13 @@ async def create( self, stream_id: int, *, - body: Iterable[overlay_create_params.Body] | NotGiven = NOT_GIVEN, + body: Iterable[overlay_create_params.Body] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OverlayCreateResponse: """ "Overlay" is a live HTML widget, which rendered and inserted over the live @@ -433,18 +433,18 @@ async def update( overlay_id: int, *, stream_id: int, - height: int | NotGiven = NOT_GIVEN, - stretch: bool | NotGiven = NOT_GIVEN, - url: str | NotGiven = NOT_GIVEN, - width: int | NotGiven = NOT_GIVEN, - x: int | NotGiven = NOT_GIVEN, - y: int | NotGiven = NOT_GIVEN, + height: int | Omit = omit, + stretch: bool | Omit = omit, + url: str | Omit = omit, + width: int | Omit = omit, + x: int | Omit = omit, + y: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Overlay: """ Updates overlay settings @@ -499,7 +499,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OverlayListResponse: """ Returns a list of HTML overlay widgets which are attached to a stream @@ -531,7 +531,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete an overlay @@ -564,7 +564,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Overlay: """ Get overlay details @@ -590,13 +590,13 @@ async def update_multiple( self, stream_id: int, *, - body: Iterable[overlay_update_multiple_params.Body] | NotGiven = NOT_GIVEN, + body: Iterable[overlay_update_multiple_params.Body] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OverlayUpdateMultipleResponse: """ Updates settings for set of overlays diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index 30c0c23b..691b6e03 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -15,7 +15,7 @@ OverlaysResourceWithStreamingResponse, AsyncOverlaysResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -70,27 +70,27 @@ def create( self, *, name: str, - active: bool | NotGiven = NOT_GIVEN, - auto_record: bool | NotGiven = NOT_GIVEN, - broadcast_ids: Iterable[int] | NotGiven = NOT_GIVEN, - cdn_id: int | NotGiven = NOT_GIVEN, - client_entity_data: str | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - dvr_duration: int | NotGiven = NOT_GIVEN, - dvr_enabled: bool | NotGiven = NOT_GIVEN, - hls_mpegts_endlist_tag: bool | NotGiven = NOT_GIVEN, - html_overlay: bool | NotGiven = NOT_GIVEN, - projection: Literal["regular", "vr360", "vr180", "vr360tb"] | NotGiven = NOT_GIVEN, - pull: bool | NotGiven = NOT_GIVEN, - quality_set_id: int | NotGiven = NOT_GIVEN, - record_type: Literal["origin", "transcoded"] | NotGiven = NOT_GIVEN, - uri: str | NotGiven = NOT_GIVEN, + active: bool | Omit = omit, + auto_record: bool | Omit = omit, + broadcast_ids: Iterable[int] | Omit = omit, + cdn_id: int | Omit = omit, + client_entity_data: str | Omit = omit, + client_user_id: int | Omit = omit, + dvr_duration: int | Omit = omit, + dvr_enabled: bool | Omit = omit, + hls_mpegts_endlist_tag: bool | Omit = omit, + html_overlay: bool | Omit = omit, + projection: Literal["regular", "vr360", "vr180", "vr360tb"] | Omit = omit, + pull: bool | Omit = omit, + quality_set_id: int | Omit = omit, + record_type: Literal["origin", "transcoded"] | Omit = omit, + uri: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Stream: """ Use this method to create a new live stream entity for broadcasting. @@ -264,13 +264,13 @@ def update( self, stream_id: int, *, - stream: stream_update_params.Stream | NotGiven = NOT_GIVEN, + stream: stream_update_params.Stream | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Stream: """ Updates stream settings @@ -296,14 +296,14 @@ def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, - with_broadcasts: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + with_broadcasts: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPageStreaming[Stream]: """Returns a list of streams @@ -351,7 +351,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a live stream. @@ -399,7 +399,7 @@ def clear_dvr( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Clear live stream DVR @@ -427,15 +427,15 @@ def create_clip( stream_id: int, *, duration: int, - expiration: int | NotGiven = NOT_GIVEN, - start: int | NotGiven = NOT_GIVEN, - vod_required: bool | NotGiven = NOT_GIVEN, + expiration: int | Omit = omit, + start: int | Omit = omit, + vod_required: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Clip: """Create an instant clip from on-going live stream. @@ -548,7 +548,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Stream: """ Returns stream details @@ -579,7 +579,7 @@ def list_clips( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamListClipsResponse: """ Get list of non expired instant clips for a stream. @@ -628,7 +628,7 @@ def start_recording( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamStartRecordingResponse: """ Start recording a stream. @@ -696,7 +696,7 @@ def stop_recording( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: """ Stop recording a stream. @@ -753,27 +753,27 @@ async def create( self, *, name: str, - active: bool | NotGiven = NOT_GIVEN, - auto_record: bool | NotGiven = NOT_GIVEN, - broadcast_ids: Iterable[int] | NotGiven = NOT_GIVEN, - cdn_id: int | NotGiven = NOT_GIVEN, - client_entity_data: str | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - dvr_duration: int | NotGiven = NOT_GIVEN, - dvr_enabled: bool | NotGiven = NOT_GIVEN, - hls_mpegts_endlist_tag: bool | NotGiven = NOT_GIVEN, - html_overlay: bool | NotGiven = NOT_GIVEN, - projection: Literal["regular", "vr360", "vr180", "vr360tb"] | NotGiven = NOT_GIVEN, - pull: bool | NotGiven = NOT_GIVEN, - quality_set_id: int | NotGiven = NOT_GIVEN, - record_type: Literal["origin", "transcoded"] | NotGiven = NOT_GIVEN, - uri: str | NotGiven = NOT_GIVEN, + active: bool | Omit = omit, + auto_record: bool | Omit = omit, + broadcast_ids: Iterable[int] | Omit = omit, + cdn_id: int | Omit = omit, + client_entity_data: str | Omit = omit, + client_user_id: int | Omit = omit, + dvr_duration: int | Omit = omit, + dvr_enabled: bool | Omit = omit, + hls_mpegts_endlist_tag: bool | Omit = omit, + html_overlay: bool | Omit = omit, + projection: Literal["regular", "vr360", "vr180", "vr360tb"] | Omit = omit, + pull: bool | Omit = omit, + quality_set_id: int | Omit = omit, + record_type: Literal["origin", "transcoded"] | Omit = omit, + uri: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Stream: """ Use this method to create a new live stream entity for broadcasting. @@ -947,13 +947,13 @@ async def update( self, stream_id: int, *, - stream: stream_update_params.Stream | NotGiven = NOT_GIVEN, + stream: stream_update_params.Stream | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Stream: """ Updates stream settings @@ -979,14 +979,14 @@ async def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, - with_broadcasts: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + with_broadcasts: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Stream, AsyncPageStreaming[Stream]]: """Returns a list of streams @@ -1034,7 +1034,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a live stream. @@ -1082,7 +1082,7 @@ async def clear_dvr( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Clear live stream DVR @@ -1110,15 +1110,15 @@ async def create_clip( stream_id: int, *, duration: int, - expiration: int | NotGiven = NOT_GIVEN, - start: int | NotGiven = NOT_GIVEN, - vod_required: bool | NotGiven = NOT_GIVEN, + expiration: int | Omit = omit, + start: int | Omit = omit, + vod_required: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Clip: """Create an instant clip from on-going live stream. @@ -1231,7 +1231,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Stream: """ Returns stream details @@ -1262,7 +1262,7 @@ async def list_clips( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamListClipsResponse: """ Get list of non expired instant clips for a stream. @@ -1311,7 +1311,7 @@ async def start_recording( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StreamStartRecordingResponse: """ Start recording a stream. @@ -1379,7 +1379,7 @@ async def stop_recording( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: """ Stop recording a stream. diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py index 4e59615e..08123c15 100644 --- a/src/gcore/resources/streaming/videos/subtitles.py +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -53,7 +53,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Subtitle: """ Add new subtitle/captions to a video entity. @@ -133,15 +133,15 @@ def update( id: int, *, video_id: int, - language: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - vtt: str | NotGiven = NOT_GIVEN, + language: str | Omit = omit, + name: str | Omit = omit, + vtt: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SubtitleBase: """Method to update subtitle of a video. @@ -194,7 +194,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SubtitleListResponse: """ Method returns a list of all subtitles that are already attached to a video. @@ -226,7 +226,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete specified video subtitle @@ -259,7 +259,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Subtitle: """ Returns information about a specific subtitle for a video. @@ -312,7 +312,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Subtitle: """ Add new subtitle/captions to a video entity. @@ -392,15 +392,15 @@ async def update( id: int, *, video_id: int, - language: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - vtt: str | NotGiven = NOT_GIVEN, + language: str | Omit = omit, + name: str | Omit = omit, + vtt: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SubtitleBase: """Method to update subtitle of a video. @@ -453,7 +453,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SubtitleListResponse: """ Method returns a list of all subtitles that are already attached to a video. @@ -485,7 +485,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete specified video subtitle @@ -518,7 +518,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Subtitle: """ Returns information about a specific subtitle for a video. diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index c77320db..0b306117 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from .subtitles import ( SubtitlesResource, @@ -70,13 +70,13 @@ def with_streaming_response(self) -> VideosResourceWithStreamingResponse: def create( self, *, - video: CreateVideoParam | NotGiven = NOT_GIVEN, + video: CreateVideoParam | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VideoCreateResponse: """ Use this method to create a new video entity. @@ -161,31 +161,31 @@ def update( video_id: int, *, name: str, - auto_transcribe_audio_language: Literal["disable", "auto", ""] | NotGiven = NOT_GIVEN, - auto_translate_subtitles_language: Literal["disable", "default", ""] | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - clip_duration_seconds: int | NotGiven = NOT_GIVEN, - clip_start_seconds: int | NotGiven = NOT_GIVEN, - custom_iframe_url: str | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - directory_id: int | NotGiven = NOT_GIVEN, - origin_http_headers: str | NotGiven = NOT_GIVEN, - origin_url: str | NotGiven = NOT_GIVEN, - poster: str | NotGiven = NOT_GIVEN, - priority: int | NotGiven = NOT_GIVEN, - projection: str | NotGiven = NOT_GIVEN, - quality_set_id: int | NotGiven = NOT_GIVEN, - remote_poster_url: str | NotGiven = NOT_GIVEN, - remove_poster: bool | NotGiven = NOT_GIVEN, - screenshot_id: int | NotGiven = NOT_GIVEN, - share_url: str | NotGiven = NOT_GIVEN, - source_bitrate_limit: bool | NotGiven = NOT_GIVEN, + auto_transcribe_audio_language: Literal["disable", "auto", ""] | Omit = omit, + auto_translate_subtitles_language: Literal["disable", "default", ""] | Omit = omit, + client_user_id: int | Omit = omit, + clip_duration_seconds: int | Omit = omit, + clip_start_seconds: int | Omit = omit, + custom_iframe_url: str | Omit = omit, + description: str | Omit = omit, + directory_id: int | Omit = omit, + origin_http_headers: str | Omit = omit, + origin_url: str | Omit = omit, + poster: str | Omit = omit, + priority: int | Omit = omit, + projection: str | Omit = omit, + quality_set_id: int | Omit = omit, + remote_poster_url: str | Omit = omit, + remove_poster: bool | Omit = omit, + screenshot_id: int | Omit = omit, + share_url: str | Omit = omit, + source_bitrate_limit: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: """Changes parameters of the video to new values. @@ -406,20 +406,20 @@ def update( def list( self, *, - id: str | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - fields: str | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - per_page: int | NotGiven = NOT_GIVEN, - search: str | NotGiven = NOT_GIVEN, - status: str | NotGiven = NOT_GIVEN, - stream_id: int | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + client_user_id: int | Omit = omit, + fields: str | Omit = omit, + page: int | Omit = omit, + per_page: int | Omit = omit, + search: str | Omit = omit, + status: str | Omit = omit, + stream_id: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPageStreaming[Video]: """ Returns a set of videos by the given criteria. @@ -500,7 +500,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Operation to delete video entity. @@ -534,14 +534,14 @@ def delete( def create_multiple( self, *, - fields: str | NotGiven = NOT_GIVEN, - videos: Iterable[video_create_multiple_params.Video] | NotGiven = NOT_GIVEN, + fields: str | Omit = omit, + videos: Iterable[video_create_multiple_params.Video] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VideoCreateMultipleResponse: """Mass upload of your videos. @@ -596,7 +596,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: """Information about a video entity. @@ -641,7 +641,7 @@ def get_parameters_for_direct_upload( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectUploadParameters: """ Use this method to get TUS' session parameters: hostname of the server to @@ -695,13 +695,13 @@ def get_parameters_for_direct_upload( def list_names( self, *, - ids: Iterable[int] | NotGiven = NOT_GIVEN, + ids: Iterable[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Returns names for specified video IDs @@ -758,13 +758,13 @@ def with_streaming_response(self) -> AsyncVideosResourceWithStreamingResponse: async def create( self, *, - video: CreateVideoParam | NotGiven = NOT_GIVEN, + video: CreateVideoParam | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VideoCreateResponse: """ Use this method to create a new video entity. @@ -849,31 +849,31 @@ async def update( video_id: int, *, name: str, - auto_transcribe_audio_language: Literal["disable", "auto", ""] | NotGiven = NOT_GIVEN, - auto_translate_subtitles_language: Literal["disable", "default", ""] | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - clip_duration_seconds: int | NotGiven = NOT_GIVEN, - clip_start_seconds: int | NotGiven = NOT_GIVEN, - custom_iframe_url: str | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - directory_id: int | NotGiven = NOT_GIVEN, - origin_http_headers: str | NotGiven = NOT_GIVEN, - origin_url: str | NotGiven = NOT_GIVEN, - poster: str | NotGiven = NOT_GIVEN, - priority: int | NotGiven = NOT_GIVEN, - projection: str | NotGiven = NOT_GIVEN, - quality_set_id: int | NotGiven = NOT_GIVEN, - remote_poster_url: str | NotGiven = NOT_GIVEN, - remove_poster: bool | NotGiven = NOT_GIVEN, - screenshot_id: int | NotGiven = NOT_GIVEN, - share_url: str | NotGiven = NOT_GIVEN, - source_bitrate_limit: bool | NotGiven = NOT_GIVEN, + auto_transcribe_audio_language: Literal["disable", "auto", ""] | Omit = omit, + auto_translate_subtitles_language: Literal["disable", "default", ""] | Omit = omit, + client_user_id: int | Omit = omit, + clip_duration_seconds: int | Omit = omit, + clip_start_seconds: int | Omit = omit, + custom_iframe_url: str | Omit = omit, + description: str | Omit = omit, + directory_id: int | Omit = omit, + origin_http_headers: str | Omit = omit, + origin_url: str | Omit = omit, + poster: str | Omit = omit, + priority: int | Omit = omit, + projection: str | Omit = omit, + quality_set_id: int | Omit = omit, + remote_poster_url: str | Omit = omit, + remove_poster: bool | Omit = omit, + screenshot_id: int | Omit = omit, + share_url: str | Omit = omit, + source_bitrate_limit: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: """Changes parameters of the video to new values. @@ -1094,20 +1094,20 @@ async def update( def list( self, *, - id: str | NotGiven = NOT_GIVEN, - client_user_id: int | NotGiven = NOT_GIVEN, - fields: str | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - per_page: int | NotGiven = NOT_GIVEN, - search: str | NotGiven = NOT_GIVEN, - status: str | NotGiven = NOT_GIVEN, - stream_id: int | NotGiven = NOT_GIVEN, + id: str | Omit = omit, + client_user_id: int | Omit = omit, + fields: str | Omit = omit, + page: int | Omit = omit, + per_page: int | Omit = omit, + search: str | Omit = omit, + status: str | Omit = omit, + stream_id: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Video, AsyncPageStreaming[Video]]: """ Returns a set of videos by the given criteria. @@ -1188,7 +1188,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Operation to delete video entity. @@ -1222,14 +1222,14 @@ async def delete( async def create_multiple( self, *, - fields: str | NotGiven = NOT_GIVEN, - videos: Iterable[video_create_multiple_params.Video] | NotGiven = NOT_GIVEN, + fields: str | Omit = omit, + videos: Iterable[video_create_multiple_params.Video] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VideoCreateMultipleResponse: """Mass upload of your videos. @@ -1288,7 +1288,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: """Information about a video entity. @@ -1333,7 +1333,7 @@ async def get_parameters_for_direct_upload( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectUploadParameters: """ Use this method to get TUS' session parameters: hostname of the server to @@ -1387,13 +1387,13 @@ async def get_parameters_for_direct_upload( async def list_names( self, *, - ids: Iterable[int] | NotGiven = NOT_GIVEN, + ids: Iterable[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Returns names for specified video IDs diff --git a/src/gcore/resources/waap/advanced_rules.py b/src/gcore/resources/waap/advanced_rules.py index 30c32c1c..6f4aca32 100644 --- a/src/gcore/resources/waap/advanced_rules.py +++ b/src/gcore/resources/waap/advanced_rules.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -47,7 +47,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return self._get( @@ -87,7 +87,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return await self._get( diff --git a/src/gcore/resources/waap/custom_page_sets.py b/src/gcore/resources/waap/custom_page_sets.py index 7ce6dca4..11d40a03 100644 --- a/src/gcore/resources/waap/custom_page_sets.py +++ b/src/gcore/resources/waap/custom_page_sets.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -55,19 +55,19 @@ def create( self, *, name: str, - block: Optional[custom_page_set_create_params.Block] | NotGiven = NOT_GIVEN, - block_csrf: Optional[custom_page_set_create_params.BlockCsrf] | NotGiven = NOT_GIVEN, - captcha: Optional[custom_page_set_create_params.Captcha] | NotGiven = NOT_GIVEN, - cookie_disabled: Optional[custom_page_set_create_params.CookieDisabled] | NotGiven = NOT_GIVEN, - domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - handshake: Optional[custom_page_set_create_params.Handshake] | NotGiven = NOT_GIVEN, - javascript_disabled: Optional[custom_page_set_create_params.JavascriptDisabled] | NotGiven = NOT_GIVEN, + block: Optional[custom_page_set_create_params.Block] | Omit = omit, + block_csrf: Optional[custom_page_set_create_params.BlockCsrf] | Omit = omit, + captcha: Optional[custom_page_set_create_params.Captcha] | Omit = omit, + cookie_disabled: Optional[custom_page_set_create_params.CookieDisabled] | Omit = omit, + domains: Optional[Iterable[int]] | Omit = omit, + handshake: Optional[custom_page_set_create_params.Handshake] | Omit = omit, + javascript_disabled: Optional[custom_page_set_create_params.JavascriptDisabled] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomPageSet: """Create a custom page set based on the provided data. @@ -112,20 +112,20 @@ def update( self, set_id: int, *, - block: Optional[custom_page_set_update_params.Block] | NotGiven = NOT_GIVEN, - block_csrf: Optional[custom_page_set_update_params.BlockCsrf] | NotGiven = NOT_GIVEN, - captcha: Optional[custom_page_set_update_params.Captcha] | NotGiven = NOT_GIVEN, - cookie_disabled: Optional[custom_page_set_update_params.CookieDisabled] | NotGiven = NOT_GIVEN, - domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - handshake: Optional[custom_page_set_update_params.Handshake] | NotGiven = NOT_GIVEN, - javascript_disabled: Optional[custom_page_set_update_params.JavascriptDisabled] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + block: Optional[custom_page_set_update_params.Block] | Omit = omit, + block_csrf: Optional[custom_page_set_update_params.BlockCsrf] | Omit = omit, + captcha: Optional[custom_page_set_update_params.Captcha] | Omit = omit, + cookie_disabled: Optional[custom_page_set_update_params.CookieDisabled] | Omit = omit, + domains: Optional[Iterable[int]] | Omit = omit, + handshake: Optional[custom_page_set_update_params.Handshake] | Omit = omit, + javascript_disabled: Optional[custom_page_set_update_params.JavascriptDisabled] | Omit = omit, + name: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Update a custom page set based on the provided parameters. @@ -175,17 +175,17 @@ def update( def list( self, *, - ids: Iterable[int] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["name", "-name", "id", "-id"] | NotGiven = NOT_GIVEN, + ids: Iterable[int] | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + ordering: Literal["name", "-name", "id", "-id"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapCustomPageSet]: """ Retrieve a list of custom page sets available for use @@ -240,7 +240,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a custom page set @@ -274,7 +274,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomPageSet: """ Retrieve a custom page set based on the provided ID @@ -309,17 +309,17 @@ def preview( "handshake.html", "javascriptDisabled.html", ], - error: Optional[str] | NotGiven = NOT_GIVEN, - header: Optional[str] | NotGiven = NOT_GIVEN, - logo: Optional[str] | NotGiven = NOT_GIVEN, - text: Optional[str] | NotGiven = NOT_GIVEN, - title: Optional[str] | NotGiven = NOT_GIVEN, + error: Optional[str] | Omit = omit, + header: Optional[str] | Omit = omit, + logo: Optional[str] | Omit = omit, + text: Optional[str] | Omit = omit, + title: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomPagePreview: """ Allows to preview a custom page without creating it based on the provided type @@ -397,19 +397,19 @@ async def create( self, *, name: str, - block: Optional[custom_page_set_create_params.Block] | NotGiven = NOT_GIVEN, - block_csrf: Optional[custom_page_set_create_params.BlockCsrf] | NotGiven = NOT_GIVEN, - captcha: Optional[custom_page_set_create_params.Captcha] | NotGiven = NOT_GIVEN, - cookie_disabled: Optional[custom_page_set_create_params.CookieDisabled] | NotGiven = NOT_GIVEN, - domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - handshake: Optional[custom_page_set_create_params.Handshake] | NotGiven = NOT_GIVEN, - javascript_disabled: Optional[custom_page_set_create_params.JavascriptDisabled] | NotGiven = NOT_GIVEN, + block: Optional[custom_page_set_create_params.Block] | Omit = omit, + block_csrf: Optional[custom_page_set_create_params.BlockCsrf] | Omit = omit, + captcha: Optional[custom_page_set_create_params.Captcha] | Omit = omit, + cookie_disabled: Optional[custom_page_set_create_params.CookieDisabled] | Omit = omit, + domains: Optional[Iterable[int]] | Omit = omit, + handshake: Optional[custom_page_set_create_params.Handshake] | Omit = omit, + javascript_disabled: Optional[custom_page_set_create_params.JavascriptDisabled] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomPageSet: """Create a custom page set based on the provided data. @@ -454,20 +454,20 @@ async def update( self, set_id: int, *, - block: Optional[custom_page_set_update_params.Block] | NotGiven = NOT_GIVEN, - block_csrf: Optional[custom_page_set_update_params.BlockCsrf] | NotGiven = NOT_GIVEN, - captcha: Optional[custom_page_set_update_params.Captcha] | NotGiven = NOT_GIVEN, - cookie_disabled: Optional[custom_page_set_update_params.CookieDisabled] | NotGiven = NOT_GIVEN, - domains: Optional[Iterable[int]] | NotGiven = NOT_GIVEN, - handshake: Optional[custom_page_set_update_params.Handshake] | NotGiven = NOT_GIVEN, - javascript_disabled: Optional[custom_page_set_update_params.JavascriptDisabled] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + block: Optional[custom_page_set_update_params.Block] | Omit = omit, + block_csrf: Optional[custom_page_set_update_params.BlockCsrf] | Omit = omit, + captcha: Optional[custom_page_set_update_params.Captcha] | Omit = omit, + cookie_disabled: Optional[custom_page_set_update_params.CookieDisabled] | Omit = omit, + domains: Optional[Iterable[int]] | Omit = omit, + handshake: Optional[custom_page_set_update_params.Handshake] | Omit = omit, + javascript_disabled: Optional[custom_page_set_update_params.JavascriptDisabled] | Omit = omit, + name: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Update a custom page set based on the provided parameters. @@ -517,17 +517,17 @@ async def update( def list( self, *, - ids: Iterable[int] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["name", "-name", "id", "-id"] | NotGiven = NOT_GIVEN, + ids: Iterable[int] | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + ordering: Literal["name", "-name", "id", "-id"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapCustomPageSet, AsyncOffsetPage[WaapCustomPageSet]]: """ Retrieve a list of custom page sets available for use @@ -582,7 +582,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a custom page set @@ -616,7 +616,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomPageSet: """ Retrieve a custom page set based on the provided ID @@ -651,17 +651,17 @@ async def preview( "handshake.html", "javascriptDisabled.html", ], - error: Optional[str] | NotGiven = NOT_GIVEN, - header: Optional[str] | NotGiven = NOT_GIVEN, - logo: Optional[str] | NotGiven = NOT_GIVEN, - text: Optional[str] | NotGiven = NOT_GIVEN, - title: Optional[str] | NotGiven = NOT_GIVEN, + error: Optional[str] | Omit = omit, + header: Optional[str] | Omit = omit, + logo: Optional[str] | Omit = omit, + text: Optional[str] | Omit = omit, + title: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomPagePreview: """ Allows to preview a custom page without creating it based on the provided type diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index e22a838f..5299f49c 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -53,14 +53,14 @@ def create( enabled: bool, name: str, source: str, - description: Optional[str] | NotGiven = NOT_GIVEN, - phase: Optional[Literal["access", "header_filter", "body_filter"]] | NotGiven = NOT_GIVEN, + description: Optional[str] | Omit = omit, + phase: Optional[Literal["access", "header_filter", "body_filter"]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAdvancedRule: """ Create an advanced rule @@ -120,18 +120,18 @@ def update( rule_id: int, *, domain_id: int, - action: Optional[advanced_rule_update_params.Action] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - enabled: Optional[bool] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - phase: Optional[Literal["access", "header_filter", "body_filter"]] | NotGiven = NOT_GIVEN, - source: Optional[str] | NotGiven = NOT_GIVEN, + action: Optional[advanced_rule_update_params.Action] | Omit = omit, + description: Optional[str] | Omit = omit, + enabled: Optional[bool] | Omit = omit, + name: Optional[str] | Omit = omit, + phase: Optional[Literal["access", "header_filter", "body_filter"]] | Omit = omit, + source: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Only properties present in the request will be updated @@ -193,12 +193,12 @@ def list( self, domain_id: int, *, - action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | Omit = omit, + description: str | Omit = omit, + enabled: bool | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Optional[ Literal[ "id", @@ -215,14 +215,14 @@ def list( "-phase", ] ] - | NotGiven = NOT_GIVEN, - phase: Literal["access", "header_filter", "body_filter"] | NotGiven = NOT_GIVEN, + | Omit = omit, + phase: Literal["access", "header_filter", "body_filter"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapAdvancedRule]: """ Retrieve a list of advanced rules assigned to a domain, offering filter, @@ -295,7 +295,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete an advanced rule @@ -332,7 +332,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAdvancedRule: """ Retrieve a specific advanced rule assigned to a domain @@ -369,7 +369,7 @@ def toggle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Toggle an advanced rule @@ -429,14 +429,14 @@ async def create( enabled: bool, name: str, source: str, - description: Optional[str] | NotGiven = NOT_GIVEN, - phase: Optional[Literal["access", "header_filter", "body_filter"]] | NotGiven = NOT_GIVEN, + description: Optional[str] | Omit = omit, + phase: Optional[Literal["access", "header_filter", "body_filter"]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAdvancedRule: """ Create an advanced rule @@ -496,18 +496,18 @@ async def update( rule_id: int, *, domain_id: int, - action: Optional[advanced_rule_update_params.Action] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - enabled: Optional[bool] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - phase: Optional[Literal["access", "header_filter", "body_filter"]] | NotGiven = NOT_GIVEN, - source: Optional[str] | NotGiven = NOT_GIVEN, + action: Optional[advanced_rule_update_params.Action] | Omit = omit, + description: Optional[str] | Omit = omit, + enabled: Optional[bool] | Omit = omit, + name: Optional[str] | Omit = omit, + phase: Optional[Literal["access", "header_filter", "body_filter"]] | Omit = omit, + source: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Only properties present in the request will be updated @@ -569,12 +569,12 @@ def list( self, domain_id: int, *, - action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | Omit = omit, + description: str | Omit = omit, + enabled: bool | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Optional[ Literal[ "id", @@ -591,14 +591,14 @@ def list( "-phase", ] ] - | NotGiven = NOT_GIVEN, - phase: Literal["access", "header_filter", "body_filter"] | NotGiven = NOT_GIVEN, + | Omit = omit, + phase: Literal["access", "header_filter", "body_filter"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapAdvancedRule, AsyncOffsetPage[WaapAdvancedRule]]: """ Retrieve a list of advanced rules assigned to a domain, offering filter, @@ -671,7 +671,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete an advanced rule @@ -708,7 +708,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAdvancedRule: """ Retrieve a specific advanced rule assigned to a domain @@ -745,7 +745,7 @@ async def toggle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Toggle an advanced rule diff --git a/src/gcore/resources/waap/domains/api_discovery.py b/src/gcore/resources/waap/domains/api_discovery.py index 6b1f7896..426426f5 100644 --- a/src/gcore/resources/waap/domains/api_discovery.py +++ b/src/gcore/resources/waap/domains/api_discovery.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -61,7 +61,7 @@ def get_scan_result( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIScanResult: """ Get Scan Result @@ -98,7 +98,7 @@ def get_settings( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIDiscoverySettings: """ Retrieve the API discovery settings for a domain @@ -126,9 +126,9 @@ def list_scan_results( self, domain_id: int, *, - limit: int | NotGiven = NOT_GIVEN, - message: Optional[str] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + message: Optional[str] | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "id", "type", @@ -143,15 +143,15 @@ def list_scan_results( "-status", "-message", ] - | NotGiven = NOT_GIVEN, - status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | NotGiven = NOT_GIVEN, - type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | NotGiven = NOT_GIVEN, + | Omit = omit, + status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | Omit = omit, + type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapAPIScanResult]: """ Get Scan Results @@ -211,7 +211,7 @@ def scan_openapi( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapTaskID: """Scan an API description file hosted online. @@ -242,17 +242,17 @@ def update_settings( self, domain_id: int, *, - description_file_location: Optional[str] | NotGiven = NOT_GIVEN, - description_file_scan_enabled: Optional[bool] | NotGiven = NOT_GIVEN, - description_file_scan_interval_hours: Optional[int] | NotGiven = NOT_GIVEN, - traffic_scan_enabled: Optional[bool] | NotGiven = NOT_GIVEN, - traffic_scan_interval_hours: Optional[int] | NotGiven = NOT_GIVEN, + description_file_location: Optional[str] | Omit = omit, + description_file_scan_enabled: Optional[bool] | Omit = omit, + description_file_scan_interval_hours: Optional[int] | Omit = omit, + traffic_scan_enabled: Optional[bool] | Omit = omit, + traffic_scan_interval_hours: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIDiscoverySettings: """ Update the API discovery settings for a domain @@ -309,7 +309,7 @@ def upload_openapi( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapTaskID: """ An API description file must adhere to the OpenAPI specification and be written @@ -379,7 +379,7 @@ async def get_scan_result( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIScanResult: """ Get Scan Result @@ -416,7 +416,7 @@ async def get_settings( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIDiscoverySettings: """ Retrieve the API discovery settings for a domain @@ -444,9 +444,9 @@ def list_scan_results( self, domain_id: int, *, - limit: int | NotGiven = NOT_GIVEN, - message: Optional[str] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + message: Optional[str] | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "id", "type", @@ -461,15 +461,15 @@ def list_scan_results( "-status", "-message", ] - | NotGiven = NOT_GIVEN, - status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | NotGiven = NOT_GIVEN, - type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | NotGiven = NOT_GIVEN, + | Omit = omit, + status: Optional[Literal["SUCCESS", "FAILURE", "IN_PROGRESS"]] | Omit = omit, + type: Optional[Literal["TRAFFIC_SCAN", "API_DESCRIPTION_FILE_SCAN"]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapAPIScanResult, AsyncOffsetPage[WaapAPIScanResult]]: """ Get Scan Results @@ -529,7 +529,7 @@ async def scan_openapi( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapTaskID: """Scan an API description file hosted online. @@ -560,17 +560,17 @@ async def update_settings( self, domain_id: int, *, - description_file_location: Optional[str] | NotGiven = NOT_GIVEN, - description_file_scan_enabled: Optional[bool] | NotGiven = NOT_GIVEN, - description_file_scan_interval_hours: Optional[int] | NotGiven = NOT_GIVEN, - traffic_scan_enabled: Optional[bool] | NotGiven = NOT_GIVEN, - traffic_scan_interval_hours: Optional[int] | NotGiven = NOT_GIVEN, + description_file_location: Optional[str] | Omit = omit, + description_file_scan_enabled: Optional[bool] | Omit = omit, + description_file_scan_interval_hours: Optional[int] | Omit = omit, + traffic_scan_enabled: Optional[bool] | Omit = omit, + traffic_scan_interval_hours: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIDiscoverySettings: """ Update the API discovery settings for a domain @@ -627,7 +627,7 @@ async def upload_openapi( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapTaskID: """ An API description file must adhere to the OpenAPI specification and be written diff --git a/src/gcore/resources/waap/domains/api_path_groups.py b/src/gcore/resources/waap/domains/api_path_groups.py index 3e66ea27..a6b25b2e 100644 --- a/src/gcore/resources/waap/domains/api_path_groups.py +++ b/src/gcore/resources/waap/domains/api_path_groups.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -48,7 +48,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APIPathGroupList: """ Retrieve a list of API path groups for a specific domain @@ -102,7 +102,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APIPathGroupList: """ Retrieve a list of API path groups for a specific domain diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py index fc1dd68c..fa4c9935 100644 --- a/src/gcore/resources/waap/domains/api_paths.py +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -52,15 +52,15 @@ def create( http_scheme: Literal["HTTP", "HTTPS"], method: Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"], path: str, - api_groups: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - api_version: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + api_groups: SequenceNotStr[str] | Omit = omit, + api_version: str | Omit = omit, + tags: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIPath: """ Create an API path for a domain @@ -113,16 +113,16 @@ def update( path_id: str, *, domain_id: int, - api_groups: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + api_groups: SequenceNotStr[str] | Omit = omit, + path: str | Omit = omit, + status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] | Omit = omit, + tags: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Update a specific API path for a domain @@ -173,14 +173,13 @@ def list( self, domain_id: int, *, - api_group: Optional[str] | NotGiven = NOT_GIVEN, - api_version: Optional[str] | NotGiven = NOT_GIVEN, - http_scheme: Optional[Literal["HTTP", "HTTPS"]] | NotGiven = NOT_GIVEN, - ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - method: Optional[Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"]] - | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + api_group: Optional[str] | Omit = omit, + api_version: Optional[str] | Omit = omit, + http_scheme: Optional[Literal["HTTP", "HTTPS"]] | Omit = omit, + ids: Optional[SequenceNotStr[str]] | Omit = omit, + limit: int | Omit = omit, + method: Optional[Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"]] | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "id", "path", @@ -201,17 +200,16 @@ def list( "-status", "-source", ] - | NotGiven = NOT_GIVEN, - path: Optional[str] | NotGiven = NOT_GIVEN, - source: Optional[Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"]] | NotGiven = NOT_GIVEN, - status: Optional[List[Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"]]] - | NotGiven = NOT_GIVEN, + | Omit = omit, + path: Optional[str] | Omit = omit, + source: Optional[Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"]] | Omit = omit, + status: Optional[List[Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"]]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapAPIPath]: """ Retrieve a list of API paths for a specific domain @@ -287,7 +285,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific API path for a domain @@ -326,7 +324,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIPath: """ Retrieve a specific API path for a domain @@ -382,15 +380,15 @@ async def create( http_scheme: Literal["HTTP", "HTTPS"], method: Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"], path: str, - api_groups: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - api_version: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + api_groups: SequenceNotStr[str] | Omit = omit, + api_version: str | Omit = omit, + tags: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIPath: """ Create an API path for a domain @@ -443,16 +441,16 @@ async def update( path_id: str, *, domain_id: int, - api_groups: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - path: str | NotGiven = NOT_GIVEN, - status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + api_groups: SequenceNotStr[str] | Omit = omit, + path: str | Omit = omit, + status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] | Omit = omit, + tags: SequenceNotStr[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Update a specific API path for a domain @@ -503,14 +501,13 @@ def list( self, domain_id: int, *, - api_group: Optional[str] | NotGiven = NOT_GIVEN, - api_version: Optional[str] | NotGiven = NOT_GIVEN, - http_scheme: Optional[Literal["HTTP", "HTTPS"]] | NotGiven = NOT_GIVEN, - ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - method: Optional[Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"]] - | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + api_group: Optional[str] | Omit = omit, + api_version: Optional[str] | Omit = omit, + http_scheme: Optional[Literal["HTTP", "HTTPS"]] | Omit = omit, + ids: Optional[SequenceNotStr[str]] | Omit = omit, + limit: int | Omit = omit, + method: Optional[Literal["GET", "POST", "PUT", "PATCH", "DELETE", "TRACE", "HEAD", "OPTIONS"]] | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "id", "path", @@ -531,17 +528,16 @@ def list( "-status", "-source", ] - | NotGiven = NOT_GIVEN, - path: Optional[str] | NotGiven = NOT_GIVEN, - source: Optional[Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"]] | NotGiven = NOT_GIVEN, - status: Optional[List[Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"]]] - | NotGiven = NOT_GIVEN, + | Omit = omit, + path: Optional[str] | Omit = omit, + source: Optional[Literal["API_DESCRIPTION_FILE", "TRAFFIC_SCAN", "USER_DEFINED"]] | Omit = omit, + status: Optional[List[Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"]]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapAPIPath, AsyncOffsetPage[WaapAPIPath]]: """ Retrieve a list of API paths for a specific domain @@ -617,7 +613,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a specific API path for a domain @@ -656,7 +652,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapAPIPath: """ Retrieve a specific API path for a domain diff --git a/src/gcore/resources/waap/domains/custom_rules.py b/src/gcore/resources/waap/domains/custom_rules.py index f175a192..8b6ccbf0 100644 --- a/src/gcore/resources/waap/domains/custom_rules.py +++ b/src/gcore/resources/waap/domains/custom_rules.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -58,13 +58,13 @@ def create( conditions: Iterable[custom_rule_create_params.Condition], enabled: bool, name: str, - description: Optional[str] | NotGiven = NOT_GIVEN, + 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomRule: """ Create a custom rule @@ -114,17 +114,17 @@ def update( rule_id: int, *, domain_id: int, - action: Optional[custom_rule_update_params.Action] | NotGiven = NOT_GIVEN, - conditions: Optional[Iterable[custom_rule_update_params.Condition]] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - enabled: Optional[bool] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + action: Optional[custom_rule_update_params.Action] | Omit = omit, + conditions: Optional[Iterable[custom_rule_update_params.Condition]] | Omit = omit, + description: Optional[str] | Omit = omit, + enabled: Optional[bool] | Omit = omit, + name: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Only properties present in the request will be updated @@ -176,24 +176,24 @@ def list( self, domain_id: int, *, - action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | Omit = omit, + description: str | Omit = omit, + enabled: bool | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Optional[ Literal[ "id", "name", "description", "enabled", "action", "-id", "-name", "-description", "-enabled", "-action" ] ] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapCustomRule]: """ Extracts a list of custom rules assigned to a domain, offering filter, ordering, @@ -258,7 +258,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a custom rule @@ -295,7 +295,7 @@ def delete_multiple( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete multiple WAAP rules @@ -335,7 +335,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomRule: """ Extracts a specific custom rule assigned to a domain @@ -372,7 +372,7 @@ def toggle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Toggle a custom rule @@ -432,13 +432,13 @@ async def create( conditions: Iterable[custom_rule_create_params.Condition], enabled: bool, name: str, - description: Optional[str] | NotGiven = NOT_GIVEN, + 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomRule: """ Create a custom rule @@ -488,17 +488,17 @@ async def update( rule_id: int, *, domain_id: int, - action: Optional[custom_rule_update_params.Action] | NotGiven = NOT_GIVEN, - conditions: Optional[Iterable[custom_rule_update_params.Condition]] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - enabled: Optional[bool] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + action: Optional[custom_rule_update_params.Action] | Omit = omit, + conditions: Optional[Iterable[custom_rule_update_params.Condition]] | Omit = omit, + description: Optional[str] | Omit = omit, + enabled: Optional[bool] | Omit = omit, + name: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Only properties present in the request will be updated @@ -550,24 +550,24 @@ def list( self, domain_id: int, *, - action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + action: Literal["allow", "block", "captcha", "handshake", "monitor", "tag"] | Omit = omit, + description: str | Omit = omit, + enabled: bool | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Optional[ Literal[ "id", "name", "description", "enabled", "action", "-id", "-name", "-description", "-enabled", "-action" ] ] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapCustomRule, AsyncOffsetPage[WaapCustomRule]]: """ Extracts a list of custom rules assigned to a domain, offering filter, ordering, @@ -632,7 +632,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a custom rule @@ -669,7 +669,7 @@ async def delete_multiple( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete multiple WAAP rules @@ -709,7 +709,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapCustomRule: """ Extracts a specific custom rule assigned to a domain @@ -746,7 +746,7 @@ async def toggle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Toggle a custom rule diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index cf4135cc..b0d8c1b0 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -23,7 +23,7 @@ SettingsResourceWithStreamingResponse, AsyncSettingsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from .api_paths import ( APIPathsResource, @@ -172,13 +172,13 @@ def update( self, domain_id: int, *, - status: Literal["active", "monitor"] | NotGiven = NOT_GIVEN, + status: Literal["active", "monitor"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Update Domain @@ -209,19 +209,18 @@ def update( def list( self, *, - ids: Iterable[int] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["id", "name", "status", "created_at", "-id", "-name", "-status", "-created_at"] - | NotGiven = NOT_GIVEN, - status: Literal["active", "bypass", "monitor", "locked"] | NotGiven = NOT_GIVEN, + ids: Iterable[int] | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + ordering: Literal["id", "name", "status", "created_at", "-id", "-name", "-status", "-created_at"] | Omit = omit, + status: Literal["active", "bypass", "monitor", "locked"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapSummaryDomain]: """ Retrieve a list of domains associated with the client @@ -279,7 +278,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Delete an inactive domain by ID. @@ -315,7 +314,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapDetailedDomain: """ Retrieve detailed information about a specific domain @@ -348,7 +347,7 @@ def list_rule_sets( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DomainListRuleSetsResponse: """ Retrieve all rule sets linked to a particular domain @@ -382,7 +381,7 @@ def toggle_policy( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapPolicyMode: """ Modify the activation state of a policy associated with a domain @@ -475,13 +474,13 @@ async def update( self, domain_id: int, *, - status: Literal["active", "monitor"] | NotGiven = NOT_GIVEN, + status: Literal["active", "monitor"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Update Domain @@ -512,19 +511,18 @@ async def update( def list( self, *, - ids: Iterable[int] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["id", "name", "status", "created_at", "-id", "-name", "-status", "-created_at"] - | NotGiven = NOT_GIVEN, - status: Literal["active", "bypass", "monitor", "locked"] | NotGiven = NOT_GIVEN, + ids: Iterable[int] | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + ordering: Literal["id", "name", "status", "created_at", "-id", "-name", "-status", "-created_at"] | Omit = omit, + status: Literal["active", "bypass", "monitor", "locked"] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapSummaryDomain, AsyncOffsetPage[WaapSummaryDomain]]: """ Retrieve a list of domains associated with the client @@ -582,7 +580,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """Delete an inactive domain by ID. @@ -618,7 +616,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapDetailedDomain: """ Retrieve detailed information about a specific domain @@ -651,7 +649,7 @@ async def list_rule_sets( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DomainListRuleSetsResponse: """ Retrieve all rule sets linked to a particular domain @@ -685,7 +683,7 @@ async def toggle_policy( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapPolicyMode: """ Modify the activation state of a policy associated with a domain diff --git a/src/gcore/resources/waap/domains/firewall_rules.py b/src/gcore/resources/waap/domains/firewall_rules.py index b8600359..8b7b446a 100644 --- a/src/gcore/resources/waap/domains/firewall_rules.py +++ b/src/gcore/resources/waap/domains/firewall_rules.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -58,13 +58,13 @@ def create( conditions: Iterable[firewall_rule_create_params.Condition], enabled: bool, name: str, - description: Optional[str] | NotGiven = NOT_GIVEN, + 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapFirewallRule: """ Create a firewall rule @@ -113,17 +113,17 @@ def update( rule_id: int, *, domain_id: int, - action: Optional[firewall_rule_update_params.Action] | NotGiven = NOT_GIVEN, - conditions: Optional[Iterable[firewall_rule_update_params.Condition]] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - enabled: Optional[bool] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + action: Optional[firewall_rule_update_params.Action] | Omit = omit, + conditions: Optional[Iterable[firewall_rule_update_params.Condition]] | Omit = omit, + description: Optional[str] | Omit = omit, + enabled: Optional[bool] | Omit = omit, + name: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Only properties present in the request will be updated @@ -174,24 +174,24 @@ def list( self, domain_id: int, *, - action: Literal["allow", "block"] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + action: Literal["allow", "block"] | Omit = omit, + description: str | Omit = omit, + enabled: bool | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Optional[ Literal[ "id", "name", "description", "enabled", "action", "-id", "-name", "-description", "-enabled", "-action" ] ] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapFirewallRule]: """ Extracts a list of firewall rules assigned to a domain, offering filter, @@ -256,7 +256,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a firewall rule @@ -293,7 +293,7 @@ def delete_multiple( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete multiple WAAP rules @@ -333,7 +333,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapFirewallRule: """ Extracts a specific firewall rule assigned to a domain @@ -370,7 +370,7 @@ def toggle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Toggle a firewall rule @@ -430,13 +430,13 @@ async def create( conditions: Iterable[firewall_rule_create_params.Condition], enabled: bool, name: str, - description: Optional[str] | NotGiven = NOT_GIVEN, + 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapFirewallRule: """ Create a firewall rule @@ -485,17 +485,17 @@ async def update( rule_id: int, *, domain_id: int, - action: Optional[firewall_rule_update_params.Action] | NotGiven = NOT_GIVEN, - conditions: Optional[Iterable[firewall_rule_update_params.Condition]] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - enabled: Optional[bool] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + action: Optional[firewall_rule_update_params.Action] | Omit = omit, + conditions: Optional[Iterable[firewall_rule_update_params.Condition]] | Omit = omit, + description: Optional[str] | Omit = omit, + enabled: Optional[bool] | Omit = omit, + name: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Only properties present in the request will be updated @@ -546,24 +546,24 @@ def list( self, domain_id: int, *, - action: Literal["allow", "block"] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + action: Literal["allow", "block"] | Omit = omit, + description: str | Omit = omit, + enabled: bool | Omit = omit, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Optional[ Literal[ "id", "name", "description", "enabled", "action", "-id", "-name", "-description", "-enabled", "-action" ] ] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapFirewallRule, AsyncOffsetPage[WaapFirewallRule]]: """ Extracts a list of firewall rules assigned to a domain, offering filter, @@ -628,7 +628,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete a firewall rule @@ -665,7 +665,7 @@ async def delete_multiple( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete multiple WAAP rules @@ -705,7 +705,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapFirewallRule: """ Extracts a specific firewall rule assigned to a domain @@ -742,7 +742,7 @@ async def toggle( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Toggle a firewall rule diff --git a/src/gcore/resources/waap/domains/insight_silences.py b/src/gcore/resources/waap/domains/insight_silences.py index 577332e9..8b57783e 100644 --- a/src/gcore/resources/waap/domains/insight_silences.py +++ b/src/gcore/resources/waap/domains/insight_silences.py @@ -8,7 +8,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -58,13 +58,13 @@ def create( comment: str, insight_type: str, labels: Dict[str, str], - expire_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + expire_at: Union[str, datetime, None] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsightSilence: """Create a new insight silence for a specified domain. @@ -118,13 +118,13 @@ def update( author: str, comment: str, expire_at: Union[str, datetime, None], - labels: Dict[str, str] | NotGiven = NOT_GIVEN, + labels: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsightSilence: """ Update an insight silence for a specific domain. @@ -173,12 +173,12 @@ def list( self, domain_id: int, *, - id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - author: Optional[str] | NotGiven = NOT_GIVEN, - comment: Optional[str] | NotGiven = NOT_GIVEN, - insight_type: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + id: Optional[SequenceNotStr[str]] | Omit = omit, + author: Optional[str] | Omit = omit, + comment: Optional[str] | Omit = omit, + insight_type: Optional[SequenceNotStr[str]] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "id", "-id", @@ -191,13 +191,13 @@ def list( "expire_at", "-expire_at", ] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapInsightSilence]: """ Retrieve a list of insight silences for a specific domain @@ -261,7 +261,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete an insight silence for a specific domain. @@ -300,7 +300,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsightSilence: """ Retrieve a specific insight silence for a specific domain @@ -357,13 +357,13 @@ async def create( comment: str, insight_type: str, labels: Dict[str, str], - expire_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + expire_at: Union[str, datetime, None] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsightSilence: """Create a new insight silence for a specified domain. @@ -417,13 +417,13 @@ async def update( author: str, comment: str, expire_at: Union[str, datetime, None], - labels: Dict[str, str] | NotGiven = NOT_GIVEN, + labels: Dict[str, str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsightSilence: """ Update an insight silence for a specific domain. @@ -472,12 +472,12 @@ def list( self, domain_id: int, *, - id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - author: Optional[str] | NotGiven = NOT_GIVEN, - comment: Optional[str] | NotGiven = NOT_GIVEN, - insight_type: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + id: Optional[SequenceNotStr[str]] | Omit = omit, + author: Optional[str] | Omit = omit, + comment: Optional[str] | Omit = omit, + insight_type: Optional[SequenceNotStr[str]] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "id", "-id", @@ -490,13 +490,13 @@ def list( "expire_at", "-expire_at", ] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapInsightSilence, AsyncOffsetPage[WaapInsightSilence]]: """ Retrieve a list of insight silences for a specific domain @@ -560,7 +560,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete an insight silence for a specific domain. @@ -599,7 +599,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsightSilence: """ Retrieve a specific insight silence for a specific domain diff --git a/src/gcore/resources/waap/domains/insights.py b/src/gcore/resources/waap/domains/insights.py index 8fb4ab52..924fe5e2 100644 --- a/src/gcore/resources/waap/domains/insights.py +++ b/src/gcore/resources/waap/domains/insights.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -49,11 +49,11 @@ def list( self, domain_id: int, *, - id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - insight_type: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + id: Optional[SequenceNotStr[str]] | Omit = omit, + description: Optional[str] | Omit = omit, + insight_type: Optional[SequenceNotStr[str]] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "id", "-id", @@ -68,14 +68,14 @@ def list( "status", "-status", ] - | NotGiven = NOT_GIVEN, - status: Optional[List[Literal["OPEN", "ACKED", "CLOSED"]]] | NotGiven = NOT_GIVEN, + | Omit = omit, + status: Optional[List[Literal["OPEN", "ACKED", "CLOSED"]]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapInsight]: """ Retrieve a list of insights for a specific domain. @@ -139,7 +139,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsight: """ Retrieve a specific insight for a specific domain. @@ -176,7 +176,7 @@ def replace( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsight: """ Update the status of an insight for a specific domain. @@ -232,11 +232,11 @@ def list( self, domain_id: int, *, - id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - insight_type: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + id: Optional[SequenceNotStr[str]] | Omit = omit, + description: Optional[str] | Omit = omit, + insight_type: Optional[SequenceNotStr[str]] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, ordering: Literal[ "id", "-id", @@ -251,14 +251,14 @@ def list( "status", "-status", ] - | NotGiven = NOT_GIVEN, - status: Optional[List[Literal["OPEN", "ACKED", "CLOSED"]]] | NotGiven = NOT_GIVEN, + | Omit = omit, + status: Optional[List[Literal["OPEN", "ACKED", "CLOSED"]]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapInsight, AsyncOffsetPage[WaapInsight]]: """ Retrieve a list of insights for a specific domain. @@ -322,7 +322,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsight: """ Retrieve a specific insight for a specific domain. @@ -359,7 +359,7 @@ async def replace( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapInsight: """ Update the status of an insight for a specific domain. diff --git a/src/gcore/resources/waap/domains/settings.py b/src/gcore/resources/waap/domains/settings.py index fc9cafbf..fcaabeaa 100644 --- a/src/gcore/resources/waap/domains/settings.py +++ b/src/gcore/resources/waap/domains/settings.py @@ -4,7 +4,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -45,14 +45,14 @@ def update( self, domain_id: int, *, - api: setting_update_params.API | NotGiven = NOT_GIVEN, - ddos: setting_update_params.DDOS | NotGiven = NOT_GIVEN, + api: setting_update_params.API | Omit = omit, + ddos: setting_update_params.DDOS | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Update settings for a specific domain @@ -97,7 +97,7 @@ def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapDomainSettingsModel: """ Retrieve settings for a specific domain @@ -146,14 +146,14 @@ async def update( self, domain_id: int, *, - api: setting_update_params.API | NotGiven = NOT_GIVEN, - ddos: setting_update_params.DDOS | NotGiven = NOT_GIVEN, + api: setting_update_params.API | Omit = omit, + ddos: setting_update_params.DDOS | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Update settings for a specific domain @@ -198,7 +198,7 @@ async def get( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapDomainSettingsModel: """ Retrieve settings for a specific domain diff --git a/src/gcore/resources/waap/domains/statistics.py b/src/gcore/resources/waap/domains/statistics.py index f23b048b..94514578 100644 --- a/src/gcore/resources/waap/domains/statistics.py +++ b/src/gcore/resources/waap/domains/statistics.py @@ -8,7 +8,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -61,17 +61,17 @@ def get_ddos_attacks( self, domain_id: int, *, - end_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["start_time", "-start_time", "end_time", "-end_time"] | NotGiven = NOT_GIVEN, - start_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + end_time: Union[str, datetime, None] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + ordering: Literal["start_time", "-start_time", "end_time", "-end_time"] | Omit = omit, + start_time: Union[str, datetime, None] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapDDOSAttack]: """ Retrieve a domain's DDoS attacks @@ -125,15 +125,15 @@ def get_ddos_info( *, group_by: Literal["URL", "User-Agent", "IP"], start: str, - end: Optional[str] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + end: Optional[str] | Omit = omit, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapDDOSInfo]: """ Returns the top DDoS counts grouped by URL, User-Agent or IP @@ -187,17 +187,17 @@ def get_events_aggregated( domain_id: int, *, start: str, - action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] | NotGiven = NOT_GIVEN, - end: Optional[str] | NotGiven = NOT_GIVEN, - ip: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - reference_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - result: Optional[List[Literal["passed", "blocked", "monitored", "allowed"]]] | NotGiven = NOT_GIVEN, + action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] | Omit = omit, + end: Optional[str] | Omit = omit, + ip: Optional[SequenceNotStr[str]] | Omit = omit, + reference_id: Optional[SequenceNotStr[str]] | Omit = omit, + result: Optional[List[Literal["passed", "blocked", "monitored", "allowed"]]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapEventStatistics: """ Retrieve an domain's event statistics @@ -258,7 +258,7 @@ def get_request_details( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapRequestDetails: """ Retrieves all the available information for a request that matches a given @@ -292,16 +292,16 @@ def get_requests_series( domain_id: int, *, start: str, - actions: List[Literal["allow", "block", "captcha", "handshake"]] | NotGiven = NOT_GIVEN, - countries: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - end: Optional[str] | NotGiven = NOT_GIVEN, - ip: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: str | NotGiven = NOT_GIVEN, - reference_id: str | NotGiven = NOT_GIVEN, - security_rule_name: str | NotGiven = NOT_GIVEN, - status_code: int | NotGiven = NOT_GIVEN, + actions: List[Literal["allow", "block", "captcha", "handshake"]] | Omit = omit, + countries: SequenceNotStr[str] | Omit = omit, + end: Optional[str] | Omit = omit, + ip: str | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + ordering: str | Omit = omit, + reference_id: str | Omit = omit, + security_rule_name: str | Omit = omit, + status_code: int | Omit = omit, traffic_types: List[ Literal[ "policy_allowed", @@ -326,13 +326,13 @@ def get_requests_series( "monitored", ] ] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapRequestSummary]: """ Retrieve a domain's requests data. @@ -408,13 +408,13 @@ def get_traffic_series( *, resolution: Literal["daily", "hourly", "minutely"], start: str, - end: Optional[str] | NotGiven = NOT_GIVEN, + end: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetTrafficSeriesResponse: """ Retrieves a comprehensive report on a domain's traffic statistics based on @@ -483,17 +483,17 @@ def get_ddos_attacks( self, domain_id: int, *, - end_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["start_time", "-start_time", "end_time", "-end_time"] | NotGiven = NOT_GIVEN, - start_time: Union[str, datetime, None] | NotGiven = NOT_GIVEN, + end_time: Union[str, datetime, None] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + ordering: Literal["start_time", "-start_time", "end_time", "-end_time"] | Omit = omit, + start_time: Union[str, datetime, None] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapDDOSAttack, AsyncOffsetPage[WaapDDOSAttack]]: """ Retrieve a domain's DDoS attacks @@ -547,15 +547,15 @@ def get_ddos_info( *, group_by: Literal["URL", "User-Agent", "IP"], start: str, - end: Optional[str] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + end: Optional[str] | Omit = omit, + limit: int | Omit = omit, + offset: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapDDOSInfo, AsyncOffsetPage[WaapDDOSInfo]]: """ Returns the top DDoS counts grouped by URL, User-Agent or IP @@ -609,17 +609,17 @@ async def get_events_aggregated( domain_id: int, *, start: str, - action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] | NotGiven = NOT_GIVEN, - end: Optional[str] | NotGiven = NOT_GIVEN, - ip: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - reference_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - result: Optional[List[Literal["passed", "blocked", "monitored", "allowed"]]] | NotGiven = NOT_GIVEN, + action: Optional[List[Literal["block", "captcha", "handshake", "monitor"]]] | Omit = omit, + end: Optional[str] | Omit = omit, + ip: Optional[SequenceNotStr[str]] | Omit = omit, + reference_id: Optional[SequenceNotStr[str]] | Omit = omit, + result: Optional[List[Literal["passed", "blocked", "monitored", "allowed"]]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapEventStatistics: """ Retrieve an domain's event statistics @@ -680,7 +680,7 @@ async def get_request_details( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapRequestDetails: """ Retrieves all the available information for a request that matches a given @@ -714,16 +714,16 @@ def get_requests_series( domain_id: int, *, start: str, - actions: List[Literal["allow", "block", "captcha", "handshake"]] | NotGiven = NOT_GIVEN, - countries: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - end: Optional[str] | NotGiven = NOT_GIVEN, - ip: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: str | NotGiven = NOT_GIVEN, - reference_id: str | NotGiven = NOT_GIVEN, - security_rule_name: str | NotGiven = NOT_GIVEN, - status_code: int | NotGiven = NOT_GIVEN, + actions: List[Literal["allow", "block", "captcha", "handshake"]] | Omit = omit, + countries: SequenceNotStr[str] | Omit = omit, + end: Optional[str] | Omit = omit, + ip: str | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + ordering: str | Omit = omit, + reference_id: str | Omit = omit, + security_rule_name: str | Omit = omit, + status_code: int | Omit = omit, traffic_types: List[ Literal[ "policy_allowed", @@ -748,13 +748,13 @@ def get_requests_series( "monitored", ] ] - | NotGiven = NOT_GIVEN, + | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapRequestSummary, AsyncOffsetPage[WaapRequestSummary]]: """ Retrieve a domain's requests data. @@ -830,13 +830,13 @@ async def get_traffic_series( *, resolution: Literal["daily", "hourly", "minutely"], start: str, - end: Optional[str] | NotGiven = NOT_GIVEN, + end: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetTrafficSeriesResponse: """ Retrieves a comprehensive report on a domain's traffic statistics based on diff --git a/src/gcore/resources/waap/insights.py b/src/gcore/resources/waap/insights.py index e056e67a..c9fc4370 100644 --- a/src/gcore/resources/waap/insights.py +++ b/src/gcore/resources/waap/insights.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -48,19 +48,18 @@ def with_streaming_response(self) -> InsightsResourceWithStreamingResponse: def list_types( self, *, - insight_frequency: Optional[int] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["name", "-name", "slug", "-slug", "insight_frequency", "-insight_frequency"] - | NotGiven = NOT_GIVEN, - slug: Optional[str] | NotGiven = NOT_GIVEN, + insight_frequency: Optional[int] | Omit = omit, + limit: int | Omit = omit, + name: Optional[str] | Omit = omit, + offset: int | Omit = omit, + ordering: Literal["name", "-name", "slug", "-slug", "insight_frequency", "-insight_frequency"] | Omit = omit, + slug: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapInsightType]: """ Insight types are generalized categories that encompass various specific @@ -134,19 +133,18 @@ def with_streaming_response(self) -> AsyncInsightsResourceWithStreamingResponse: def list_types( self, *, - insight_frequency: Optional[int] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Literal["name", "-name", "slug", "-slug", "insight_frequency", "-insight_frequency"] - | NotGiven = NOT_GIVEN, - slug: Optional[str] | NotGiven = NOT_GIVEN, + insight_frequency: Optional[int] | Omit = omit, + limit: int | Omit = omit, + name: Optional[str] | Omit = omit, + offset: int | Omit = omit, + ordering: Literal["name", "-name", "slug", "-slug", "insight_frequency", "-insight_frequency"] | Omit = omit, + slug: 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapInsightType, AsyncOffsetPage[WaapInsightType]]: """ Insight types are generalized categories that encompass various specific diff --git a/src/gcore/resources/waap/ip_info/ip_info.py b/src/gcore/resources/waap/ip_info/ip_info.py index e721bf7d..0c0050f2 100644 --- a/src/gcore/resources/waap/ip_info/ip_info.py +++ b/src/gcore/resources/waap/ip_info/ip_info.py @@ -12,7 +12,7 @@ MetricsResourceWithStreamingResponse, AsyncMetricsResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -78,7 +78,7 @@ def get_attack_time_series( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetAttackTimeSeriesResponse: """ Retrieve a time-series of attacks originating from a specified IP address. @@ -118,7 +118,7 @@ def get_blocked_requests( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetBlockedRequestsResponse: """ Retrieve metrics, which enumerate blocked requests originating from a specific @@ -168,7 +168,7 @@ def get_ddos_attack_series( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapIPDDOSInfoModel: """ Fetch and analyze DDoS (Distributed Denial of Service) attack metrics for a @@ -211,7 +211,7 @@ def get_ip_info( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapIPInfo: """ Fetch details about a particular IP address, including WHOIS data, risk score, @@ -250,7 +250,7 @@ def get_top_urls( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetTopURLsResponse: """ Returns a list of the top 10 URLs accessed by a specified IP address within a @@ -301,7 +301,7 @@ def get_top_user_agents( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetTopUserAgentsResponse: """ Retrieve the top 10 user agents interacting with a specified domain, filtered by @@ -350,7 +350,7 @@ def get_top_user_sessions( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetTopUserSessionsResponse: """ Obtain the top 10 user sessions interfacing with a particular domain, identified @@ -398,7 +398,7 @@ def list_attacked_countries( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoListAttackedCountriesResponse: """ Retrieve a list of countries attacked by the specified IP address @@ -462,7 +462,7 @@ async def get_attack_time_series( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetAttackTimeSeriesResponse: """ Retrieve a time-series of attacks originating from a specified IP address. @@ -502,7 +502,7 @@ async def get_blocked_requests( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetBlockedRequestsResponse: """ Retrieve metrics, which enumerate blocked requests originating from a specific @@ -552,7 +552,7 @@ async def get_ddos_attack_series( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapIPDDOSInfoModel: """ Fetch and analyze DDoS (Distributed Denial of Service) attack metrics for a @@ -595,7 +595,7 @@ async def get_ip_info( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapIPInfo: """ Fetch details about a particular IP address, including WHOIS data, risk score, @@ -634,7 +634,7 @@ async def get_top_urls( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetTopURLsResponse: """ Returns a list of the top 10 URLs accessed by a specified IP address within a @@ -685,7 +685,7 @@ async def get_top_user_agents( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetTopUserAgentsResponse: """ Retrieve the top 10 user agents interacting with a specified domain, filtered by @@ -734,7 +734,7 @@ async def get_top_user_sessions( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoGetTopUserSessionsResponse: """ Obtain the top 10 user sessions interfacing with a particular domain, identified @@ -782,7 +782,7 @@ async def list_attacked_countries( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IPInfoListAttackedCountriesResponse: """ Retrieve a list of countries attacked by the specified IP address diff --git a/src/gcore/resources/waap/ip_info/metrics.py b/src/gcore/resources/waap/ip_info/metrics.py index c70d3faa..dd60d037 100644 --- a/src/gcore/resources/waap/ip_info/metrics.py +++ b/src/gcore/resources/waap/ip_info/metrics.py @@ -6,7 +6,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +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 @@ -47,13 +47,13 @@ def list( self, *, ip: str, - domain_id: Optional[int] | NotGiven = NOT_GIVEN, + domain_id: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapIPInfoCounts: """ Retrieve metrics encompassing the counts of total requests, blocked requests and @@ -119,13 +119,13 @@ async def list( self, *, ip: str, - domain_id: Optional[int] | NotGiven = NOT_GIVEN, + domain_id: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapIPInfoCounts: """ Retrieve metrics encompassing the counts of total requests, blocked requests and diff --git a/src/gcore/resources/waap/organizations.py b/src/gcore/resources/waap/organizations.py index f36dcb35..07a8bc66 100644 --- a/src/gcore/resources/waap/organizations.py +++ b/src/gcore/resources/waap/organizations.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -48,16 +48,16 @@ def with_streaming_response(self) -> OrganizationsResourceWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Optional[Literal["name", "id", "-name", "-id"]] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + ordering: Optional[Literal["name", "id", "-name", "-id"]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapOrganization]: """ This endpoint retrieves a list of network organizations that own IP ranges as @@ -126,16 +126,16 @@ def with_streaming_response(self) -> AsyncOrganizationsResourceWithStreamingResp def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - ordering: Optional[Literal["name", "id", "-name", "-id"]] | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, + ordering: Optional[Literal["name", "id", "-name", "-id"]] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapOrganization, AsyncOffsetPage[WaapOrganization]]: """ This endpoint retrieves a list of network organizations that own IP ranges as diff --git a/src/gcore/resources/waap/statistics.py b/src/gcore/resources/waap/statistics.py index f8258bab..e383f236 100644 --- a/src/gcore/resources/waap/statistics.py +++ b/src/gcore/resources/waap/statistics.py @@ -8,7 +8,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -57,7 +57,7 @@ def get_usage_series( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapStatisticsSeries: """Retrieve statistics data as a time series. @@ -139,7 +139,7 @@ async def get_usage_series( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapStatisticsSeries: """Retrieve statistics data as a time series. diff --git a/src/gcore/resources/waap/tags.py b/src/gcore/resources/waap/tags.py index df171560..879f3f47 100644 --- a/src/gcore/resources/waap/tags.py +++ b/src/gcore/resources/waap/tags.py @@ -7,7 +7,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -48,19 +48,19 @@ def with_streaming_response(self) -> TagsResourceWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Optional[Literal["name", "readable_name", "reserved", "-name", "-readable_name", "-reserved"]] - | NotGiven = NOT_GIVEN, - readable_name: str | NotGiven = NOT_GIVEN, - reserved: bool | NotGiven = NOT_GIVEN, + | Omit = omit, + readable_name: str | Omit = omit, + reserved: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[WaapTag]: """ Tags are shortcuts for the rules used in WAAP policies for the creation of more @@ -134,19 +134,19 @@ def with_streaming_response(self) -> AsyncTagsResourceWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + name: str | Omit = omit, + offset: int | Omit = omit, ordering: Optional[Literal["name", "readable_name", "reserved", "-name", "-readable_name", "-reserved"]] - | NotGiven = NOT_GIVEN, - readable_name: str | NotGiven = NOT_GIVEN, - reserved: bool | NotGiven = NOT_GIVEN, + | Omit = omit, + readable_name: str | Omit = omit, + reserved: bool | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WaapTag, AsyncOffsetPage[WaapTag]]: """ Tags are shortcuts for the rules used in WAAP policies for the creation of more diff --git a/src/gcore/resources/waap/waap.py b/src/gcore/resources/waap/waap.py index 3d68c41f..d5509b5f 100644 --- a/src/gcore/resources/waap/waap.py +++ b/src/gcore/resources/waap/waap.py @@ -12,7 +12,7 @@ TagsResourceWithStreamingResponse, AsyncTagsResourceWithStreamingResponse, ) -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from .insights import ( InsightsResource, AsyncInsightsResource, @@ -143,7 +143,7 @@ def get_account_overview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return self._get( @@ -215,7 +215,7 @@ async def get_account_overview( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return await self._get( diff --git a/tests/test_transform.py b/tests/test_transform.py index a2beb233..f66c5ae2 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -8,7 +8,7 @@ import pytest -from gcore._types import NOT_GIVEN, Base64FileInput +from gcore._types import Base64FileInput, omit, not_given from gcore._utils import ( PropertyInfo, transform as _transform, @@ -450,4 +450,11 @@ async def test_transform_skipping(use_async: bool) -> None: @pytest.mark.asyncio async def test_strips_notgiven(use_async: bool) -> None: assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} - assert await transform({"foo_bar": NOT_GIVEN}, Foo1, use_async) == {} + assert await transform({"foo_bar": not_given}, Foo1, use_async) == {} + + +@parametrize +@pytest.mark.asyncio +async def test_strips_omit(use_async: bool) -> None: + assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} + assert await transform({"foo_bar": omit}, Foo1, use_async) == {} From 2a4abf1aa6f07c9c9f8d16150caed76e8e35a146 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 19 Sep 2025 16:28:08 +0100 Subject: [PATCH 06/23] chore: use Omit in more places --- .../resources/cloud/baremetal/servers.py | 60 ++++---- src/gcore/resources/cloud/floating_ips.py | 22 +-- .../gpu_baremetal_clusters.py | 26 ++-- .../cloud/gpu_baremetal_clusters/images.py | 42 +++--- .../cloud/gpu_baremetal_clusters/servers.py | 10 +- .../inference/deployments/deployments.py | 110 +++++++------- src/gcore/resources/cloud/instances/images.py | 86 +++++------ .../resources/cloud/instances/instances.py | 90 +++++------ .../resources/cloud/instances/interfaces.py | 142 +++++++++--------- .../load_balancers/l7_policies/l7_policies.py | 70 ++++----- .../cloud/load_balancers/l7_policies/rules.py | 38 ++--- .../cloud/load_balancers/listeners.py | 86 +++++------ .../cloud/load_balancers/load_balancers.py | 70 ++++----- .../cloud/load_balancers/pools/pools.py | 106 ++++++------- .../resources/cloud/networks/networks.py | 22 +-- src/gcore/resources/cloud/networks/subnets.py | 38 ++--- .../reserved_fixed_ips/reserved_fixed_ips.py | 78 +++++----- src/gcore/resources/cloud/secrets.py | 8 +- src/gcore/resources/cloud/tasks.py | 6 +- src/gcore/resources/cloud/volumes.py | 138 ++++++++--------- 20 files changed, 624 insertions(+), 624 deletions(-) diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index 195832fb..ca62957e 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -398,18 +398,18 @@ def create_and_poll( region_id: int | None = None, flavor: str, interfaces: Iterable[server_create_params.Interface], - app_config: Optional[object] | NotGiven = NOT_GIVEN, - apptemplate_id: str | NotGiven = NOT_GIVEN, - ddos_profile: server_create_params.DDOSProfile | NotGiven = NOT_GIVEN, - image_id: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - password: str | NotGiven = NOT_GIVEN, - ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - username: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + app_config: Optional[object] | Omit = omit, + apptemplate_id: str | Omit = omit, + ddos_profile: server_create_params.DDOSProfile | Omit = omit, + image_id: str | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + password: str | Omit = omit, + ssh_key_name: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + user_data: str | Omit = omit, + username: str | Omit = omit, + polling_interval_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, @@ -467,9 +467,9 @@ def rebuild_and_poll( *, project_id: int | None = None, region_id: int | None = None, - image_id: str | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + image_id: str | Omit = omit, + user_data: str | Omit = omit, + polling_interval_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, @@ -880,18 +880,18 @@ async def create_and_poll( region_id: int | None = None, flavor: str, interfaces: Iterable[server_create_params.Interface], - app_config: Optional[object] | NotGiven = NOT_GIVEN, - apptemplate_id: str | NotGiven = NOT_GIVEN, - ddos_profile: server_create_params.DDOSProfile | NotGiven = NOT_GIVEN, - image_id: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - password: str | NotGiven = NOT_GIVEN, - ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - username: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + app_config: Optional[object] | Omit = omit, + apptemplate_id: str | Omit = omit, + ddos_profile: server_create_params.DDOSProfile | Omit = omit, + image_id: str | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + password: str | Omit = omit, + ssh_key_name: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + user_data: str | Omit = omit, + username: str | Omit = omit, + polling_interval_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, @@ -949,9 +949,9 @@ async def rebuild_and_poll( *, project_id: int | None = None, region_id: int | None = None, - image_id: str | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + image_id: str | Omit = omit, + user_data: str | Omit = omit, + polling_interval_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, diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 7f00da43..46f4510e 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -6,7 +6,7 @@ import httpx -from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ..._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -434,10 +434,10 @@ def create_and_poll( *, project_id: int | None = None, region_id: int | None = None, - fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, - port_id: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + fixed_ip_address: Optional[str] | Omit = omit, + port_id: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + polling_interval_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. @@ -485,7 +485,7 @@ def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. @@ -916,10 +916,10 @@ async def create_and_poll( *, project_id: int | None = None, region_id: int | None = None, - fixed_ip_address: Optional[str] | NotGiven = NOT_GIVEN, - port_id: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + fixed_ip_address: Optional[str] | Omit = omit, + port_id: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + polling_interval_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. @@ -967,7 +967,7 @@ async def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. 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 c036650d..752eced7 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 @@ -31,7 +31,7 @@ ServersResourceWithStreamingResponse, AsyncServersResourceWithStreamingResponse, ) -from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ...._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from .interfaces import ( @@ -551,8 +551,8 @@ def create_and_poll( name: str, servers_count: int, servers_settings: gpu_baremetal_cluster_create_params.ServersSettings, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | Omit = omit, + polling_interval_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, @@ -606,9 +606,9 @@ def rebuild_and_poll( project_id: int | None = None, region_id: int | None = None, nodes: List[str], - image_id: Optional[str] | NotGiven = NOT_GIVEN, - user_data: Optional[str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + image_id: Optional[str] | Omit = omit, + user_data: Optional[str] | Omit = omit, + polling_interval_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, @@ -657,7 +657,7 @@ def resize_and_poll( project_id: int | None = None, region_id: int | None = None, instances_count: int, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, @@ -1184,8 +1184,8 @@ async def create_and_poll( name: str, servers_count: int, servers_settings: gpu_baremetal_cluster_create_params.ServersSettings, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + tags: Dict[str, str] | Omit = omit, + polling_interval_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, @@ -1239,9 +1239,9 @@ async def rebuild_and_poll( project_id: int | None = None, region_id: int | None = None, nodes: List[str], - image_id: Optional[str] | NotGiven = NOT_GIVEN, - user_data: Optional[str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + image_id: Optional[str] | Omit = omit, + user_data: Optional[str] | Omit = omit, + polling_interval_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, @@ -1290,7 +1290,7 @@ async def resize_and_poll( project_id: int | None = None, region_id: int | None = None, instances_count: int, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index 834ed8cc..7b550f98 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -7,7 +7,7 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._types import NOT_GIVEN, 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 @@ -137,7 +137,7 @@ def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, @@ -309,15 +309,15 @@ def upload_and_poll( region_id: int | None = None, name: str, url: str, - architecture: Optional[Literal["aarch64", "x86_64"]] | NotGiven = NOT_GIVEN, - cow_format: bool | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - os_distro: Optional[str] | NotGiven = NOT_GIVEN, - os_type: Optional[Literal["linux", "windows"]] | NotGiven = NOT_GIVEN, - os_version: Optional[str] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + architecture: Optional[Literal["aarch64", "x86_64"]] | Omit = omit, + cow_format: bool | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + os_distro: Optional[str] | Omit = omit, + os_type: Optional[Literal["linux", "windows"]] | Omit = omit, + os_version: Optional[str] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + polling_interval_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, @@ -480,7 +480,7 @@ async def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, @@ -652,15 +652,15 @@ async def upload_and_poll( region_id: int | None = None, name: str, url: str, - architecture: Optional[Literal["aarch64", "x86_64"]] | NotGiven = NOT_GIVEN, - cow_format: bool | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - os_distro: Optional[str] | NotGiven = NOT_GIVEN, - os_type: Optional[Literal["linux", "windows"]] | NotGiven = NOT_GIVEN, - os_version: Optional[str] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + architecture: Optional[Literal["aarch64", "x86_64"]] | Omit = omit, + cow_format: bool | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + os_distro: Optional[str] | Omit = omit, + os_type: Optional[Literal["linux", "windows"]] | Omit = omit, + os_version: Optional[str] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + polling_interval_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, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index d3249b07..cdbce6a7 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -8,7 +8,7 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ...._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -227,8 +227,8 @@ def delete_and_poll( project_id: int | None = None, region_id: int | None = None, cluster_id: str, - delete_floatings: bool | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + delete_floatings: bool | Omit = omit, + polling_interval_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, @@ -874,8 +874,8 @@ async def delete_and_poll( project_id: int | None = None, region_id: int | None = None, cluster_id: str, - delete_floatings: bool | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + delete_floatings: bool | Omit = omit, + polling_interval_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, diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 889ebf69..40f311ba 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -15,7 +15,7 @@ LogsResourceWithStreamingResponse, AsyncLogsResourceWithStreamingResponse, ) -from ....._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given +from ....._types import NOT_GIVEN, Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -569,17 +569,17 @@ def create_and_poll( image: str, listening_port: int, name: str, - api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - auth_enabled: bool | NotGiven = NOT_GIVEN, - command: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - credentials_name: Optional[str] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - envs: Dict[str, str] | NotGiven = NOT_GIVEN, - ingress_opts: Optional[deployment_create_params.IngressOpts] | NotGiven = NOT_GIVEN, - logging: Optional[deployment_create_params.Logging] | NotGiven = NOT_GIVEN, - probes: Optional[deployment_create_params.Probes] | NotGiven = NOT_GIVEN, - api_timeout: Optional[int] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | Omit = omit, + auth_enabled: bool | Omit = omit, + command: Optional[SequenceNotStr[str]] | Omit = omit, + credentials_name: Optional[str] | Omit = omit, + description: Optional[str] | Omit = omit, + envs: Dict[str, str] | Omit = omit, + ingress_opts: Optional[deployment_create_params.IngressOpts] | Omit = omit, + logging: Optional[deployment_create_params.Logging] | Omit = omit, + probes: Optional[deployment_create_params.Probes] | Omit = omit, + api_timeout: Optional[int] | Omit = omit, + polling_interval_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. @@ -634,21 +634,21 @@ def update_and_poll( deployment_name: str, *, project_id: int | None = None, - api_keys: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - auth_enabled: bool | NotGiven = NOT_GIVEN, - command: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN, - credentials_name: Optional[str] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - flavor_name: str | NotGiven = NOT_GIVEN, - image: Optional[str] | NotGiven = NOT_GIVEN, - ingress_opts: Optional[deployment_update_params.IngressOpts] | NotGiven = NOT_GIVEN, - listening_port: Optional[int] | NotGiven = NOT_GIVEN, - logging: Optional[deployment_update_params.Logging] | NotGiven = NOT_GIVEN, - probes: Optional[deployment_update_params.Probes] | NotGiven = NOT_GIVEN, - api_timeout: Optional[int] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + api_keys: Optional[SequenceNotStr[str]] | Omit = omit, + auth_enabled: bool | Omit = omit, + command: Optional[SequenceNotStr[str]] | Omit = omit, + containers: Optional[Iterable[deployment_update_params.Container]] | Omit = omit, + credentials_name: Optional[str] | Omit = omit, + description: Optional[str] | Omit = omit, + envs: Optional[Dict[str, str]] | Omit = omit, + flavor_name: str | Omit = omit, + image: Optional[str] | Omit = omit, + ingress_opts: Optional[deployment_update_params.IngressOpts] | Omit = omit, + listening_port: Optional[int] | Omit = omit, + logging: Optional[deployment_update_params.Logging] | Omit = omit, + probes: Optional[deployment_update_params.Probes] | Omit = omit, + api_timeout: Optional[int] | Omit = omit, + polling_interval_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. @@ -700,7 +700,7 @@ def delete_and_poll( deployment_name: str, *, project_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. @@ -1262,17 +1262,17 @@ async def create_and_poll( image: str, listening_port: int, name: str, - api_keys: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - auth_enabled: bool | NotGiven = NOT_GIVEN, - command: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - credentials_name: Optional[str] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - envs: Dict[str, str] | NotGiven = NOT_GIVEN, - ingress_opts: Optional[deployment_create_params.IngressOpts] | NotGiven = NOT_GIVEN, - logging: Optional[deployment_create_params.Logging] | NotGiven = NOT_GIVEN, - probes: Optional[deployment_create_params.Probes] | NotGiven = NOT_GIVEN, - api_timeout: Optional[int] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + api_keys: SequenceNotStr[str] | Omit = omit, + auth_enabled: bool | Omit = omit, + command: Optional[SequenceNotStr[str]] | Omit = omit, + credentials_name: Optional[str] | Omit = omit, + description: Optional[str] | Omit = omit, + envs: Dict[str, str] | Omit = omit, + ingress_opts: Optional[deployment_create_params.IngressOpts] | Omit = omit, + logging: Optional[deployment_create_params.Logging] | Omit = omit, + probes: Optional[deployment_create_params.Probes] | Omit = omit, + api_timeout: Optional[int] | Omit = omit, + polling_interval_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. @@ -1327,21 +1327,21 @@ async def update_and_poll( deployment_name: str, *, project_id: int | None = None, - api_keys: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - auth_enabled: bool | NotGiven = NOT_GIVEN, - command: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN, - credentials_name: Optional[str] | NotGiven = NOT_GIVEN, - description: Optional[str] | NotGiven = NOT_GIVEN, - envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - flavor_name: str | NotGiven = NOT_GIVEN, - image: Optional[str] | NotGiven = NOT_GIVEN, - ingress_opts: Optional[deployment_update_params.IngressOpts] | NotGiven = NOT_GIVEN, - listening_port: Optional[int] | NotGiven = NOT_GIVEN, - logging: Optional[deployment_update_params.Logging] | NotGiven = NOT_GIVEN, - probes: Optional[deployment_update_params.Probes] | NotGiven = NOT_GIVEN, - api_timeout: Optional[int] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + api_keys: Optional[SequenceNotStr[str]] | Omit = omit, + auth_enabled: bool | Omit = omit, + command: Optional[SequenceNotStr[str]] | Omit = omit, + containers: Optional[Iterable[deployment_update_params.Container]] | Omit = omit, + credentials_name: Optional[str] | Omit = omit, + description: Optional[str] | Omit = omit, + envs: Optional[Dict[str, str]] | Omit = omit, + flavor_name: str | Omit = omit, + image: Optional[str] | Omit = omit, + ingress_opts: Optional[deployment_update_params.IngressOpts] | Omit = omit, + listening_port: Optional[int] | Omit = omit, + logging: Optional[deployment_update_params.Logging] | Omit = omit, + probes: Optional[deployment_update_params.Probes] | Omit = omit, + api_timeout: Optional[int] | Omit = omit, + polling_interval_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. @@ -1393,7 +1393,7 @@ async def delete_and_poll( deployment_name: str, *, project_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index 341ecc47..e863821c 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -7,7 +7,7 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ...._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -243,7 +243,7 @@ def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, @@ -365,15 +365,15 @@ def create_from_volume_and_poll( region_id: int | None = None, name: str, volume_id: str, - architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN, - is_baremetal: bool | NotGiven = NOT_GIVEN, - os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - source: Literal["volume"] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + architecture: Literal["aarch64", "x86_64"] | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + hw_machine_type: Optional[Literal["pc", "q35"]] | Omit = omit, + is_baremetal: bool | Omit = omit, + os_type: Literal["linux", "windows"] | Omit = omit, + source: Literal["volume"] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + polling_interval_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, @@ -567,17 +567,17 @@ def upload_and_poll( region_id: int | None = None, name: str, url: str, - architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, - cow_format: bool | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN, - is_baremetal: bool | NotGiven = NOT_GIVEN, - os_distro: Optional[str] | NotGiven = NOT_GIVEN, - os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - os_version: Optional[str] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + architecture: Literal["aarch64", "x86_64"] | Omit = omit, + cow_format: bool | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + hw_machine_type: Optional[Literal["pc", "q35"]] | Omit = omit, + is_baremetal: bool | Omit = omit, + os_distro: Optional[str] | Omit = omit, + os_type: Literal["linux", "windows"] | Omit = omit, + os_version: Optional[str] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + polling_interval_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, @@ -835,7 +835,7 @@ async def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, @@ -957,15 +957,15 @@ async def create_from_volume_and_poll( region_id: int | None = None, name: str, volume_id: str, - architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN, - is_baremetal: bool | NotGiven = NOT_GIVEN, - os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - source: Literal["volume"] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + architecture: Literal["aarch64", "x86_64"] | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + hw_machine_type: Optional[Literal["pc", "q35"]] | Omit = omit, + is_baremetal: bool | Omit = omit, + os_type: Literal["linux", "windows"] | Omit = omit, + source: Literal["volume"] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + polling_interval_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, @@ -1159,17 +1159,17 @@ async def upload_and_poll( region_id: int | None = None, name: str, url: str, - architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN, - cow_format: bool | NotGiven = NOT_GIVEN, - hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN, - hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN, - is_baremetal: bool | NotGiven = NOT_GIVEN, - os_distro: Optional[str] | NotGiven = NOT_GIVEN, - os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN, - os_version: Optional[str] | NotGiven = NOT_GIVEN, - ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + architecture: Literal["aarch64", "x86_64"] | Omit = omit, + cow_format: bool | Omit = omit, + hw_firmware_type: Optional[Literal["bios", "uefi"]] | Omit = omit, + hw_machine_type: Optional[Literal["pc", "q35"]] | Omit = omit, + is_baremetal: bool | Omit = omit, + os_distro: Optional[str] | Omit = omit, + os_type: Literal["linux", "windows"] | Omit = omit, + os_version: Optional[str] | Omit = omit, + ssh_key: Literal["allow", "deny", "required"] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + polling_interval_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, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 01bc8444..91d99fcd 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -32,7 +32,7 @@ MetricsResourceWithStreamingResponse, AsyncMetricsResourceWithStreamingResponse, ) -from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given +from ...._types import NOT_GIVEN, Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ...._utils import required_args, maybe_transform, async_maybe_transform from ...._compat import cached_property from .interfaces import ( @@ -262,18 +262,18 @@ def create_and_poll( flavor: str, interfaces: Iterable[instance_create_params.Interface], volumes: Iterable[instance_create_params.Volume], - allow_app_ports: bool | NotGiven = NOT_GIVEN, - configuration: Optional[object] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - password: str | NotGiven = NOT_GIVEN, - security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, - servergroup_id: str | NotGiven = NOT_GIVEN, - ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - username: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + allow_app_ports: bool | Omit = omit, + configuration: Optional[object] | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + password: str | Omit = omit, + security_groups: Iterable[instance_create_params.SecurityGroup] | Omit = omit, + servergroup_id: str | Omit = omit, + ssh_key_name: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + user_data: str | Omit = omit, + username: str | Omit = omit, + polling_interval_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, @@ -633,11 +633,11 @@ def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - delete_floatings: bool | NotGiven = NOT_GIVEN, - floatings: str | NotGiven = NOT_GIVEN, - reserved_fixed_ips: str | NotGiven = NOT_GIVEN, - volumes: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + delete_floatings: bool | Omit = omit, + floatings: str | Omit = omit, + reserved_fixed_ips: str | Omit = omit, + volumes: str | Omit = omit, + polling_interval_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, @@ -781,7 +781,7 @@ def action_and_poll( project_id: int | None = None, region_id: int | None = None, action: Literal["start"], - activate_profile: Optional[bool] | NotGiven = NOT_GIVEN, + activate_profile: Optional[bool] | 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, @@ -848,7 +848,7 @@ def action_and_poll( project_id: int | None = None, region_id: int | None = None, action: Literal["start", "reboot", "reboot_hard", "resume", "stop", "suspend"], - activate_profile: Optional[bool] | NotGiven = NOT_GIVEN, + activate_profile: Optional[bool] | 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, @@ -947,7 +947,7 @@ def add_to_placement_group_and_poll( project_id: int | None = None, region_id: int | None = None, servergroup_id: str, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, @@ -1265,7 +1265,7 @@ def remove_from_placement_group_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, @@ -1349,7 +1349,7 @@ def resize_and_poll( project_id: int | None = None, region_id: int | None = None, flavor_id: str, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, @@ -1631,18 +1631,18 @@ async def create_and_poll( flavor: str, interfaces: Iterable[instance_create_params.Interface], volumes: Iterable[instance_create_params.Volume], - allow_app_ports: bool | NotGiven = NOT_GIVEN, - configuration: Optional[object] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - password: str | NotGiven = NOT_GIVEN, - security_groups: Iterable[instance_create_params.SecurityGroup] | NotGiven = NOT_GIVEN, - servergroup_id: str | NotGiven = NOT_GIVEN, - ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - user_data: str | NotGiven = NOT_GIVEN, - username: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + allow_app_ports: bool | Omit = omit, + configuration: Optional[object] | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + password: str | Omit = omit, + security_groups: Iterable[instance_create_params.SecurityGroup] | Omit = omit, + servergroup_id: str | Omit = omit, + ssh_key_name: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + user_data: str | Omit = omit, + username: str | Omit = omit, + polling_interval_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, @@ -2002,11 +2002,11 @@ async def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - delete_floatings: bool | NotGiven = NOT_GIVEN, - floatings: str | NotGiven = NOT_GIVEN, - reserved_fixed_ips: str | NotGiven = NOT_GIVEN, - volumes: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + delete_floatings: bool | Omit = omit, + floatings: str | Omit = omit, + reserved_fixed_ips: str | Omit = omit, + volumes: str | Omit = omit, + polling_interval_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, @@ -2150,7 +2150,7 @@ async def action_and_poll( project_id: int | None = None, region_id: int | None = None, action: Literal["start"], - activate_profile: Optional[bool] | NotGiven = NOT_GIVEN, + activate_profile: Optional[bool] | 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, @@ -2217,7 +2217,7 @@ async def action_and_poll( project_id: int | None = None, region_id: int | None = None, action: Literal["start", "reboot", "reboot_hard", "resume", "stop", "suspend"], - activate_profile: Optional[bool] | NotGiven = NOT_GIVEN, + activate_profile: Optional[bool] | 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, @@ -2316,7 +2316,7 @@ async def add_to_placement_group_and_poll( project_id: int | None = None, region_id: int | None = None, servergroup_id: str, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, @@ -2634,7 +2634,7 @@ async def remove_from_placement_group_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, @@ -2718,7 +2718,7 @@ async def resize_and_poll( project_id: int | None = None, region_id: int | None = None, flavor_id: str, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index fb39a7fc..8336732b 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -7,7 +7,7 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._types import NOT_GIVEN, 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 @@ -338,13 +338,13 @@ def attach_and_poll( project_id: int | None = None, region_id: int | None = None, ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -386,12 +386,12 @@ def attach_and_poll( project_id: int | None = None, region_id: int | None = None, subnet_id: str, - ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -433,13 +433,13 @@ def attach_and_poll( project_id: int | None = None, region_id: int | None = None, network_id: str, - ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -483,12 +483,12 @@ def attach_and_poll( project_id: int | None = None, region_id: int | None = None, port_id: str, - ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -529,17 +529,17 @@ def attach_and_poll( project_id: int | None = None, region_id: int | None = None, ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - subnet_id: str | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - port_id: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + port_id: str | Omit = omit, + polling_interval_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, @@ -591,7 +591,7 @@ def detach_and_poll( region_id: int | None = None, ip_address: str, port_id: str, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, @@ -989,14 +989,14 @@ async def attach_and_poll( project_id: int | None = None, region_id: int | None = None, ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, + polling_interval_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, @@ -1018,13 +1018,13 @@ async def attach_and_poll( project_id: int | None = None, region_id: int | None = None, subnet_id: str, - ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceSpecificSubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceSpecificSubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, + polling_interval_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, @@ -1046,14 +1046,14 @@ async def attach_and_poll( project_id: int | None = None, region_id: int | None = None, network_id: str, - ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceAnySubnetSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceAnySubnetSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, + polling_interval_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, @@ -1075,13 +1075,13 @@ async def attach_and_poll( project_id: int | None = None, region_id: int | None = None, port_id: str, - ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + ddos_profile: interface_attach_params.NewInterfaceReservedFixedIPSchemaDDOSProfile | Omit = omit, + interface_name: str | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceReservedFixedIPSchemaSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, + polling_interval_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, @@ -1102,17 +1102,17 @@ async def attach_and_poll( project_id: int | None = None, region_id: int | None = None, ddos_profile: interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile - | NotGiven = NOT_GIVEN, - interface_name: str | NotGiven = NOT_GIVEN, - ip_family: Literal["dual", "ipv4", "ipv6"] | NotGiven = NOT_GIVEN, - port_group: int | NotGiven = NOT_GIVEN, + | Omit = omit, + interface_name: str | Omit = omit, + ip_family: Literal["dual", "ipv4", "ipv6"] | Omit = omit, + port_group: int | Omit = omit, security_groups: Iterable[interface_attach_params.NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup] - | NotGiven = NOT_GIVEN, - type: str | NotGiven = NOT_GIVEN, - subnet_id: str | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - port_id: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + | Omit = omit, + type: str | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + port_id: str | Omit = omit, + polling_interval_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, @@ -1164,7 +1164,7 @@ async def detach_and_poll( region_id: int | None = None, ip_address: str, port_id: str, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, 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 595113f4..135534b2 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 @@ -14,7 +14,7 @@ RulesResourceWithStreamingResponse, AsyncRulesResourceWithStreamingResponse, ) -from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ....._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -341,14 +341,14 @@ def create_and_poll( region_id: int | None = None, action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], listener_id: str, - name: str | NotGiven = NOT_GIVEN, - position: int | NotGiven = NOT_GIVEN, - redirect_http_code: int | NotGiven = NOT_GIVEN, - redirect_pool_id: str | NotGiven = NOT_GIVEN, - redirect_prefix: str | NotGiven = NOT_GIVEN, - redirect_url: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | Omit = omit, + redirect_pool_id: str | Omit = omit, + redirect_prefix: str | Omit = omit, + redirect_url: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, + polling_interval_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. @@ -400,7 +400,7 @@ def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. @@ -432,14 +432,14 @@ def replace_and_poll( project_id: int | None = None, region_id: int | None = None, action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], - name: str | NotGiven = NOT_GIVEN, - position: int | NotGiven = NOT_GIVEN, - redirect_http_code: int | NotGiven = NOT_GIVEN, - redirect_pool_id: str | NotGiven = NOT_GIVEN, - redirect_prefix: str | NotGiven = NOT_GIVEN, - redirect_url: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | Omit = omit, + redirect_pool_id: str | Omit = omit, + redirect_prefix: str | Omit = omit, + redirect_url: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, + polling_interval_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. @@ -788,14 +788,14 @@ async def create_and_poll( region_id: int | None = None, action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], listener_id: str, - name: str | NotGiven = NOT_GIVEN, - position: int | NotGiven = NOT_GIVEN, - redirect_http_code: int | NotGiven = NOT_GIVEN, - redirect_pool_id: str | NotGiven = NOT_GIVEN, - redirect_prefix: str | NotGiven = NOT_GIVEN, - redirect_url: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | Omit = omit, + redirect_pool_id: str | Omit = omit, + redirect_prefix: str | Omit = omit, + redirect_url: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, + polling_interval_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. @@ -847,7 +847,7 @@ async def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. @@ -879,14 +879,14 @@ async def replace_and_poll( project_id: int | None = None, region_id: int | None = None, action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"], - name: str | NotGiven = NOT_GIVEN, - position: int | NotGiven = NOT_GIVEN, - redirect_http_code: int | NotGiven = NOT_GIVEN, - redirect_pool_id: str | NotGiven = NOT_GIVEN, - redirect_prefix: str | NotGiven = NOT_GIVEN, - redirect_url: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | Omit = omit, + redirect_pool_id: str | Omit = omit, + redirect_prefix: str | Omit = omit, + redirect_url: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, + polling_interval_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. 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 cbae12d9..023faf7a 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -6,7 +6,7 @@ import httpx -from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ....._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ....._utils import maybe_transform, async_maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -348,10 +348,10 @@ def create_and_poll( "SSL_VERIFY_RESULT", ], value: str, - invert: bool | NotGiven = NOT_GIVEN, - key: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + invert: bool | Omit = omit, + key: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, + polling_interval_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. @@ -399,7 +399,7 @@ def delete_and_poll( project_id: int | None = None, region_id: int | None = None, l7policy_id: str, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. @@ -447,10 +447,10 @@ def replace_and_poll( "SSL_VERIFY_RESULT", ], value: str, - invert: bool | NotGiven = NOT_GIVEN, - key: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + invert: bool | Omit = omit, + key: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, + polling_interval_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. @@ -817,10 +817,10 @@ async def create_and_poll( "SSL_VERIFY_RESULT", ], value: str, - invert: bool | NotGiven = NOT_GIVEN, - key: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + invert: bool | Omit = omit, + key: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, + polling_interval_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. @@ -868,7 +868,7 @@ async def delete_and_poll( project_id: int | None = None, region_id: int | None = None, l7policy_id: str, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. @@ -916,10 +916,10 @@ async def replace_and_poll( "SSL_VERIFY_RESULT", ], value: str, - invert: bool | NotGiven = NOT_GIVEN, - key: str | NotGiven = NOT_GIVEN, - tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + invert: bool | Omit = omit, + key: str | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, + polling_interval_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. diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index 84de9e4d..dff543de 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -6,7 +6,7 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ...._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -402,16 +402,16 @@ def create_and_poll( name: str, protocol: LbListenerProtocol, protocol_port: int, - allowed_cidrs: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - connection_limit: int | NotGiven = NOT_GIVEN, - insert_x_forwarded: bool | NotGiven = NOT_GIVEN, - secret_id: str | NotGiven = NOT_GIVEN, - sni_secret_id: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, - user_list: Iterable[listener_create_params.UserList] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, + connection_limit: int | Omit = omit, + insert_x_forwarded: bool | Omit = omit, + secret_id: str | Omit = omit, + sni_secret_id: SequenceNotStr[str] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, + user_list: Iterable[listener_create_params.UserList] | Omit = omit, + polling_interval_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. @@ -467,7 +467,7 @@ def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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,16 +501,16 @@ def update_and_poll( *, project_id: int | None = None, region_id: int | None = None, - allowed_cidrs: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - connection_limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - sni_secret_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, - user_list: Optional[Iterable[listener_update_params.UserList]] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, + connection_limit: int | Omit = omit, + name: str | Omit = omit, + secret_id: Optional[str] | Omit = omit, + sni_secret_id: Optional[SequenceNotStr[str]] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, + user_list: Optional[Iterable[listener_update_params.UserList]] | Omit = omit, + polling_interval_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. @@ -925,16 +925,16 @@ async def create_and_poll( name: str, protocol: LbListenerProtocol, protocol_port: int, - allowed_cidrs: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - connection_limit: int | NotGiven = NOT_GIVEN, - insert_x_forwarded: bool | NotGiven = NOT_GIVEN, - secret_id: str | NotGiven = NOT_GIVEN, - sni_secret_id: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, - user_list: Iterable[listener_create_params.UserList] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, + connection_limit: int | Omit = omit, + insert_x_forwarded: bool | Omit = omit, + secret_id: str | Omit = omit, + sni_secret_id: SequenceNotStr[str] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, + user_list: Iterable[listener_create_params.UserList] | Omit = omit, + polling_interval_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. @@ -990,7 +990,7 @@ async def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. @@ -1024,16 +1024,16 @@ async def update_and_poll( *, project_id: int | None = None, region_id: int | None = None, - allowed_cidrs: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - connection_limit: int | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - sni_secret_id: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, - user_list: Optional[Iterable[listener_update_params.UserList]] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + allowed_cidrs: Optional[SequenceNotStr[str]] | Omit = omit, + connection_limit: int | Omit = omit, + name: str | Omit = omit, + secret_id: Optional[str] | Omit = omit, + sni_secret_id: Optional[SequenceNotStr[str]] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, + user_list: Optional[Iterable[listener_update_params.UserList]] | Omit = omit, + polling_interval_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. diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index a8031808..799c335f 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -30,7 +30,7 @@ StatusesResourceWithStreamingResponse, AsyncStatusesResourceWithStreamingResponse, ) -from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ...._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from .listeners import ( ListenersResource, @@ -586,19 +586,19 @@ def create_and_poll( *, project_id: int | None = None, region_id: int | None = None, - flavor: str | NotGiven = NOT_GIVEN, - floating_ip: load_balancer_create_params.FloatingIP | NotGiven = NOT_GIVEN, - listeners: Iterable[load_balancer_create_params.Listener] | NotGiven = NOT_GIVEN, - logging: load_balancer_create_params.Logging | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - vip_ip_family: InterfaceIPFamily | NotGiven = NOT_GIVEN, - vip_network_id: str | NotGiven = NOT_GIVEN, - vip_port_id: str | NotGiven = NOT_GIVEN, - vip_subnet_id: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + flavor: str | Omit = omit, + floating_ip: load_balancer_create_params.FloatingIP | Omit = omit, + listeners: Iterable[load_balancer_create_params.Listener] | Omit = omit, + logging: load_balancer_create_params.Logging | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, + tags: Dict[str, str] | Omit = omit, + vip_ip_family: InterfaceIPFamily | Omit = omit, + vip_network_id: str | Omit = omit, + vip_port_id: str | Omit = omit, + vip_subnet_id: str | Omit = omit, + polling_interval_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. @@ -653,7 +653,7 @@ def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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,8 +687,8 @@ def failover_and_poll( *, project_id: int | None = None, region_id: int | None = None, - force: bool | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + force: bool | Omit = omit, + polling_interval_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. @@ -731,7 +731,7 @@ def resize_and_poll( project_id: int | None = None, region_id: int | None = None, flavor: str, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. @@ -1271,19 +1271,19 @@ async def create_and_poll( *, project_id: int | None = None, region_id: int | None = None, - flavor: str | NotGiven = NOT_GIVEN, - floating_ip: load_balancer_create_params.FloatingIP | NotGiven = NOT_GIVEN, - listeners: Iterable[load_balancer_create_params.Listener] | NotGiven = NOT_GIVEN, - logging: load_balancer_create_params.Logging | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - name_template: str | NotGiven = NOT_GIVEN, - preferred_connectivity: LoadBalancerMemberConnectivity | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - vip_ip_family: InterfaceIPFamily | NotGiven = NOT_GIVEN, - vip_network_id: str | NotGiven = NOT_GIVEN, - vip_port_id: str | NotGiven = NOT_GIVEN, - vip_subnet_id: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + flavor: str | Omit = omit, + floating_ip: load_balancer_create_params.FloatingIP | Omit = omit, + listeners: Iterable[load_balancer_create_params.Listener] | Omit = omit, + logging: load_balancer_create_params.Logging | Omit = omit, + name: str | Omit = omit, + name_template: str | Omit = omit, + preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit, + tags: Dict[str, str] | Omit = omit, + vip_ip_family: InterfaceIPFamily | Omit = omit, + vip_network_id: str | Omit = omit, + vip_port_id: str | Omit = omit, + vip_subnet_id: str | Omit = omit, + polling_interval_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. @@ -1338,7 +1338,7 @@ async def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. @@ -1372,8 +1372,8 @@ async def failover_and_poll( *, project_id: int | None = None, region_id: int | None = None, - force: bool | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + force: bool | Omit = omit, + polling_interval_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. @@ -1416,7 +1416,7 @@ async def resize_and_poll( project_id: int | None = None, region_id: int | None = None, flavor: str, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 387b4b18..bfeeeb9f 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -14,7 +14,7 @@ MembersResourceWithStreamingResponse, AsyncMembersResourceWithStreamingResponse, ) -from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ....._types import NOT_GIVEN, 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 @@ -444,18 +444,18 @@ def create_and_poll( lb_algorithm: LbAlgorithm, name: str, protocol: LbPoolProtocol, - ca_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - crl_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - healthmonitor: Optional[pool_create_params.Healthmonitor] | NotGiven = NOT_GIVEN, - listener_id: Optional[str] | NotGiven = NOT_GIVEN, - loadbalancer_id: Optional[str] | NotGiven = NOT_GIVEN, - members: Optional[Iterable[pool_create_params.Member]] | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - session_persistence: Optional[pool_create_params.SessionPersistence] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + ca_secret_id: Optional[str] | Omit = omit, + crl_secret_id: Optional[str] | Omit = omit, + healthmonitor: Optional[pool_create_params.Healthmonitor] | Omit = omit, + listener_id: Optional[str] | Omit = omit, + loadbalancer_id: Optional[str] | Omit = omit, + members: Optional[Iterable[pool_create_params.Member]] | Omit = omit, + secret_id: Optional[str] | Omit = omit, + session_persistence: Optional[pool_create_params.SessionPersistence] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, + polling_interval_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. @@ -508,7 +508,7 @@ def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. @@ -542,19 +542,19 @@ def update_and_poll( *, project_id: int | None = None, region_id: int | None = None, - ca_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - crl_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - healthmonitor: Optional[pool_update_params.Healthmonitor] | NotGiven = NOT_GIVEN, - lb_algorithm: LbAlgorithm | NotGiven = NOT_GIVEN, - members: Optional[Iterable[pool_update_params.Member]] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - protocol: LbPoolProtocol | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - session_persistence: Optional[pool_update_params.SessionPersistence] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + ca_secret_id: Optional[str] | Omit = omit, + crl_secret_id: Optional[str] | Omit = omit, + healthmonitor: Optional[pool_update_params.Healthmonitor] | Omit = omit, + lb_algorithm: LbAlgorithm | Omit = omit, + members: Optional[Iterable[pool_update_params.Member]] | Omit = omit, + name: str | Omit = omit, + protocol: LbPoolProtocol | Omit = omit, + secret_id: Optional[str] | Omit = omit, + session_persistence: Optional[pool_update_params.SessionPersistence] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, + polling_interval_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. @@ -1002,18 +1002,18 @@ async def create_and_poll( lb_algorithm: LbAlgorithm, name: str, protocol: LbPoolProtocol, - ca_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - crl_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - healthmonitor: Optional[pool_create_params.Healthmonitor] | NotGiven = NOT_GIVEN, - listener_id: Optional[str] | NotGiven = NOT_GIVEN, - loadbalancer_id: Optional[str] | NotGiven = NOT_GIVEN, - members: Optional[Iterable[pool_create_params.Member]] | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - session_persistence: Optional[pool_create_params.SessionPersistence] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + ca_secret_id: Optional[str] | Omit = omit, + crl_secret_id: Optional[str] | Omit = omit, + healthmonitor: Optional[pool_create_params.Healthmonitor] | Omit = omit, + listener_id: Optional[str] | Omit = omit, + loadbalancer_id: Optional[str] | Omit = omit, + members: Optional[Iterable[pool_create_params.Member]] | Omit = omit, + secret_id: Optional[str] | Omit = omit, + session_persistence: Optional[pool_create_params.SessionPersistence] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, + polling_interval_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. @@ -1066,7 +1066,7 @@ async def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. @@ -1100,19 +1100,19 @@ async def update_and_poll( *, project_id: int | None = None, region_id: int | None = None, - ca_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - crl_secret_id: Optional[str] | NotGiven = NOT_GIVEN, - healthmonitor: Optional[pool_update_params.Healthmonitor] | NotGiven = NOT_GIVEN, - lb_algorithm: LbAlgorithm | NotGiven = NOT_GIVEN, - members: Optional[Iterable[pool_update_params.Member]] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - protocol: LbPoolProtocol | NotGiven = NOT_GIVEN, - secret_id: Optional[str] | NotGiven = NOT_GIVEN, - session_persistence: Optional[pool_update_params.SessionPersistence] | NotGiven = NOT_GIVEN, - timeout_client_data: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_connect: Optional[int] | NotGiven = NOT_GIVEN, - timeout_member_data: Optional[int] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + ca_secret_id: Optional[str] | Omit = omit, + crl_secret_id: Optional[str] | Omit = omit, + healthmonitor: Optional[pool_update_params.Healthmonitor] | Omit = omit, + lb_algorithm: LbAlgorithm | Omit = omit, + members: Optional[Iterable[pool_update_params.Member]] | Omit = omit, + name: str | Omit = omit, + protocol: LbPoolProtocol | Omit = omit, + secret_id: Optional[str] | Omit = omit, + session_persistence: Optional[pool_update_params.SessionPersistence] | Omit = omit, + timeout_client_data: Optional[int] | Omit = omit, + timeout_member_connect: Optional[int] | Omit = omit, + timeout_member_data: Optional[int] | Omit = omit, + polling_interval_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. diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index da98158e..92cc45e6 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -23,7 +23,7 @@ SubnetsResourceWithStreamingResponse, AsyncSubnetsResourceWithStreamingResponse, ) -from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ...._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -142,10 +142,10 @@ def create_and_poll( project_id: int | None = None, region_id: int | None = None, name: str, - create_router: bool | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type: Literal["vlan", "vxlan"] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + create_router: bool | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type: Literal["vlan", "vxlan"] | Omit = omit, + polling_interval_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, @@ -391,7 +391,7 @@ def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, @@ -562,10 +562,10 @@ async def create_and_poll( project_id: int | None = None, region_id: int | None = None, name: str, - create_router: bool | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - type: Literal["vlan", "vxlan"] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + create_router: bool | Omit = omit, + tags: Dict[str, str] | Omit = omit, + type: Literal["vlan", "vxlan"] | Omit = omit, + polling_interval_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, @@ -811,7 +811,7 @@ async def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index 12f04056..a1b237aa 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -7,7 +7,7 @@ import httpx -from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given +from ...._types import NOT_GIVEN, Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -156,15 +156,15 @@ def create_and_poll( cidr: str, name: str, network_id: str, - connect_to_network_router: bool | NotGiven = NOT_GIVEN, - dns_nameservers: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - enable_dhcp: bool | NotGiven = NOT_GIVEN, - gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, - ip_version: IPVersion | NotGiven = NOT_GIVEN, - router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + connect_to_network_router: bool | Omit = omit, + dns_nameservers: Optional[SequenceNotStr[str]] | Omit = omit, + enable_dhcp: bool | Omit = omit, + gateway_ip: Optional[str] | Omit = omit, + host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | Omit = omit, + ip_version: IPVersion | Omit = omit, + router_id_to_connect: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + polling_interval_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, @@ -612,15 +612,15 @@ async def create_and_poll( cidr: str, name: str, network_id: str, - connect_to_network_router: bool | NotGiven = NOT_GIVEN, - dns_nameservers: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - enable_dhcp: bool | NotGiven = NOT_GIVEN, - gateway_ip: Optional[str] | NotGiven = NOT_GIVEN, - host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | NotGiven = NOT_GIVEN, - ip_version: IPVersion | NotGiven = NOT_GIVEN, - router_id_to_connect: Optional[str] | NotGiven = NOT_GIVEN, - tags: Dict[str, str] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + connect_to_network_router: bool | Omit = omit, + dns_nameservers: Optional[SequenceNotStr[str]] | Omit = omit, + enable_dhcp: bool | Omit = omit, + gateway_ip: Optional[str] | Omit = omit, + host_routes: Optional[Iterable[subnet_create_params.HostRoute]] | Omit = omit, + ip_version: IPVersion | Omit = omit, + router_id_to_connect: Optional[str] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + polling_interval_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, 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 19bdb0c4..beacc819 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 @@ -15,7 +15,7 @@ VipResourceWithStreamingResponse, AsyncVipResourceWithStreamingResponse, ) -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import required_args, maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -462,9 +462,9 @@ def create_and_poll( project_id: int | None = None, region_id: int | None = None, type: Literal["external"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | Omit = omit, + polling_interval_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. @@ -500,8 +500,8 @@ def create_and_poll( region_id: int | None = None, subnet_id: str, type: Literal["subnet"], - is_vip: bool | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + is_vip: bool | Omit = omit, + polling_interval_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,9 +537,9 @@ def create_and_poll( region_id: int | None = None, network_id: str, type: Literal["any_subnet"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | Omit = omit, + polling_interval_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. @@ -578,8 +578,8 @@ def create_and_poll( ip_address: str, network_id: str, type: Literal["ip_address"], - is_vip: bool | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + is_vip: bool | Omit = omit, + polling_interval_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. @@ -617,7 +617,7 @@ def create_and_poll( region_id: int | None = None, port_id: str, type: Literal["port"], - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. @@ -657,13 +657,13 @@ def create_and_poll( project_id: int | None = None, region_id: int | None = None, type: Literal["external"] | Literal["subnet"] | Literal["any_subnet"] | Literal["ip_address"] | Literal["port"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, - subnet_id: str | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - port_id: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + ip_address: str | Omit = omit, + port_id: str | Omit = omit, + polling_interval_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. @@ -719,7 +719,7 @@ def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. @@ -1175,9 +1175,9 @@ async def create_and_poll( project_id: int | None = None, region_id: int | None = None, type: Literal["external"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | Omit = omit, + polling_interval_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. @@ -1213,8 +1213,8 @@ async def create_and_poll( region_id: int | None = None, subnet_id: str, type: Literal["subnet"], - is_vip: bool | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + is_vip: bool | Omit = omit, + polling_interval_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. @@ -1250,9 +1250,9 @@ async def create_and_poll( region_id: int | None = None, network_id: str, type: Literal["any_subnet"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | Omit = omit, + polling_interval_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. @@ -1291,8 +1291,8 @@ async def create_and_poll( ip_address: str, network_id: str, type: Literal["ip_address"], - is_vip: bool | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + is_vip: bool | Omit = omit, + polling_interval_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. @@ -1330,7 +1330,7 @@ async def create_and_poll( region_id: int | None = None, port_id: str, type: Literal["port"], - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. @@ -1370,13 +1370,13 @@ async def create_and_poll( project_id: int | None = None, region_id: int | None = None, type: Literal["external"] | Literal["subnet"] | Literal["any_subnet"] | Literal["ip_address"] | Literal["port"], - ip_family: Optional[InterfaceIPFamily] | NotGiven = NOT_GIVEN, - is_vip: bool | NotGiven = NOT_GIVEN, - subnet_id: str | NotGiven = NOT_GIVEN, - network_id: str | NotGiven = NOT_GIVEN, - ip_address: str | NotGiven = NOT_GIVEN, - port_id: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + ip_family: Optional[InterfaceIPFamily] | Omit = omit, + is_vip: bool | Omit = omit, + subnet_id: str | Omit = omit, + network_id: str | Omit = omit, + ip_address: str | Omit = omit, + port_id: str | Omit = omit, + polling_interval_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. @@ -1432,7 +1432,7 @@ async def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index 71d8f982..9c2020f1 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -258,8 +258,8 @@ def upload_tls_certificate_and_poll( region_id: int | None = None, name: str, payload: secret_upload_tls_certificate_params.Payload, - expiration: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + expiration: Union[str, datetime, None] | Omit = omit, + polling_interval_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, @@ -525,8 +525,8 @@ async def upload_tls_certificate_and_poll( region_id: int | None = None, name: str, payload: secret_upload_tls_certificate_params.Payload, - expiration: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + expiration: Union[str, datetime, None] | Omit = omit, + polling_interval_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, diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 31af102f..3e374c10 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -9,7 +9,7 @@ import httpx -from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ..._types import NOT_GIVEN, Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import is_given, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -52,7 +52,7 @@ def poll( self, task_id: str, *, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, @@ -363,7 +363,7 @@ async def poll( self, task_id: str, *, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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, diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 615bb8e7..601753a5 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -7,7 +7,7 @@ import httpx -from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given +from ..._types import NOT_GIVEN, Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ..._utils import required_args, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -850,13 +850,13 @@ def create_and_poll( name: str, size: int, source: Literal["image"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + | Omit = omit, + polling_interval_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. @@ -919,14 +919,14 @@ def create_and_poll( name: str, snapshot_id: str, source: Literal["snapshot"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + size: int | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + | Omit = omit, + polling_interval_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. @@ -990,13 +990,13 @@ def create_and_poll( name: str, size: int, source: Literal["new-volume"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + | Omit = omit, + polling_interval_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. @@ -1056,18 +1056,18 @@ def create_and_poll( *, project_id: int | None = None, region_id: int | None = None, - image_id: str | NotGiven = NOT_GIVEN, + image_id: str | Omit = omit, name: str, - size: int | NotGiven = NOT_GIVEN, + size: int | Omit = omit, source: Literal["image"] | Literal["snapshot"] | Literal["new-volume"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, - snapshot_id: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + | Omit = omit, + snapshot_id: str | Omit = omit, + polling_interval_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. @@ -1120,8 +1120,8 @@ def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - snapshots: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + snapshots: str | Omit = omit, + polling_interval_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. @@ -1155,8 +1155,8 @@ def attach_to_instance_and_poll( project_id: int | None = None, region_id: int | None = None, instance_id: str, - attachment_tag: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + polling_interval_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. @@ -1191,7 +1191,7 @@ def detach_from_instance_and_poll( project_id: int | None = None, region_id: int | None = None, instance_id: str, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. @@ -1225,7 +1225,7 @@ def resize_and_poll( project_id: int | None = None, region_id: int | None = None, size: int, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. @@ -2078,13 +2078,13 @@ async def create_and_poll( name: str, size: int, source: Literal["image"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + | Omit = omit, + polling_interval_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. @@ -2147,14 +2147,14 @@ async def create_and_poll( name: str, snapshot_id: str, source: Literal["snapshot"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + size: int | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + | Omit = omit, + polling_interval_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. @@ -2218,13 +2218,13 @@ async def create_and_poll( name: str, size: int, source: Literal["new-volume"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + | Omit = omit, + polling_interval_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. @@ -2284,18 +2284,18 @@ async def create_and_poll( *, project_id: int | None = None, region_id: int | None = None, - image_id: str | NotGiven = NOT_GIVEN, + image_id: str | Omit = omit, name: str, - size: int | NotGiven = NOT_GIVEN, + size: int | Omit = omit, source: Literal["image"] | Literal["snapshot"] | Literal["new-volume"], - attachment_tag: str | NotGiven = NOT_GIVEN, - instance_id_to_attach_to: str | NotGiven = NOT_GIVEN, - lifecycle_policy_ids: Iterable[int] | NotGiven = NOT_GIVEN, - tags: TagUpdateMapParam | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + instance_id_to_attach_to: str | Omit = omit, + lifecycle_policy_ids: Iterable[int] | Omit = omit, + tags: TagUpdateMapParam | Omit = omit, type_name: Literal["cold", "ssd_hiiops", "ssd_local", "ssd_lowlatency", "standard", "ultra"] - | NotGiven = NOT_GIVEN, - snapshot_id: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + | Omit = omit, + snapshot_id: str | Omit = omit, + polling_interval_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. @@ -2348,8 +2348,8 @@ async def delete_and_poll( *, project_id: int | None = None, region_id: int | None = None, - snapshots: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + snapshots: str | Omit = omit, + polling_interval_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. @@ -2383,8 +2383,8 @@ async def attach_to_instance_and_poll( project_id: int | None = None, region_id: int | None = None, instance_id: str, - attachment_tag: str | NotGiven = NOT_GIVEN, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + attachment_tag: str | Omit = omit, + polling_interval_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. @@ -2419,7 +2419,7 @@ async def detach_from_instance_and_poll( project_id: int | None = None, region_id: int | None = None, instance_id: str, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. @@ -2453,7 +2453,7 @@ async def resize_and_poll( project_id: int | None = None, region_id: int | None = None, size: int, - polling_interval_seconds: int | NotGiven = NOT_GIVEN, + polling_interval_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. From 9482c4755e629b9411290d189efc5f1de4bbbec1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 19 Sep 2025 17:46:04 +0000 Subject: [PATCH 07/23] chore: do not install brew dependencies in ./scripts/bootstrap by default --- scripts/bootstrap | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/bootstrap b/scripts/bootstrap index e84fe62c..b430fee3 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,10 +4,18 @@ set -e cd "$(dirname "$0")/.." -if ! command -v rye >/dev/null 2>&1 && [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then brew bundle check >/dev/null 2>&1 || { - echo "==> Installing Homebrew dependencies…" - brew bundle + echo -n "==> Install Homebrew dependencies? (y/N): " + read -r response + case "$response" in + [yY][eE][sS]|[yY]) + brew bundle + ;; + *) + ;; + esac + echo } fi From f1ff65992ff4992554d00f10b1b17794155cc129 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Sep 2025 06:14:23 +0000 Subject: [PATCH 08/23] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/waap/domains/advanced_rules.py | 14 ++-- src/gcore/resources/waap/domains/api_paths.py | 24 +------ .../resources/waap/domains/custom_rules.py | 14 ++-- src/gcore/resources/waap/domains/domains.py | 4 +- .../resources/waap/domains/firewall_rules.py | 4 +- src/gcore/resources/waap/insights.py | 4 +- src/gcore/types/waap/domain_update_params.py | 4 +- .../domains/advanced_rule_create_params.py | 25 ++++--- .../domains/advanced_rule_update_params.py | 20 +++--- .../waap/domains/api_path_create_params.py | 3 - .../waap/domains/api_path_update_params.py | 4 +- .../waap/domains/custom_rule_create_params.py | 71 ++++++++++--------- .../waap/domains/custom_rule_update_params.py | 64 ++++++++--------- .../domains/firewall_rule_create_params.py | 12 ++-- .../domains/firewall_rule_update_params.py | 10 +-- .../types/waap/domains/waap_advanced_rule.py | 7 +- .../types/waap/domains/waap_custom_rule.py | 7 +- .../types/waap/domains/waap_firewall_rule.py | 2 +- src/gcore/types/waap/domains/waap_insight.py | 2 +- .../types/waap/insight_list_types_params.py | 2 +- .../waap/domains/test_custom_rules.py | 32 ++++----- .../waap/domains/test_firewall_rules.py | 24 +++---- .../waap/domains/test_insight_silences.py | 16 ++--- tests/api_resources/waap/test_domains.py | 18 ++--- 25 files changed, 184 insertions(+), 207 deletions(-) diff --git a/.stats.yml b/.stats.yml index 12d70d76..72e1a72b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b473743ee0ba83806f1c8fad37c8dc55062a7d64b726e4ce2ee7e6ed679500a0.yml -openapi_spec_hash: 990a444fc9f47cee9b92c1fc8915f6ac +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b274569f3b7b4720901d8180f3ce6072354a76aebcba71034efacc0d7c2e86af.yml +openapi_spec_hash: 23852eed0d43bf23e4bdce79570b7742 config_hash: b2097de8bb0184ce4379a853a61ef740 diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index 5299f49c..4e557da1 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -53,7 +53,7 @@ def create( enabled: bool, name: str, source: str, - description: Optional[str] | Omit = omit, + description: str | Omit = omit, phase: Optional[Literal["access", "header_filter", "body_filter"]] | 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. @@ -68,7 +68,8 @@ def create( Args: domain_id: The domain ID - action: The action that the rule takes when triggered + action: The action that the rule takes when triggered. Only one action can be set per + rule. enabled: Whether or not the rule is enabled @@ -141,7 +142,7 @@ def update( rule_id: The advanced rule ID - action: The action that a WAAP rule takes when triggered + action: The action that a WAAP rule takes when triggered. description: The description assigned to the rule @@ -429,7 +430,7 @@ async def create( enabled: bool, name: str, source: str, - description: Optional[str] | Omit = omit, + description: str | Omit = omit, phase: Optional[Literal["access", "header_filter", "body_filter"]] | 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. @@ -444,7 +445,8 @@ async def create( Args: domain_id: The domain ID - action: The action that the rule takes when triggered + action: The action that the rule takes when triggered. Only one action can be set per + rule. enabled: Whether or not the rule is enabled @@ -517,7 +519,7 @@ async def update( rule_id: The advanced rule ID - action: The action that a WAAP rule takes when triggered + action: The action that a WAAP rule takes when triggered. description: The description assigned to the rule diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py index fa4c9935..ea3057ec 100644 --- a/src/gcore/resources/waap/domains/api_paths.py +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -75,12 +75,6 @@ def create( path: The API path, locations that are saved for resource IDs will be put in curly brackets - api_groups: An array of api groups associated with the API path - - api_version: The API version - - tags: An array of tags associated with the API path - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -132,14 +126,10 @@ def update( path_id: The path ID - api_groups: An array of api groups associated with the API path - path: The updated API path. When updating the path, variables can be renamed, path parts can be converted to variables and vice versa. - status: The status of the discovered API path - - tags: An array of tags associated with the API path + status: The different statuses an API path can have extra_headers: Send extra headers @@ -403,12 +393,6 @@ async def create( path: The API path, locations that are saved for resource IDs will be put in curly brackets - api_groups: An array of api groups associated with the API path - - api_version: The API version - - tags: An array of tags associated with the API path - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -460,14 +444,10 @@ async def update( path_id: The path ID - api_groups: An array of api groups associated with the API path - path: The updated API path. When updating the path, variables can be renamed, path parts can be converted to variables and vice versa. - status: The status of the discovered API path - - tags: An array of tags associated with the API path + status: The different statuses an API path can have extra_headers: Send extra headers diff --git a/src/gcore/resources/waap/domains/custom_rules.py b/src/gcore/resources/waap/domains/custom_rules.py index 8b6ccbf0..e81e575e 100644 --- a/src/gcore/resources/waap/domains/custom_rules.py +++ b/src/gcore/resources/waap/domains/custom_rules.py @@ -58,7 +58,7 @@ def create( conditions: Iterable[custom_rule_create_params.Condition], enabled: bool, name: str, - description: Optional[str] | Omit = omit, + description: 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, @@ -72,7 +72,8 @@ def create( Args: domain_id: The domain ID - action: The action that the rule takes when triggered + action: The action that the rule takes when triggered. Only one action can be set per + rule. conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have between 1 and 5 conditions. All conditions must pass for the rule to trigger @@ -134,7 +135,7 @@ def update( rule_id: The custom rule ID - action: The action that a WAAP rule takes when triggered + action: The action that a WAAP rule takes when triggered. conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have between 1 and 5 conditions. All conditions must pass for the rule to trigger @@ -432,7 +433,7 @@ async def create( conditions: Iterable[custom_rule_create_params.Condition], enabled: bool, name: str, - description: Optional[str] | Omit = omit, + description: 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, @@ -446,7 +447,8 @@ async def create( Args: domain_id: The domain ID - action: The action that the rule takes when triggered + action: The action that the rule takes when triggered. Only one action can be set per + rule. conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have between 1 and 5 conditions. All conditions must pass for the rule to trigger @@ -508,7 +510,7 @@ async def update( rule_id: The custom rule ID - action: The action that a WAAP rule takes when triggered + action: The action that a WAAP rule takes when triggered. conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have between 1 and 5 conditions. All conditions must pass for the rule to trigger diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index b0d8c1b0..644191c1 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -172,7 +172,7 @@ def update( self, domain_id: int, *, - status: Literal["active", "monitor"] | Omit = omit, + status: Literal["active", "monitor"], # 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, @@ -474,7 +474,7 @@ async def update( self, domain_id: int, *, - status: Literal["active", "monitor"] | Omit = omit, + status: Literal["active", "monitor"], # 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, diff --git a/src/gcore/resources/waap/domains/firewall_rules.py b/src/gcore/resources/waap/domains/firewall_rules.py index 8b7b446a..3dbdde0b 100644 --- a/src/gcore/resources/waap/domains/firewall_rules.py +++ b/src/gcore/resources/waap/domains/firewall_rules.py @@ -58,7 +58,7 @@ def create( conditions: Iterable[firewall_rule_create_params.Condition], enabled: bool, name: str, - description: Optional[str] | Omit = omit, + description: 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, @@ -430,7 +430,7 @@ async def create( conditions: Iterable[firewall_rule_create_params.Condition], enabled: bool, name: str, - description: Optional[str] | Omit = omit, + description: 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, diff --git a/src/gcore/resources/waap/insights.py b/src/gcore/resources/waap/insights.py index c9fc4370..5de0a968 100644 --- a/src/gcore/resources/waap/insights.py +++ b/src/gcore/resources/waap/insights.py @@ -76,7 +76,7 @@ def list_types( ordering: Sort the response by given field. - slug: Filter by the slug of the insight type + slug: The slug of the insight type extra_headers: Send extra headers @@ -161,7 +161,7 @@ def list_types( ordering: Sort the response by given field. - slug: Filter by the slug of the insight type + slug: The slug of the insight type extra_headers: Send extra headers diff --git a/src/gcore/types/waap/domain_update_params.py b/src/gcore/types/waap/domain_update_params.py index cd2134bd..a445eddf 100644 --- a/src/gcore/types/waap/domain_update_params.py +++ b/src/gcore/types/waap/domain_update_params.py @@ -2,11 +2,11 @@ from __future__ import annotations -from typing_extensions import Literal, TypedDict +from typing_extensions import Literal, Required, TypedDict __all__ = ["DomainUpdateParams"] class DomainUpdateParams(TypedDict, total=False): - status: Literal["active", "monitor"] + status: Required[Literal["active", "monitor"]] """The current status of the domain""" diff --git a/src/gcore/types/waap/domains/advanced_rule_create_params.py b/src/gcore/types/waap/domains/advanced_rule_create_params.py index a1edf88a..019e227a 100644 --- a/src/gcore/types/waap/domains/advanced_rule_create_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_create_params.py @@ -12,7 +12,10 @@ class AdvancedRuleCreateParams(TypedDict, total=False): action: Required[Action] - """The action that the rule takes when triggered""" + """The action that the rule takes when triggered. + + Only one action can be set per rule. + """ enabled: Required[bool] """Whether or not the rule is enabled""" @@ -28,7 +31,7 @@ class AdvancedRuleCreateParams(TypedDict, total=False): https://gcore.com/docs/waap/waap-rules/advanced-rules """ - description: Optional[str] + description: str """The description assigned to the rule""" phase: Optional[Literal["access", "header_filter", "body_filter"]] @@ -43,7 +46,7 @@ class AdvancedRuleCreateParams(TypedDict, total=False): class ActionBlock(TypedDict, total=False): - action_duration: Optional[str] + action_duration: str """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or @@ -51,8 +54,8 @@ class ActionBlock(TypedDict, total=False): intervals are not allowed. """ - status_code: Optional[Literal[403, 405, 418, 429]] - """Designates the HTTP status code to deliver when a request is blocked.""" + status_code: Literal[403, 405, 418, 429] + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class ActionTag(TypedDict, total=False): @@ -61,23 +64,23 @@ class ActionTag(TypedDict, total=False): class Action(TypedDict, total=False): - allow: Optional[object] + allow: object """The WAAP allowed the request""" - block: Optional[ActionBlock] + block: ActionBlock """ WAAP block action behavior could be configured with response status code and action duration. """ - captcha: Optional[object] + captcha: object """The WAAP presented the user with a captcha""" - handshake: Optional[object] + handshake: object """The WAAP performed automatic browser validation""" - monitor: Optional[object] + monitor: object """The WAAP monitored the request but took no action""" - tag: Optional[ActionTag] + tag: ActionTag """WAAP tag action gets a list of tags to tag the request scope with""" diff --git a/src/gcore/types/waap/domains/advanced_rule_update_params.py b/src/gcore/types/waap/domains/advanced_rule_update_params.py index f158d460..90e297cb 100644 --- a/src/gcore/types/waap/domains/advanced_rule_update_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_update_params.py @@ -15,7 +15,7 @@ class AdvancedRuleUpdateParams(TypedDict, total=False): """The domain ID""" action: Optional[Action] - """The action that a WAAP rule takes when triggered""" + """The action that a WAAP rule takes when triggered.""" description: Optional[str] """The description assigned to the rule""" @@ -46,7 +46,7 @@ class AdvancedRuleUpdateParams(TypedDict, total=False): class ActionBlock(TypedDict, total=False): - action_duration: Optional[str] + action_duration: str """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or @@ -54,8 +54,8 @@ class ActionBlock(TypedDict, total=False): intervals are not allowed. """ - status_code: Optional[Literal[403, 405, 418, 429]] - """Designates the HTTP status code to deliver when a request is blocked.""" + status_code: Literal[403, 405, 418, 429] + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class ActionTag(TypedDict, total=False): @@ -64,23 +64,23 @@ class ActionTag(TypedDict, total=False): class Action(TypedDict, total=False): - allow: Optional[object] + allow: object """The WAAP allowed the request""" - block: Optional[ActionBlock] + block: ActionBlock """ WAAP block action behavior could be configured with response status code and action duration. """ - captcha: Optional[object] + captcha: object """The WAAP presented the user with a captcha""" - handshake: Optional[object] + handshake: object """The WAAP performed automatic browser validation""" - monitor: Optional[object] + monitor: object """The WAAP monitored the request but took no action""" - tag: Optional[ActionTag] + tag: ActionTag """WAAP tag action gets a list of tags to tag the request scope with""" diff --git a/src/gcore/types/waap/domains/api_path_create_params.py b/src/gcore/types/waap/domains/api_path_create_params.py index bec29966..b8c370d3 100644 --- a/src/gcore/types/waap/domains/api_path_create_params.py +++ b/src/gcore/types/waap/domains/api_path_create_params.py @@ -23,10 +23,7 @@ class APIPathCreateParams(TypedDict, total=False): """ api_groups: SequenceNotStr[str] - """An array of api groups associated with the API path""" api_version: str - """The API version""" tags: SequenceNotStr[str] - """An array of tags associated with the API path""" diff --git a/src/gcore/types/waap/domains/api_path_update_params.py b/src/gcore/types/waap/domains/api_path_update_params.py index 71c995ba..18c1927f 100644 --- a/src/gcore/types/waap/domains/api_path_update_params.py +++ b/src/gcore/types/waap/domains/api_path_update_params.py @@ -14,7 +14,6 @@ class APIPathUpdateParams(TypedDict, total=False): """The domain ID""" api_groups: SequenceNotStr[str] - """An array of api groups associated with the API path""" path: str """The updated API path. @@ -24,7 +23,6 @@ class APIPathUpdateParams(TypedDict, total=False): """ status: Literal["CONFIRMED_API", "POTENTIAL_API", "NOT_API", "DELISTED_API"] - """The status of the discovered API path""" + """The different statuses an API path can have""" tags: SequenceNotStr[str] - """An array of tags associated with the API path""" diff --git a/src/gcore/types/waap/domains/custom_rule_create_params.py b/src/gcore/types/waap/domains/custom_rule_create_params.py index 13bd6574..cdd1397d 100644 --- a/src/gcore/types/waap/domains/custom_rule_create_params.py +++ b/src/gcore/types/waap/domains/custom_rule_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import List, Iterable from typing_extensions import Literal, Required, TypedDict from ...._types import SequenceNotStr @@ -36,7 +36,10 @@ class CustomRuleCreateParams(TypedDict, total=False): action: Required[Action] - """The action that the rule takes when triggered""" + """The action that the rule takes when triggered. + + Only one action can be set per rule. + """ conditions: Required[Iterable[Condition]] """The conditions required for the WAAP engine to trigger the rule. @@ -51,12 +54,12 @@ class CustomRuleCreateParams(TypedDict, total=False): name: Required[str] """The name assigned to the rule""" - description: Optional[str] + description: str """The description assigned to the rule""" class ActionBlock(TypedDict, total=False): - action_duration: Optional[str] + action_duration: str """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or @@ -64,8 +67,8 @@ class ActionBlock(TypedDict, total=False): intervals are not allowed. """ - status_code: Optional[Literal[403, 405, 418, 429]] - """Designates the HTTP status code to deliver when a request is blocked.""" + status_code: Literal[403, 405, 418, 429] + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class ActionTag(TypedDict, total=False): @@ -74,25 +77,25 @@ class ActionTag(TypedDict, total=False): class Action(TypedDict, total=False): - allow: Optional[object] + allow: object """The WAAP allowed the request""" - block: Optional[ActionBlock] + block: ActionBlock """ WAAP block action behavior could be configured with response status code and action duration. """ - captcha: Optional[object] + captcha: object """The WAAP presented the user with a captcha""" - handshake: Optional[object] + handshake: object """The WAAP performed automatic browser validation""" - monitor: Optional[object] + monitor: object """The WAAP monitored the request but took no action""" - tag: Optional[ActionTag] + tag: ActionTag """WAAP tag action gets a list of tags to tag the request scope with""" @@ -218,15 +221,13 @@ class ConditionRequestRate(TypedDict, total=False): triggering a request rate condition """ - http_methods: Optional[ - List[Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]] - ] + http_methods: List[Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]] """Possible HTTP request methods that can trigger a request rate condition""" - ips: Optional[SequenceNotStr[str]] + ips: SequenceNotStr[str] """A list of source IPs that can trigger a request rate condition""" - user_defined_tag: Optional[str] + user_defined_tag: str """ A user-defined tag that can be included in incoming requests and used to trigger a request rate condition @@ -310,62 +311,62 @@ class ConditionUserDefinedTags(TypedDict, total=False): class Condition(TypedDict, total=False): - content_type: Optional[ConditionContentType] + content_type: ConditionContentType """Match the requested Content-Type""" - country: Optional[ConditionCountry] + country: ConditionCountry """Match the country that the request originated from""" - file_extension: Optional[ConditionFileExtension] + file_extension: ConditionFileExtension """Match the incoming file extension""" - header: Optional[ConditionHeader] + header: ConditionHeader """Match an incoming request header""" - header_exists: Optional[ConditionHeaderExists] + header_exists: ConditionHeaderExists """Match when an incoming request header is present""" - http_method: Optional[ConditionHTTPMethod] + http_method: ConditionHTTPMethod """Match the incoming HTTP method""" - ip: Optional[ConditionIP] + ip: ConditionIP """Match the incoming request against a single IP address""" - ip_range: Optional[ConditionIPRange] + ip_range: ConditionIPRange """Match the incoming request against an IP range""" - organization: Optional[ConditionOrganization] + organization: ConditionOrganization """ Match the organization the request originated from, as determined by a WHOIS lookup of the requesting IP """ - owner_types: Optional[ConditionOwnerTypes] + owner_types: ConditionOwnerTypes """ Match the type of organization that owns the IP address making an incoming request """ - request_rate: Optional[ConditionRequestRate] + request_rate: ConditionRequestRate """Match the rate at which requests come in that match certain conditions""" - response_header: Optional[ConditionResponseHeader] + response_header: ConditionResponseHeader """Match a response header""" - response_header_exists: Optional[ConditionResponseHeaderExists] + response_header_exists: ConditionResponseHeaderExists """Match when a response header is present""" - session_request_count: Optional[ConditionSessionRequestCount] + session_request_count: ConditionSessionRequestCount """Match the number of dynamic page requests made in a WAAP session""" - tags: Optional[ConditionTags] + tags: ConditionTags """Matches requests based on specified tags""" - url: Optional[ConditionURL] + url: ConditionURL """Match the incoming request URL""" - user_agent: Optional[ConditionUserAgent] + user_agent: ConditionUserAgent """Match the user agent making the request""" - user_defined_tags: Optional[ConditionUserDefinedTags] + user_defined_tags: ConditionUserDefinedTags """Matches requests based on user-defined tags""" diff --git a/src/gcore/types/waap/domains/custom_rule_update_params.py b/src/gcore/types/waap/domains/custom_rule_update_params.py index 2978bc66..b9144fba 100644 --- a/src/gcore/types/waap/domains/custom_rule_update_params.py +++ b/src/gcore/types/waap/domains/custom_rule_update_params.py @@ -39,7 +39,7 @@ class CustomRuleUpdateParams(TypedDict, total=False): """The domain ID""" action: Optional[Action] - """The action that a WAAP rule takes when triggered""" + """The action that a WAAP rule takes when triggered.""" conditions: Optional[Iterable[Condition]] """The conditions required for the WAAP engine to trigger the rule. @@ -59,7 +59,7 @@ class CustomRuleUpdateParams(TypedDict, total=False): class ActionBlock(TypedDict, total=False): - action_duration: Optional[str] + action_duration: str """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or @@ -67,8 +67,8 @@ class ActionBlock(TypedDict, total=False): intervals are not allowed. """ - status_code: Optional[Literal[403, 405, 418, 429]] - """Designates the HTTP status code to deliver when a request is blocked.""" + status_code: Literal[403, 405, 418, 429] + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class ActionTag(TypedDict, total=False): @@ -77,25 +77,25 @@ class ActionTag(TypedDict, total=False): class Action(TypedDict, total=False): - allow: Optional[object] + allow: object """The WAAP allowed the request""" - block: Optional[ActionBlock] + block: ActionBlock """ WAAP block action behavior could be configured with response status code and action duration. """ - captcha: Optional[object] + captcha: object """The WAAP presented the user with a captcha""" - handshake: Optional[object] + handshake: object """The WAAP performed automatic browser validation""" - monitor: Optional[object] + monitor: object """The WAAP monitored the request but took no action""" - tag: Optional[ActionTag] + tag: ActionTag """WAAP tag action gets a list of tags to tag the request scope with""" @@ -221,15 +221,13 @@ class ConditionRequestRate(TypedDict, total=False): triggering a request rate condition """ - http_methods: Optional[ - List[Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]] - ] + http_methods: List[Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]] """Possible HTTP request methods that can trigger a request rate condition""" - ips: Optional[SequenceNotStr[str]] + ips: SequenceNotStr[str] """A list of source IPs that can trigger a request rate condition""" - user_defined_tag: Optional[str] + user_defined_tag: str """ A user-defined tag that can be included in incoming requests and used to trigger a request rate condition @@ -313,62 +311,62 @@ class ConditionUserDefinedTags(TypedDict, total=False): class Condition(TypedDict, total=False): - content_type: Optional[ConditionContentType] + content_type: ConditionContentType """Match the requested Content-Type""" - country: Optional[ConditionCountry] + country: ConditionCountry """Match the country that the request originated from""" - file_extension: Optional[ConditionFileExtension] + file_extension: ConditionFileExtension """Match the incoming file extension""" - header: Optional[ConditionHeader] + header: ConditionHeader """Match an incoming request header""" - header_exists: Optional[ConditionHeaderExists] + header_exists: ConditionHeaderExists """Match when an incoming request header is present""" - http_method: Optional[ConditionHTTPMethod] + http_method: ConditionHTTPMethod """Match the incoming HTTP method""" - ip: Optional[ConditionIP] + ip: ConditionIP """Match the incoming request against a single IP address""" - ip_range: Optional[ConditionIPRange] + ip_range: ConditionIPRange """Match the incoming request against an IP range""" - organization: Optional[ConditionOrganization] + organization: ConditionOrganization """ Match the organization the request originated from, as determined by a WHOIS lookup of the requesting IP """ - owner_types: Optional[ConditionOwnerTypes] + owner_types: ConditionOwnerTypes """ Match the type of organization that owns the IP address making an incoming request """ - request_rate: Optional[ConditionRequestRate] + request_rate: ConditionRequestRate """Match the rate at which requests come in that match certain conditions""" - response_header: Optional[ConditionResponseHeader] + response_header: ConditionResponseHeader """Match a response header""" - response_header_exists: Optional[ConditionResponseHeaderExists] + response_header_exists: ConditionResponseHeaderExists """Match when a response header is present""" - session_request_count: Optional[ConditionSessionRequestCount] + session_request_count: ConditionSessionRequestCount """Match the number of dynamic page requests made in a WAAP session""" - tags: Optional[ConditionTags] + tags: ConditionTags """Matches requests based on specified tags""" - url: Optional[ConditionURL] + url: ConditionURL """Match the incoming request URL""" - user_agent: Optional[ConditionUserAgent] + user_agent: ConditionUserAgent """Match the user agent making the request""" - user_defined_tags: Optional[ConditionUserDefinedTags] + user_defined_tags: ConditionUserDefinedTags """Matches requests based on user-defined tags""" diff --git a/src/gcore/types/waap/domains/firewall_rule_create_params.py b/src/gcore/types/waap/domains/firewall_rule_create_params.py index 84b671fb..fec010b2 100644 --- a/src/gcore/types/waap/domains/firewall_rule_create_params.py +++ b/src/gcore/types/waap/domains/firewall_rule_create_params.py @@ -21,12 +21,12 @@ class FirewallRuleCreateParams(TypedDict, total=False): name: Required[str] """The name assigned to the rule""" - description: Optional[str] + description: str """The description assigned to the rule""" class ActionBlock(TypedDict, total=False): - action_duration: Optional[str] + action_duration: str """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or @@ -34,8 +34,8 @@ class ActionBlock(TypedDict, total=False): intervals are not allowed. """ - status_code: Optional[Literal[403, 405, 418, 429]] - """Designates the HTTP status code to deliver when a request is blocked.""" + status_code: Literal[403, 405, 418, 429] + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class Action(TypedDict, total=False): @@ -69,8 +69,8 @@ class ConditionIPRange(TypedDict, total=False): class Condition(TypedDict, total=False): - ip: Optional[ConditionIP] + ip: ConditionIP """Match the incoming request against a single IP address""" - ip_range: Optional[ConditionIPRange] + ip_range: ConditionIPRange """Match the incoming request against an IP range""" diff --git a/src/gcore/types/waap/domains/firewall_rule_update_params.py b/src/gcore/types/waap/domains/firewall_rule_update_params.py index 478d257c..87b0cd7e 100644 --- a/src/gcore/types/waap/domains/firewall_rule_update_params.py +++ b/src/gcore/types/waap/domains/firewall_rule_update_params.py @@ -29,7 +29,7 @@ class FirewallRuleUpdateParams(TypedDict, total=False): class ActionBlock(TypedDict, total=False): - action_duration: Optional[str] + action_duration: str """How long a rule's block action will apply to subsequent requests. Can be specified in seconds or by using a numeral followed by 's', 'm', 'h', or @@ -37,8 +37,8 @@ class ActionBlock(TypedDict, total=False): intervals are not allowed. """ - status_code: Optional[Literal[403, 405, 418, 429]] - """Designates the HTTP status code to deliver when a request is blocked.""" + status_code: Literal[403, 405, 418, 429] + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class Action(TypedDict, total=False): @@ -72,8 +72,8 @@ class ConditionIPRange(TypedDict, total=False): class Condition(TypedDict, total=False): - ip: Optional[ConditionIP] + ip: ConditionIP """Match the incoming request against a single IP address""" - ip_range: Optional[ConditionIPRange] + ip_range: ConditionIPRange """Match the incoming request against an IP range""" diff --git a/src/gcore/types/waap/domains/waap_advanced_rule.py b/src/gcore/types/waap/domains/waap_advanced_rule.py index fc264a1a..d9160d4c 100644 --- a/src/gcore/types/waap/domains/waap_advanced_rule.py +++ b/src/gcore/types/waap/domains/waap_advanced_rule.py @@ -18,7 +18,7 @@ class ActionBlock(BaseModel): """ status_code: Optional[Literal[403, 405, 418, 429]] = None - """Designates the HTTP status code to deliver when a request is blocked.""" + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class ActionTag(BaseModel): @@ -54,7 +54,10 @@ class WaapAdvancedRule(BaseModel): """The unique identifier for the rule""" action: Action - """The action that the rule takes when triggered""" + """The action that the rule takes when triggered. + + Only one action can be set per rule. + """ enabled: bool """Whether or not the rule is enabled""" diff --git a/src/gcore/types/waap/domains/waap_custom_rule.py b/src/gcore/types/waap/domains/waap_custom_rule.py index aec81343..0a3ba958 100644 --- a/src/gcore/types/waap/domains/waap_custom_rule.py +++ b/src/gcore/types/waap/domains/waap_custom_rule.py @@ -42,7 +42,7 @@ class ActionBlock(BaseModel): """ status_code: Optional[Literal[403, 405, 418, 429]] = None - """Designates the HTTP status code to deliver when a request is blocked.""" + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class ActionTag(BaseModel): @@ -355,7 +355,10 @@ class WaapCustomRule(BaseModel): """The unique identifier for the rule""" action: Action - """The action that the rule takes when triggered""" + """The action that the rule takes when triggered. + + Only one action can be set per rule. + """ conditions: List[Condition] """The conditions required for the WAAP engine to trigger the rule. diff --git a/src/gcore/types/waap/domains/waap_firewall_rule.py b/src/gcore/types/waap/domains/waap_firewall_rule.py index d9ffa8dc..1130a89a 100644 --- a/src/gcore/types/waap/domains/waap_firewall_rule.py +++ b/src/gcore/types/waap/domains/waap_firewall_rule.py @@ -18,7 +18,7 @@ class ActionBlock(BaseModel): """ status_code: Optional[Literal[403, 405, 418, 429]] = None - """Designates the HTTP status code to deliver when a request is blocked.""" + """A custom HTTP status code that the WAAP returns if a rule blocks a request""" class Action(BaseModel): diff --git a/src/gcore/types/waap/domains/waap_insight.py b/src/gcore/types/waap/domains/waap_insight.py index f5ca2825..070c8bd8 100644 --- a/src/gcore/types/waap/domains/waap_insight.py +++ b/src/gcore/types/waap/domains/waap_insight.py @@ -20,7 +20,7 @@ class WaapInsight(BaseModel): """The date and time the insight was first seen in ISO 8601 format""" insight_type: str - """The type of the insight represented as a slug""" + """The slug of the insight type""" labels: Dict[str, str] """A hash table of label names and values that apply to the insight""" diff --git a/src/gcore/types/waap/insight_list_types_params.py b/src/gcore/types/waap/insight_list_types_params.py index 534f2cc2..6eae7ac3 100644 --- a/src/gcore/types/waap/insight_list_types_params.py +++ b/src/gcore/types/waap/insight_list_types_params.py @@ -25,4 +25,4 @@ class InsightListTypesParams(TypedDict, total=False): """Sort the response by given field.""" slug: Optional[str] - """Filter by the slug of the insight type""" + """The slug of the insight type""" diff --git a/tests/api_resources/waap/domains/test_custom_rules.py b/tests/api_resources/waap/domains/test_custom_rules.py index 62327ad7..36a7e89f 100644 --- a/tests/api_resources/waap/domains/test_custom_rules.py +++ b/tests/api_resources/waap/domains/test_custom_rules.py @@ -75,12 +75,12 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "negation": True, }, "ip": { - "ip_address": "192.168.1.1", + "ip_address": "ip_address", "negation": True, }, "ip_range": { - "lower_bound": "192.168.1.1", - "upper_bound": "192.168.1.1", + "lower_bound": "lower_bound", + "upper_bound": "upper_bound", "negation": True, }, "organization": { @@ -96,7 +96,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "requests": 20, "time": 1, "http_methods": ["CONNECT"], - "ips": ["192.168.1.1"], + "ips": ["string"], "user_defined_tag": "SQfNklznVLBBpr", }, "response_header": { @@ -224,12 +224,12 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "negation": True, }, "ip": { - "ip_address": "192.168.1.1", + "ip_address": "ip_address", "negation": True, }, "ip_range": { - "lower_bound": "192.168.1.1", - "upper_bound": "192.168.1.1", + "lower_bound": "lower_bound", + "upper_bound": "upper_bound", "negation": True, }, "organization": { @@ -245,7 +245,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: "requests": 20, "time": 1, "http_methods": ["CONNECT"], - "ips": ["192.168.1.1"], + "ips": ["string"], "user_defined_tag": "SQfNklznVLBBpr", }, "response_header": { @@ -559,12 +559,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "negation": True, }, "ip": { - "ip_address": "192.168.1.1", + "ip_address": "ip_address", "negation": True, }, "ip_range": { - "lower_bound": "192.168.1.1", - "upper_bound": "192.168.1.1", + "lower_bound": "lower_bound", + "upper_bound": "upper_bound", "negation": True, }, "organization": { @@ -580,7 +580,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "requests": 20, "time": 1, "http_methods": ["CONNECT"], - "ips": ["192.168.1.1"], + "ips": ["string"], "user_defined_tag": "SQfNklznVLBBpr", }, "response_header": { @@ -708,12 +708,12 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "negation": True, }, "ip": { - "ip_address": "192.168.1.1", + "ip_address": "ip_address", "negation": True, }, "ip_range": { - "lower_bound": "192.168.1.1", - "upper_bound": "192.168.1.1", + "lower_bound": "lower_bound", + "upper_bound": "upper_bound", "negation": True, }, "organization": { @@ -729,7 +729,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> "requests": 20, "time": 1, "http_methods": ["CONNECT"], - "ips": ["192.168.1.1"], + "ips": ["string"], "user_defined_tag": "SQfNklznVLBBpr", }, "response_header": { diff --git a/tests/api_resources/waap/domains/test_firewall_rules.py b/tests/api_resources/waap/domains/test_firewall_rules.py index 72064193..560b4128 100644 --- a/tests/api_resources/waap/domains/test_firewall_rules.py +++ b/tests/api_resources/waap/domains/test_firewall_rules.py @@ -45,12 +45,12 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: conditions=[ { "ip": { - "ip_address": "192.168.1.1", + "ip_address": "ip_address", "negation": True, }, "ip_range": { - "lower_bound": "192.168.1.1", - "upper_bound": "192.168.1.1", + "lower_bound": "lower_bound", + "upper_bound": "upper_bound", "negation": True, }, } @@ -116,12 +116,12 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: conditions=[ { "ip": { - "ip_address": "192.168.1.1", + "ip_address": "ip_address", "negation": True, }, "ip_range": { - "lower_bound": "192.168.1.1", - "upper_bound": "192.168.1.1", + "lower_bound": "lower_bound", + "upper_bound": "upper_bound", "negation": True, }, } @@ -373,12 +373,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> conditions=[ { "ip": { - "ip_address": "192.168.1.1", + "ip_address": "ip_address", "negation": True, }, "ip_range": { - "lower_bound": "192.168.1.1", - "upper_bound": "192.168.1.1", + "lower_bound": "lower_bound", + "upper_bound": "upper_bound", "negation": True, }, } @@ -444,12 +444,12 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> conditions=[ { "ip": { - "ip_address": "192.168.1.1", + "ip_address": "ip_address", "negation": True, }, "ip_range": { - "lower_bound": "192.168.1.1", - "upper_bound": "192.168.1.1", + "lower_bound": "lower_bound", + "upper_bound": "upper_bound", "negation": True, }, } diff --git a/tests/api_resources/waap/domains/test_insight_silences.py b/tests/api_resources/waap/domains/test_insight_silences.py index cd1d687a..835b21bf 100644 --- a/tests/api_resources/waap/domains/test_insight_silences.py +++ b/tests/api_resources/waap/domains/test_insight_silences.py @@ -27,7 +27,7 @@ def test_method_create(self, client: Gcore) -> None: domain_id=1, author="author", comment="comment", - insight_type="insight_type", + insight_type="26f1klzn5713-56bincal4ca-60zz1k91s4", labels={"foo": "string"}, ) assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) @@ -38,7 +38,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: domain_id=1, author="author", comment="comment", - insight_type="insight_type", + insight_type="26f1klzn5713-56bincal4ca-60zz1k91s4", labels={"foo": "string"}, expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -50,7 +50,7 @@ def test_raw_response_create(self, client: Gcore) -> None: domain_id=1, author="author", comment="comment", - insight_type="insight_type", + insight_type="26f1klzn5713-56bincal4ca-60zz1k91s4", labels={"foo": "string"}, ) @@ -65,7 +65,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: domain_id=1, author="author", comment="comment", - insight_type="insight_type", + insight_type="26f1klzn5713-56bincal4ca-60zz1k91s4", labels={"foo": "string"}, ) as response: assert not response.is_closed @@ -283,7 +283,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: domain_id=1, author="author", comment="comment", - insight_type="insight_type", + insight_type="26f1klzn5713-56bincal4ca-60zz1k91s4", labels={"foo": "string"}, ) assert_matches_type(WaapInsightSilence, insight_silence, path=["response"]) @@ -294,7 +294,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> domain_id=1, author="author", comment="comment", - insight_type="insight_type", + insight_type="26f1klzn5713-56bincal4ca-60zz1k91s4", labels={"foo": "string"}, expire_at=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -306,7 +306,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: domain_id=1, author="author", comment="comment", - insight_type="insight_type", + insight_type="26f1klzn5713-56bincal4ca-60zz1k91s4", labels={"foo": "string"}, ) @@ -321,7 +321,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None domain_id=1, author="author", comment="comment", - insight_type="insight_type", + insight_type="26f1klzn5713-56bincal4ca-60zz1k91s4", labels={"foo": "string"}, ) as response: assert not response.is_closed diff --git a/tests/api_resources/waap/test_domains.py b/tests/api_resources/waap/test_domains.py index f311215b..9c3d9c26 100644 --- a/tests/api_resources/waap/test_domains.py +++ b/tests/api_resources/waap/test_domains.py @@ -25,13 +25,6 @@ class TestDomains: @parametrize def test_method_update(self, client: Gcore) -> None: - domain = client.waap.domains.update( - domain_id=1, - ) - assert domain is None - - @parametrize - def test_method_update_with_all_params(self, client: Gcore) -> None: domain = client.waap.domains.update( domain_id=1, status="active", @@ -42,6 +35,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: def test_raw_response_update(self, client: Gcore) -> None: response = client.waap.domains.with_raw_response.update( domain_id=1, + status="active", ) assert response.is_closed is True @@ -53,6 +47,7 @@ def test_raw_response_update(self, client: Gcore) -> None: def test_streaming_response_update(self, client: Gcore) -> None: with client.waap.domains.with_streaming_response.update( domain_id=1, + status="active", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -242,13 +237,6 @@ class TestAsyncDomains: @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - domain = await async_client.waap.domains.update( - domain_id=1, - ) - assert domain is None - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: domain = await async_client.waap.domains.update( domain_id=1, status="active", @@ -259,6 +247,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.waap.domains.with_raw_response.update( domain_id=1, + status="active", ) assert response.is_closed is True @@ -270,6 +259,7 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.waap.domains.with_streaming_response.update( domain_id=1, + status="active", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From d8b63dbe8b16d8aca27b6b07611f636b74dd8adb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Sep 2025 06:42:17 +0000 Subject: [PATCH 09/23] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 72e1a72b..630a2f2b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b274569f3b7b4720901d8180f3ce6072354a76aebcba71034efacc0d7c2e86af.yml openapi_spec_hash: 23852eed0d43bf23e4bdce79570b7742 -config_hash: b2097de8bb0184ce4379a853a61ef740 +config_hash: 6bfe9b43c2ea6ddba1339589bc58d2fa From 0784cf918ef8d820a7a5ecfd9dc5b185829041a1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Sep 2025 14:49:24 +0000 Subject: [PATCH 10/23] feat(api): aggregated API specs update --- .stats.yml | 6 +- .../resources/cloud/baremetal/servers.py | 26 +- src/gcore/resources/cloud/cost_reports.py | 118 ++-- .../cloud/file_shares/file_shares.py | 8 +- src/gcore/resources/cloud/floating_ips.py | 8 +- .../resources/cloud/instances/instances.py | 42 +- src/gcore/resources/cloud/ip_ranges.py | 26 +- .../resources/cloud/k8s/clusters/clusters.py | 36 +- .../cloud/load_balancers/load_balancers.py | 8 +- .../cloud/load_balancers/pools/pools.py | 14 +- .../resources/cloud/networks/networks.py | 8 +- src/gcore/resources/cloud/networks/subnets.py | 8 +- .../resources/cloud/registries/registries.py | 14 +- src/gcore/resources/cloud/registries/users.py | 14 +- .../cloud/security_groups/security_groups.py | 8 +- src/gcore/resources/cloud/volumes.py | 8 +- src/gcore/resources/dns/zones/rrsets.py | 118 ++-- src/gcore/resources/dns/zones/zones.py | 146 +++-- src/gcore/resources/iam/users.py | 60 +- .../resources/storage/buckets/buckets.py | 16 +- src/gcore/resources/storage/storage.py | 16 +- src/gcore/resources/streaming/ai_tasks.py | 392 +++++++----- src/gcore/resources/streaming/broadcasts.py | 12 +- src/gcore/resources/streaming/directories.py | 30 +- src/gcore/resources/streaming/playlists.py | 122 ++-- src/gcore/resources/streaming/quality_sets.py | 74 ++- src/gcore/resources/streaming/statistics.py | 574 +++++++++++------- .../resources/streaming/streams/overlays.py | 68 ++- .../resources/streaming/streams/streams.py | 468 ++++++++------ .../resources/streaming/videos/subtitles.py | 132 ++-- .../resources/streaming/videos/videos.py | 494 +++++++++------ .../resources/waap/domains/advanced_rules.py | 108 ++-- .../types/cloud/file_share_update_params.py | 4 +- .../types/cloud/floating_ip_update_params.py | 4 +- .../cloud/inference/inference_deployment.py | 4 +- .../types/cloud/instance_create_params.py | 4 +- .../types/cloud/k8s/cluster_create_params.py | 10 +- .../types/cloud/k8s/cluster_update_params.py | 10 +- src/gcore/types/cloud/k8s/k8s_cluster.py | 7 +- .../cloud/load_balancer_update_params.py | 4 +- .../types/cloud/network_update_params.py | 4 +- .../cloud/networks/subnet_update_params.py | 4 +- .../registries/user_create_multiple_params.py | 8 +- .../cloud/registries/user_create_params.py | 8 +- .../types/cloud/registry_create_params.py | 8 +- .../cloud/security_group_update_params.py | 4 +- src/gcore/types/cloud/ssh_key_created.py | 9 +- src/gcore/types/cloud/volume_update_params.py | 4 +- .../types/dns/zone_get_statistics_params.py | 21 +- .../types/dns/zone_get_statistics_response.py | 4 +- src/gcore/types/dns/zone_import_params.py | 36 +- src/gcore/types/dns/zones/dns_output_rrset.py | 10 +- src/gcore/types/iam/account_overview.py | 9 +- src/gcore/types/iam/user.py | 9 +- src/gcore/types/iam/user_detailed.py | 9 +- src/gcore/types/iam/user_invite_params.py | 5 +- src/gcore/types/iam/user_update.py | 9 +- src/gcore/types/iam/user_update_params.py | 9 +- .../ai_contentmoderation_hardnudity.py | 10 +- .../streaming/ai_contentmoderation_nsfw.py | 10 +- .../ai_contentmoderation_softnudity.py | 10 +- .../streaming/ai_contentmoderation_sport.py | 10 +- src/gcore/types/streaming/ai_task.py | 31 +- .../types/streaming/ai_task_create_params.py | 31 +- .../types/streaming/ai_task_get_response.py | 9 +- .../types/streaming/ai_task_list_params.py | 16 +- src/gcore/types/streaming/clip.py | 55 +- .../types/streaming/create_video_param.py | 118 ++-- src/gcore/types/streaming/playlist.py | 12 +- .../types/streaming/playlist_create_params.py | 12 +- .../types/streaming/playlist_update_params.py | 12 +- src/gcore/types/streaming/playlist_video.py | 118 ++-- ...statistic_get_unique_viewers_cdn_params.py | 11 +- src/gcore/types/streaming/stream.py | 343 ++++++----- .../streaming/stream_create_clip_params.py | 55 +- .../types/streaming/stream_create_params.py | 65 +- .../types/streaming/stream_update_params.py | 65 +- src/gcore/types/streaming/video.py | 214 ++++--- .../types/streaming/video_list_params.py | 6 +- .../types/streaming/video_update_params.py | 118 ++-- .../domains/advanced_rule_create_params.py | 19 +- .../waap/domains/advanced_rule_list_params.py | 17 +- .../domains/advanced_rule_update_params.py | 19 +- .../types/waap/domains/waap_advanced_rule.py | 19 +- 84 files changed, 3013 insertions(+), 1791 deletions(-) diff --git a/.stats.yml b/.stats.yml index 630a2f2b..bf3f4fca 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-b274569f3b7b4720901d8180f3ce6072354a76aebcba71034efacc0d7c2e86af.yml -openapi_spec_hash: 23852eed0d43bf23e4bdce79570b7742 -config_hash: 6bfe9b43c2ea6ddba1339589bc58d2fa +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e543fc395c453a5bb59daf3463c5bbaf7fde7a7ffc957225eb2986c35d2c97ed.yml +openapi_spec_hash: b4be9c9d643d7d20c45dcffe381d1595 +config_hash: cd9ebeaa0d08830a9e995e37db3cd6e1 diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index ca62957e..a41d040d 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -72,10 +72,12 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: - """Create a new bare metal server with the specified configuration. + """ + Create a new bare metal server with the specified configuration. + + How to get access: - How to get - access: For Linux, + For Linux, - Use the `user_data` field to provide a [cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html) @@ -83,7 +85,10 @@ def create( - Specify the `username` and `password` to create a new user. - When only `password` is provided, it is set as the password for the default user of the image. - - The `user_data` is ignored when the `password` is specified. For Windows, + - The `user_data` is ignored when the `password` is specified. + + For Windows, + - Use the `user_data` field to provide a [cloudbase-init script](https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config) in base64 to create new users on Windows. @@ -554,10 +559,12 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: - """Create a new bare metal server with the specified configuration. + """ + Create a new bare metal server with the specified configuration. + + How to get access: - How to get - access: For Linux, + For Linux, - Use the `user_data` field to provide a [cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html) @@ -565,7 +572,10 @@ async def create( - Specify the `username` and `password` to create a new user. - When only `password` is provided, it is set as the password for the default user of the image. - - The `user_data` is ignored when the `password` is specified. For Windows, + - The `user_data` is ignored when the `password` is specified. + + For Windows, + - Use the `user_data` field to provide a [cloudbase-init script](https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config) in base64 to create new users on Windows. diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index d5bb66c1..1ee323ee 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -103,15 +103,19 @@ def get_aggregated( """Get cost report totals (aggregated costs) for a given period. Requested period - should not exceed 31 days. Note: This report assumes there are no active commit - features in the billing plan. If there are active commit features (pre-paid - resources) in your plan, use /v1/`reservation_cost_report`/totals, as the - results from this report will not be accurate. Receiving data from the past hour - might lead to incomplete statistics. For the most accurate data, we recommend - accessing the statistics after at least one hour. Typically, updates are - available within a 24-hour period, although the frequency can vary. Maintenance - periods or other exceptions may cause delays, potentially extending beyond 24 - hours until the servers are back online and the missing data is filled in. + should not exceed 31 days. + + Note: This report assumes there are no active commit features in the billing + plan. If there are active commit features (pre-paid resources) in your plan, use + /v1/`reservation_cost_report`/totals, as the results from this report will not + be accurate. + + Receiving data from the past hour might lead to incomplete statistics. For the + most accurate data, we recommend accessing the statistics after at least one + hour. Typically, updates are available within a 24-hour period, although the + frequency can vary. Maintenance periods or other exceptions may cause delays, + potentially extending beyond 24 hours until the servers are back online and the + missing data is filled in. Args: time_from: The start date of the report period (ISO 8601). The report starts from the @@ -220,12 +224,14 @@ def get_aggregated_monthly( Retrieve a detailed cost report totals for a specified month, which includes both commit and pay-as-you-go (overcommit) prices. Additionally, it provides the spent billing units (e.g., hours or GB) for resources. The "`time_to`" parameter - represents all days in the specified month. Receiving data from the past hour - might lead to incomplete statistics. For the most accurate data, we recommend - accessing the statistics after at least one hour. Typically, updates are - available within a 24-hour period, although the frequency can vary. Maintenance - periods or other exceptions may cause delays, potentially extending beyond 24 - hours until the servers are back online and the missing data is filled in. + represents all days in the specified month. + + Receiving data from the past hour might lead to incomplete statistics. For the + most accurate data, we recommend accessing the statistics after at least one + hour. Typically, updates are available within a 24-hour period, although the + frequency can vary. Maintenance periods or other exceptions may cause delays, + potentially extending beyond 24 hours until the servers are back online and the + missing data is filled in. Args: regions: List of region IDs. @@ -331,16 +337,19 @@ def get_detailed( """Get a detailed cost report for a given period and specific resources. Requested - period should not exceed 31 days. Note: This report assumes there are no active - commit features in the billing plan. If there are active commit features - (pre-paid resources) in your plan, use /v1/`reservation_cost_report`/totals, as - the results from this report will not be accurate. Receiving data from the past - hour might lead to incomplete statistics. For the most accurate data, we - recommend accessing the statistics after at least one hour. Typically, updates - are available within a 24-hour period, although the frequency can vary. - Maintenance periods or other exceptions may cause delays, potentially extending - beyond 24 hours until the servers are back online and the missing data is filled - in. + period should not exceed 31 days. + + Note: This report assumes there are no active commit features in the billing + plan. If there are active commit features (pre-paid resources) in your plan, use + /v1/`reservation_cost_report`/totals, as the results from this report will not + be accurate. + + Receiving data from the past hour might lead to incomplete statistics. For the + most accurate data, we recommend accessing the statistics after at least one + hour. Typically, updates are available within a 24-hour period, although the + frequency can vary. Maintenance periods or other exceptions may cause delays, + potentially extending beyond 24 hours until the servers are back online and the + missing data is filled in. Args: time_from: The start date of the report period (ISO 8601). The report starts from the @@ -479,15 +488,19 @@ async def get_aggregated( """Get cost report totals (aggregated costs) for a given period. Requested period - should not exceed 31 days. Note: This report assumes there are no active commit - features in the billing plan. If there are active commit features (pre-paid - resources) in your plan, use /v1/`reservation_cost_report`/totals, as the - results from this report will not be accurate. Receiving data from the past hour - might lead to incomplete statistics. For the most accurate data, we recommend - accessing the statistics after at least one hour. Typically, updates are - available within a 24-hour period, although the frequency can vary. Maintenance - periods or other exceptions may cause delays, potentially extending beyond 24 - hours until the servers are back online and the missing data is filled in. + should not exceed 31 days. + + Note: This report assumes there are no active commit features in the billing + plan. If there are active commit features (pre-paid resources) in your plan, use + /v1/`reservation_cost_report`/totals, as the results from this report will not + be accurate. + + Receiving data from the past hour might lead to incomplete statistics. For the + most accurate data, we recommend accessing the statistics after at least one + hour. Typically, updates are available within a 24-hour period, although the + frequency can vary. Maintenance periods or other exceptions may cause delays, + potentially extending beyond 24 hours until the servers are back online and the + missing data is filled in. Args: time_from: The start date of the report period (ISO 8601). The report starts from the @@ -596,12 +609,14 @@ async def get_aggregated_monthly( Retrieve a detailed cost report totals for a specified month, which includes both commit and pay-as-you-go (overcommit) prices. Additionally, it provides the spent billing units (e.g., hours or GB) for resources. The "`time_to`" parameter - represents all days in the specified month. Receiving data from the past hour - might lead to incomplete statistics. For the most accurate data, we recommend - accessing the statistics after at least one hour. Typically, updates are - available within a 24-hour period, although the frequency can vary. Maintenance - periods or other exceptions may cause delays, potentially extending beyond 24 - hours until the servers are back online and the missing data is filled in. + represents all days in the specified month. + + Receiving data from the past hour might lead to incomplete statistics. For the + most accurate data, we recommend accessing the statistics after at least one + hour. Typically, updates are available within a 24-hour period, although the + frequency can vary. Maintenance periods or other exceptions may cause delays, + potentially extending beyond 24 hours until the servers are back online and the + missing data is filled in. Args: regions: List of region IDs. @@ -707,16 +722,19 @@ async def get_detailed( """Get a detailed cost report for a given period and specific resources. Requested - period should not exceed 31 days. Note: This report assumes there are no active - commit features in the billing plan. If there are active commit features - (pre-paid resources) in your plan, use /v1/`reservation_cost_report`/totals, as - the results from this report will not be accurate. Receiving data from the past - hour might lead to incomplete statistics. For the most accurate data, we - recommend accessing the statistics after at least one hour. Typically, updates - are available within a 24-hour period, although the frequency can vary. - Maintenance periods or other exceptions may cause delays, potentially extending - beyond 24 hours until the servers are back online and the missing data is filled - in. + period should not exceed 31 days. + + Note: This report assumes there are no active commit features in the billing + plan. If there are active commit features (pre-paid resources) in your plan, use + /v1/`reservation_cost_report`/totals, as the results from this report will not + be accurate. + + Receiving data from the past hour might lead to incomplete statistics. For the + most accurate data, we recommend accessing the statistics after at least one + hour. Typically, updates are available within a 24-hour period, although the + frequency can vary. Maintenance periods or other exceptions may cause delays, + potentially extending beyond 24 hours until the servers are back online and the + missing data is filled in. Args: time_from: The start date of the report period (ISO 8601). The report starts from the diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index 3d18dec1..da32da6f 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -260,7 +260,9 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or @@ -733,7 +735,9 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 46f4510e..15e8f12e 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -142,7 +142,9 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or @@ -624,7 +626,9 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 91d99fcd..27eab660 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -134,9 +134,12 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: - """Create an instance with specified configuration. + """ + Create an instance with specified configuration. + + How to get access: - How to get access: For Linux, + For Linux, - Use the `user_data` field to provide a [cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html) @@ -144,7 +147,10 @@ def create( - Specify the `username` and `password` to create a new user. - When only `password` is provided, it is set as the password for the default user of the image. - - The `user_data` is ignored when the `password` is specified. For Windows, + - The `user_data` is ignored when the `password` is specified. + + For Windows, + - Use the `user_data` field to provide a [cloudbase-init script](https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config) in base64 to create new users on Windows. @@ -188,8 +194,9 @@ def create( security_groups: Specifies security group UUIDs to be applied to all instance network interfaces. - servergroup_id: - Placement group ID for instance placement policy. Supported group types: + servergroup_id: Placement group ID for instance placement policy. + + Supported group types: - `anti-affinity`: Ensures instances are placed on different hosts for high availability. @@ -1133,7 +1140,9 @@ def get( The response content language for `ddos_profile` can be controlled via the 'language' cookie - parameter. **Cookie Parameters**: + parameter. + + **Cookie Parameters**: - `language` (str, optional): Language for the response content. Affects the `ddos_profile` field. Supported values: @@ -1503,9 +1512,12 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskIDList: - """Create an instance with specified configuration. + """ + Create an instance with specified configuration. + + How to get access: - How to get access: For Linux, + For Linux, - Use the `user_data` field to provide a [cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html) @@ -1513,7 +1525,10 @@ async def create( - Specify the `username` and `password` to create a new user. - When only `password` is provided, it is set as the password for the default user of the image. - - The `user_data` is ignored when the `password` is specified. For Windows, + - The `user_data` is ignored when the `password` is specified. + + For Windows, + - Use the `user_data` field to provide a [cloudbase-init script](https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config) in base64 to create new users on Windows. @@ -1557,8 +1572,9 @@ async def create( security_groups: Specifies security group UUIDs to be applied to all instance network interfaces. - servergroup_id: - Placement group ID for instance placement policy. Supported group types: + servergroup_id: Placement group ID for instance placement policy. + + Supported group types: - `anti-affinity`: Ensures instances are placed on different hosts for high availability. @@ -2502,7 +2518,9 @@ async def get( The response content language for `ddos_profile` can be controlled via the 'language' cookie - parameter. **Cookie Parameters**: + parameter. + + **Cookie Parameters**: - `language` (str, optional): Language for the response content. Affects the `ddos_profile` field. Supported values: diff --git a/src/gcore/resources/cloud/ip_ranges.py b/src/gcore/resources/cloud/ip_ranges.py index fe7f9a68..d807001b 100644 --- a/src/gcore/resources/cloud/ip_ranges.py +++ b/src/gcore/resources/cloud/ip_ranges.py @@ -51,7 +51,9 @@ def list( ) -> IPRanges: """ Returns the complete list of IPv4 and IPv6 address ranges that Cloud uses for - outbound (egress) traffic. Typical reasons to call this endpoint: + outbound (egress) traffic. + + Typical reasons to call this endpoint: - Host-file delivery workflows – You upload images or other assets to the Cloud and share a download link that points to your own infrastructure. Add these @@ -61,10 +63,11 @@ def list( Cloud pushes events to your listener endpoint. Whitelisting the egress IP ranges lets you accept only traffic that originates from us. - General security controls, audit tooling, or SIEM rules that need to verify - that traffic truly comes from the Cloud. The list is global (covers all - regions) and refreshed automatically whenever Gcore allocates new egress IP - space. The response is an array of CIDR blocks; duplicate prefixes are not - returned. + that traffic truly comes from the Cloud. + + The list is global (covers all regions) and refreshed automatically whenever + Gcore allocates new egress IP space. The response is an array of CIDR blocks; + duplicate prefixes are not returned. """ return self._get( "/cloud/public/v1/ipranges/egress", @@ -107,7 +110,9 @@ async def list( ) -> IPRanges: """ Returns the complete list of IPv4 and IPv6 address ranges that Cloud uses for - outbound (egress) traffic. Typical reasons to call this endpoint: + outbound (egress) traffic. + + Typical reasons to call this endpoint: - Host-file delivery workflows – You upload images or other assets to the Cloud and share a download link that points to your own infrastructure. Add these @@ -117,10 +122,11 @@ async def list( Cloud pushes events to your listener endpoint. Whitelisting the egress IP ranges lets you accept only traffic that originates from us. - General security controls, audit tooling, or SIEM rules that need to verify - that traffic truly comes from the Cloud. The list is global (covers all - regions) and refreshed automatically whenever Gcore allocates new egress IP - space. The response is an array of CIDR blocks; duplicate prefixes are not - returned. + that traffic truly comes from the Cloud. + + The list is global (covers all regions) and refreshed automatically whenever + Gcore allocates new egress IP space. The response is an array of CIDR blocks; + duplicate prefixes are not returned. """ return await self._get( "/cloud/public/v1/ipranges/egress", diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index 2ab3669e..3e3f3398 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -120,9 +120,12 @@ def create( authentication: Authentication settings - autoscaler_config: Cluster autoscaler configuration. It allows you to override the default - cluster-autoscaler parameters provided by the platform with your preferred - values. Supported parameters (in alphabetical order): + autoscaler_config: Cluster autoscaler configuration. + + It allows you to override the default cluster-autoscaler parameters provided by + the platform with your preferred values. + + Supported parameters (in alphabetical order): - balance-similar-node-groups (boolean: true/false) - Detect similar node groups and balance the number of nodes between them. @@ -263,9 +266,12 @@ def update( Args: authentication: Authentication settings - autoscaler_config: Cluster autoscaler configuration. It allows you to override the default - cluster-autoscaler parameters provided by the platform with your preferred - values. Supported parameters (in alphabetical order): + autoscaler_config: Cluster autoscaler configuration. + + It allows you to override the default cluster-autoscaler parameters provided by + the platform with your preferred values. + + Supported parameters (in alphabetical order): - balance-similar-node-groups (boolean: true/false) - Detect similar node groups and balance the number of nodes between them. @@ -709,9 +715,12 @@ async def create( authentication: Authentication settings - autoscaler_config: Cluster autoscaler configuration. It allows you to override the default - cluster-autoscaler parameters provided by the platform with your preferred - values. Supported parameters (in alphabetical order): + autoscaler_config: Cluster autoscaler configuration. + + It allows you to override the default cluster-autoscaler parameters provided by + the platform with your preferred values. + + Supported parameters (in alphabetical order): - balance-similar-node-groups (boolean: true/false) - Detect similar node groups and balance the number of nodes between them. @@ -852,9 +861,12 @@ async def update( Args: authentication: Authentication settings - autoscaler_config: Cluster autoscaler configuration. It allows you to override the default - cluster-autoscaler parameters provided by the platform with your preferred - values. Supported parameters (in alphabetical order): + autoscaler_config: Cluster autoscaler configuration. + + It allows you to override the default cluster-autoscaler parameters provided by + the platform with your preferred values. + + Supported parameters (in alphabetical order): - balance-similar-node-groups (boolean: true/false) - Detect similar node groups and balance the number of nodes between them. diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index 799c335f..cd013254 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -265,7 +265,9 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or @@ -948,7 +950,9 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index bfeeeb9f..18e7807a 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -200,6 +200,7 @@ def update( ) -> TaskIDList: """ Updates the specified load balancer pool with the provided changes. + **Behavior:** - Simple fields (strings, numbers, booleans) will be updated if provided @@ -209,8 +210,10 @@ def update( - If no change is detected for a specific field compared to the current pool state, that field will be skipped - If no changes are detected at all across all fields, no task will be created - and an empty task list will be returned **Examples of complex objects that - require full specification:** + and an empty task list will be returned + + **Examples of complex objects that require full specification:** + - Pool members: All member properties must be provided when updating members - Health monitors: Complete health monitor configuration must be specified - Session persistence: Full session persistence settings must be included @@ -758,6 +761,7 @@ async def update( ) -> TaskIDList: """ Updates the specified load balancer pool with the provided changes. + **Behavior:** - Simple fields (strings, numbers, booleans) will be updated if provided @@ -767,8 +771,10 @@ async def update( - If no change is detected for a specific field compared to the current pool state, that field will be skipped - If no changes are detected at all across all fields, no task will be created - and an empty task list will be returned **Examples of complex objects that - require full specification:** + and an empty task list will be returned + + **Examples of complex objects that require full specification:** + - Pool members: All member properties must be provided when updating members - Health monitors: Complete health monitor configuration must be specified - Session persistence: Full session persistence settings must be included diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index 92cc45e6..d2a7615a 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -219,7 +219,9 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or @@ -639,7 +641,9 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index a1b237aa..052a2327 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -253,7 +253,9 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or @@ -709,7 +711,9 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py index 9ed4f0ec..0ba3414e 100644 --- a/src/gcore/resources/cloud/registries/registries.py +++ b/src/gcore/resources/cloud/registries/registries.py @@ -108,8 +108,11 @@ def create( Create a new container registry with the specified configuration. Args: - name: A name for the container registry. Should be in lowercase, consisting only of - numbers, letters and -, with maximum length of 24 characters + name: A name for the container registry. + + Should be in lowercase, consisting only of numbers, letters and -, + + with maximum length of 24 characters storage_limit: Registry storage limit, GiB @@ -347,8 +350,11 @@ async def create( Create a new container registry with the specified configuration. Args: - name: A name for the container registry. Should be in lowercase, consisting only of - numbers, letters and -, with maximum length of 24 characters + name: A name for the container registry. + + Should be in lowercase, consisting only of numbers, letters and -, + + with maximum length of 24 characters storage_limit: Registry storage limit, GiB diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index 110b6d2b..5225429a 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -69,8 +69,11 @@ def create( Args: duration: User account operating time, days - name: A name for the registry user. Should be in lowercase, consisting only of numbers - and letters, with maximum length of 16 characters + name: A name for the registry user. + + Should be in lowercase, consisting only of numbers and letters, + + with maximum length of 16 characters read_only: Read-only user @@ -355,8 +358,11 @@ async def create( Args: duration: User account operating time, days - name: A name for the registry user. Should be in lowercase, consisting only of numbers - and letters, with maximum length of 16 characters + name: A name for the registry user. + + Should be in lowercase, consisting only of numbers and letters, + + with maximum length of 16 characters read_only: Read-only user diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 52c3c958..5961799b 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -138,7 +138,9 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or @@ -508,7 +510,9 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index 601753a5..b1b577eb 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -340,7 +340,9 @@ def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or @@ -1566,7 +1568,9 @@ async def update( tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and - cannot be modified. **Examples:** + cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/resources/dns/zones/rrsets.py b/src/gcore/resources/dns/zones/rrsets.py index bba8e773..15085076 100644 --- a/src/gcore/resources/dns/zones/rrsets.py +++ b/src/gcore/resources/dns/zones/rrsets.py @@ -86,9 +86,11 @@ def create( determined by EDNS Client Subnet (ECS) if defined, otherwise - by client/recursor IP. Selector pickers are used in the specified order until the first match, in case of match - all next selectors are bypassed. Filters or - mutators are applied to the match according to the order they are specified. For - example, sort records by proximity to user, shuffle based on weights and return - not more than 3: + mutators are applied to the match according to the order they are specified. + + For example, sort records by proximity to user, shuffle based on weights and + return not more than 3: + `"pickers": [ { "type": "geodistance" }, { "type": "`weighted_shuffle`" }, { "type": "`first_n`", "limit": 3 } ]` #### geodns filter @@ -103,11 +105,14 @@ def create( - `regions` - list of region codes, e.g. `["de-bw", "de-by"]`; - `countries` - list of country codes, e.g. `["de", "lu", "lt"]`; - `continents` - list of continent codes, e.g. - `["af", "an", "eu", "as", "na", "sa", "oc"]`. If there is a record (or - multiple) with metadata matched IP, it's used as a response. If not - asn, - then country and then continent are checked for a match. If there is no match, - then the behaviour is defined by _strict_ parameter of the filter. Example: - `"pickers": [ { "type": "geodns", "strict": true } ]` + `["af", "an", "eu", "as", "na", "sa", "oc"]`. + + If there is a record (or multiple) with metadata matched IP, it's used as a + response. If not - asn, then country and then continent are checked for a match. + If there is no match, then the behaviour is defined by _strict_ parameter of the + filter. + + Example: `"pickers": [ { "type": "geodns", "strict": true } ]` ##### Strict parameter @@ -119,41 +124,50 @@ def create( Resource records which ASN metadata matches ASN of the requestor are picked by this selector, and passed to the next non-selector picker, if there is no - match - next configured picker starts with all records. Example: - `"pickers": [ {"type": "asn"} ]` + match - next configured picker starts with all records. + + Example: `"pickers": [ {"type": "asn"} ]` #### country selector Resource records which country metadata matches country of the requestor are picked by this selector, and passed to the next non-selector picker, if there is - no match - next configured picker starts with all records. Example: - `"pickers": [ { "type": "country" } ]` + no match - next configured picker starts with all records. + + Example: `"pickers": [ { "type": "country" } ]` #### continent selector Resource records which continent metadata matches continent of the requestor are picked by this selector, and passed to the next non-selector picker, if there is - no match - next configured picker starts with all records. Example: - `"pickers": [ { "type": "continent" } ]` + no match - next configured picker starts with all records. + + Example: `"pickers": [ { "type": "continent" } ]` #### region selector Resource records which region metadata matches region of the requestor are picked by this selector, and passed to the next non-selector picker, if there is no match - next configured picker starts with all records. e.g. `fr-nor` for - France/Normandy. Example: `"pickers": [ { "type": "region" } ]` + France/Normandy. + + Example: `"pickers": [ { "type": "region" } ]` #### ip selector Resource records which IP metadata matches IP of the requestor are picked by this selector, and passed to the next non-selector picker, if there is no match - next configured picker starts with all records. Maximum 100 subnets are - allowed to specify in meta of RR. Example: `"pickers": [ { "type": "ip" } ]` + allowed to specify in meta of RR. + + Example: `"pickers": [ { "type": "ip" } ]` #### default selector When enabled, records marked as default are selected: - `"meta": {"default": true}`. Example: + `"meta": {"default": true}`. + + Example: `"pickers": [ { "type": "geodns", "strict": false }, { "type": "default" }, { "type": "`first_n`", "limit": 2 } ]` #### geodistance mutator @@ -162,19 +176,22 @@ def create( meters) from requestor to the coordinates specified in latlong metadata. Distance is calculated using Haversine formula. The "nearest" to the user's IP RR goes first. The records without latlong metadata come last. e.g. for Berlin - `[52.520008, 13.404954]`.; In this configuration the only "nearest" to the - requestor record to be returned: + `[52.520008, 13.404954]`.; + + In this configuration the only "nearest" to the requestor record to be returned: `"pickers": [ { "type": "geodistance" }, { "type": "`first_n`", "limit": 1 } ]` #### `weighted_shuffle` mutator The resource records are rearranged in random order based on the `weight` - metadata. Default weight (if not specified) is 50. Example: - `"pickers": [ { "type": "`weighted_shuffle`" } ]` + metadata. Default weight (if not specified) is 50. + + Example: `"pickers": [ { "type": "`weighted_shuffle`" } ]` #### `first_n` filter Slices first N (N specified as a limit parameter value) resource records. + Example: `"pickers": [ { "type": "`first_n`", "limit": 1 } ]` returns only the first resource record. @@ -525,9 +542,11 @@ async def create( determined by EDNS Client Subnet (ECS) if defined, otherwise - by client/recursor IP. Selector pickers are used in the specified order until the first match, in case of match - all next selectors are bypassed. Filters or - mutators are applied to the match according to the order they are specified. For - example, sort records by proximity to user, shuffle based on weights and return - not more than 3: + mutators are applied to the match according to the order they are specified. + + For example, sort records by proximity to user, shuffle based on weights and + return not more than 3: + `"pickers": [ { "type": "geodistance" }, { "type": "`weighted_shuffle`" }, { "type": "`first_n`", "limit": 3 } ]` #### geodns filter @@ -542,11 +561,14 @@ async def create( - `regions` - list of region codes, e.g. `["de-bw", "de-by"]`; - `countries` - list of country codes, e.g. `["de", "lu", "lt"]`; - `continents` - list of continent codes, e.g. - `["af", "an", "eu", "as", "na", "sa", "oc"]`. If there is a record (or - multiple) with metadata matched IP, it's used as a response. If not - asn, - then country and then continent are checked for a match. If there is no match, - then the behaviour is defined by _strict_ parameter of the filter. Example: - `"pickers": [ { "type": "geodns", "strict": true } ]` + `["af", "an", "eu", "as", "na", "sa", "oc"]`. + + If there is a record (or multiple) with metadata matched IP, it's used as a + response. If not - asn, then country and then continent are checked for a match. + If there is no match, then the behaviour is defined by _strict_ parameter of the + filter. + + Example: `"pickers": [ { "type": "geodns", "strict": true } ]` ##### Strict parameter @@ -558,41 +580,50 @@ async def create( Resource records which ASN metadata matches ASN of the requestor are picked by this selector, and passed to the next non-selector picker, if there is no - match - next configured picker starts with all records. Example: - `"pickers": [ {"type": "asn"} ]` + match - next configured picker starts with all records. + + Example: `"pickers": [ {"type": "asn"} ]` #### country selector Resource records which country metadata matches country of the requestor are picked by this selector, and passed to the next non-selector picker, if there is - no match - next configured picker starts with all records. Example: - `"pickers": [ { "type": "country" } ]` + no match - next configured picker starts with all records. + + Example: `"pickers": [ { "type": "country" } ]` #### continent selector Resource records which continent metadata matches continent of the requestor are picked by this selector, and passed to the next non-selector picker, if there is - no match - next configured picker starts with all records. Example: - `"pickers": [ { "type": "continent" } ]` + no match - next configured picker starts with all records. + + Example: `"pickers": [ { "type": "continent" } ]` #### region selector Resource records which region metadata matches region of the requestor are picked by this selector, and passed to the next non-selector picker, if there is no match - next configured picker starts with all records. e.g. `fr-nor` for - France/Normandy. Example: `"pickers": [ { "type": "region" } ]` + France/Normandy. + + Example: `"pickers": [ { "type": "region" } ]` #### ip selector Resource records which IP metadata matches IP of the requestor are picked by this selector, and passed to the next non-selector picker, if there is no match - next configured picker starts with all records. Maximum 100 subnets are - allowed to specify in meta of RR. Example: `"pickers": [ { "type": "ip" } ]` + allowed to specify in meta of RR. + + Example: `"pickers": [ { "type": "ip" } ]` #### default selector When enabled, records marked as default are selected: - `"meta": {"default": true}`. Example: + `"meta": {"default": true}`. + + Example: `"pickers": [ { "type": "geodns", "strict": false }, { "type": "default" }, { "type": "`first_n`", "limit": 2 } ]` #### geodistance mutator @@ -601,19 +632,22 @@ async def create( meters) from requestor to the coordinates specified in latlong metadata. Distance is calculated using Haversine formula. The "nearest" to the user's IP RR goes first. The records without latlong metadata come last. e.g. for Berlin - `[52.520008, 13.404954]`.; In this configuration the only "nearest" to the - requestor record to be returned: + `[52.520008, 13.404954]`.; + + In this configuration the only "nearest" to the requestor record to be returned: `"pickers": [ { "type": "geodistance" }, { "type": "`first_n`", "limit": 1 } ]` #### `weighted_shuffle` mutator The resource records are rearranged in random order based on the `weight` - metadata. Default weight (if not specified) is 50. Example: - `"pickers": [ { "type": "`weighted_shuffle`" } ]` + metadata. Default weight (if not specified) is 50. + + Example: `"pickers": [ { "type": "`weighted_shuffle`" } ]` #### `first_n` filter Slices first N (N specified as a limit parameter value) resource records. + Example: `"pickers": [ { "type": "`first_n`", "limit": 1 } ]` returns only the first resource record. diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index 0a5e9535..765d77eb 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -472,26 +472,30 @@ def get_statistics( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneGetStatisticsResponse: - """Statistics of DNS zone in common and by record types. + """ + Statistics of DNS zone in common and by record types. + + To get summary statistics for all zones use `all` instead of zone name in path. - To get summary statistics - for all zones use `all` instead of zone name in path. Note: Consumption - statistics is updated in near real-time as a standard practice. However, the - frequency of updates can vary, but they are typically available within a 30 - minutes period. Exceptions, such as maintenance periods, may delay data beyond - 30 minutes until servers resume and backfill missing statistics. + Note: Consumption statistics is updated in near real-time as a standard + practice. However, the frequency of updates can vary, but they are typically + available within a 30 minutes period. Exceptions, such as maintenance periods, + may delay data beyond 30 minutes until servers resume and backfill missing + statistics. Args: - from_: - Beginning of the requested time period (Unix Timestamp, UTC.) In a query string: - &from=1709068637 + from_: Beginning of the requested time period (Unix Timestamp, UTC.) + + In a query string: &from=1709068637 granularity: Granularity parameter string is a sequence of decimal numbers, each with - optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". Valid - time units are "s", "m", "h". + optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". - record_type: - DNS record type. Possible values: + Valid time units are "s", "m", "h". + + record_type: DNS record type. + + Possible values: - A - AAAA @@ -502,9 +506,9 @@ def get_statistics( - SVCB - HTTPS - to: - End of the requested time period (Unix Timestamp, UTC.) In a query string: - &to=1709673437 + to: End of the requested time period (Unix Timestamp, UTC.) + + In a query string: &to=1709673437 extra_headers: Send extra headers @@ -557,20 +561,27 @@ def import_( n <= len(p)) and any error encountered. Even if Read returns n < len(p), it may use all of p as scratch space during the call. If some data is available but not len(p) bytes, Read conventionally returns what is available instead of waiting - for more. When Read encounters an error or end-of-file condition after - successfully reading n > 0 bytes, it returns the number of bytes read. It may - return the (non-nil) error from the same call or return the error (and n == 0) - from a subsequent call. An instance of this general case is that a Reader - returning a non-zero number of bytes at the end of the input stream may return - either err == EOF or err == nil. The next Read should return 0, EOF. Callers - should always process the n > 0 bytes returned before considering the error err. - Doing so correctly handles I/O errors that happen after reading some bytes and - also both of the allowed EOF behaviors. If len(p) == 0, Read should always - return n == 0. It may return a non-nil error if some error condition is known, - such as EOF. Implementations of Read are discouraged from returning a zero byte - count with a nil error, except when len(p) == 0. Callers should treat a return - of 0 and nil as indicating that nothing happened; in particular it does not - indicate EOF. Implementations must not retain p. + for more. + + When Read encounters an error or end-of-file condition after successfully + reading n > 0 bytes, it returns the number of bytes read. It may return the + (non-nil) error from the same call or return the error (and n == 0) from a + subsequent call. An instance of this general case is that a Reader returning a + non-zero number of bytes at the end of the input stream may return either err == + EOF or err == nil. The next Read should return 0, EOF. + + Callers should always process the n > 0 bytes returned before considering the + error err. Doing so correctly handles I/O errors that happen after reading some + bytes and also both of the allowed EOF behaviors. + + If len(p) == 0, Read should always return n == 0. It may return a non-nil error + if some error condition is known, such as EOF. + + Implementations of Read are discouraged from returning a zero byte count with a + nil error, except when len(p) == 0. Callers should treat a return of 0 and nil + as indicating that nothing happened; in particular it does not indicate EOF. + + Implementations must not retain p. extra_headers: Send extra headers @@ -1098,26 +1109,30 @@ async def get_statistics( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ZoneGetStatisticsResponse: - """Statistics of DNS zone in common and by record types. + """ + Statistics of DNS zone in common and by record types. + + To get summary statistics for all zones use `all` instead of zone name in path. - To get summary statistics - for all zones use `all` instead of zone name in path. Note: Consumption - statistics is updated in near real-time as a standard practice. However, the - frequency of updates can vary, but they are typically available within a 30 - minutes period. Exceptions, such as maintenance periods, may delay data beyond - 30 minutes until servers resume and backfill missing statistics. + Note: Consumption statistics is updated in near real-time as a standard + practice. However, the frequency of updates can vary, but they are typically + available within a 30 minutes period. Exceptions, such as maintenance periods, + may delay data beyond 30 minutes until servers resume and backfill missing + statistics. Args: - from_: - Beginning of the requested time period (Unix Timestamp, UTC.) In a query string: - &from=1709068637 + from_: Beginning of the requested time period (Unix Timestamp, UTC.) + + In a query string: &from=1709068637 granularity: Granularity parameter string is a sequence of decimal numbers, each with - optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". Valid - time units are "s", "m", "h". + optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". - record_type: - DNS record type. Possible values: + Valid time units are "s", "m", "h". + + record_type: DNS record type. + + Possible values: - A - AAAA @@ -1128,9 +1143,9 @@ async def get_statistics( - SVCB - HTTPS - to: - End of the requested time period (Unix Timestamp, UTC.) In a query string: - &to=1709673437 + to: End of the requested time period (Unix Timestamp, UTC.) + + In a query string: &to=1709673437 extra_headers: Send extra headers @@ -1183,20 +1198,27 @@ async def import_( n <= len(p)) and any error encountered. Even if Read returns n < len(p), it may use all of p as scratch space during the call. If some data is available but not len(p) bytes, Read conventionally returns what is available instead of waiting - for more. When Read encounters an error or end-of-file condition after - successfully reading n > 0 bytes, it returns the number of bytes read. It may - return the (non-nil) error from the same call or return the error (and n == 0) - from a subsequent call. An instance of this general case is that a Reader - returning a non-zero number of bytes at the end of the input stream may return - either err == EOF or err == nil. The next Read should return 0, EOF. Callers - should always process the n > 0 bytes returned before considering the error err. - Doing so correctly handles I/O errors that happen after reading some bytes and - also both of the allowed EOF behaviors. If len(p) == 0, Read should always - return n == 0. It may return a non-nil error if some error condition is known, - such as EOF. Implementations of Read are discouraged from returning a zero byte - count with a nil error, except when len(p) == 0. Callers should treat a return - of 0 and nil as indicating that nothing happened; in particular it does not - indicate EOF. Implementations must not retain p. + for more. + + When Read encounters an error or end-of-file condition after successfully + reading n > 0 bytes, it returns the number of bytes read. It may return the + (non-nil) error from the same call or return the error (and n == 0) from a + subsequent call. An instance of this general case is that a Reader returning a + non-zero number of bytes at the end of the input stream may return either err == + EOF or err == nil. The next Read should return 0, EOF. + + Callers should always process the n > 0 bytes returned before considering the + error err. Doing so correctly handles I/O errors that happen after reading some + bytes and also both of the allowed EOF behaviors. + + If len(p) == 0, Read should always return n == 0. It may return a non-nil error + if some error condition is known, such as EOF. + + Implementations of Read are discouraged from returning a zero byte count with a + nil error, except when len(p) == 0. Callers should treat a return of 0 and nil + as indicating that nothing happened; in particular it does not indicate EOF. + + Implementations must not retain p. extra_headers: Send extra headers diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index bbb9e413..f411d577 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -77,8 +77,9 @@ def update( email: User's email address. - groups: - User's group in the current account. IAM supports 5 groups: + groups: User's group in the current account. + + IAM supports 5 groups: - Users - Administrators @@ -86,7 +87,9 @@ def update( - Purge and Prefetch only (API) - Purge and Prefetch only (API+Web) - lang: User's language. Defines language of the control panel and email messages. + lang: User's language. + + Defines language of the control panel and email messages. name: User's name. @@ -132,11 +135,12 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[User]: - """Get a list of users. + """ + Get a list of users. - Pass a value for the `limit` parameter in your request if - you want retrieve a paginated result. Otherwise API returns a list with all - users without pagination. + Pass a value for the `limit` parameter in your request if you want retrieve a + paginated result. Otherwise API returns a list with all users without + pagination. Args: limit: The maximum number of items. @@ -253,16 +257,20 @@ def invite( ) -> UserInvite: """Invite a user to the account. - User will receive an email. The new user will - receive an invitation email with a link to create an account password, the - existing user will be notified about the invitation to the account. + User will receive an email. + + The new user will receive an invitation email with a + link to create an account password, the existing user will be notified about the + invitation to the account. Args: client_id: ID of account. email: User email. - lang: User's language. Defines language of the control panel and email messages. + lang: User's language. + + Defines language of the control panel and email messages. name: User name. @@ -342,8 +350,9 @@ async def update( email: User's email address. - groups: - User's group in the current account. IAM supports 5 groups: + groups: User's group in the current account. + + IAM supports 5 groups: - Users - Administrators @@ -351,7 +360,9 @@ async def update( - Purge and Prefetch only (API) - Purge and Prefetch only (API+Web) - lang: User's language. Defines language of the control panel and email messages. + lang: User's language. + + Defines language of the control panel and email messages. name: User's name. @@ -397,11 +408,12 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[User, AsyncOffsetPage[User]]: - """Get a list of users. + """ + Get a list of users. - Pass a value for the `limit` parameter in your request if - you want retrieve a paginated result. Otherwise API returns a list with all - users without pagination. + Pass a value for the `limit` parameter in your request if you want retrieve a + paginated result. Otherwise API returns a list with all users without + pagination. Args: limit: The maximum number of items. @@ -518,16 +530,20 @@ async def invite( ) -> UserInvite: """Invite a user to the account. - User will receive an email. The new user will - receive an invitation email with a link to create an account password, the - existing user will be notified about the invitation to the account. + User will receive an email. + + The new user will receive an invitation email with a + link to create an account password, the existing user will be notified about the + invitation to the account. Args: client_id: ID of account. email: User email. - lang: User's language. Defines language of the control panel and email messages. + lang: User's language. + + Defines language of the control panel and email messages. name: User name. diff --git a/src/gcore/resources/storage/buckets/buckets.py b/src/gcore/resources/storage/buckets/buckets.py index 66c28797..e6c589fa 100644 --- a/src/gcore/resources/storage/buckets/buckets.py +++ b/src/gcore/resources/storage/buckets/buckets.py @@ -128,11 +128,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPage[Bucket]: - """Returns the list of buckets for the storage in a wrapped response. + """ + Returns the list of buckets for the storage in a wrapped response. - Response - format: count: total number of buckets (independent of pagination) results: - current page of buckets according to limit/offset + Response format: count: total number of buckets (independent of pagination) + results: current page of buckets according to limit/offset Args: limit: Max number of records in response @@ -286,11 +286,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Bucket, AsyncOffsetPage[Bucket]]: - """Returns the list of buckets for the storage in a wrapped response. + """ + Returns the list of buckets for the storage in a wrapped response. - Response - format: count: total number of buckets (independent of pagination) results: - current page of buckets according to limit/offset + Response format: count: total number of buckets (independent of pagination) + results: current page of buckets according to limit/offset Args: limit: Max number of records in response diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index 7b5d0039..c3a2d71e 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -224,9 +224,11 @@ def list( ) -> SyncOffsetPage[Storage]: """ Returns storages with the same filtering and pagination as v2, but in a - simplified response shape for easier client consumption. Response format: count: - total number of storages matching the filter (independent of pagination) - results: the current page of storages according to limit/offset + simplified response shape for easier client consumption. + + Response format: count: total number of storages matching the filter + (independent of pagination) results: the current page of storages according to + limit/offset Args: id: Filter by storage ID @@ -626,9 +628,11 @@ def list( ) -> AsyncPaginator[Storage, AsyncOffsetPage[Storage]]: """ Returns storages with the same filtering and pagination as v2, but in a - simplified response shape for easier client consumption. Response format: count: - total number of storages matching the filter (independent of pagination) - results: the current page of storages according to limit/offset + simplified response shape for easier client consumption. + + Response format: count: total number of storages matching the filter + (independent of pagination) results: the current page of storages according to + limit/offset Args: id: Filter by storage ID diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index 5fef8653..6811e64c 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -65,10 +65,10 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskCreateResponse: - """Creating an AI task. + """ + Creating an AI task. - This method allows you to create an AI task for VOD video - processing: + This method allows you to create an AI task for VOD video processing: - ASR: Transcribe video - ASR: Translate subtitles @@ -77,28 +77,39 @@ def create( - CM: Soft nudity detection - CM: Hard nudity detection - CM: Objects recognition (soon) - ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) - How to use: + + ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) + + How to use: + - Create an AI task, specify algoritm to use - Get `task_id` - - Check a result using `.../ai/tasks/{task_id}` method For more detailed - information, see the description of each method separately. + - Check a result using `.../ai/tasks/{task_id}` method + + For more detailed information, see the description of each method separately. - **AI Automatic Speech Recognition (ASR)** AI is instrumental in automatic video - processing for subtitles creation by using Automatic Speech Recognition (ASR) - technology to transcribe spoken words into text, which can then be translated - into multiple languages for broader accessibility. Categories: + **AI Automatic Speech Recognition (ASR)** + + AI is instrumental in automatic video processing for subtitles creation by using + Automatic Speech Recognition (ASR) technology to transcribe spoken words into + text, which can then be translated into multiple languages for broader + accessibility. + + Categories: - `transcription` – to create subtitles/captions from audio in the original language. - `translation` – to transate subtitles/captions from the original language to - 99+ other languages. AI subtitle transcription and translation tools are - highly efficient, processing large volumes of audio-visual content quickly and - providing accurate transcriptions and translations with minimal human - intervention. Additionally, AI-driven solutions can significantly reduce costs - and turnaround times compared to traditional methods, making them an - invaluable resource for content creators and broadcasters aiming to reach - global audiences. Example response with positive result: + 99+ other languages. + + AI subtitle transcription and translation tools are highly efficient, processing + large volumes of audio-visual content quickly and providing accurate + transcriptions and translations with minimal human intervention. Additionally, + AI-driven solutions can significantly reduce costs and turnaround times compared + to traditional methods, making them an invaluable resource for content creators + and broadcasters aiming to reach global audiences. + + Example response with positive result: ``` { @@ -120,11 +131,14 @@ def create( } ``` - **AI Content Moderation (CM)** The AI Content Moderation API offers a powerful - solution for analyzing video content to detect various categories of - inappropriate material. Leveraging state-of-the-art AI models, this API ensures - real-time analysis and flagging of sensitive or restricted content types, making - it an essential tool for platforms requiring stringent content moderation. + **AI Content Moderation (CM)** + + The AI Content Moderation API offers a powerful solution for analyzing video + content to detect various categories of inappropriate material. Leveraging + state-of-the-art AI models, this API ensures real-time analysis and flagging of + sensitive or restricted content types, making it an essential tool for platforms + requiring stringent content moderation. + Categories: - `nsfw`: Quick algorithm to detect pornographic material, ensuring content is @@ -134,11 +148,15 @@ def create( - `soft_nudity`: Detailed video analysis that reveals both explicit and partial nudity, including the presence of male and female faces and other uncovered body parts. - - `sport`: Recognizes various sporting activities. The AI Content Moderation API - is an invaluable tool for managing and controlling the type of content being - shared or streamed on your platform. By implementing this API, you can ensure - compliance with community guidelines and legal requirements, as well as - provide a safer environment for your users. Important notes: + - `sport`: Recognizes various sporting activities. + + The AI Content Moderation API is an invaluable tool for managing and controlling + the type of content being shared or streamed on your platform. By implementing + this API, you can ensure compliance with community guidelines and legal + requirements, as well as provide a safer environment for your users. + + Important notes: + - It's allowed to analyse still images too (where applicable). Format of image: JPEG, PNG. In that case one image is the same as video of 1 second duration. - Not all frames in the video are used for analysis, but only key frames @@ -146,7 +164,9 @@ def create( detection will only occur at these timestamps. If an object appears and disappears between these time stamps, it will not be detected. We are working on a version to analyze more frames, please contact your manager or our - support team to enable this method. Example response with positive result: + support team to enable this method. + + Example response with positive result: ``` { @@ -159,9 +179,11 @@ def create( } ``` - **Additional information** Billing takes into account the duration of the - analyzed video. Or the duration until the stop tag(where applicable), if the - condition was triggered during the analysis. + **Additional information** + + Billing takes into account the duration of the analyzed video. Or the duration + until the stop tag(where applicable), if the condition was triggered during the + analysis. The heart of content moderation is AI, with additional services. They run on our own infrastructure, so the files/data are not transferred anywhere to external @@ -177,13 +199,20 @@ def create( url: URL to the MP4 file to analyse. File must be publicly accessible via HTTP/HTTPS. audio_language: Language in original audio (transcription only). This value is used to determine - the language from which to transcribe. If this is not set, the system will run - auto language identification and the subtitles will be in the detected language. - The method also works based on AI analysis. It's fairly accurate, but if it's - wrong, then set the language explicitly. Additionally, when this is not set, we - also support recognition of alternate languages in the video (language - code-switching). Language is set by 3-letter language code according to - ISO-639-2 (bibliographic code). We can process languages: + the language from which to transcribe. + + If this is not set, the system will run auto language identification and the + subtitles will be in the detected language. The method also works based on AI + analysis. It's fairly accurate, but if it's wrong, then set the language + explicitly. + + Additionally, when this is not set, we also support recognition of alternate + languages in the video (language code-switching). + + Language is set by 3-letter language code according to ISO-639-2 (bibliographic + code). + + We can process languages: - 'afr': Afrikaans - 'alb': Albanian @@ -290,10 +319,12 @@ def create( client_entity_data: Meta parameter, designed to store your own extra information about a video entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. + processing. + + For example, if an AI-task was created automatically when you uploaded a video + with the AI auto-processing option (nudity detection, etc), then the ID of the + associated video for which the task was performed will be explicitly indicated + here. client_user_id: Meta parameter, designed to store your own identifier. Can be used by you to tag requests from different end-users. It is not used in any way in video @@ -301,6 +332,7 @@ def create( subtitles_language: Indicates which language it is clearly necessary to translate into. If this is not set, the original language will be used from attribute "`audio_language`". + Please note that: - transcription into the original language is a free procedure, @@ -356,11 +388,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPageStreamingAI[AITask]: - """Returns a list of previously created and processed AI tasks. + """ + Returns a list of previously created and processed AI tasks. - The list contains - brief information about the task and its execution status. Data is displayed - page by page. + The list contains brief information about the task and its execution status. + Data is displayed page by page. Args: date_created: Time when task was created. Datetime in ISO 8601 format. @@ -368,15 +400,21 @@ def list( limit: Number of results to return per page. ordering: Which field to use when ordering the results: `task_id`, status, and - `task_name`. Sorting is done in ascending (ASC) order. If parameter is omitted - then "`started_at` DESC" is used for ordering by default. + `task_name`. Sorting is done in ascending (ASC) order. + + If parameter is omitted then "`started_at` DESC" is used for ordering by + default. page: Page to view from task list, starting from 1 search: This is an field for combined text search in the following fields: `task_id`, - `task_name`, status, and `task_data`. Both full and partial searches are - possible inside specified above fields. For example, you can filter tasks of a - certain category, or tasks by a specific original file. Example: + `task_name`, status, and `task_data`. + + Both full and partial searches are possible inside specified above fields. For + example, you can filter tasks of a certain category, or tasks by a specific + original file. + + Example: - To filter tasks of Content Moderation NSFW method: `GET /streaming/ai/tasks?search=nsfw` @@ -436,7 +474,9 @@ def cancel( ) -> AITaskCancelResponse: """ Stopping a previously launched AI-task without waiting for it to be fully - completed. The task will be moved to "REVOKED" status. + completed. + + The task will be moved to "REVOKED" status. Args: extra_headers: Send extra headers @@ -470,9 +510,10 @@ def get( ) -> AITaskGetResponse: """ This is the single method to check the execution status of an AI task, and - obtain the result of any type of AI task. Based on the results of processing, - the “result” field will contain an answer corresponding to the type of the - initially created task: + obtain the result of any type of AI task. + + Based on the results of processing, the “result” field will contain an answer + corresponding to the type of the initially created task: - ASR: Transcribe video - ASR: Translate subtitles @@ -484,7 +525,9 @@ def get( - etc... (see other methods from /ai/ domain) A queue is used to process videos. The waiting time depends on the total number - of requests in the system, so sometimes you will have to wait. Statuses: + of requests in the system, so sometimes you will have to wait. + + Statuses: - PENDING – the task is received and it is pending for available resources - STARTED – processing has started @@ -492,12 +535,14 @@ def get( - FAILURE – processing failed - REVOKED – processing was cancelled by the user (or the system) - RETRY – the task execution failed due to internal reasons, the task is queued - for re-execution (up to 3 times) Each task is processed in sub-stages, for - example, original language is first determined in a video, and then - transcription is performed. In such cases, the video processing status may - change from "STARTED" to "PENDING", and back. This is due to waiting for - resources for a specific processing sub-stage. In this case, the overall - percentage "progress" of video processing will reflect the full picture. + for re-execution (up to 3 times) + + Each task is processed in sub-stages, for example, original language is first + determined in a video, and then transcription is performed. In such cases, the + video processing status may change from "STARTED" to "PENDING", and back. This + is due to waiting for resources for a specific processing sub-stage. In this + case, the overall percentage "progress" of video processing will reflect the + full picture. The result data is stored for 1 month, after which it is deleted. @@ -547,12 +592,17 @@ def get_ai_settings( or not for AI translation. - this list will expand as new AI methods are added. - **`language_support`** There are many languages available for transcription. But - not all languages can be automatically translated to and from with good quality. - In order to determine the availability of translation from the audio language to - the desired subtitle language, you can use this type of "`language_support`". AI - models are constantly improving, so this method can be used for dynamic - determination. Example: + **`language_support`** + + There are many languages available for transcription. But not all languages can + be automatically translated to and from with good quality. In order to determine + the availability of translation from the audio language to the desired subtitle + language, you can use this type of "`language_support`". + + AI models are constantly improving, so this method can be used for dynamic + determination. + + Example: ``` curl -L 'https://api.gcore.com/streaming/ai/info?type=language_support&audio_language=eng&subtitles_language=fre' @@ -560,10 +610,12 @@ def get_ai_settings( { "supported": true } ``` - Today we provide the following capabilities as below. These are the 100 - languages for which we support only transcription and translation to English. - The iso639-2b codes for these are: + Today we provide the following capabilities as below. + + These are the 100 languages for which we support only transcription and + translation to English. The iso639-2b codes for these are: `afr, sqi, amh, ara, hye, asm, aze, bak, eus, bel, ben, bos, bre, bul, mya, cat, zho, hrv, ces, dan, nld, eng, est, fao, fin, fra, glg, kat, deu, guj, hat, hau, haw, heb, hin, hun, isl, ind, ita, jpn, jav, kan, kaz, khm, kor, lao, lat, lav, lin, lit, ltz, mkd, mlg, msa, mal, mlt, mri, mar, ell, mon, nep, nor, nno, oci, pan, fas, pol, por, pus, ron, rus, san, srp, sna, snd, sin, slk, slv, som, spa, sun, swa, swe, tgl, tgk, tam, tat, tel, tha, bod, tur, tuk, ukr, urd, uzb, vie, cym, yid, yor`. + These are the 77 languages for which we support translation to other languages and translation to: `afr, amh, ara, hye, asm, aze, eus, bel, ben, bos, bul, mya, cat, zho, hrv, ces, dan, nld, eng, est, fin, fra, glg, kat, deu, guj, heb, hin, hun, isl, ind, ita, jpn, jav, kan, kaz, khm, kor, lao, lav, lit, mkd, mal, mlt, mar, ell, mon, nep, nno, pan, fas, pol, por, pus, ron, rus, srp, sna, snd, slk, slv, som, spa, swa, swe, tgl, tgk, tam, tel, tha, tur, ukr, urd, vie, cym, yor`. @@ -645,10 +697,10 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AITaskCreateResponse: - """Creating an AI task. + """ + Creating an AI task. - This method allows you to create an AI task for VOD video - processing: + This method allows you to create an AI task for VOD video processing: - ASR: Transcribe video - ASR: Translate subtitles @@ -657,28 +709,39 @@ async def create( - CM: Soft nudity detection - CM: Hard nudity detection - CM: Objects recognition (soon) - ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) - How to use: + + ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif) + + How to use: + - Create an AI task, specify algoritm to use - Get `task_id` - - Check a result using `.../ai/tasks/{task_id}` method For more detailed - information, see the description of each method separately. + - Check a result using `.../ai/tasks/{task_id}` method + + For more detailed information, see the description of each method separately. - **AI Automatic Speech Recognition (ASR)** AI is instrumental in automatic video - processing for subtitles creation by using Automatic Speech Recognition (ASR) - technology to transcribe spoken words into text, which can then be translated - into multiple languages for broader accessibility. Categories: + **AI Automatic Speech Recognition (ASR)** + + AI is instrumental in automatic video processing for subtitles creation by using + Automatic Speech Recognition (ASR) technology to transcribe spoken words into + text, which can then be translated into multiple languages for broader + accessibility. + + Categories: - `transcription` – to create subtitles/captions from audio in the original language. - `translation` – to transate subtitles/captions from the original language to - 99+ other languages. AI subtitle transcription and translation tools are - highly efficient, processing large volumes of audio-visual content quickly and - providing accurate transcriptions and translations with minimal human - intervention. Additionally, AI-driven solutions can significantly reduce costs - and turnaround times compared to traditional methods, making them an - invaluable resource for content creators and broadcasters aiming to reach - global audiences. Example response with positive result: + 99+ other languages. + + AI subtitle transcription and translation tools are highly efficient, processing + large volumes of audio-visual content quickly and providing accurate + transcriptions and translations with minimal human intervention. Additionally, + AI-driven solutions can significantly reduce costs and turnaround times compared + to traditional methods, making them an invaluable resource for content creators + and broadcasters aiming to reach global audiences. + + Example response with positive result: ``` { @@ -700,11 +763,14 @@ async def create( } ``` - **AI Content Moderation (CM)** The AI Content Moderation API offers a powerful - solution for analyzing video content to detect various categories of - inappropriate material. Leveraging state-of-the-art AI models, this API ensures - real-time analysis and flagging of sensitive or restricted content types, making - it an essential tool for platforms requiring stringent content moderation. + **AI Content Moderation (CM)** + + The AI Content Moderation API offers a powerful solution for analyzing video + content to detect various categories of inappropriate material. Leveraging + state-of-the-art AI models, this API ensures real-time analysis and flagging of + sensitive or restricted content types, making it an essential tool for platforms + requiring stringent content moderation. + Categories: - `nsfw`: Quick algorithm to detect pornographic material, ensuring content is @@ -714,11 +780,15 @@ async def create( - `soft_nudity`: Detailed video analysis that reveals both explicit and partial nudity, including the presence of male and female faces and other uncovered body parts. - - `sport`: Recognizes various sporting activities. The AI Content Moderation API - is an invaluable tool for managing and controlling the type of content being - shared or streamed on your platform. By implementing this API, you can ensure - compliance with community guidelines and legal requirements, as well as - provide a safer environment for your users. Important notes: + - `sport`: Recognizes various sporting activities. + + The AI Content Moderation API is an invaluable tool for managing and controlling + the type of content being shared or streamed on your platform. By implementing + this API, you can ensure compliance with community guidelines and legal + requirements, as well as provide a safer environment for your users. + + Important notes: + - It's allowed to analyse still images too (where applicable). Format of image: JPEG, PNG. In that case one image is the same as video of 1 second duration. - Not all frames in the video are used for analysis, but only key frames @@ -726,7 +796,9 @@ async def create( detection will only occur at these timestamps. If an object appears and disappears between these time stamps, it will not be detected. We are working on a version to analyze more frames, please contact your manager or our - support team to enable this method. Example response with positive result: + support team to enable this method. + + Example response with positive result: ``` { @@ -739,9 +811,11 @@ async def create( } ``` - **Additional information** Billing takes into account the duration of the - analyzed video. Or the duration until the stop tag(where applicable), if the - condition was triggered during the analysis. + **Additional information** + + Billing takes into account the duration of the analyzed video. Or the duration + until the stop tag(where applicable), if the condition was triggered during the + analysis. The heart of content moderation is AI, with additional services. They run on our own infrastructure, so the files/data are not transferred anywhere to external @@ -757,13 +831,20 @@ async def create( url: URL to the MP4 file to analyse. File must be publicly accessible via HTTP/HTTPS. audio_language: Language in original audio (transcription only). This value is used to determine - the language from which to transcribe. If this is not set, the system will run - auto language identification and the subtitles will be in the detected language. - The method also works based on AI analysis. It's fairly accurate, but if it's - wrong, then set the language explicitly. Additionally, when this is not set, we - also support recognition of alternate languages in the video (language - code-switching). Language is set by 3-letter language code according to - ISO-639-2 (bibliographic code). We can process languages: + the language from which to transcribe. + + If this is not set, the system will run auto language identification and the + subtitles will be in the detected language. The method also works based on AI + analysis. It's fairly accurate, but if it's wrong, then set the language + explicitly. + + Additionally, when this is not set, we also support recognition of alternate + languages in the video (language code-switching). + + Language is set by 3-letter language code according to ISO-639-2 (bibliographic + code). + + We can process languages: - 'afr': Afrikaans - 'alb': Albanian @@ -870,10 +951,12 @@ async def create( client_entity_data: Meta parameter, designed to store your own extra information about a video entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. + processing. + + For example, if an AI-task was created automatically when you uploaded a video + with the AI auto-processing option (nudity detection, etc), then the ID of the + associated video for which the task was performed will be explicitly indicated + here. client_user_id: Meta parameter, designed to store your own identifier. Can be used by you to tag requests from different end-users. It is not used in any way in video @@ -881,6 +964,7 @@ async def create( subtitles_language: Indicates which language it is clearly necessary to translate into. If this is not set, the original language will be used from attribute "`audio_language`". + Please note that: - transcription into the original language is a free procedure, @@ -936,11 +1020,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[AITask, AsyncPageStreamingAI[AITask]]: - """Returns a list of previously created and processed AI tasks. + """ + Returns a list of previously created and processed AI tasks. - The list contains - brief information about the task and its execution status. Data is displayed - page by page. + The list contains brief information about the task and its execution status. + Data is displayed page by page. Args: date_created: Time when task was created. Datetime in ISO 8601 format. @@ -948,15 +1032,21 @@ def list( limit: Number of results to return per page. ordering: Which field to use when ordering the results: `task_id`, status, and - `task_name`. Sorting is done in ascending (ASC) order. If parameter is omitted - then "`started_at` DESC" is used for ordering by default. + `task_name`. Sorting is done in ascending (ASC) order. + + If parameter is omitted then "`started_at` DESC" is used for ordering by + default. page: Page to view from task list, starting from 1 search: This is an field for combined text search in the following fields: `task_id`, - `task_name`, status, and `task_data`. Both full and partial searches are - possible inside specified above fields. For example, you can filter tasks of a - certain category, or tasks by a specific original file. Example: + `task_name`, status, and `task_data`. + + Both full and partial searches are possible inside specified above fields. For + example, you can filter tasks of a certain category, or tasks by a specific + original file. + + Example: - To filter tasks of Content Moderation NSFW method: `GET /streaming/ai/tasks?search=nsfw` @@ -1016,7 +1106,9 @@ async def cancel( ) -> AITaskCancelResponse: """ Stopping a previously launched AI-task without waiting for it to be fully - completed. The task will be moved to "REVOKED" status. + completed. + + The task will be moved to "REVOKED" status. Args: extra_headers: Send extra headers @@ -1050,9 +1142,10 @@ async def get( ) -> AITaskGetResponse: """ This is the single method to check the execution status of an AI task, and - obtain the result of any type of AI task. Based on the results of processing, - the “result” field will contain an answer corresponding to the type of the - initially created task: + obtain the result of any type of AI task. + + Based on the results of processing, the “result” field will contain an answer + corresponding to the type of the initially created task: - ASR: Transcribe video - ASR: Translate subtitles @@ -1064,7 +1157,9 @@ async def get( - etc... (see other methods from /ai/ domain) A queue is used to process videos. The waiting time depends on the total number - of requests in the system, so sometimes you will have to wait. Statuses: + of requests in the system, so sometimes you will have to wait. + + Statuses: - PENDING – the task is received and it is pending for available resources - STARTED – processing has started @@ -1072,12 +1167,14 @@ async def get( - FAILURE – processing failed - REVOKED – processing was cancelled by the user (or the system) - RETRY – the task execution failed due to internal reasons, the task is queued - for re-execution (up to 3 times) Each task is processed in sub-stages, for - example, original language is first determined in a video, and then - transcription is performed. In such cases, the video processing status may - change from "STARTED" to "PENDING", and back. This is due to waiting for - resources for a specific processing sub-stage. In this case, the overall - percentage "progress" of video processing will reflect the full picture. + for re-execution (up to 3 times) + + Each task is processed in sub-stages, for example, original language is first + determined in a video, and then transcription is performed. In such cases, the + video processing status may change from "STARTED" to "PENDING", and back. This + is due to waiting for resources for a specific processing sub-stage. In this + case, the overall percentage "progress" of video processing will reflect the + full picture. The result data is stored for 1 month, after which it is deleted. @@ -1127,12 +1224,17 @@ async def get_ai_settings( or not for AI translation. - this list will expand as new AI methods are added. - **`language_support`** There are many languages available for transcription. But - not all languages can be automatically translated to and from with good quality. - In order to determine the availability of translation from the audio language to - the desired subtitle language, you can use this type of "`language_support`". AI - models are constantly improving, so this method can be used for dynamic - determination. Example: + **`language_support`** + + There are many languages available for transcription. But not all languages can + be automatically translated to and from with good quality. In order to determine + the availability of translation from the audio language to the desired subtitle + language, you can use this type of "`language_support`". + + AI models are constantly improving, so this method can be used for dynamic + determination. + + Example: ``` curl -L 'https://api.gcore.com/streaming/ai/info?type=language_support&audio_language=eng&subtitles_language=fre' @@ -1140,10 +1242,12 @@ async def get_ai_settings( { "supported": true } ``` - Today we provide the following capabilities as below. These are the 100 - languages for which we support only transcription and translation to English. - The iso639-2b codes for these are: + Today we provide the following capabilities as below. + + These are the 100 languages for which we support only transcription and + translation to English. The iso639-2b codes for these are: `afr, sqi, amh, ara, hye, asm, aze, bak, eus, bel, ben, bos, bre, bul, mya, cat, zho, hrv, ces, dan, nld, eng, est, fao, fin, fra, glg, kat, deu, guj, hat, hau, haw, heb, hin, hun, isl, ind, ita, jpn, jav, kan, kaz, khm, kor, lao, lat, lav, lin, lit, ltz, mkd, mlg, msa, mal, mlt, mri, mar, ell, mon, nep, nor, nno, oci, pan, fas, pol, por, pus, ron, rus, san, srp, sna, snd, sin, slk, slv, som, spa, sun, swa, swe, tgl, tgk, tam, tat, tel, tha, bod, tur, tuk, ukr, urd, uzb, vie, cym, yid, yor`. + These are the 77 languages for which we support translation to other languages and translation to: `afr, amh, ara, hye, asm, aze, eus, bel, ben, bos, bul, mya, cat, zho, hrv, ces, dan, nld, eng, est, fin, fra, glg, kat, deu, guj, heb, hin, hun, isl, ind, ita, jpn, jav, kan, kaz, khm, kor, lao, lav, lit, mkd, mal, mlt, mar, ell, mon, nep, nno, pan, fas, pol, por, pus, ron, rus, srp, sna, snd, slk, slv, som, spa, swa, swe, tgl, tgk, tam, tel, tha, tur, ukr, urd, vie, cym, yor`. diff --git a/src/gcore/resources/streaming/broadcasts.py b/src/gcore/resources/streaming/broadcasts.py index bb9803bb..757bde4d 100644 --- a/src/gcore/resources/streaming/broadcasts.py +++ b/src/gcore/resources/streaming/broadcasts.py @@ -59,8 +59,10 @@ def create( - many live streams, - advertising, - - and design in one config. If you use other players or you get streams by - direct .m3u8/.mpd links, then you will not need this entity. + - and design in one config. + + If you use other players or you get streams by direct .m3u8/.mpd links, then you + will not need this entity. Scheme of "broadcast" entity using: ![Scheme of "broadcast" using](https://demo-files.gvideo.io/apidocs/broadcasts.png) @@ -289,8 +291,10 @@ async def create( - many live streams, - advertising, - - and design in one config. If you use other players or you get streams by - direct .m3u8/.mpd links, then you will not need this entity. + - and design in one config. + + If you use other players or you get streams by direct .m3u8/.mpd links, then you + will not need this entity. Scheme of "broadcast" entity using: ![Scheme of "broadcast" using](https://demo-files.gvideo.io/apidocs/broadcasts.png) diff --git a/src/gcore/resources/streaming/directories.py b/src/gcore/resources/streaming/directories.py index 0f70207a..3c45afb6 100644 --- a/src/gcore/resources/streaming/directories.py +++ b/src/gcore/resources/streaming/directories.py @@ -148,9 +148,12 @@ def delete( After its execution, all contents of the directory will be deleted recursively: - Subdirectories - - Videos The directory and contents are deleted permanently and irreversibly. - Therefore, it is impossible to restore files after this. For details, see the - Product Documentation. + - Videos + + The directory and contents are deleted permanently and irreversibly. Therefore, + it is impossible to restore files after this. + + For details, see the Product Documentation. Args: extra_headers: Send extra headers @@ -213,10 +216,10 @@ def get_tree( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoriesTree: - """Tree structure of directories. + """ + Tree structure of directories. - This endpoint returns hierarchical data about - directories in video hosting. + This endpoint returns hierarchical data about directories in video hosting. """ return self._get( "/streaming/directories/tree", @@ -352,9 +355,12 @@ async def delete( After its execution, all contents of the directory will be deleted recursively: - Subdirectories - - Videos The directory and contents are deleted permanently and irreversibly. - Therefore, it is impossible to restore files after this. For details, see the - Product Documentation. + - Videos + + The directory and contents are deleted permanently and irreversibly. Therefore, + it is impossible to restore files after this. + + For details, see the Product Documentation. Args: extra_headers: Send extra headers @@ -417,10 +423,10 @@ async def get_tree( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoriesTree: - """Tree structure of directories. + """ + Tree structure of directories. - This endpoint returns hierarchical data about - directories in video hosting. + This endpoint returns hierarchical data about directories in video hosting. """ return await self._get( "/streaming/directories/tree", diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index bb2036fc..aea53517 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -73,8 +73,10 @@ def create( ) -> PlaylistCreate: """ Playlist is a curated collection of video content organized in a sequential - manner. This method offers several advantages and features that are typical of - live streaming but with more control over the content. Here's how it works: + manner. + + This method offers several advantages and features that are typical of live + streaming but with more control over the content. Here's how it works: - Playlist always consists only of static VOD videos you previously uploaded to the system. @@ -84,24 +86,33 @@ def create( - Playlist can be looped endlessly. In this case, all the videos in the list will be constantly repeated through the list. - Playlist can be programmed to be played at a specific time in the future. In - that case, before the start time there will be empty manifest. You can add new - videos to the list, remove unnecessary videos, or change the order of videos - in the list. But please pay attention to when the video list changes, it is - updated instantly on the server. This means that after saving the changed - list, the playlist will be reloaded for all users and it will start plays from - the very first element. Maximum video limit = 128 videos in a row. + that case, before the start time there will be empty manifest. + + You can add new videos to the list, remove unnecessary videos, or change the + order of videos in the list. But please pay attention to when the video list + changes, it is updated instantly on the server. This means that after saving the + changed list, the playlist will be reloaded for all users and it will start + plays from the very first element. + + Maximum video limit = 128 videos in a row. Examples of usage: - Looped video playback - - Scheduled playback **Looped video playback** It can be used to simulate TV - channel pre-programmed behaviour. + - Scheduled playback + + **Looped video playback** + + It can be used to simulate TV channel pre-programmed behaviour. + - Selection: Choose a series of videos, such as TV show episodes, movies, tutorials, or any other relevant content. - Order: Arrange the selected videos in the desired sequence, much like setting a broadcast schedule. - Looping: Optionally, the playlist can be set to loop, replaying the sequence - once it finishes to maintain a continuous stream. Example: + once it finishes to maintain a continuous stream. + + Example: ``` active: true @@ -109,9 +120,11 @@ def create( name: "Playlist: TV channel 'The world around us' (Programmed broadcast for 24 hours)" ``` - **Scheduled playback** It can be used to simulate live events such as virtual - concerts, webinars, or any special broadcasts without the logistical challenges - of an actual live stream. + **Scheduled playback** + + It can be used to simulate live events such as virtual concerts, webinars, or + any special broadcasts without the logistical challenges of an actual live + stream. - Timing: Set specific start time, creating the illusion of a live broadcast schedule. @@ -172,8 +185,10 @@ def create( iframe_url: A URL to a built-in HTML video player with the video inside. It can be inserted into an iframe on your website and the video will automatically play in all - browsers. The player can be opened or shared via this direct link. Also the - video player can be integrated into your web pages using the Iframe tag. + browsers. + + The player can be opened or shared via this direct link. Also the video player + can be integrated into your web pages using the Iframe tag. Please see the details in `iframe_url` attribute of /videos/{id} method. @@ -193,7 +208,9 @@ def create( Datetime in ISO 8601 format. video_ids: A list of VOD IDs included in the playlist. Order of videos in a playlist - reflects the order of IDs in the array. Maximum video limit = 128. + reflects the order of IDs in the array. + + Maximum video limit = 128. extra_headers: Send extra headers @@ -303,8 +320,10 @@ def update( iframe_url: A URL to a built-in HTML video player with the video inside. It can be inserted into an iframe on your website and the video will automatically play in all - browsers. The player can be opened or shared via this direct link. Also the - video player can be integrated into your web pages using the Iframe tag. + browsers. + + The player can be opened or shared via this direct link. Also the video player + can be integrated into your web pages using the Iframe tag. Please see the details in `iframe_url` attribute of /videos/{id} method. @@ -324,7 +343,9 @@ def update( Datetime in ISO 8601 format. video_ids: A list of VOD IDs included in the playlist. Order of videos in a playlist - reflects the order of IDs in the array. Maximum video limit = 128. + reflects the order of IDs in the array. + + Maximum video limit = 128. extra_headers: Send extra headers @@ -541,8 +562,10 @@ async def create( ) -> PlaylistCreate: """ Playlist is a curated collection of video content organized in a sequential - manner. This method offers several advantages and features that are typical of - live streaming but with more control over the content. Here's how it works: + manner. + + This method offers several advantages and features that are typical of live + streaming but with more control over the content. Here's how it works: - Playlist always consists only of static VOD videos you previously uploaded to the system. @@ -552,24 +575,33 @@ async def create( - Playlist can be looped endlessly. In this case, all the videos in the list will be constantly repeated through the list. - Playlist can be programmed to be played at a specific time in the future. In - that case, before the start time there will be empty manifest. You can add new - videos to the list, remove unnecessary videos, or change the order of videos - in the list. But please pay attention to when the video list changes, it is - updated instantly on the server. This means that after saving the changed - list, the playlist will be reloaded for all users and it will start plays from - the very first element. Maximum video limit = 128 videos in a row. + that case, before the start time there will be empty manifest. + + You can add new videos to the list, remove unnecessary videos, or change the + order of videos in the list. But please pay attention to when the video list + changes, it is updated instantly on the server. This means that after saving the + changed list, the playlist will be reloaded for all users and it will start + plays from the very first element. + + Maximum video limit = 128 videos in a row. Examples of usage: - Looped video playback - - Scheduled playback **Looped video playback** It can be used to simulate TV - channel pre-programmed behaviour. + - Scheduled playback + + **Looped video playback** + + It can be used to simulate TV channel pre-programmed behaviour. + - Selection: Choose a series of videos, such as TV show episodes, movies, tutorials, or any other relevant content. - Order: Arrange the selected videos in the desired sequence, much like setting a broadcast schedule. - Looping: Optionally, the playlist can be set to loop, replaying the sequence - once it finishes to maintain a continuous stream. Example: + once it finishes to maintain a continuous stream. + + Example: ``` active: true @@ -577,9 +609,11 @@ async def create( name: "Playlist: TV channel 'The world around us' (Programmed broadcast for 24 hours)" ``` - **Scheduled playback** It can be used to simulate live events such as virtual - concerts, webinars, or any special broadcasts without the logistical challenges - of an actual live stream. + **Scheduled playback** + + It can be used to simulate live events such as virtual concerts, webinars, or + any special broadcasts without the logistical challenges of an actual live + stream. - Timing: Set specific start time, creating the illusion of a live broadcast schedule. @@ -640,8 +674,10 @@ async def create( iframe_url: A URL to a built-in HTML video player with the video inside. It can be inserted into an iframe on your website and the video will automatically play in all - browsers. The player can be opened or shared via this direct link. Also the - video player can be integrated into your web pages using the Iframe tag. + browsers. + + The player can be opened or shared via this direct link. Also the video player + can be integrated into your web pages using the Iframe tag. Please see the details in `iframe_url` attribute of /videos/{id} method. @@ -661,7 +697,9 @@ async def create( Datetime in ISO 8601 format. video_ids: A list of VOD IDs included in the playlist. Order of videos in a playlist - reflects the order of IDs in the array. Maximum video limit = 128. + reflects the order of IDs in the array. + + Maximum video limit = 128. extra_headers: Send extra headers @@ -771,8 +809,10 @@ async def update( iframe_url: A URL to a built-in HTML video player with the video inside. It can be inserted into an iframe on your website and the video will automatically play in all - browsers. The player can be opened or shared via this direct link. Also the - video player can be integrated into your web pages using the Iframe tag. + browsers. + + The player can be opened or shared via this direct link. Also the video player + can be integrated into your web pages using the Iframe tag. Please see the details in `iframe_url` attribute of /videos/{id} method. @@ -792,7 +832,9 @@ async def update( Datetime in ISO 8601 format. video_ids: A list of VOD IDs included in the playlist. Order of videos in a playlist - reflects the order of IDs in the array. Maximum video limit = 128. + reflects the order of IDs in the array. + + Maximum video limit = 128. extra_headers: Send extra headers diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py index 5343d5c5..d91c5569 100644 --- a/src/gcore/resources/streaming/quality_sets.py +++ b/src/gcore/resources/streaming/quality_sets.py @@ -64,19 +64,26 @@ def list( described in the [documentation](https://gcore.com/docs/streaming-platform/live-streams-and-videos-protocols-and-codecs/output-parameters-after-transcoding-bitrate-frame-rate-and-codecs). These values are the default for everyone. There is no need to configure - anything additional. Read more about qiality in our blog + anything additional. + + Read more about qiality in our blog [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality). - ![Quality ladder](https://demo-files.gvideo.io/apidocs/encoding_ladder.png) Only - for those cases when, in addition to the main parameters, it is necessary to use - your own, then it is necessary to use custom quality sets. How to use: + + ![Quality ladder](https://demo-files.gvideo.io/apidocs/encoding_ladder.png) + + Only for those cases when, in addition to the main parameters, it is necessary + to use your own, then it is necessary to use custom quality sets. + + How to use: 1. By default custom quality set is empty – `{ "live":[],"vod":[] }` 2. Request the use of custom quality sets from your manager or the Support Team. 3. Please forward your requirements to us, since the parameters are set not by you, but by our engineers. (We are working to ensure that later you can create qualities by yourself.) - 4. Use the created quality sets through the these specified API methods. Here - are some common parameters of quality settings: + 4. Use the created quality sets through the these specified API methods. + + Here are some common parameters of quality settings: - Resolution: Determines the size of the video frame. I.e. 720p, 1080p, 4K, etc. - Bitrate: Refers to the amount of data processed per unit of time. @@ -110,19 +117,23 @@ def set_default( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QualitySets: - """Method to set default quality set for VOD and Live transcoding. + """ + Method to set default quality set for VOD and Live transcoding. + + For changing default quality set, specify the ID of the custom quality set from + the method GET /`quality_sets`. - For changing - default quality set, specify the ID of the custom quality set from the method - GET /`quality_sets`. Default value can be reverted to the system defaults - (cleared) by setting `"id": null`. + Default value can be reverted to the system defaults (cleared) by setting + `"id": null`. Live transcoding management: - You can specify quality set explicitly in POST /streams method, look at attribute "`quality_set_id`". - - Otherwise these default values will be used by the system by default. VOD - transcoding management: + - Otherwise these default values will be used by the system by default. + + VOD transcoding management: + - You can specify quality set explicitly in POST /videos method, look at attribute "`quality_set_id`". - Otherwise these default values will be used by the system by default. @@ -195,19 +206,26 @@ async def list( described in the [documentation](https://gcore.com/docs/streaming-platform/live-streams-and-videos-protocols-and-codecs/output-parameters-after-transcoding-bitrate-frame-rate-and-codecs). These values are the default for everyone. There is no need to configure - anything additional. Read more about qiality in our blog + anything additional. + + Read more about qiality in our blog [How we lowered the bitrate for live and VOD streaming by 32.5% without sacrificing quality](https://gcore.com/blog/how-we-lowered-the-bitrate-for-live-and-vod-streaming-by-32-5-without-sacrificing-quality). - ![Quality ladder](https://demo-files.gvideo.io/apidocs/encoding_ladder.png) Only - for those cases when, in addition to the main parameters, it is necessary to use - your own, then it is necessary to use custom quality sets. How to use: + + ![Quality ladder](https://demo-files.gvideo.io/apidocs/encoding_ladder.png) + + Only for those cases when, in addition to the main parameters, it is necessary + to use your own, then it is necessary to use custom quality sets. + + How to use: 1. By default custom quality set is empty – `{ "live":[],"vod":[] }` 2. Request the use of custom quality sets from your manager or the Support Team. 3. Please forward your requirements to us, since the parameters are set not by you, but by our engineers. (We are working to ensure that later you can create qualities by yourself.) - 4. Use the created quality sets through the these specified API methods. Here - are some common parameters of quality settings: + 4. Use the created quality sets through the these specified API methods. + + Here are some common parameters of quality settings: - Resolution: Determines the size of the video frame. I.e. 720p, 1080p, 4K, etc. - Bitrate: Refers to the amount of data processed per unit of time. @@ -241,19 +259,23 @@ async def set_default( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QualitySets: - """Method to set default quality set for VOD and Live transcoding. + """ + Method to set default quality set for VOD and Live transcoding. + + For changing default quality set, specify the ID of the custom quality set from + the method GET /`quality_sets`. - For changing - default quality set, specify the ID of the custom quality set from the method - GET /`quality_sets`. Default value can be reverted to the system defaults - (cleared) by setting `"id": null`. + Default value can be reverted to the system defaults (cleared) by setting + `"id": null`. Live transcoding management: - You can specify quality set explicitly in POST /streams method, look at attribute "`quality_set_id`". - - Otherwise these default values will be used by the system by default. VOD - transcoding management: + - Otherwise these default values will be used by the system by default. + + VOD transcoding management: + - You can specify quality set explicitly in POST /videos method, look at attribute "`quality_set_id`". - Otherwise these default values will be used by the system by default. diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py index b252b848..82b2a1f6 100644 --- a/src/gcore/resources/streaming/statistics.py +++ b/src/gcore/resources/streaming/statistics.py @@ -104,6 +104,7 @@ def get_ffprobes( """ Aggregates data for the specified video stream in the specified time interval. "interval" and "units" params working together to point aggregation interval. + You can use this method to watch when stream was alive in time, and when it was off. @@ -158,14 +159,17 @@ def get_live_unique_viewers( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetLiveUniqueViewersResponse: - """Calculates time series of unique viewers of Live streams via CDN. - - The statistics - are taken from the data of CDN and work regardless of which player the views - were made with. Works similar to the method `/statistics/cdn/uniqs`. But this - allows you to break down data with the specified granularity: minutes, hours, - days. Based on this method, a graph of unique views in the Customer Portal is - built. + """ + Calculates time series of unique viewers of Live streams via CDN. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. + + Works similar to the method `/statistics/cdn/uniqs`. But this allows you to + break down data with the specified granularity: minutes, hours, days. + + Based on this method, a graph of unique views in the Customer Portal is built. + ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/cdn_unique_viewers.png) Args: @@ -226,11 +230,14 @@ def get_live_watch_time_cdn( """Calculates a time series of live streams watching duration in minutes. Views of - only those streams that meet the specified filters are summed up. The statistics - are taken from the data of CDN and work regardless of which player the views - were made with. Please note that the result for each time interval is in - minutes, it is rounded to the nearest upper integer. You cannot use the sum of - all intervals as the total watch time value; instead, use the /total method. + only those streams that meet the specified filters are summed up. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. + + Please note that the result for each time interval is in minutes, it is rounded + to the nearest upper integer. You cannot use the sum of all intervals as the + total watch time value; instead, use the /total method. Args: from_: Start of the time period for counting minutes of watching. Format is date time @@ -291,9 +298,10 @@ def get_live_watch_time_total_cdn( """Calculates the total duration of live streams watching in minutes. Views of only - those streams that meet the specified filters are summed up. The statistics are - taken from the data of CDN and work regardless of which player the views were - made with. + those streams that meet the specified filters are summed up. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. Args: client_user_id: Filter by field "`client_user_id`" @@ -400,12 +408,13 @@ def get_popular_videos( ) -> PopularVideos: """ Aggregates the number of views for all client videos, grouping them by id and - sort from most popular to less in the built-in player. Note. This method - operates only on data collected by the built-in HTML player. It will not show - statistics if you are using another player or viewing in native OS players - through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations through - CDN (look at method /statistics/cdn/uniqs) or statistics of the players you have - chosen. + sort from most popular to less in the built-in player. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -560,15 +569,19 @@ def get_unique_viewers( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UniqueViewers: - """Get the number of unique viewers in the built-in player. + """ + Get the number of unique viewers in the built-in player. + + Counts the number of unique IPs. - Counts the number of - unique IPs. Allows flexible grouping and filtering. The fields in the response - depend on the selected grouping. Note. This method operates only on data - collected by the built-in HTML player. It will not show statistics if you are - using another player or viewing in native OS players through direct - .m3u8/.mpd/.mp4 links. For such cases, use calculations through CDN (look at - method /statistics/cdn/uniqs) or statistics of the players you have chosen. + Allows flexible grouping and filtering. The fields in the response depend on the + selected grouping. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -636,30 +649,44 @@ def get_unique_viewers_cdn( """Сounts the number of unique viewers of a video entity over CDN. It doesn't - matter what player you used. All unique viewers for the specified period of time - are counted. **How does it work?** Calculating the number of unique viewers for - a Live stream or VOD over CDN involves aggregating and analyzing various metrics - to ensure each individual viewer is counted only once, regardless of how many - times they connect or disconnect during the stream. This method provides - statistics for any video viewing by unique users, regardless of viewing method - and a player you used. Thus, this is the most important difference from viewing - through the built-in player: + matter what player you used. + + All unique viewers for the specified period of time are counted. + + **How does it work?** + + Calculating the number of unique viewers for a Live stream or VOD over CDN + involves aggregating and analyzing various metrics to ensure each individual + viewer is counted only once, regardless of how many times they connect or + disconnect during the stream. + + This method provides statistics for any video viewing by unique users, + regardless of viewing method and a player you used. Thus, this is the most + important difference from viewing through the built-in player: - In method /statistics/uniqs viewers of the built-in player are tracked only. - - But this method tracks all viewers from everywhere. This method is a - combination of two other Live and VOD detailed methods. If you need detailed - information, then see the methods: `/statistics/stream/viewers` and - `/statistics/vod/viewers`. **Data Processing and Deduplication** We us IP - Address & User-Agent combination. Each unique combination of IP address and - User-Agent string might be considered a unique viewer. This approach allows to - accurately estimate the number of unique viewers. However, this is not - foolproof due to NAT (Network Address Translation) and shared networks. Thus - if your users fall under such restrictions, then the number of unique viewers - may be higher than calculated. **Why is there no "Unique Views" method?** - Based on CDN data, we can calculate the number of unique viewers only. Thus - only your player will be able to count the number of unique views (clicks on - the Play button) within the player session (i.e. how many times 1 unique - viewer clicked the Play button within a unique player's session). + - But this method tracks all viewers from everywhere. + + This method is a combination of two other Live and VOD detailed methods. If you + need detailed information, then see the methods: `/statistics/stream/viewers` + and `/statistics/vod/viewers`. + + **Data Processing and Deduplication** + + We us IP Address & User-Agent combination. Each unique combination of IP address + and User-Agent string might be considered a unique viewer. + + This approach allows to accurately estimate the number of unique viewers. + However, this is not foolproof due to NAT (Network Address Translation) and + shared networks. Thus if your users fall under such restrictions, then the + number of unique viewers may be higher than calculated. + + **Why is there no "Unique Views" method?** + + Based on CDN data, we can calculate the number of unique viewers only. Thus only + your player will be able to count the number of unique views (clicks on the Play + button) within the player session (i.e. how many times 1 unique viewer clicked + the Play button within a unique player's session). Args: date_from: Start of time frame. Format is date time in ISO 8601. @@ -667,10 +694,13 @@ def get_unique_viewers_cdn( date_to: End of time frame. Format is date time in ISO 8601. id: Filter by entity's id. Put ID of a Live stream, VOD or a playlist to be - calculated. If the value is omitted, then the calculation is done for all - videos/streams of the specified type. When using this "id" parameter, be sure to - specify the "type" parameter too. If you do not specify a type, the "id" will be - ignored. + calculated. + + If the value is omitted, then the calculation is done for all videos/streams of + the specified type. + + When using this "id" parameter, be sure to specify the "type" parameter too. If + you do not specify a type, the "id" will be ignored. type: Filter by entity's type @@ -720,15 +750,17 @@ def get_views( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Views: - """Get the number of views in the built-in player. + """ + Get the number of views in the built-in player. - Allows flexible grouping and - filtering. The fields in the response depend on the selected grouping. Note. - This method operates only on data collected by the built-in HTML player. It will - not show statistics if you are using another player or viewing in native OS - players through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations - through CDN (look at method /statistics/cdn/uniqs) or statistics of the players - you have chosen. + Allows flexible grouping and filtering. The fields in the response depend on the + selected grouping. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -793,11 +825,13 @@ def get_views_by_browsers( ) -> ViewsByBrowser: """ Aggregates the number of views for all client videos, grouping them by browsers - in the built-in player. Note. This method operates only on data collected by the - built-in HTML player. It will not show statistics if you are using another - player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For - such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) - or statistics of the players you have chosen. + in the built-in player. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -844,6 +878,7 @@ def get_views_by_country( ) -> ViewsByCountry: """ Aggregates the number of views grouping them by country in the built-in player. + Note. This method operates only on data collected by the built-in HTML player. It will not show statistics if you are using another player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use @@ -895,11 +930,13 @@ def get_views_by_hostname( ) -> ViewsByHostname: """ Aggregates the number of views, grouping them by "host" domain name the built-in - player was embeded to. Note. This method operates only on data collected by the - built-in HTML player. It will not show statistics if you are using another - player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For - such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) - or statistics of the players you have chosen. + player was embeded to. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -946,11 +983,13 @@ def get_views_by_operating_system( ) -> ViewsByOperatingSystem: """ Aggregates the number of views for all client videos, grouping them by device - OSs in the built-in player. Note. This method operates only on data collected by - the built-in HTML player. It will not show statistics if you are using another - player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For - such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) - or statistics of the players you have chosen. + OSs in the built-in player. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -997,11 +1036,13 @@ def get_views_by_referer( ) -> ViewsByReferer: """ Aggregates the number of views, grouping them by "referer" URL of pages the - built-in player was embeded to. Note. This method operates only on data - collected by the built-in HTML player. It will not show statistics if you are - using another player or viewing in native OS players through direct - .m3u8/.mpd/.mp4 links. For such cases, use calculations through CDN (look at - method /statistics/cdn/uniqs) or statistics of the players you have chosen. + built-in player was embeded to. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -1048,11 +1089,13 @@ def get_views_by_region( ) -> ViewsByRegion: """ Aggregates the number of views grouping them by regions of countries in the - built-in player. Note. This method operates only on data collected by the - built-in HTML player. It will not show statistics if you are using another - player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For - such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) - or statistics of the players you have chosen. + built-in player. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -1101,14 +1144,18 @@ def get_views_heatmap( ) -> ViewsHeatmap: """ Shows information about what part of the video your viewers watched in the - built-in player. This way you can find out how many viewers started watching the - video, and where they stopped watching instead of watching the entire video to - the end. Has different format of response depends on query param "type". Note. - This method operates only on data collected by the built-in HTML player. It will - not show statistics if you are using another player or viewing in native OS - players through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations - through CDN (look at method /statistics/cdn/uniqs) or statistics of the players - you have chosen. + built-in player. + + This way you can find out how many viewers started watching the video, and where + they stopped watching instead of watching the entire video to the end. + + Has different format of response depends on query param "type". + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -1161,8 +1208,10 @@ def get_vod_storage_volume( ) -> VodStatisticsSeries: """ Calculates time series of the duration in minutes for all processed and - undeleted client videos. The data is updated every 8 hours, it does not make - sense to set the granulation less than 1 day. + undeleted client videos. + + The data is updated every 8 hours, it does not make sense to set the granulation + less than 1 day. Args: from_: Start of time frame. Datetime in ISO 8601 format. @@ -1209,8 +1258,10 @@ def get_vod_transcoding_duration( ) -> VodStatisticsSeries: """ Calculates time series of the transcoding time in minutes for all processed - client videos. The data is updated every 8 hours, it does not make sense to set - the granulation less than 1 day. + client videos. + + The data is updated every 8 hours, it does not make sense to set the granulation + less than 1 day. Args: from_: Start of time frame. Datetime in ISO 8601 format. @@ -1258,13 +1309,17 @@ def get_vod_unique_viewers_cdn( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: - """Calculates time series of unique viewers of VOD via CDN. + """ + Calculates time series of unique viewers of VOD via CDN. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. + + Works similar to the method `/statistics/cdn/uniqs`. But this allows you to + break down data with the specified granularity: minutes, hours, days. - The statistics are - taken from the data of CDN and work regardless of which player the views were - made with. Works similar to the method `/statistics/cdn/uniqs`. But this allows - you to break down data with the specified granularity: minutes, hours, days. Based on this method, a graph of unique views in the Customer Portal is built. + ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/cdn_unique_viewers.png) Args: @@ -1325,11 +1380,14 @@ def get_vod_watch_time_cdn( """Calculates a time series of video watching duration in minutes. Views of only - those videos that meet the specified filters are summed up. The statistics are - taken from the data of CDN and work regardless of which player the views were - made with. Please note that the result for each time interval is in minutes, it - is rounded to the nearest upper integer. You cannot use the sum of all intervals - as the total watch time value; instead, use the /total method. + those videos that meet the specified filters are summed up. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. + + Please note that the result for each time interval is in minutes, it is rounded + to the nearest upper integer. You cannot use the sum of all intervals as the + total watch time value; instead, use the /total method. Args: from_: Start of the time period for counting minutes of watching. Format is date time @@ -1390,9 +1448,10 @@ def get_vod_watch_time_total_cdn( """Calculates the total duration of video watching in minutes. Views of only those - videos that meet the specified filters are summed up. The statistics are taken - from the data of CDN and work regardless of which player the views were made - with. + videos that meet the specified filters are summed up. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. Args: client_user_id: Filter by field "`client_user_id`" @@ -1472,6 +1531,7 @@ async def get_ffprobes( """ Aggregates data for the specified video stream in the specified time interval. "interval" and "units" params working together to point aggregation interval. + You can use this method to watch when stream was alive in time, and when it was off. @@ -1526,14 +1586,17 @@ async def get_live_unique_viewers( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> StatisticGetLiveUniqueViewersResponse: - """Calculates time series of unique viewers of Live streams via CDN. - - The statistics - are taken from the data of CDN and work regardless of which player the views - were made with. Works similar to the method `/statistics/cdn/uniqs`. But this - allows you to break down data with the specified granularity: minutes, hours, - days. Based on this method, a graph of unique views in the Customer Portal is - built. + """ + Calculates time series of unique viewers of Live streams via CDN. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. + + Works similar to the method `/statistics/cdn/uniqs`. But this allows you to + break down data with the specified granularity: minutes, hours, days. + + Based on this method, a graph of unique views in the Customer Portal is built. + ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/cdn_unique_viewers.png) Args: @@ -1594,11 +1657,14 @@ async def get_live_watch_time_cdn( """Calculates a time series of live streams watching duration in minutes. Views of - only those streams that meet the specified filters are summed up. The statistics - are taken from the data of CDN and work regardless of which player the views - were made with. Please note that the result for each time interval is in - minutes, it is rounded to the nearest upper integer. You cannot use the sum of - all intervals as the total watch time value; instead, use the /total method. + only those streams that meet the specified filters are summed up. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. + + Please note that the result for each time interval is in minutes, it is rounded + to the nearest upper integer. You cannot use the sum of all intervals as the + total watch time value; instead, use the /total method. Args: from_: Start of the time period for counting minutes of watching. Format is date time @@ -1659,9 +1725,10 @@ async def get_live_watch_time_total_cdn( """Calculates the total duration of live streams watching in minutes. Views of only - those streams that meet the specified filters are summed up. The statistics are - taken from the data of CDN and work regardless of which player the views were - made with. + those streams that meet the specified filters are summed up. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. Args: client_user_id: Filter by field "`client_user_id`" @@ -1768,12 +1835,13 @@ async def get_popular_videos( ) -> PopularVideos: """ Aggregates the number of views for all client videos, grouping them by id and - sort from most popular to less in the built-in player. Note. This method - operates only on data collected by the built-in HTML player. It will not show - statistics if you are using another player or viewing in native OS players - through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations through - CDN (look at method /statistics/cdn/uniqs) or statistics of the players you have - chosen. + sort from most popular to less in the built-in player. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -1928,15 +1996,19 @@ async def get_unique_viewers( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UniqueViewers: - """Get the number of unique viewers in the built-in player. + """ + Get the number of unique viewers in the built-in player. + + Counts the number of unique IPs. - Counts the number of - unique IPs. Allows flexible grouping and filtering. The fields in the response - depend on the selected grouping. Note. This method operates only on data - collected by the built-in HTML player. It will not show statistics if you are - using another player or viewing in native OS players through direct - .m3u8/.mpd/.mp4 links. For such cases, use calculations through CDN (look at - method /statistics/cdn/uniqs) or statistics of the players you have chosen. + Allows flexible grouping and filtering. The fields in the response depend on the + selected grouping. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -2004,30 +2076,44 @@ async def get_unique_viewers_cdn( """Сounts the number of unique viewers of a video entity over CDN. It doesn't - matter what player you used. All unique viewers for the specified period of time - are counted. **How does it work?** Calculating the number of unique viewers for - a Live stream or VOD over CDN involves aggregating and analyzing various metrics - to ensure each individual viewer is counted only once, regardless of how many - times they connect or disconnect during the stream. This method provides - statistics for any video viewing by unique users, regardless of viewing method - and a player you used. Thus, this is the most important difference from viewing - through the built-in player: + matter what player you used. + + All unique viewers for the specified period of time are counted. + + **How does it work?** + + Calculating the number of unique viewers for a Live stream or VOD over CDN + involves aggregating and analyzing various metrics to ensure each individual + viewer is counted only once, regardless of how many times they connect or + disconnect during the stream. + + This method provides statistics for any video viewing by unique users, + regardless of viewing method and a player you used. Thus, this is the most + important difference from viewing through the built-in player: - In method /statistics/uniqs viewers of the built-in player are tracked only. - - But this method tracks all viewers from everywhere. This method is a - combination of two other Live and VOD detailed methods. If you need detailed - information, then see the methods: `/statistics/stream/viewers` and - `/statistics/vod/viewers`. **Data Processing and Deduplication** We us IP - Address & User-Agent combination. Each unique combination of IP address and - User-Agent string might be considered a unique viewer. This approach allows to - accurately estimate the number of unique viewers. However, this is not - foolproof due to NAT (Network Address Translation) and shared networks. Thus - if your users fall under such restrictions, then the number of unique viewers - may be higher than calculated. **Why is there no "Unique Views" method?** - Based on CDN data, we can calculate the number of unique viewers only. Thus - only your player will be able to count the number of unique views (clicks on - the Play button) within the player session (i.e. how many times 1 unique - viewer clicked the Play button within a unique player's session). + - But this method tracks all viewers from everywhere. + + This method is a combination of two other Live and VOD detailed methods. If you + need detailed information, then see the methods: `/statistics/stream/viewers` + and `/statistics/vod/viewers`. + + **Data Processing and Deduplication** + + We us IP Address & User-Agent combination. Each unique combination of IP address + and User-Agent string might be considered a unique viewer. + + This approach allows to accurately estimate the number of unique viewers. + However, this is not foolproof due to NAT (Network Address Translation) and + shared networks. Thus if your users fall under such restrictions, then the + number of unique viewers may be higher than calculated. + + **Why is there no "Unique Views" method?** + + Based on CDN data, we can calculate the number of unique viewers only. Thus only + your player will be able to count the number of unique views (clicks on the Play + button) within the player session (i.e. how many times 1 unique viewer clicked + the Play button within a unique player's session). Args: date_from: Start of time frame. Format is date time in ISO 8601. @@ -2035,10 +2121,13 @@ async def get_unique_viewers_cdn( date_to: End of time frame. Format is date time in ISO 8601. id: Filter by entity's id. Put ID of a Live stream, VOD or a playlist to be - calculated. If the value is omitted, then the calculation is done for all - videos/streams of the specified type. When using this "id" parameter, be sure to - specify the "type" parameter too. If you do not specify a type, the "id" will be - ignored. + calculated. + + If the value is omitted, then the calculation is done for all videos/streams of + the specified type. + + When using this "id" parameter, be sure to specify the "type" parameter too. If + you do not specify a type, the "id" will be ignored. type: Filter by entity's type @@ -2088,15 +2177,17 @@ async def get_views( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Views: - """Get the number of views in the built-in player. + """ + Get the number of views in the built-in player. - Allows flexible grouping and - filtering. The fields in the response depend on the selected grouping. Note. - This method operates only on data collected by the built-in HTML player. It will - not show statistics if you are using another player or viewing in native OS - players through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations - through CDN (look at method /statistics/cdn/uniqs) or statistics of the players - you have chosen. + Allows flexible grouping and filtering. The fields in the response depend on the + selected grouping. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -2161,11 +2252,13 @@ async def get_views_by_browsers( ) -> ViewsByBrowser: """ Aggregates the number of views for all client videos, grouping them by browsers - in the built-in player. Note. This method operates only on data collected by the - built-in HTML player. It will not show statistics if you are using another - player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For - such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) - or statistics of the players you have chosen. + in the built-in player. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -2212,6 +2305,7 @@ async def get_views_by_country( ) -> ViewsByCountry: """ Aggregates the number of views grouping them by country in the built-in player. + Note. This method operates only on data collected by the built-in HTML player. It will not show statistics if you are using another player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use @@ -2263,11 +2357,13 @@ async def get_views_by_hostname( ) -> ViewsByHostname: """ Aggregates the number of views, grouping them by "host" domain name the built-in - player was embeded to. Note. This method operates only on data collected by the - built-in HTML player. It will not show statistics if you are using another - player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For - such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) - or statistics of the players you have chosen. + player was embeded to. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -2314,11 +2410,13 @@ async def get_views_by_operating_system( ) -> ViewsByOperatingSystem: """ Aggregates the number of views for all client videos, grouping them by device - OSs in the built-in player. Note. This method operates only on data collected by - the built-in HTML player. It will not show statistics if you are using another - player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For - such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) - or statistics of the players you have chosen. + OSs in the built-in player. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -2365,11 +2463,13 @@ async def get_views_by_referer( ) -> ViewsByReferer: """ Aggregates the number of views, grouping them by "referer" URL of pages the - built-in player was embeded to. Note. This method operates only on data - collected by the built-in HTML player. It will not show statistics if you are - using another player or viewing in native OS players through direct - .m3u8/.mpd/.mp4 links. For such cases, use calculations through CDN (look at - method /statistics/cdn/uniqs) or statistics of the players you have chosen. + built-in player was embeded to. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -2416,11 +2516,13 @@ async def get_views_by_region( ) -> ViewsByRegion: """ Aggregates the number of views grouping them by regions of countries in the - built-in player. Note. This method operates only on data collected by the - built-in HTML player. It will not show statistics if you are using another - player or viewing in native OS players through direct .m3u8/.mpd/.mp4 links. For - such cases, use calculations through CDN (look at method /statistics/cdn/uniqs) - or statistics of the players you have chosen. + built-in player. + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -2469,14 +2571,18 @@ async def get_views_heatmap( ) -> ViewsHeatmap: """ Shows information about what part of the video your viewers watched in the - built-in player. This way you can find out how many viewers started watching the - video, and where they stopped watching instead of watching the entire video to - the end. Has different format of response depends on query param "type". Note. - This method operates only on data collected by the built-in HTML player. It will - not show statistics if you are using another player or viewing in native OS - players through direct .m3u8/.mpd/.mp4 links. For such cases, use calculations - through CDN (look at method /statistics/cdn/uniqs) or statistics of the players - you have chosen. + built-in player. + + This way you can find out how many viewers started watching the video, and where + they stopped watching instead of watching the entire video to the end. + + Has different format of response depends on query param "type". + + Note. This method operates only on data collected by the built-in HTML player. + It will not show statistics if you are using another player or viewing in native + OS players through direct .m3u8/.mpd/.mp4 links. For such cases, use + calculations through CDN (look at method /statistics/cdn/uniqs) or statistics of + the players you have chosen. Args: date_from: Start of time frame. Datetime in ISO 8601 format. @@ -2529,8 +2635,10 @@ async def get_vod_storage_volume( ) -> VodStatisticsSeries: """ Calculates time series of the duration in minutes for all processed and - undeleted client videos. The data is updated every 8 hours, it does not make - sense to set the granulation less than 1 day. + undeleted client videos. + + The data is updated every 8 hours, it does not make sense to set the granulation + less than 1 day. Args: from_: Start of time frame. Datetime in ISO 8601 format. @@ -2577,8 +2685,10 @@ async def get_vod_transcoding_duration( ) -> VodStatisticsSeries: """ Calculates time series of the transcoding time in minutes for all processed - client videos. The data is updated every 8 hours, it does not make sense to set - the granulation less than 1 day. + client videos. + + The data is updated every 8 hours, it does not make sense to set the granulation + less than 1 day. Args: from_: Start of time frame. Datetime in ISO 8601 format. @@ -2626,13 +2736,17 @@ async def get_vod_unique_viewers_cdn( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VodStatisticsSeries: - """Calculates time series of unique viewers of VOD via CDN. + """ + Calculates time series of unique viewers of VOD via CDN. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. + + Works similar to the method `/statistics/cdn/uniqs`. But this allows you to + break down data with the specified granularity: minutes, hours, days. - The statistics are - taken from the data of CDN and work regardless of which player the views were - made with. Works similar to the method `/statistics/cdn/uniqs`. But this allows - you to break down data with the specified granularity: minutes, hours, days. Based on this method, a graph of unique views in the Customer Portal is built. + ![Unique viewers via CDN in Customer Portal](https://demo-files.gvideo.io/apidocs/cdn_unique_viewers.png) Args: @@ -2693,11 +2807,14 @@ async def get_vod_watch_time_cdn( """Calculates a time series of video watching duration in minutes. Views of only - those videos that meet the specified filters are summed up. The statistics are - taken from the data of CDN and work regardless of which player the views were - made with. Please note that the result for each time interval is in minutes, it - is rounded to the nearest upper integer. You cannot use the sum of all intervals - as the total watch time value; instead, use the /total method. + those videos that meet the specified filters are summed up. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. + + Please note that the result for each time interval is in minutes, it is rounded + to the nearest upper integer. You cannot use the sum of all intervals as the + total watch time value; instead, use the /total method. Args: from_: Start of the time period for counting minutes of watching. Format is date time @@ -2758,9 +2875,10 @@ async def get_vod_watch_time_total_cdn( """Calculates the total duration of video watching in minutes. Views of only those - videos that meet the specified filters are summed up. The statistics are taken - from the data of CDN and work regardless of which player the views were made - with. + videos that meet the specified filters are summed up. + + The statistics are taken from the data of CDN and work regardless of which + player the views were made with. Args: client_user_id: Filter by field "`client_user_id`" diff --git a/src/gcore/resources/streaming/streams/overlays.py b/src/gcore/resources/streaming/streams/overlays.py index b6f1b4fd..780f045b 100644 --- a/src/gcore/resources/streaming/streams/overlays.py +++ b/src/gcore/resources/streaming/streams/overlays.py @@ -65,6 +65,7 @@ def create( There are can be more that 1 overlay over a stream, which are small or stretched over full frame. Overlays can have transparent areas. Frequency of update is 1 FPS. Automatic size scaling for Adaptative Bitrate qualities is applied. + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/coffee_run_overlays.gif) How to activate and use in simple steps: @@ -73,12 +74,16 @@ def create( - Set “`html_overlay`” attribute to "true" for a stream - Set array of overlays - Start or restart your stream again - - Enjoy :-) For the first time an overlay should be enabled **before** start - pushing of a live stream. If you are pushing the stream already (stream is - alive and you are activating overlay for the first time), then overlay will - become active after restart pushing. Once you activate the overlay for the - stream for the first time, you can add, change, move, delete widgets on the - fly even during a live stream with no affection on a result stream. + - Enjoy :-) + + For the first time an overlay should be enabled **before** start pushing of a + live stream. If you are pushing the stream already (stream is alive and you are + activating overlay for the first time), then overlay will become active after + restart pushing. + + Once you activate the overlay for the stream for the first time, you can add, + change, move, delete widgets on the fly even during a live stream with no + affection on a result stream. Tech limits: @@ -105,13 +110,16 @@ def create( can be stopped automatically, and the ability to insert widgets itself is banned. - If feature is disabled, you will receive HTTP code: 422. Error text: Feature - disabled. Contact support to enable. Please, pay attention to the content of - HTML widges you use. If you don't trust them, then you shouldn't use them, as - their result will be displayed in live stream to all users. **Will there be a - widget in the recording?** Right now overlay widgets are sent to the end - viewer in the HLS/DASH streams, but are not recorded due to technical - limitations. We are working to ensure that widgets remain in the recordings as - well. Follow the news. + disabled. Contact support to enable. + + Please, pay attention to the content of HTML widges you use. If you don't trust + them, then you shouldn't use them, as their result will be displayed in live + stream to all users. + + **Will there be a widget in the recording?** Right now overlay widgets are sent + to the end viewer in the HLS/DASH streams, but are not recorded due to technical + limitations. We are working to ensure that widgets remain in the recordings as + well. Follow the news. Args: extra_headers: Send extra headers @@ -362,6 +370,7 @@ async def create( There are can be more that 1 overlay over a stream, which are small or stretched over full frame. Overlays can have transparent areas. Frequency of update is 1 FPS. Automatic size scaling for Adaptative Bitrate qualities is applied. + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/coffee_run_overlays.gif) How to activate and use in simple steps: @@ -370,12 +379,16 @@ async def create( - Set “`html_overlay`” attribute to "true" for a stream - Set array of overlays - Start or restart your stream again - - Enjoy :-) For the first time an overlay should be enabled **before** start - pushing of a live stream. If you are pushing the stream already (stream is - alive and you are activating overlay for the first time), then overlay will - become active after restart pushing. Once you activate the overlay for the - stream for the first time, you can add, change, move, delete widgets on the - fly even during a live stream with no affection on a result stream. + - Enjoy :-) + + For the first time an overlay should be enabled **before** start pushing of a + live stream. If you are pushing the stream already (stream is alive and you are + activating overlay for the first time), then overlay will become active after + restart pushing. + + Once you activate the overlay for the stream for the first time, you can add, + change, move, delete widgets on the fly even during a live stream with no + affection on a result stream. Tech limits: @@ -402,13 +415,16 @@ async def create( can be stopped automatically, and the ability to insert widgets itself is banned. - If feature is disabled, you will receive HTTP code: 422. Error text: Feature - disabled. Contact support to enable. Please, pay attention to the content of - HTML widges you use. If you don't trust them, then you shouldn't use them, as - their result will be displayed in live stream to all users. **Will there be a - widget in the recording?** Right now overlay widgets are sent to the end - viewer in the HLS/DASH streams, but are not recorded due to technical - limitations. We are working to ensure that widgets remain in the recordings as - well. Follow the news. + disabled. Contact support to enable. + + Please, pay attention to the content of HTML widges you use. If you don't trust + them, then you shouldn't use them, as their result will be displayed in live + stream to all users. + + **Will there be a widget in the recording?** Right now overlay widgets are sent + to the end viewer in the HLS/DASH streams, but are not recorded due to technical + limitations. We are working to ensure that widgets remain in the recordings as + well. Follow the news. Args: extra_headers: Send extra headers diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index 691b6e03..acc3a7f3 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -97,22 +97,26 @@ def create( The input in API may contain streams of different formats, including the most common ones RTMP, RTMPS, SRT, HLS. Note that multicast MPEG-TS over UDP and - others are supported too, ask the Support Team please. For ingestion, you can - use both PUSH and PULL methods. Also you can use the main and backup servers, - which are geographically located in different locations. By default, any free - ingest points in the world are used. Settings have been applied that deliver - low-latency streams in the optimal way. If for some reason you need to set a - fixed ingest point, or if you need to set the main and backup ingest points in - the same region (for example, do not send streams outside the EU or US), then - contact our Support Team. + others are supported too, ask the Support Team please. + + For ingestion, you can use both PUSH and PULL methods. + + Also you can use the main and backup servers, which are geographically located + in different locations. By default, any free ingest points in the world are + used. Settings have been applied that deliver low-latency streams in the optimal + way. If for some reason you need to set a fixed ingest point, or if you need to + set the main and backup ingest points in the same region (for example, do not + send streams outside the EU or US), then contact our Support Team. The output is HLS and MPEG-DASH with ABR. We transcode video for you by our cloud-based infrastructure. ABR ladder supports all qualities from SD to 8K HDR - 60fps. All our streams are Low Latency enabled. We support a delay of ±4 seconds - for video streams by utilizing Common Media Application Format (CMAF) - technology. So you obtain latency from the traditional 30-50 seconds to ±4 - seconds only by default. If you need legacy non-low-latency HLS, then look at - HLS MPEG-TS delivery below. + 60fps. + + All our streams are Low Latency enabled. We support a delay of ±4 seconds for + video streams by utilizing Common Media Application Format (CMAF) technology. So + you obtain latency from the traditional 30-50 seconds to ±4 seconds only by + default. If you need legacy non-low-latency HLS, then look at HLS MPEG-TS + delivery below. You have access to additional functions such as: @@ -125,11 +129,16 @@ def create( For more information see specific API methods, and the Knowledge Base. To organize streaming with ultra-low latency, look for WebRTC delivery in different section in the Knowledge Base. + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/low-latency-football.gif) Args: - name: Stream name. Often used as a human-readable name for the stream, but can contain - any text you wish. The values are not unique and may be repeated. Examples: + name: Stream name. + + Often used as a human-readable name for the stream, but can contain any text you + wish. The values are not unique and may be repeated. + + Examples: - Conference in July - Stream #10003 @@ -137,17 +146,21 @@ def create( - 480fd499-2de2-4988-bc1a-a4eebe9818ee active: Stream switch between on and off. This is not an indicator of the status "stream - is receiving and it is LIVE", but rather an on/off switch. When stream is - switched off, there is no way to process it: PULL is deactivated and PUSH will - return an error. + is receiving and it is LIVE", but rather an on/off switch. + + When stream is switched off, there is no way to process it: PULL is deactivated + and PUSH will return an error. - true – stream can be processed - false – stream is off, and cannot be processed auto_record: Enables autotomatic recording of the stream when it started. So you don't need - to call recording manually. Result of recording is automatically added to video - hosting. For details see the /streams/`start_recording` method and in knowledge - base Values: + to call recording manually. + + Result of recording is automatically added to video hosting. For details see the + /streams/`start_recording` method and in knowledge base + + Values: - true – auto recording is enabled - false – auto recording is disabled @@ -167,9 +180,12 @@ def create( field in any way when processing the stream. Example: `client_user_id = 1001` dvr_duration: DVR duration in seconds if DVR feature is enabled for the stream. So this is - duration of how far the user can rewind the live stream. `dvr_duration` range is - [30...14400]. Maximum value is 4 hours = 14400 seconds. If you need more, ask - the Support Team please. + duration of how far the user can rewind the live stream. + + `dvr_duration` range is [30...14400]. + + Maximum value is 4 hours = 14400 seconds. If you need more, ask the Support Team + please. dvr_enabled: Enables DVR for the stream: @@ -185,7 +201,9 @@ def create( projection: Visualization mode for 360° streams, how the stream is rendered in our web player ONLY. If you would like to show video 360° in an external video player, - then use parameters of that video player. Modes: + then use parameters of that video player. + + Modes: - regular – regular “flat” stream - vr360 – display stream in 360° mode @@ -205,23 +223,28 @@ def create( your conditions. Look at GET /`quality_sets` method record_type: Method of recording a stream. Specifies the source from which the stream will be - recorded: original or transcoded. Types: + recorded: original or transcoded. + + Types: - "origin" – To record RMTP/SRT/etc original clean media source. - "transcoded" – To record the output transcoded version of the stream, including overlays, texts, logos, etc. additional media layers. - uri: When using PULL method, this is the URL to pull a stream from. You can specify - multiple addresses separated by a space (" "), so you can organize a backup - plan. In this case, the specified addresses will be selected one by one using - round robin scheduling. If the first address does not respond, then the next one - in the list will be automatically requested, returning to the first and so on in - a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 2 hours of - inactivity of your original stream, the system stops PULL requests and the - stream is deactivated (the "active" field switches to "false"). Please, note - that this field is for PULL only, so is not suitable for PUSH. Look at fields - "`push_url`" and "`push_url_srt`" from GET method. + uri: When using PULL method, this is the URL to pull a stream from. + + You can specify multiple addresses separated by a space (" "), so you can + organize a backup plan. In this case, the specified addresses will be selected + one by one using round robin scheduling. If the first address does not respond, + then the next one in the list will be automatically requested, returning to the + first and so on in a circle. Also, if the sucessfully working stream stops + sending data, then the next one will be selected according to the same scheme. + + After 2 hours of inactivity of your original stream, the system stops PULL + requests and the stream is deactivated (the "active" field switches to "false"). + + Please, note that this field is for PULL only, so is not suitable for PUSH. Look + at fields "`push_url`" and "`push_url_srt`" from GET method. extra_headers: Send extra headers @@ -357,11 +380,14 @@ def delete( Delete a live stream. After deleting the live stream, all associated data is deleted: settings, PUSH - and PULL links, video playback links, etc. Live stream information is deleted - permanently and irreversibly. Therefore, it is impossible to restore data and - files after this. But if the live had recordings, they continue to remain - independent Video entities. The "`stream_id`" parameter will simply point to a - stream that no longer exists. + and PULL links, video playback links, etc. + + Live stream information is deleted permanently and irreversibly. Therefore, it + is impossible to restore data and files after this. + + But if the live had recordings, they continue to remain independent Video + entities. The "`stream_id`" parameter will simply point to a stream that no + longer exists. Perhaps, instead of deleting, you may use the stream deactivation: @@ -437,24 +463,29 @@ def create_clip( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Clip: - """Create an instant clip from on-going live stream. + """ + Create an instant clip from on-going live stream. - Instant clips are applicable - in cases where there is no time to wait for the broadcast to be completed and - recorded. For example, for quickly cutting highlights in sport events, or - cutting an important moment in the news or live performance. + Instant clips are applicable in cases where there is no time to wait for the + broadcast to be completed and recorded. For example, for quickly cutting + highlights in sport events, or cutting an important moment in the news or live + performance. Instant clip becomes available for viewing in the following formats: - HLS .m3u8, - MP4, - VOD in video hosting with a permanent link to watch video. - ![HTML Overlays](https://demo-files.gvideo.io/apidocs/clip_recording_mp4_hls.gif) - **Clip lifetime:** Instant clips are a copy of the stream, created from a live - stream. They are stored in memory for a limited time, after which the clip - ceases to exist and you will receive a 404 on the link. Limits that you should - keep in mind: + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/clip_recording_mp4_hls.gif) + + **Clip lifetime:** + + Instant clips are a copy of the stream, created from a live stream. They are + stored in memory for a limited time, after which the clip ceases to exist and + you will receive a 404 on the link. + + Limits that you should keep in mind: - The clip's lifespan is controlled by `expiration` parameter. - The default expiration value is 1 hour. The value can be set from 1 minute to @@ -468,9 +499,10 @@ def create_clip( you try to request it before this time, the response will be error code 425 "Too Early". - **Cutting a clip from a source:** In order to use clips recording feature, DVR - must be enabled for a stream: "`dvr_enabled`: true". The DVR serves as a source - for creating clips: + **Cutting a clip from a source:** + + In order to use clips recording feature, DVR must be enabled for a stream: + "`dvr_enabled`: true". The DVR serves as a source for creating clips: - By default live stream DVR is set to 1 hour (3600 seconds). You can create an instant clip using any segment of this time period by specifying the desired @@ -478,39 +510,56 @@ def create_clip( - If you create a clip, but the DVR expires, the clip will still exist for the specified time as a copy of the stream. - **Getting permanent VOD:** To get permanent VOD version of a live clip use this - parameter when making a request to create a clip: `vod_required: true`. Later, - when the clip is ready, grab `video_id` value from the response and query the - video by regular GET /video/{id} method. + **Getting permanent VOD:** + + To get permanent VOD version of a live clip use this parameter when making a + request to create a clip: `vod_required: true`. + + Later, when the clip is ready, grab `video_id` value from the response and query + the video by regular GET /video/{id} method. Args: - duration: Requested segment duration in seconds to be cut. Please, note that cutting is - based on the idea of instantly creating a clip, instead of precise timing. So - final segment may be: + duration: Requested segment duration in seconds to be cut. + + Please, note that cutting is based on the idea of instantly creating a clip, + instead of precise timing. So final segment may be: - Less than the specified value if there is less data in the DVR than the requested segment. - Greater than the specified value, because segment is aligned to the first and last key frames of already stored fragment in DVR, this way -1 and +1 chunks - can be added to left and right. Duration of cutted segment cannot be greater - than DVR duration for this stream. Therefore, to change the maximum, use - "`dvr_duration`" parameter of this stream. - - expiration: Expire time of the clip via a public link. Unix timestamp in seconds, absolute - value. This is the time how long the instant clip will be stored in the server - memory and can be accessed via public HLS/MP4 links. Download and/or use the - instant clip before this time expires. After the time has expired, the clip is - deleted from memory and is no longer available via the link. You need to create - a new segment, or use `vod_required: true` attribute. If value is omitted, then - expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e. - `unix timestamp = + + 3600`). Allowed range: 1m <= expiration - <= 4h. Example: + can be added to left and right. + + Duration of cutted segment cannot be greater than DVR duration for this stream. + Therefore, to change the maximum, use "`dvr_duration`" parameter of this stream. + + expiration: Expire time of the clip via a public link. + + Unix timestamp in seconds, absolute value. + + This is the time how long the instant clip will be stored in the server memory + and can be accessed via public HLS/MP4 links. Download and/or use the instant + clip before this time expires. + + After the time has expired, the clip is deleted from memory and is no longer + available via the link. You need to create a new segment, or use + `vod_required: true` attribute. + + If value is omitted, then expiration is counted as +3600 seconds (1 hour) to the + end of the clip (i.e. `unix timestamp = + + 3600`). + + Allowed range: 1m <= expiration <= 4h. + + Example: `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` - start: Starting point of the segment to cut. Unix timestamp in seconds, absolute value. - Example: `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` If a value - from the past is specified, it is used as the starting point for the segment to - cut. If the value is omitted, then clip will start from now. + start: Starting point of the segment to cut. + + Unix timestamp in seconds, absolute value. Example: + `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` + + If a value from the past is specified, it is used as the starting point for the + segment to cut. If the value is omitted, then clip will start from now. vod_required: Indicates if video needs to be stored also as permanent VOD @@ -587,11 +636,13 @@ def list_clips( You can now use both MP4 just-in-time packager and HLS for all clips. Get URLs from "`hls_master`" and "`mp4_master`". - **How to download renditions of clips:** URLs contain "master" alias by default, - which means maximum available quality from ABR set (based on height metadata). - There is also possibility to access individual bitrates from ABR ladder. That - works for both HLS and MP4. You can replace manually "master" to a value from - renditions list in order to get exact bitrate/quality from the set. Example: + **How to download renditions of clips:** + + URLs contain "master" alias by default, which means maximum available quality + from ABR set (based on height metadata). There is also possibility to access + individual bitrates from ABR ladder. That works for both HLS and MP4. You can + replace manually "master" to a value from renditions list in order to get exact + bitrate/quality from the set. Example: - HLS 720p: `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_master.m3u8` @@ -648,12 +699,14 @@ def start_recording( - If you have access to the premium feature of saving the original stream (so not just transcoded renditions), then the link to the original file will be in the "`origin_url`" field. Look at the description of the field how to use it. - Stream must be live for the recording to start, please check fields "live" - and/or "`backup_live`". After the recording starts, field "recording" will - switch to "true", and the recording duration in seconds will appear in the - "`recording_duration`" field. Please, keep in mind that recording doesn't - start instantly, it takes ±3-7 seconds to initialize the process after - executing this method. + + Stream must be live for the recording to start, please check fields "live" + and/or "`backup_live`". After the recording starts, field "recording" will + switch to "true", and the recording duration in seconds will appear in the + "`recording_duration`" field. + + Please, keep in mind that recording doesn't start instantly, it takes ±3-7 + seconds to initialize the process after executing this method. Stream recording stops when: @@ -662,6 +715,7 @@ def start_recording( method again, the recording will be made to a new video file. - When sending the stream stops on the client side, or stops accidentally. In this case, recording process is waiting for 10 seconds to resume recording: + - If the stream resumes within that period, recording will continue to the same file. - After that period, the file will be completely saved and closed. @@ -780,22 +834,26 @@ async def create( The input in API may contain streams of different formats, including the most common ones RTMP, RTMPS, SRT, HLS. Note that multicast MPEG-TS over UDP and - others are supported too, ask the Support Team please. For ingestion, you can - use both PUSH and PULL methods. Also you can use the main and backup servers, - which are geographically located in different locations. By default, any free - ingest points in the world are used. Settings have been applied that deliver - low-latency streams in the optimal way. If for some reason you need to set a - fixed ingest point, or if you need to set the main and backup ingest points in - the same region (for example, do not send streams outside the EU or US), then - contact our Support Team. + others are supported too, ask the Support Team please. + + For ingestion, you can use both PUSH and PULL methods. + + Also you can use the main and backup servers, which are geographically located + in different locations. By default, any free ingest points in the world are + used. Settings have been applied that deliver low-latency streams in the optimal + way. If for some reason you need to set a fixed ingest point, or if you need to + set the main and backup ingest points in the same region (for example, do not + send streams outside the EU or US), then contact our Support Team. The output is HLS and MPEG-DASH with ABR. We transcode video for you by our cloud-based infrastructure. ABR ladder supports all qualities from SD to 8K HDR - 60fps. All our streams are Low Latency enabled. We support a delay of ±4 seconds - for video streams by utilizing Common Media Application Format (CMAF) - technology. So you obtain latency from the traditional 30-50 seconds to ±4 - seconds only by default. If you need legacy non-low-latency HLS, then look at - HLS MPEG-TS delivery below. + 60fps. + + All our streams are Low Latency enabled. We support a delay of ±4 seconds for + video streams by utilizing Common Media Application Format (CMAF) technology. So + you obtain latency from the traditional 30-50 seconds to ±4 seconds only by + default. If you need legacy non-low-latency HLS, then look at HLS MPEG-TS + delivery below. You have access to additional functions such as: @@ -808,11 +866,16 @@ async def create( For more information see specific API methods, and the Knowledge Base. To organize streaming with ultra-low latency, look for WebRTC delivery in different section in the Knowledge Base. + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/low-latency-football.gif) Args: - name: Stream name. Often used as a human-readable name for the stream, but can contain - any text you wish. The values are not unique and may be repeated. Examples: + name: Stream name. + + Often used as a human-readable name for the stream, but can contain any text you + wish. The values are not unique and may be repeated. + + Examples: - Conference in July - Stream #10003 @@ -820,17 +883,21 @@ async def create( - 480fd499-2de2-4988-bc1a-a4eebe9818ee active: Stream switch between on and off. This is not an indicator of the status "stream - is receiving and it is LIVE", but rather an on/off switch. When stream is - switched off, there is no way to process it: PULL is deactivated and PUSH will - return an error. + is receiving and it is LIVE", but rather an on/off switch. + + When stream is switched off, there is no way to process it: PULL is deactivated + and PUSH will return an error. - true – stream can be processed - false – stream is off, and cannot be processed auto_record: Enables autotomatic recording of the stream when it started. So you don't need - to call recording manually. Result of recording is automatically added to video - hosting. For details see the /streams/`start_recording` method and in knowledge - base Values: + to call recording manually. + + Result of recording is automatically added to video hosting. For details see the + /streams/`start_recording` method and in knowledge base + + Values: - true – auto recording is enabled - false – auto recording is disabled @@ -850,9 +917,12 @@ async def create( field in any way when processing the stream. Example: `client_user_id = 1001` dvr_duration: DVR duration in seconds if DVR feature is enabled for the stream. So this is - duration of how far the user can rewind the live stream. `dvr_duration` range is - [30...14400]. Maximum value is 4 hours = 14400 seconds. If you need more, ask - the Support Team please. + duration of how far the user can rewind the live stream. + + `dvr_duration` range is [30...14400]. + + Maximum value is 4 hours = 14400 seconds. If you need more, ask the Support Team + please. dvr_enabled: Enables DVR for the stream: @@ -868,7 +938,9 @@ async def create( projection: Visualization mode for 360° streams, how the stream is rendered in our web player ONLY. If you would like to show video 360° in an external video player, - then use parameters of that video player. Modes: + then use parameters of that video player. + + Modes: - regular – regular “flat” stream - vr360 – display stream in 360° mode @@ -888,23 +960,28 @@ async def create( your conditions. Look at GET /`quality_sets` method record_type: Method of recording a stream. Specifies the source from which the stream will be - recorded: original or transcoded. Types: + recorded: original or transcoded. + + Types: - "origin" – To record RMTP/SRT/etc original clean media source. - "transcoded" – To record the output transcoded version of the stream, including overlays, texts, logos, etc. additional media layers. - uri: When using PULL method, this is the URL to pull a stream from. You can specify - multiple addresses separated by a space (" "), so you can organize a backup - plan. In this case, the specified addresses will be selected one by one using - round robin scheduling. If the first address does not respond, then the next one - in the list will be automatically requested, returning to the first and so on in - a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 2 hours of - inactivity of your original stream, the system stops PULL requests and the - stream is deactivated (the "active" field switches to "false"). Please, note - that this field is for PULL only, so is not suitable for PUSH. Look at fields - "`push_url`" and "`push_url_srt`" from GET method. + uri: When using PULL method, this is the URL to pull a stream from. + + You can specify multiple addresses separated by a space (" "), so you can + organize a backup plan. In this case, the specified addresses will be selected + one by one using round robin scheduling. If the first address does not respond, + then the next one in the list will be automatically requested, returning to the + first and so on in a circle. Also, if the sucessfully working stream stops + sending data, then the next one will be selected according to the same scheme. + + After 2 hours of inactivity of your original stream, the system stops PULL + requests and the stream is deactivated (the "active" field switches to "false"). + + Please, note that this field is for PULL only, so is not suitable for PUSH. Look + at fields "`push_url`" and "`push_url_srt`" from GET method. extra_headers: Send extra headers @@ -1040,11 +1117,14 @@ async def delete( Delete a live stream. After deleting the live stream, all associated data is deleted: settings, PUSH - and PULL links, video playback links, etc. Live stream information is deleted - permanently and irreversibly. Therefore, it is impossible to restore data and - files after this. But if the live had recordings, they continue to remain - independent Video entities. The "`stream_id`" parameter will simply point to a - stream that no longer exists. + and PULL links, video playback links, etc. + + Live stream information is deleted permanently and irreversibly. Therefore, it + is impossible to restore data and files after this. + + But if the live had recordings, they continue to remain independent Video + entities. The "`stream_id`" parameter will simply point to a stream that no + longer exists. Perhaps, instead of deleting, you may use the stream deactivation: @@ -1120,24 +1200,29 @@ async def create_clip( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Clip: - """Create an instant clip from on-going live stream. + """ + Create an instant clip from on-going live stream. - Instant clips are applicable - in cases where there is no time to wait for the broadcast to be completed and - recorded. For example, for quickly cutting highlights in sport events, or - cutting an important moment in the news or live performance. + Instant clips are applicable in cases where there is no time to wait for the + broadcast to be completed and recorded. For example, for quickly cutting + highlights in sport events, or cutting an important moment in the news or live + performance. Instant clip becomes available for viewing in the following formats: - HLS .m3u8, - MP4, - VOD in video hosting with a permanent link to watch video. - ![HTML Overlays](https://demo-files.gvideo.io/apidocs/clip_recording_mp4_hls.gif) - **Clip lifetime:** Instant clips are a copy of the stream, created from a live - stream. They are stored in memory for a limited time, after which the clip - ceases to exist and you will receive a 404 on the link. Limits that you should - keep in mind: + ![HTML Overlays](https://demo-files.gvideo.io/apidocs/clip_recording_mp4_hls.gif) + + **Clip lifetime:** + + Instant clips are a copy of the stream, created from a live stream. They are + stored in memory for a limited time, after which the clip ceases to exist and + you will receive a 404 on the link. + + Limits that you should keep in mind: - The clip's lifespan is controlled by `expiration` parameter. - The default expiration value is 1 hour. The value can be set from 1 minute to @@ -1151,9 +1236,10 @@ async def create_clip( you try to request it before this time, the response will be error code 425 "Too Early". - **Cutting a clip from a source:** In order to use clips recording feature, DVR - must be enabled for a stream: "`dvr_enabled`: true". The DVR serves as a source - for creating clips: + **Cutting a clip from a source:** + + In order to use clips recording feature, DVR must be enabled for a stream: + "`dvr_enabled`: true". The DVR serves as a source for creating clips: - By default live stream DVR is set to 1 hour (3600 seconds). You can create an instant clip using any segment of this time period by specifying the desired @@ -1161,39 +1247,56 @@ async def create_clip( - If you create a clip, but the DVR expires, the clip will still exist for the specified time as a copy of the stream. - **Getting permanent VOD:** To get permanent VOD version of a live clip use this - parameter when making a request to create a clip: `vod_required: true`. Later, - when the clip is ready, grab `video_id` value from the response and query the - video by regular GET /video/{id} method. + **Getting permanent VOD:** + + To get permanent VOD version of a live clip use this parameter when making a + request to create a clip: `vod_required: true`. + + Later, when the clip is ready, grab `video_id` value from the response and query + the video by regular GET /video/{id} method. Args: - duration: Requested segment duration in seconds to be cut. Please, note that cutting is - based on the idea of instantly creating a clip, instead of precise timing. So - final segment may be: + duration: Requested segment duration in seconds to be cut. + + Please, note that cutting is based on the idea of instantly creating a clip, + instead of precise timing. So final segment may be: - Less than the specified value if there is less data in the DVR than the requested segment. - Greater than the specified value, because segment is aligned to the first and last key frames of already stored fragment in DVR, this way -1 and +1 chunks - can be added to left and right. Duration of cutted segment cannot be greater - than DVR duration for this stream. Therefore, to change the maximum, use - "`dvr_duration`" parameter of this stream. - - expiration: Expire time of the clip via a public link. Unix timestamp in seconds, absolute - value. This is the time how long the instant clip will be stored in the server - memory and can be accessed via public HLS/MP4 links. Download and/or use the - instant clip before this time expires. After the time has expired, the clip is - deleted from memory and is no longer available via the link. You need to create - a new segment, or use `vod_required: true` attribute. If value is omitted, then - expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e. - `unix timestamp = + + 3600`). Allowed range: 1m <= expiration - <= 4h. Example: + can be added to left and right. + + Duration of cutted segment cannot be greater than DVR duration for this stream. + Therefore, to change the maximum, use "`dvr_duration`" parameter of this stream. + + expiration: Expire time of the clip via a public link. + + Unix timestamp in seconds, absolute value. + + This is the time how long the instant clip will be stored in the server memory + and can be accessed via public HLS/MP4 links. Download and/or use the instant + clip before this time expires. + + After the time has expired, the clip is deleted from memory and is no longer + available via the link. You need to create a new segment, or use + `vod_required: true` attribute. + + If value is omitted, then expiration is counted as +3600 seconds (1 hour) to the + end of the clip (i.e. `unix timestamp = + + 3600`). + + Allowed range: 1m <= expiration <= 4h. + + Example: `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` - start: Starting point of the segment to cut. Unix timestamp in seconds, absolute value. - Example: `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` If a value - from the past is specified, it is used as the starting point for the segment to - cut. If the value is omitted, then clip will start from now. + start: Starting point of the segment to cut. + + Unix timestamp in seconds, absolute value. Example: + `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` + + If a value from the past is specified, it is used as the starting point for the + segment to cut. If the value is omitted, then clip will start from now. vod_required: Indicates if video needs to be stored also as permanent VOD @@ -1270,11 +1373,13 @@ async def list_clips( You can now use both MP4 just-in-time packager and HLS for all clips. Get URLs from "`hls_master`" and "`mp4_master`". - **How to download renditions of clips:** URLs contain "master" alias by default, - which means maximum available quality from ABR set (based on height metadata). - There is also possibility to access individual bitrates from ABR ladder. That - works for both HLS and MP4. You can replace manually "master" to a value from - renditions list in order to get exact bitrate/quality from the set. Example: + **How to download renditions of clips:** + + URLs contain "master" alias by default, which means maximum available quality + from ABR set (based on height metadata). There is also possibility to access + individual bitrates from ABR ladder. That works for both HLS and MP4. You can + replace manually "master" to a value from renditions list in order to get exact + bitrate/quality from the set. Example: - HLS 720p: `https://CID.domain.com/rec/111_1000/rec_d7bsli54p8n4_qsid42_master.m3u8` @@ -1331,12 +1436,14 @@ async def start_recording( - If you have access to the premium feature of saving the original stream (so not just transcoded renditions), then the link to the original file will be in the "`origin_url`" field. Look at the description of the field how to use it. - Stream must be live for the recording to start, please check fields "live" - and/or "`backup_live`". After the recording starts, field "recording" will - switch to "true", and the recording duration in seconds will appear in the - "`recording_duration`" field. Please, keep in mind that recording doesn't - start instantly, it takes ±3-7 seconds to initialize the process after - executing this method. + + Stream must be live for the recording to start, please check fields "live" + and/or "`backup_live`". After the recording starts, field "recording" will + switch to "true", and the recording duration in seconds will appear in the + "`recording_duration`" field. + + Please, keep in mind that recording doesn't start instantly, it takes ±3-7 + seconds to initialize the process after executing this method. Stream recording stops when: @@ -1345,6 +1452,7 @@ async def start_recording( method again, the recording will be made to a new video file. - When sending the stream stops on the client side, or stops accidentally. In this case, recording process is waiting for 10 seconds to resume recording: + - If the stream resumes within that period, recording will continue to the same file. - After that period, the file will be completely saved and closed. diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py index 08123c15..5930fd58 100644 --- a/src/gcore/resources/streaming/videos/subtitles.py +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -58,8 +58,9 @@ def create( """ Add new subtitle/captions to a video entity. - **Add already exist subtitles** Subtitles must be in one of the following - formats: + **Add already exist subtitles** + + Subtitles must be in one of the following formats: - SRT – SubRip Text is described on [wikipedia.org](https://en.wikipedia.org/wiki/SubRip#SubRip_file_format). Must @@ -69,19 +70,26 @@ def create( - WebVTT – Web Video Text Tracks Format is described on [developer.mozilla.org](https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API). Must start from "WEBVTT" header. Use validators to check the subtitles, like - [W3C](https://w3c.github.io/webvtt.js/parser.html). Language is 3-letter - language code according to ISO-639-2 (bibliographic code). Specify language - you need, or just look at our list in the attribute "`audio_language`" of - section - ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). - You can add multiple subtitles in the same language, language uniqueness is - not required. Size must be up to 5Mb. + [W3C](https://w3c.github.io/webvtt.js/parser.html). + + Language is 3-letter language code according to ISO-639-2 (bibliographic code). + Specify language you need, or just look at our list in the attribute + "`audio_language`" of section + ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). + + You can add multiple subtitles in the same language, language uniqueness is not + required. + + Size must be up to 5Mb. The update time for added or changed subtitles is up to 30 seconds. Just like videos, subtitles are cached, so it takes time to update the data. - **AI subtitles and transcribing** It is also possible to automatically create - subtitles based on AI. Read more: + **AI subtitles and transcribing** + + It is also possible to automatically create subtitles based on AI. + + Read more: - What is ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). @@ -95,14 +103,20 @@ def create( that. Also you can point several languages to translate to, then a separate subtitle will be generated for each specified language. The created AI-task(s) will be automatically executed, and result will also be automatically attached - to this video as subtitle(s). If AI is disabled in your account, you will - receive code 422 in response. + to this video as subtitle(s). - **Where and how subtitles are displayed?** Subtitles are became available in the - API response and in playback manifests. All added subtitles are automatically - inserted into the output manifest .m3u8. This way, subtitles become available to - any player: our player, OS built-in, or other specialized ones. You don't need - to do anything else. Read more information in the Knowledge Base. Example: + If AI is disabled in your account, you will receive code 422 in response. + + **Where and how subtitles are displayed?** + + Subtitles are became available in the API response and in playback manifests. + + All added subtitles are automatically inserted into the output manifest .m3u8. + This way, subtitles become available to any player: our player, OS built-in, or + other specialized ones. You don't need to do anything else. Read more + information in the Knowledge Base. + + Example: ``` # EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs0",NAME="English",LANGUAGE="en",AUTOSELECT=YES,URI="subs-0.m3u8" @@ -143,16 +157,20 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SubtitleBase: - """Method to update subtitle of a video. + """ + Method to update subtitle of a video. + + You can update all or only some of fields you need. - You can update all or only some of fields - you need. If you want to replace the text of subtitles (i.e. found a typo in the - text, or the timing in the video changed), then: + If you want to replace the text of subtitles (i.e. found a typo in the text, or + the timing in the video changed), then: - download it using GET method, - change it in an external editor, - - and update it using this PATCH method. Just like videos, subtitles are cached, - so it takes time to update the data. See POST method for details. + - and update it using this PATCH method. + + Just like videos, subtitles are cached, so it takes time to update the data. See + POST method for details. Args: language: 3-letter language code according to ISO-639-2 (bibliographic code) @@ -317,8 +335,9 @@ async def create( """ Add new subtitle/captions to a video entity. - **Add already exist subtitles** Subtitles must be in one of the following - formats: + **Add already exist subtitles** + + Subtitles must be in one of the following formats: - SRT – SubRip Text is described on [wikipedia.org](https://en.wikipedia.org/wiki/SubRip#SubRip_file_format). Must @@ -328,19 +347,26 @@ async def create( - WebVTT – Web Video Text Tracks Format is described on [developer.mozilla.org](https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API). Must start from "WEBVTT" header. Use validators to check the subtitles, like - [W3C](https://w3c.github.io/webvtt.js/parser.html). Language is 3-letter - language code according to ISO-639-2 (bibliographic code). Specify language - you need, or just look at our list in the attribute "`audio_language`" of - section - ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). - You can add multiple subtitles in the same language, language uniqueness is - not required. Size must be up to 5Mb. + [W3C](https://w3c.github.io/webvtt.js/parser.html). + + Language is 3-letter language code according to ISO-639-2 (bibliographic code). + Specify language you need, or just look at our list in the attribute + "`audio_language`" of section + ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). + + You can add multiple subtitles in the same language, language uniqueness is not + required. + + Size must be up to 5Mb. The update time for added or changed subtitles is up to 30 seconds. Just like videos, subtitles are cached, so it takes time to update the data. - **AI subtitles and transcribing** It is also possible to automatically create - subtitles based on AI. Read more: + **AI subtitles and transcribing** + + It is also possible to automatically create subtitles based on AI. + + Read more: - What is ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). @@ -354,14 +380,20 @@ async def create( that. Also you can point several languages to translate to, then a separate subtitle will be generated for each specified language. The created AI-task(s) will be automatically executed, and result will also be automatically attached - to this video as subtitle(s). If AI is disabled in your account, you will - receive code 422 in response. + to this video as subtitle(s). - **Where and how subtitles are displayed?** Subtitles are became available in the - API response and in playback manifests. All added subtitles are automatically - inserted into the output manifest .m3u8. This way, subtitles become available to - any player: our player, OS built-in, or other specialized ones. You don't need - to do anything else. Read more information in the Knowledge Base. Example: + If AI is disabled in your account, you will receive code 422 in response. + + **Where and how subtitles are displayed?** + + Subtitles are became available in the API response and in playback manifests. + + All added subtitles are automatically inserted into the output manifest .m3u8. + This way, subtitles become available to any player: our player, OS built-in, or + other specialized ones. You don't need to do anything else. Read more + information in the Knowledge Base. + + Example: ``` # EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs0",NAME="English",LANGUAGE="en",AUTOSELECT=YES,URI="subs-0.m3u8" @@ -402,16 +434,20 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SubtitleBase: - """Method to update subtitle of a video. + """ + Method to update subtitle of a video. + + You can update all or only some of fields you need. - You can update all or only some of fields - you need. If you want to replace the text of subtitles (i.e. found a typo in the - text, or the timing in the video changed), then: + If you want to replace the text of subtitles (i.e. found a typo in the text, or + the timing in the video changed), then: - download it using GET method, - change it in an external editor, - - and update it using this PATCH method. Just like videos, subtitles are cached, - so it takes time to update the data. See POST method for details. + - and update it using this PATCH method. + + Just like videos, subtitles are cached, so it takes time to update the data. See + POST method for details. Args: language: 3-letter language code according to ISO-639-2 (bibliographic code) diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index 0b306117..256d7d6f 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -81,8 +81,10 @@ def create( """ Use this method to create a new video entity. - **Methods of creating** To upload the original video file to the server, there - are several possible scenarios: + **Methods of creating** + + To upload the original video file to the server, there are several possible + scenarios: - **Copy from another server** – If your video is accessable via "http://", "https://", or "sftp://" public link, then you can use this method to copy a @@ -91,20 +93,26 @@ def create( execution file will be uploaded and will be sent to transcoding automatically, you don't have to do anything else. Use extra field `origin_http_headers` if authorization is required on the external server. + - **Direct upload from a local device** – If you need to upload video directly from your local device or from a mobile app, then use this method. Keep `origin_url` empty and use TUS protocol ([tus.io](https://tus.io)) to upload file. More details are here ["Get TUS' upload"](/docs/api-reference/streaming/videos/get-tus-parameters-for-direct-upload) - After getting the video, it is processed through the queue. There are 2 - priority criteria: global and local. Global is determined automatically by the - system as converters are ready to get next video, so your videos rarely queue - longer than usual (when you don't have a dedicated region). Local priority - works at the level of your account and you have full control over it, look at - "priority" attribute. - **AI processing** When uploading a video, it is possible to automatically create - subtitles based on AI. Read more: + After getting the video, it is processed through the queue. There are 2 priority + criteria: global and local. Global is determined automatically by the system as + converters are ready to get next video, so your videos rarely queue longer than + usual (when you don't have a dedicated region). Local priority works at the + level of your account and you have full control over it, look at "priority" + attribute. + + **AI processing** + + When uploading a video, it is possible to automatically create subtitles based + on AI. + + Read more: - What is ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). @@ -119,21 +127,26 @@ def create( subtitle will be generated for each specified language. - How to ["add AI-generated subtitles to an exist video"](/docs/api-reference/streaming/subtitles/add-subtitle). - The created AI-task(s) will be automatically executed, and result will also be - automatically attached to this video as subtitle(s). Please note that - transcription is done automatically for all videos uploaded to our video - hosting. If necessary, you can disable automatic creation of subtitles. If AI - is disabled in your account, no AI functionality is called. - - **Advanced Features** For details on the requirements for incoming original - files, and output video parameters after transcoding, refer to the Knowledge - Base documentation. By default video will be transcoded according to the - original resolution, and a quality ladder suitable for your original video will - be applied. There is no automatic upscaling; the maximum quality is taken from - the original video. If you want to upload specific files not explicitly listed - in requirements or wish to modify the standard quality ladder (i.e. decrease - quality or add new non-standard qualities), then such customization is possible. - Please reach out to us for assistance. + + The created AI-task(s) will be automatically executed, and result will also be + automatically attached to this video as subtitle(s). + + Please note that transcription is done automatically for all videos uploaded to + our video hosting. If necessary, you can disable automatic creation of + subtitles. If AI is disabled in your account, no AI functionality is called. + + **Advanced Features** + + For details on the requirements for incoming original files, and output video + parameters after transcoding, refer to the Knowledge Base documentation. By + default video will be transcoded according to the original resolution, and a + quality ladder suitable for your original video will be applied. There is no + automatic upscaling; the maximum quality is taken from the original video. + + If you want to upload specific files not explicitly listed in requirements or + wish to modify the standard quality ladder (i.e. decrease quality or add new + non-standard qualities), then such customization is possible. Please reach out + to us for assistance. Additionally, check the Knowledge Base for any supplementary information you may need. @@ -187,26 +200,30 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: - """Changes parameters of the video to new values. + """ + Changes parameters of the video to new values. - It's allowed to update only those - public parameters that are described in POST method to create a new “video” - entity. So it's not possible to change calculated parameters like "id", - "duration", "`hls_url`", etc. Examples of changing: + It's allowed to update only those public parameters that are described in POST + method to create a new “video” entity. So it's not possible to change calculated + parameters like "id", "duration", "`hls_url`", etc. + + Examples of changing: - Name: `{ "name": "new name of the video" }` - - Move the video to a new directory: ` { "directory_id": 200 }` Please note that - some parameters are used on initial step (before transcoding) only, so after - transcoding there is no use in changing their values. For example, - "`origin_url`" parameter is used for downloading an original file from a - source and never used after transcoding; or "priority" parameter is used to - set priority of processing and never used after transcoding. + - Move the video to a new directory: ` { "directory_id": 200 }` + + Please note that some parameters are used on initial step (before transcoding) + only, so after transcoding there is no use in changing their values. For + example, "`origin_url`" parameter is used for downloading an original file from + a source and never used after transcoding; or "priority" parameter is used to + set priority of processing and never used after transcoding. Args: name: Video name - auto_transcribe_audio_language: - Automatic creation of subtitles by transcribing the audio track. Values: + auto_transcribe_audio_language: Automatic creation of subtitles by transcribing the audio track. + + Values: - disable – Do not transcribe. - auto – Automatically detects the activation of the option based on the @@ -216,7 +233,9 @@ def update( language spoken in the audio track, or when auto language detection fails. Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). List of languages is available in `audio_language` - attribute of API POST /streaming/ai/transcribe . Example: + attribute of API POST /streaming/ai/transcribe . + + Example: ``` auto_transcribe_audio_language: "auto" @@ -232,15 +251,23 @@ def update( auto_translate_subtitles_language: Automatic translation of auto-transcribed subtitles to the specified language(s). Can be used both together with `auto_transcribe_audio_language` - option only. Use it when you want to make automatic subtitles in languages other - than the original language in audio. Values: + option only. + + Use it when you want to make automatic subtitles in languages other than the + original language in audio. + + Values: - disable – Do not translate. - default – There are 3 default languages: eng,fre,ger - \\ – Explicit language to translate to, or list of languages separated by a comma. Look at list of available languages in description of AI ASR task - creation. If several languages are specified for translation, a separate - subtitle will be generated for each language. Example: + creation. + + If several languages are specified for translation, a separate subtitle will be + generated for each language. + + Example: ``` auto_translate_subtitles_language: default @@ -260,8 +287,10 @@ def update( length if the video, then you can provide timecodes of starting point and duration of a segment to process. Start encoding from is a number in seconds. - custom_iframe_url: Deprecated. Custom URL of IFrame for video player to be used in share panel in - player. Auto generated IFrame URL provided by default + custom_iframe_url: Deprecated. + + Custom URL of IFrame for video player to be used in share panel in player. Auto + generated IFrame URL provided by default description: Video details; not visible to the end-users @@ -269,8 +298,11 @@ def update( origin_http_headers: Authorization HTTP request header. Will be used as credentials to authenticate a request to download a file (specified in "`origin_url`" parameter) on an - external server. Syntax: - `Authorization: ` Examples: + external server. + + Syntax: `Authorization: ` + + Examples: - "`origin_http_headers`": "Authorization: Basic ..." - "`origin_http_headers`": "Authorization: Bearer ..." @@ -292,14 +324,20 @@ def update( transcoding. poster: Poster is your own static image which can be displayed before the video starts. + After uploading the video, the system will automatically create several screenshots (they will be stored in "screenshots" attribute) from which you can select an default screenshot. This "poster" field is for uploading your own image. Also use attribute "`screenshot_id`" to select poster as a default - screnshot. Attribute accepts single image as base64-encoded string + screnshot. + + Attribute accepts single image as base64-encoded string [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In - format: `data:[];base64,` MIME-types are image/jpeg, - image/webp, and image/png and file sizes up to 1Mb. Examples: + format: `data:[];base64,` + + MIME-types are image/jpeg, image/webp, and image/png and file sizes up to 1Mb. + + Examples: - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` - `data:image/png;base64,iVBORw0KGg...ggg==` @@ -307,12 +345,14 @@ def update( priority: Priority allows you to adjust the urgency of processing some videos before others in your account, if your algorithm requires it. For example, when there - are very urgent video and some regular ones that can wait in the queue. Value - range, integer [-10..10]. -10 is the lowest down-priority, 10 is the highest - up-priority. Default priority is 0. + are very urgent video and some regular ones that can wait in the queue. + + Value range, integer [-10..10]. -10 is the lowest down-priority, 10 is the + highest up-priority. Default priority is 0. + + projection: Deprecated. - projection: - Deprecated. Regulates the video format: + Regulates the video format: - **regular** — plays the video as usual - **vr360** — plays the video in 360 degree mode @@ -325,21 +365,29 @@ def update( your conditions. Look at GET /`quality_sets` method remote_poster_url: Poster URL to download from external resource, instead of uploading via "poster" - attribute. It has the same restrictions as "poster" attribute. + attribute. + + It has the same restrictions as "poster" attribute. remove_poster: Set it to true to remove poster - screenshot_id: Default screenshot index. Specify an ID from the "screenshots" array, so that - the URL of the required screenshot appears in the "screenshot" attribute as the - default screenshot. By default 5 static screenshots will be taken from different - places in the video after transcoding. If the video is short, there may be fewer - screenshots. Counting from 0. A value of -1 sets the default screenshot to the - URL of your own image from the "poster" attribute. Look at "screenshot" - attribute in GET /videos/{`video_id`} for details. + screenshot_id: Default screenshot index. + + Specify an ID from the "screenshots" array, so that the URL of the required + screenshot appears in the "screenshot" attribute as the default screenshot. By + default 5 static screenshots will be taken from different places in the video + after transcoding. If the video is short, there may be fewer screenshots. + + Counting from 0. A value of -1 sets the default screenshot to the URL of your + own image from the "poster" attribute. + + Look at "screenshot" attribute in GET /videos/{`video_id`} for details. + + share_url: Deprecated. - share_url: Deprecated. Custom URL or iframe displayed in the link field when a user clicks - on a sharing button in player. If empty, the link field and social network - sharing is disabled + Custom URL or iframe displayed in the link field when a user clicks on a sharing + button in player. If empty, the link field and social network sharing is + disabled source_bitrate_limit: The option allows you to set the video transcoding rule so that the output bitrate in ABR ladder is not exceeding the bitrate of the original video. @@ -349,18 +397,21 @@ def update( By default `source_bitrate_limit: true` this option allows you to have the output bitrate not more than in the original video, thus to transcode video faster and to deliver it to end-viewers faster as well. At the same time, the - quality will be similar to the original. If for some reason you need more - byte-space in the output quality when encoding, you can set this option to - `source_bitrate_limit: false`. Then, when transcoding, the quality ceiling will - be raised from the bitrate of the original video to the maximum possible limit - specified in our the Product Documentation. For example, this may be needed - when: + quality will be similar to the original. + + If for some reason you need more byte-space in the output quality when encoding, + you can set this option to `source_bitrate_limit: false`. Then, when + transcoding, the quality ceiling will be raised from the bitrate of the original + video to the maximum possible limit specified in our the Product Documentation. + For example, this may be needed when: - to improve the visual quality parameters using PSNR, SSIM, VMAF metrics, - to improve the picture quality on dynamic scenes, - - etc. The option is applied only at the video creation stage and cannot be - changed later. If you want to re-transcode the video using new value, then you - need to create and upload a new video only. + - etc. + + The option is applied only at the video creation stage and cannot be changed + later. If you want to re-transcode the video using new value, then you need to + create and upload a new video only. extra_headers: Send extra headers @@ -443,8 +494,10 @@ def list( search: Aggregated search condition. If set, the video list is filtered by one combined SQL criterion: - - id={s} OR slug={s} OR name like {s} i.e. "/videos?search=1000" returns list of - videos where id=1000 or slug=1000 or name contains "1000". + - id={s} OR slug={s} OR name like {s} + + i.e. "/videos?search=1000" returns list of videos where id=1000 or slug=1000 or + name contains "1000". status: Use it to get videos filtered by their status. Possible values: @@ -507,8 +560,10 @@ def delete( When you delete a video, all transcoded qualities and all associated files such as subtitles and screenshots, as well as other data, are deleted from cloud - storage. The video is deleted permanently and irreversibly. Therefore, it is - impossible to restore files after this. + storage. + + The video is deleted permanently and irreversibly. Therefore, it is impossible + to restore files after this. For detailed information and information on calculating your maximum monthly storage usage, please refer to the Product Documentation. @@ -553,6 +608,7 @@ def create_multiple( All videos in the request will be processed in queue in order of priority. Use "priority" attribute and look at general description in POST /videos method. + Limits: - Batch max size = 500 videos. @@ -598,11 +654,13 @@ def get( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: - """Information about a video entity. + """ + Information about a video entity. - Contains all the data about the video: - meta-data, data for streaming and renditions, static media data, data about - original video. You can use different methods to play video: + Contains all the data about the video: meta-data, data for streaming and + renditions, static media data, data about original video. + + You can use different methods to play video: - `iframe_url` – a URL to a built-in HTML video player with automatically configured video playback. @@ -613,7 +671,8 @@ def get( - `dash_url` – a URL to MPEG-DASH .mpd manifest, which can be played in most modern video players. Preferable for Android and Windows devices. - `converted_videos`/`mp4_url` – a URL to MP4 file of specific rendition. - ![Video player](https://demo-files.gvideo.io/apidocs/coffee-run-player.jpg) + + ![Video player](https://demo-files.gvideo.io/apidocs/coffee-run-player.jpg) Args: extra_headers: Send extra headers @@ -645,19 +704,23 @@ def get_parameters_for_direct_upload( ) -> DirectUploadParameters: """ Use this method to get TUS' session parameters: hostname of the server to - upload, secure token. The general sequence of actions for a direct upload of a - video is as follows: + upload, secure token. + + The general sequence of actions for a direct upload of a video is as follows: - Create video entity via POST method ["Create video"](/docs/api-reference/streaming/videos/create-video) - Get TUS' session parameters (you are here now) - Upload file via TUS client, choose your implementation on - [tus.io](https://tus.io/implementations) Final endpoint for uploading is - constructed using the following template: "https://{hostname}/upload/". Also - you have to provide token, `client_id`, `video_id` as metadata too. A short - javascript example is shown below, based on tus-js-client. Variable "data" - below is the result of this API request. Please, note that we support 2.x - version only of tus-js-client. + [tus.io](https://tus.io/implementations) + + Final endpoint for uploading is constructed using the following template: + "https://{hostname}/upload/". Also you have to provide token, `client_id`, + `video_id` as metadata too. + + A short javascript example is shown below, based on tus-js-client. Variable + "data" below is the result of this API request. Please, note that we support 2.x + version only of tus-js-client. ``` uploads[data.video.id] = new tus.Upload(file, { @@ -769,8 +832,10 @@ async def create( """ Use this method to create a new video entity. - **Methods of creating** To upload the original video file to the server, there - are several possible scenarios: + **Methods of creating** + + To upload the original video file to the server, there are several possible + scenarios: - **Copy from another server** – If your video is accessable via "http://", "https://", or "sftp://" public link, then you can use this method to copy a @@ -779,20 +844,26 @@ async def create( execution file will be uploaded and will be sent to transcoding automatically, you don't have to do anything else. Use extra field `origin_http_headers` if authorization is required on the external server. + - **Direct upload from a local device** – If you need to upload video directly from your local device or from a mobile app, then use this method. Keep `origin_url` empty and use TUS protocol ([tus.io](https://tus.io)) to upload file. More details are here ["Get TUS' upload"](/docs/api-reference/streaming/videos/get-tus-parameters-for-direct-upload) - After getting the video, it is processed through the queue. There are 2 - priority criteria: global and local. Global is determined automatically by the - system as converters are ready to get next video, so your videos rarely queue - longer than usual (when you don't have a dedicated region). Local priority - works at the level of your account and you have full control over it, look at - "priority" attribute. - **AI processing** When uploading a video, it is possible to automatically create - subtitles based on AI. Read more: + After getting the video, it is processed through the queue. There are 2 priority + criteria: global and local. Global is determined automatically by the system as + converters are ready to get next video, so your videos rarely queue longer than + usual (when you don't have a dedicated region). Local priority works at the + level of your account and you have full control over it, look at "priority" + attribute. + + **AI processing** + + When uploading a video, it is possible to automatically create subtitles based + on AI. + + Read more: - What is ["AI Speech Recognition"](/docs/api-reference/streaming/ai/create-ai-asr-task). @@ -807,21 +878,26 @@ async def create( subtitle will be generated for each specified language. - How to ["add AI-generated subtitles to an exist video"](/docs/api-reference/streaming/subtitles/add-subtitle). - The created AI-task(s) will be automatically executed, and result will also be - automatically attached to this video as subtitle(s). Please note that - transcription is done automatically for all videos uploaded to our video - hosting. If necessary, you can disable automatic creation of subtitles. If AI - is disabled in your account, no AI functionality is called. - - **Advanced Features** For details on the requirements for incoming original - files, and output video parameters after transcoding, refer to the Knowledge - Base documentation. By default video will be transcoded according to the - original resolution, and a quality ladder suitable for your original video will - be applied. There is no automatic upscaling; the maximum quality is taken from - the original video. If you want to upload specific files not explicitly listed - in requirements or wish to modify the standard quality ladder (i.e. decrease - quality or add new non-standard qualities), then such customization is possible. - Please reach out to us for assistance. + + The created AI-task(s) will be automatically executed, and result will also be + automatically attached to this video as subtitle(s). + + Please note that transcription is done automatically for all videos uploaded to + our video hosting. If necessary, you can disable automatic creation of + subtitles. If AI is disabled in your account, no AI functionality is called. + + **Advanced Features** + + For details on the requirements for incoming original files, and output video + parameters after transcoding, refer to the Knowledge Base documentation. By + default video will be transcoded according to the original resolution, and a + quality ladder suitable for your original video will be applied. There is no + automatic upscaling; the maximum quality is taken from the original video. + + If you want to upload specific files not explicitly listed in requirements or + wish to modify the standard quality ladder (i.e. decrease quality or add new + non-standard qualities), then such customization is possible. Please reach out + to us for assistance. Additionally, check the Knowledge Base for any supplementary information you may need. @@ -875,26 +951,30 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: - """Changes parameters of the video to new values. + """ + Changes parameters of the video to new values. - It's allowed to update only those - public parameters that are described in POST method to create a new “video” - entity. So it's not possible to change calculated parameters like "id", - "duration", "`hls_url`", etc. Examples of changing: + It's allowed to update only those public parameters that are described in POST + method to create a new “video” entity. So it's not possible to change calculated + parameters like "id", "duration", "`hls_url`", etc. + + Examples of changing: - Name: `{ "name": "new name of the video" }` - - Move the video to a new directory: ` { "directory_id": 200 }` Please note that - some parameters are used on initial step (before transcoding) only, so after - transcoding there is no use in changing their values. For example, - "`origin_url`" parameter is used for downloading an original file from a - source and never used after transcoding; or "priority" parameter is used to - set priority of processing and never used after transcoding. + - Move the video to a new directory: ` { "directory_id": 200 }` + + Please note that some parameters are used on initial step (before transcoding) + only, so after transcoding there is no use in changing their values. For + example, "`origin_url`" parameter is used for downloading an original file from + a source and never used after transcoding; or "priority" parameter is used to + set priority of processing and never used after transcoding. Args: name: Video name - auto_transcribe_audio_language: - Automatic creation of subtitles by transcribing the audio track. Values: + auto_transcribe_audio_language: Automatic creation of subtitles by transcribing the audio track. + + Values: - disable – Do not transcribe. - auto – Automatically detects the activation of the option based on the @@ -904,7 +984,9 @@ async def update( language spoken in the audio track, or when auto language detection fails. Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). List of languages is available in `audio_language` - attribute of API POST /streaming/ai/transcribe . Example: + attribute of API POST /streaming/ai/transcribe . + + Example: ``` auto_transcribe_audio_language: "auto" @@ -920,15 +1002,23 @@ async def update( auto_translate_subtitles_language: Automatic translation of auto-transcribed subtitles to the specified language(s). Can be used both together with `auto_transcribe_audio_language` - option only. Use it when you want to make automatic subtitles in languages other - than the original language in audio. Values: + option only. + + Use it when you want to make automatic subtitles in languages other than the + original language in audio. + + Values: - disable – Do not translate. - default – There are 3 default languages: eng,fre,ger - \\ – Explicit language to translate to, or list of languages separated by a comma. Look at list of available languages in description of AI ASR task - creation. If several languages are specified for translation, a separate - subtitle will be generated for each language. Example: + creation. + + If several languages are specified for translation, a separate subtitle will be + generated for each language. + + Example: ``` auto_translate_subtitles_language: default @@ -948,8 +1038,10 @@ async def update( length if the video, then you can provide timecodes of starting point and duration of a segment to process. Start encoding from is a number in seconds. - custom_iframe_url: Deprecated. Custom URL of IFrame for video player to be used in share panel in - player. Auto generated IFrame URL provided by default + custom_iframe_url: Deprecated. + + Custom URL of IFrame for video player to be used in share panel in player. Auto + generated IFrame URL provided by default description: Video details; not visible to the end-users @@ -957,8 +1049,11 @@ async def update( origin_http_headers: Authorization HTTP request header. Will be used as credentials to authenticate a request to download a file (specified in "`origin_url`" parameter) on an - external server. Syntax: - `Authorization: ` Examples: + external server. + + Syntax: `Authorization: ` + + Examples: - "`origin_http_headers`": "Authorization: Basic ..." - "`origin_http_headers`": "Authorization: Bearer ..." @@ -980,14 +1075,20 @@ async def update( transcoding. poster: Poster is your own static image which can be displayed before the video starts. + After uploading the video, the system will automatically create several screenshots (they will be stored in "screenshots" attribute) from which you can select an default screenshot. This "poster" field is for uploading your own image. Also use attribute "`screenshot_id`" to select poster as a default - screnshot. Attribute accepts single image as base64-encoded string + screnshot. + + Attribute accepts single image as base64-encoded string [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In - format: `data:[];base64,` MIME-types are image/jpeg, - image/webp, and image/png and file sizes up to 1Mb. Examples: + format: `data:[];base64,` + + MIME-types are image/jpeg, image/webp, and image/png and file sizes up to 1Mb. + + Examples: - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` - `data:image/png;base64,iVBORw0KGg...ggg==` @@ -995,12 +1096,14 @@ async def update( priority: Priority allows you to adjust the urgency of processing some videos before others in your account, if your algorithm requires it. For example, when there - are very urgent video and some regular ones that can wait in the queue. Value - range, integer [-10..10]. -10 is the lowest down-priority, 10 is the highest - up-priority. Default priority is 0. + are very urgent video and some regular ones that can wait in the queue. + + Value range, integer [-10..10]. -10 is the lowest down-priority, 10 is the + highest up-priority. Default priority is 0. + + projection: Deprecated. - projection: - Deprecated. Regulates the video format: + Regulates the video format: - **regular** — plays the video as usual - **vr360** — plays the video in 360 degree mode @@ -1013,21 +1116,29 @@ async def update( your conditions. Look at GET /`quality_sets` method remote_poster_url: Poster URL to download from external resource, instead of uploading via "poster" - attribute. It has the same restrictions as "poster" attribute. + attribute. + + It has the same restrictions as "poster" attribute. remove_poster: Set it to true to remove poster - screenshot_id: Default screenshot index. Specify an ID from the "screenshots" array, so that - the URL of the required screenshot appears in the "screenshot" attribute as the - default screenshot. By default 5 static screenshots will be taken from different - places in the video after transcoding. If the video is short, there may be fewer - screenshots. Counting from 0. A value of -1 sets the default screenshot to the - URL of your own image from the "poster" attribute. Look at "screenshot" - attribute in GET /videos/{`video_id`} for details. + screenshot_id: Default screenshot index. + + Specify an ID from the "screenshots" array, so that the URL of the required + screenshot appears in the "screenshot" attribute as the default screenshot. By + default 5 static screenshots will be taken from different places in the video + after transcoding. If the video is short, there may be fewer screenshots. + + Counting from 0. A value of -1 sets the default screenshot to the URL of your + own image from the "poster" attribute. + + Look at "screenshot" attribute in GET /videos/{`video_id`} for details. + + share_url: Deprecated. - share_url: Deprecated. Custom URL or iframe displayed in the link field when a user clicks - on a sharing button in player. If empty, the link field and social network - sharing is disabled + Custom URL or iframe displayed in the link field when a user clicks on a sharing + button in player. If empty, the link field and social network sharing is + disabled source_bitrate_limit: The option allows you to set the video transcoding rule so that the output bitrate in ABR ladder is not exceeding the bitrate of the original video. @@ -1037,18 +1148,21 @@ async def update( By default `source_bitrate_limit: true` this option allows you to have the output bitrate not more than in the original video, thus to transcode video faster and to deliver it to end-viewers faster as well. At the same time, the - quality will be similar to the original. If for some reason you need more - byte-space in the output quality when encoding, you can set this option to - `source_bitrate_limit: false`. Then, when transcoding, the quality ceiling will - be raised from the bitrate of the original video to the maximum possible limit - specified in our the Product Documentation. For example, this may be needed - when: + quality will be similar to the original. + + If for some reason you need more byte-space in the output quality when encoding, + you can set this option to `source_bitrate_limit: false`. Then, when + transcoding, the quality ceiling will be raised from the bitrate of the original + video to the maximum possible limit specified in our the Product Documentation. + For example, this may be needed when: - to improve the visual quality parameters using PSNR, SSIM, VMAF metrics, - to improve the picture quality on dynamic scenes, - - etc. The option is applied only at the video creation stage and cannot be - changed later. If you want to re-transcode the video using new value, then you - need to create and upload a new video only. + - etc. + + The option is applied only at the video creation stage and cannot be changed + later. If you want to re-transcode the video using new value, then you need to + create and upload a new video only. extra_headers: Send extra headers @@ -1131,8 +1245,10 @@ def list( search: Aggregated search condition. If set, the video list is filtered by one combined SQL criterion: - - id={s} OR slug={s} OR name like {s} i.e. "/videos?search=1000" returns list of - videos where id=1000 or slug=1000 or name contains "1000". + - id={s} OR slug={s} OR name like {s} + + i.e. "/videos?search=1000" returns list of videos where id=1000 or slug=1000 or + name contains "1000". status: Use it to get videos filtered by their status. Possible values: @@ -1195,8 +1311,10 @@ async def delete( When you delete a video, all transcoded qualities and all associated files such as subtitles and screenshots, as well as other data, are deleted from cloud - storage. The video is deleted permanently and irreversibly. Therefore, it is - impossible to restore files after this. + storage. + + The video is deleted permanently and irreversibly. Therefore, it is impossible + to restore files after this. For detailed information and information on calculating your maximum monthly storage usage, please refer to the Product Documentation. @@ -1241,6 +1359,7 @@ async def create_multiple( All videos in the request will be processed in queue in order of priority. Use "priority" attribute and look at general description in POST /videos method. + Limits: - Batch max size = 500 videos. @@ -1290,11 +1409,13 @@ async def get( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Video: - """Information about a video entity. + """ + Information about a video entity. - Contains all the data about the video: - meta-data, data for streaming and renditions, static media data, data about - original video. You can use different methods to play video: + Contains all the data about the video: meta-data, data for streaming and + renditions, static media data, data about original video. + + You can use different methods to play video: - `iframe_url` – a URL to a built-in HTML video player with automatically configured video playback. @@ -1305,7 +1426,8 @@ async def get( - `dash_url` – a URL to MPEG-DASH .mpd manifest, which can be played in most modern video players. Preferable for Android and Windows devices. - `converted_videos`/`mp4_url` – a URL to MP4 file of specific rendition. - ![Video player](https://demo-files.gvideo.io/apidocs/coffee-run-player.jpg) + + ![Video player](https://demo-files.gvideo.io/apidocs/coffee-run-player.jpg) Args: extra_headers: Send extra headers @@ -1337,19 +1459,23 @@ async def get_parameters_for_direct_upload( ) -> DirectUploadParameters: """ Use this method to get TUS' session parameters: hostname of the server to - upload, secure token. The general sequence of actions for a direct upload of a - video is as follows: + upload, secure token. + + The general sequence of actions for a direct upload of a video is as follows: - Create video entity via POST method ["Create video"](/docs/api-reference/streaming/videos/create-video) - Get TUS' session parameters (you are here now) - Upload file via TUS client, choose your implementation on - [tus.io](https://tus.io/implementations) Final endpoint for uploading is - constructed using the following template: "https://{hostname}/upload/". Also - you have to provide token, `client_id`, `video_id` as metadata too. A short - javascript example is shown below, based on tus-js-client. Variable "data" - below is the result of this API request. Please, note that we support 2.x - version only of tus-js-client. + [tus.io](https://tus.io/implementations) + + Final endpoint for uploading is constructed using the following template: + "https://{hostname}/upload/". Also you have to provide token, `client_id`, + `video_id` as metadata too. + + A short javascript example is shown below, based on tus-js-client. Variable + "data" below is the result of this API request. Please, note that we support 2.x + version only of tus-js-client. ``` uploads[data.video.id] = new tus.Upload(file, { diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index 4e557da1..f46e4f46 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -77,17 +77,23 @@ def create( source: A CEL syntax expression that contains the rule's conditions. Allowed objects are: request, whois, session, response, tags, `user_defined_tags`, `user_agent`, - `client_data`. More info can be found here: + `client_data`. + + More info can be found here: https://gcore.com/docs/waap/waap-rules/advanced-rules description: The description assigned to the rule - phase: The WAAP request/response phase for applying the rule. Default is "access". The - "access" phase is responsible for modifying the request before it is sent to the - origin server. The "`header_filter`" phase is responsible for modifying the HTTP - headers of a response before they are sent back to the client. The - "`body_filter`" phase is responsible for modifying the body of a response before - it is sent back to the client. + phase: The WAAP request/response phase for applying the rule. Default is "access". + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + + The "`header_filter`" phase is responsible for modifying the HTTP headers of a + response before they are sent back to the client. + + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. extra_headers: Send extra headers @@ -150,16 +156,22 @@ def update( name: The name assigned to the rule - phase: The WAAP request/response phase for applying the rule. The "access" phase is - responsible for modifying the request before it is sent to the origin server. + phase: The WAAP request/response phase for applying the rule. + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + The "`header_filter`" phase is responsible for modifying the HTTP headers of a - response before they are sent back to the client. The "`body_filter`" phase is - responsible for modifying the body of a response before it is sent back to the - client. + response before they are sent back to the client. + + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. source: A CEL syntax expression that contains the rule's conditions. Allowed objects are: request, whois, session, response, tags, `user_defined_tags`, `user_agent`, - `client_data`. More info can be found here: + `client_data`. + + More info can be found here: https://gcore.com/docs/waap/waap-rules/advanced-rules extra_headers: Send extra headers @@ -246,12 +258,16 @@ def list( ordering: Determine the field to order results by - phase: Filter rules based on the WAAP request/response phase for applying the rule. The - "access" phase is responsible for modifying the request before it is sent to the - origin server. The "`header_filter`" phase is responsible for modifying the HTTP - headers of a response before they are sent back to the client. The - "`body_filter`" phase is responsible for modifying the body of a response before - it is sent back to the client. + phase: Filter rules based on the WAAP request/response phase for applying the rule. + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + + The "`header_filter`" phase is responsible for modifying the HTTP headers of a + response before they are sent back to the client. + + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. extra_headers: Send extra headers @@ -454,17 +470,23 @@ async def create( source: A CEL syntax expression that contains the rule's conditions. Allowed objects are: request, whois, session, response, tags, `user_defined_tags`, `user_agent`, - `client_data`. More info can be found here: + `client_data`. + + More info can be found here: https://gcore.com/docs/waap/waap-rules/advanced-rules description: The description assigned to the rule - phase: The WAAP request/response phase for applying the rule. Default is "access". The - "access" phase is responsible for modifying the request before it is sent to the - origin server. The "`header_filter`" phase is responsible for modifying the HTTP - headers of a response before they are sent back to the client. The - "`body_filter`" phase is responsible for modifying the body of a response before - it is sent back to the client. + phase: The WAAP request/response phase for applying the rule. Default is "access". + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + + The "`header_filter`" phase is responsible for modifying the HTTP headers of a + response before they are sent back to the client. + + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. extra_headers: Send extra headers @@ -527,16 +549,22 @@ async def update( name: The name assigned to the rule - phase: The WAAP request/response phase for applying the rule. The "access" phase is - responsible for modifying the request before it is sent to the origin server. + phase: The WAAP request/response phase for applying the rule. + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + The "`header_filter`" phase is responsible for modifying the HTTP headers of a - response before they are sent back to the client. The "`body_filter`" phase is - responsible for modifying the body of a response before it is sent back to the - client. + response before they are sent back to the client. + + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. source: A CEL syntax expression that contains the rule's conditions. Allowed objects are: request, whois, session, response, tags, `user_defined_tags`, `user_agent`, - `client_data`. More info can be found here: + `client_data`. + + More info can be found here: https://gcore.com/docs/waap/waap-rules/advanced-rules extra_headers: Send extra headers @@ -623,12 +651,16 @@ def list( ordering: Determine the field to order results by - phase: Filter rules based on the WAAP request/response phase for applying the rule. The - "access" phase is responsible for modifying the request before it is sent to the - origin server. The "`header_filter`" phase is responsible for modifying the HTTP - headers of a response before they are sent back to the client. The - "`body_filter`" phase is responsible for modifying the body of a response before - it is sent back to the client. + phase: Filter rules based on the WAAP request/response phase for applying the rule. + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + + The "`header_filter`" phase is responsible for modifying the HTTP headers of a + response before they are sent back to the client. + + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. extra_headers: Send extra headers diff --git a/src/gcore/types/cloud/file_share_update_params.py b/src/gcore/types/cloud/file_share_update_params.py index a51b8aa0..fc03f7c5 100644 --- a/src/gcore/types/cloud/file_share_update_params.py +++ b/src/gcore/types/cloud/file_share_update_params.py @@ -28,7 +28,9 @@ class FileShareUpdateParams(TypedDict, total=False): Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always - preserved and cannot be modified. **Examples:** + preserved and cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/types/cloud/floating_ip_update_params.py b/src/gcore/types/cloud/floating_ip_update_params.py index 79377f4b..59b962fe 100644 --- a/src/gcore/types/cloud/floating_ip_update_params.py +++ b/src/gcore/types/cloud/floating_ip_update_params.py @@ -22,7 +22,9 @@ class FloatingIPUpdateParams(TypedDict, total=False): Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always - preserved and cannot be modified. **Examples:** + preserved and cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/types/cloud/inference/inference_deployment.py b/src/gcore/types/cloud/inference/inference_deployment.py index 1cde4c63..bd0ab822 100644 --- a/src/gcore/types/cloud/inference/inference_deployment.py +++ b/src/gcore/types/cloud/inference/inference_deployment.py @@ -239,7 +239,9 @@ class InferenceDeployment(BaseModel): """Project ID. If not provided, your default project ID will be used.""" status: Literal["ACTIVE", "DELETING", "DEPLOYING", "DISABLED", "PARTIALLYDEPLOYED", "PENDING"] - """Inference instance status. Value can be one of the following: + """Inference instance status. + + Value can be one of the following: - `DEPLOYING` - The instance is being deployed. Containers are not yet created. - `PARTIALLYDEPLOYED` - All containers have been created, but some may not be diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index 6d84dc51..b2acd4a1 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -97,7 +97,9 @@ class InstanceCreateParams(TypedDict, total=False): """ servergroup_id: str - """Placement group ID for instance placement policy. Supported group types: + """Placement group ID for instance placement policy. + + Supported group types: - `anti-affinity`: Ensures instances are placed on different hosts for high availability. diff --git a/src/gcore/types/cloud/k8s/cluster_create_params.py b/src/gcore/types/cloud/k8s/cluster_create_params.py index d7c9497b..d0b1050e 100644 --- a/src/gcore/types/cloud/k8s/cluster_create_params.py +++ b/src/gcore/types/cloud/k8s/cluster_create_params.py @@ -43,10 +43,12 @@ class ClusterCreateParams(TypedDict, total=False): """Authentication settings""" autoscaler_config: Optional[Dict[str, str]] - """ - Cluster autoscaler configuration. It allows you to override the default - cluster-autoscaler parameters provided by the platform with your preferred - values. Supported parameters (in alphabetical order): + """Cluster autoscaler configuration. + + It allows you to override the default cluster-autoscaler parameters provided by + the platform with your preferred values. + + Supported parameters (in alphabetical order): - balance-similar-node-groups (boolean: true/false) - Detect similar node groups and balance the number of nodes between them. diff --git a/src/gcore/types/cloud/k8s/cluster_update_params.py b/src/gcore/types/cloud/k8s/cluster_update_params.py index 74a40789..32011180 100644 --- a/src/gcore/types/cloud/k8s/cluster_update_params.py +++ b/src/gcore/types/cloud/k8s/cluster_update_params.py @@ -28,10 +28,12 @@ class ClusterUpdateParams(TypedDict, total=False): """Authentication settings""" autoscaler_config: Optional[Dict[str, str]] - """ - Cluster autoscaler configuration. It allows you to override the default - cluster-autoscaler parameters provided by the platform with your preferred - values. Supported parameters (in alphabetical order): + """Cluster autoscaler configuration. + + It allows you to override the default cluster-autoscaler parameters provided by + the platform with your preferred values. + + Supported parameters (in alphabetical order): - balance-similar-node-groups (boolean: true/false) - Detect similar node groups and balance the number of nodes between them. diff --git a/src/gcore/types/cloud/k8s/k8s_cluster.py b/src/gcore/types/cloud/k8s/k8s_cluster.py index 621ef6e5..1df10feb 100644 --- a/src/gcore/types/cloud/k8s/k8s_cluster.py +++ b/src/gcore/types/cloud/k8s/k8s_cluster.py @@ -166,9 +166,10 @@ class K8sCluster(BaseModel): """Cluster authentication settings""" autoscaler_config: Optional[Dict[str, str]] = None - """ - Cluster autoscaler configuration. It contains overrides to the default - cluster-autoscaler parameters provided by the platform. + """Cluster autoscaler configuration. + + It contains overrides to the default cluster-autoscaler parameters provided by + the platform. """ cni: Optional[Cni] = None diff --git a/src/gcore/types/cloud/load_balancer_update_params.py b/src/gcore/types/cloud/load_balancer_update_params.py index f4b01786..0870d49c 100644 --- a/src/gcore/types/cloud/load_balancer_update_params.py +++ b/src/gcore/types/cloud/load_balancer_update_params.py @@ -34,7 +34,9 @@ class LoadBalancerUpdateParams(TypedDict, total=False): Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always - preserved and cannot be modified. **Examples:** + preserved and cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/types/cloud/network_update_params.py b/src/gcore/types/cloud/network_update_params.py index 8aa509d3..76a08699 100644 --- a/src/gcore/types/cloud/network_update_params.py +++ b/src/gcore/types/cloud/network_update_params.py @@ -25,7 +25,9 @@ class NetworkUpdateParams(TypedDict, total=False): Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always - preserved and cannot be modified. **Examples:** + preserved and cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/types/cloud/networks/subnet_update_params.py b/src/gcore/types/cloud/networks/subnet_update_params.py index 455119cc..122b546d 100644 --- a/src/gcore/types/cloud/networks/subnet_update_params.py +++ b/src/gcore/types/cloud/networks/subnet_update_params.py @@ -43,7 +43,9 @@ class SubnetUpdateParams(TypedDict, total=False): Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always - preserved and cannot be modified. **Examples:** + preserved and cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/types/cloud/registries/user_create_multiple_params.py b/src/gcore/types/cloud/registries/user_create_multiple_params.py index 48dbfc44..e580e8dc 100644 --- a/src/gcore/types/cloud/registries/user_create_multiple_params.py +++ b/src/gcore/types/cloud/registries/user_create_multiple_params.py @@ -22,9 +22,11 @@ class User(TypedDict, total=False): """User account operating time, days""" name: Required[str] - """ - A name for the registry user. Should be in lowercase, consisting only of numbers - and letters, with maximum length of 16 characters + """A name for the registry user. + + Should be in lowercase, consisting only of numbers and letters, + + with maximum length of 16 characters """ read_only: bool diff --git a/src/gcore/types/cloud/registries/user_create_params.py b/src/gcore/types/cloud/registries/user_create_params.py index 19283e53..a658b14c 100644 --- a/src/gcore/types/cloud/registries/user_create_params.py +++ b/src/gcore/types/cloud/registries/user_create_params.py @@ -16,9 +16,11 @@ class UserCreateParams(TypedDict, total=False): """User account operating time, days""" name: Required[str] - """ - A name for the registry user. Should be in lowercase, consisting only of numbers - and letters, with maximum length of 16 characters + """A name for the registry user. + + Should be in lowercase, consisting only of numbers and letters, + + with maximum length of 16 characters """ read_only: bool diff --git a/src/gcore/types/cloud/registry_create_params.py b/src/gcore/types/cloud/registry_create_params.py index 13f03cab..2d5ecfbb 100644 --- a/src/gcore/types/cloud/registry_create_params.py +++ b/src/gcore/types/cloud/registry_create_params.py @@ -13,9 +13,11 @@ class RegistryCreateParams(TypedDict, total=False): region_id: int name: Required[str] - """ - A name for the container registry. Should be in lowercase, consisting only of - numbers, letters and -, with maximum length of 24 characters + """A name for the container registry. + + Should be in lowercase, consisting only of numbers, letters and -, + + with maximum length of 24 characters """ storage_limit: int diff --git a/src/gcore/types/cloud/security_group_update_params.py b/src/gcore/types/cloud/security_group_update_params.py index a63fad11..dbc8fa10 100644 --- a/src/gcore/types/cloud/security_group_update_params.py +++ b/src/gcore/types/cloud/security_group_update_params.py @@ -26,7 +26,9 @@ class SecurityGroupUpdateParams(TypedDict, total=False): Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always - preserved and cannot be modified. **Examples:** + preserved and cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/types/cloud/ssh_key_created.py b/src/gcore/types/cloud/ssh_key_created.py index 7e304ed8..c889ff5a 100644 --- a/src/gcore/types/cloud/ssh_key_created.py +++ b/src/gcore/types/cloud/ssh_key_created.py @@ -26,9 +26,12 @@ class SSHKeyCreated(BaseModel): """The private part of an SSH key is the confidential portion of the key pair. It should never be shared or exposed. This key is used to prove your identity - when connecting to a server. If you omit the `public_key`, the platform will - generate a key for you. The `private_key` will be returned **once** in the API - response. Be sure to save it securely, as it cannot be retrieved again later. + when connecting to a server. + + If you omit the `public_key`, the platform will generate a key for you. The + `private_key` will be returned **once** in the API response. Be sure to save it + securely, as it cannot be retrieved again later. + Best practice: Save the private key to a secure location on your machine (e.g., `~/.ssh/id_ed25519`) and set the file permissions to be readable only by you. """ diff --git a/src/gcore/types/cloud/volume_update_params.py b/src/gcore/types/cloud/volume_update_params.py index 455e6210..cf8b7815 100644 --- a/src/gcore/types/cloud/volume_update_params.py +++ b/src/gcore/types/cloud/volume_update_params.py @@ -25,7 +25,9 @@ class VolumeUpdateParams(TypedDict, total=False): Provide key-value pairs to add or update tags. Set tag values to `null` to remove tags. Unspecified tags remain unchanged. Read-only tags are always - preserved and cannot be modified. **Examples:** + preserved and cannot be modified. + + **Examples:** - **Add/update tags:** `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or diff --git a/src/gcore/types/dns/zone_get_statistics_params.py b/src/gcore/types/dns/zone_get_statistics_params.py index ee528101..2db7a140 100644 --- a/src/gcore/types/dns/zone_get_statistics_params.py +++ b/src/gcore/types/dns/zone_get_statistics_params.py @@ -11,20 +11,23 @@ class ZoneGetStatisticsParams(TypedDict, total=False): from_: Annotated[int, PropertyInfo(alias="from")] - """ - Beginning of the requested time period (Unix Timestamp, UTC.) In a query string: - &from=1709068637 + """Beginning of the requested time period (Unix Timestamp, UTC.) + + In a query string: &from=1709068637 """ granularity: str """ Granularity parameter string is a sequence of decimal numbers, each with - optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". Valid - time units are "s", "m", "h". + optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". + + Valid time units are "s", "m", "h". """ record_type: str - """DNS record type. Possible values: + """DNS record type. + + Possible values: - A - AAAA @@ -37,7 +40,7 @@ class ZoneGetStatisticsParams(TypedDict, total=False): """ to: int - """ - End of the requested time period (Unix Timestamp, UTC.) In a query string: - &to=1709673437 + """End of the requested time period (Unix Timestamp, UTC.) + + In a query string: &to=1709673437 """ diff --git a/src/gcore/types/dns/zone_get_statistics_response.py b/src/gcore/types/dns/zone_get_statistics_response.py index 6798692d..76dadd2e 100644 --- a/src/gcore/types/dns/zone_get_statistics_response.py +++ b/src/gcore/types/dns/zone_get_statistics_response.py @@ -11,7 +11,9 @@ class ZoneGetStatisticsResponse(BaseModel): requests: Optional[object] = None """ Requests amount (values) for particular zone fractionated by time intervals - (keys). Example of response: + (keys). + + Example of response: `{ "requests": { "1598608080000": 14716, "1598608140000": 51167, "1598608200000": 53432, "1598611020000": 51050, "1598611080000": 52611, "1598611140000": 46884 } }` """ diff --git a/src/gcore/types/dns/zone_import_params.py b/src/gcore/types/dns/zone_import_params.py index ca009f38..5f189393 100644 --- a/src/gcore/types/dns/zone_import_params.py +++ b/src/gcore/types/dns/zone_import_params.py @@ -14,19 +14,25 @@ class ZoneImportParams(TypedDict, total=False): It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. Even if Read returns n < len(p), it may use all of p as scratch space during the call. If some data is available but not len(p) bytes, Read - conventionally returns what is available instead of waiting for more. When Read - encounters an error or end-of-file condition after successfully reading n > 0 - bytes, it returns the number of bytes read. It may return the (non-nil) error - from the same call or return the error (and n == 0) from a subsequent call. An - instance of this general case is that a Reader returning a non-zero number of - bytes at the end of the input stream may return either err == EOF or err == nil. - The next Read should return 0, EOF. Callers should always process the n > 0 - bytes returned before considering the error err. Doing so correctly handles I/O - errors that happen after reading some bytes and also both of the allowed EOF - behaviors. If len(p) == 0, Read should always return n == 0. It may return a - non-nil error if some error condition is known, such as EOF. Implementations of - Read are discouraged from returning a zero byte count with a nil error, except - when len(p) == 0. Callers should treat a return of 0 and nil as indicating that - nothing happened; in particular it does not indicate EOF. Implementations must - not retain p. + conventionally returns what is available instead of waiting for more. + + When Read encounters an error or end-of-file condition after successfully + reading n > 0 bytes, it returns the number of bytes read. It may return the + (non-nil) error from the same call or return the error (and n == 0) from a + subsequent call. An instance of this general case is that a Reader returning a + non-zero number of bytes at the end of the input stream may return either err == + EOF or err == nil. The next Read should return 0, EOF. + + Callers should always process the n > 0 bytes returned before considering the + error err. Doing so correctly handles I/O errors that happen after reading some + bytes and also both of the allowed EOF behaviors. + + If len(p) == 0, Read should always return n == 0. It may return a non-nil error + if some error condition is known, such as EOF. + + Implementations of Read are discouraged from returning a zero byte count with a + nil error, except when len(p) == 0. Callers should treat a return of 0 and nil + as indicating that nothing happened; in particular it does not indicate EOF. + + Implementations must not retain p. """ diff --git a/src/gcore/types/dns/zones/dns_output_rrset.py b/src/gcore/types/dns/zones/dns_output_rrset.py index 8ff63143..13a99e28 100644 --- a/src/gcore/types/dns/zones/dns_output_rrset.py +++ b/src/gcore/types/dns/zones/dns_output_rrset.py @@ -42,9 +42,13 @@ class ResourceRecord(BaseModel): 6. `backup` (bool) 7. `notes` (string) 8. `weight` (float) - 9. `ip` (string) Some keys are reserved for balancing, @see - https://api.gcore.com/dns/v2/info/meta This meta will be used to decide which - resource record should pass through filters from the filter set + 9. `ip` (string) + + Some keys are reserved for balancing, @see + https://api.gcore.com/dns/v2/info/meta + + This meta will be used to decide which resource record should pass through + filters from the filter set """ diff --git a/src/gcore/types/iam/account_overview.py b/src/gcore/types/iam/account_overview.py index 0f30b80b..68de5bbd 100644 --- a/src/gcore/types/iam/account_overview.py +++ b/src/gcore/types/iam/account_overview.py @@ -372,7 +372,9 @@ class User(BaseModel): """User's email address.""" groups: Optional[List[UserGroup]] = None - """User's group in the current account. IAM supports 5 groups: + """User's group in the current account. + + IAM supports 5 groups: - Users - Administrators @@ -382,7 +384,10 @@ class User(BaseModel): """ lang: Optional[Literal["de", "en", "ru", "zh", "az"]] = None - """User's language. Defines language of the control panel and email messages.""" + """User's language. + + Defines language of the control panel and email messages. + """ name: Optional[str] = None """User's name.""" diff --git a/src/gcore/types/iam/user.py b/src/gcore/types/iam/user.py index 15424ee4..ba27f51d 100644 --- a/src/gcore/types/iam/user.py +++ b/src/gcore/types/iam/user.py @@ -51,7 +51,9 @@ class User(BaseModel): """User's email address.""" groups: Optional[List[Group]] = None - """User's group in the current account. IAM supports 5 groups: + """User's group in the current account. + + IAM supports 5 groups: - Users - Administrators @@ -61,7 +63,10 @@ class User(BaseModel): """ lang: Optional[Literal["de", "en", "ru", "zh", "az"]] = None - """User's language. Defines language of the control panel and email messages.""" + """User's language. + + Defines language of the control panel and email messages. + """ name: Optional[str] = None """User's name.""" diff --git a/src/gcore/types/iam/user_detailed.py b/src/gcore/types/iam/user_detailed.py index b82809a2..15a94926 100644 --- a/src/gcore/types/iam/user_detailed.py +++ b/src/gcore/types/iam/user_detailed.py @@ -66,7 +66,9 @@ class UserDetailed(BaseModel): """User's email address.""" groups: Optional[List[Group]] = None - """User's group in the current account. IAM supports 5 groups: + """User's group in the current account. + + IAM supports 5 groups: - Users - Administrators @@ -79,7 +81,10 @@ class UserDetailed(BaseModel): """User activity flag.""" lang: Optional[Literal["de", "en", "ru", "zh", "az"]] = None - """User's language. Defines language of the control panel and email messages.""" + """User's language. + + Defines language of the control panel and email messages. + """ name: Optional[str] = None """User's name.""" diff --git a/src/gcore/types/iam/user_invite_params.py b/src/gcore/types/iam/user_invite_params.py index 8f17f566..47c0baac 100644 --- a/src/gcore/types/iam/user_invite_params.py +++ b/src/gcore/types/iam/user_invite_params.py @@ -17,7 +17,10 @@ class UserInviteParams(TypedDict, total=False): user_role: Required[UserRole] lang: Literal["de", "en", "ru", "zh", "az"] - """User's language. Defines language of the control panel and email messages.""" + """User's language. + + Defines language of the control panel and email messages. + """ name: str """User name.""" diff --git a/src/gcore/types/iam/user_update.py b/src/gcore/types/iam/user_update.py index 78b75ac0..83b13534 100644 --- a/src/gcore/types/iam/user_update.py +++ b/src/gcore/types/iam/user_update.py @@ -66,7 +66,9 @@ class UserUpdate(BaseModel): """User's email address.""" groups: Optional[List[Group]] = None - """User's group in the current account. IAM supports 5 groups: + """User's group in the current account. + + IAM supports 5 groups: - Users - Administrators @@ -79,7 +81,10 @@ class UserUpdate(BaseModel): """User activity flag.""" lang: Optional[Literal["de", "en", "ru", "zh", "az"]] = None - """User's language. Defines language of the control panel and email messages.""" + """User's language. + + Defines language of the control panel and email messages. + """ name: Optional[str] = None """User's name.""" diff --git a/src/gcore/types/iam/user_update_params.py b/src/gcore/types/iam/user_update_params.py index 6353a943..80d93a28 100644 --- a/src/gcore/types/iam/user_update_params.py +++ b/src/gcore/types/iam/user_update_params.py @@ -19,7 +19,9 @@ class UserUpdateParams(TypedDict, total=False): """User's email address.""" groups: Iterable[Group] - """User's group in the current account. IAM supports 5 groups: + """User's group in the current account. + + IAM supports 5 groups: - Users - Administrators @@ -29,7 +31,10 @@ class UserUpdateParams(TypedDict, total=False): """ lang: Literal["de", "en", "ru", "zh", "az"] - """User's language. Defines language of the control panel and email messages.""" + """User's language. + + Defines language of the control panel and email messages. + """ name: Optional[str] """User's name.""" diff --git a/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py b/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py index 61517f1a..11b0629a 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py +++ b/src/gcore/types/streaming/ai_contentmoderation_hardnudity.py @@ -25,10 +25,12 @@ class AIContentmoderationHardnudity(BaseModel): """ Meta parameter, designed to store your own extra information about a video entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. + processing. + + For example, if an AI-task was created automatically when you uploaded a video + with the AI auto-processing option (nudity detection, etc), then the ID of the + associated video for which the task was performed will be explicitly indicated + here. """ client_user_id: Optional[str] = None diff --git a/src/gcore/types/streaming/ai_contentmoderation_nsfw.py b/src/gcore/types/streaming/ai_contentmoderation_nsfw.py index e7c3436b..fac523f2 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_nsfw.py +++ b/src/gcore/types/streaming/ai_contentmoderation_nsfw.py @@ -25,10 +25,12 @@ class AIContentmoderationNsfw(BaseModel): """ Meta parameter, designed to store your own extra information about a video entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. + processing. + + For example, if an AI-task was created automatically when you uploaded a video + with the AI auto-processing option (nudity detection, etc), then the ID of the + associated video for which the task was performed will be explicitly indicated + here. """ client_user_id: Optional[str] = None diff --git a/src/gcore/types/streaming/ai_contentmoderation_softnudity.py b/src/gcore/types/streaming/ai_contentmoderation_softnudity.py index 5c0b7f3c..ebfb6a59 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_softnudity.py +++ b/src/gcore/types/streaming/ai_contentmoderation_softnudity.py @@ -25,10 +25,12 @@ class AIContentmoderationSoftnudity(BaseModel): """ Meta parameter, designed to store your own extra information about a video entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. + processing. + + For example, if an AI-task was created automatically when you uploaded a video + with the AI auto-processing option (nudity detection, etc), then the ID of the + associated video for which the task was performed will be explicitly indicated + here. """ client_user_id: Optional[str] = None diff --git a/src/gcore/types/streaming/ai_contentmoderation_sport.py b/src/gcore/types/streaming/ai_contentmoderation_sport.py index 78c5b629..079043dd 100644 --- a/src/gcore/types/streaming/ai_contentmoderation_sport.py +++ b/src/gcore/types/streaming/ai_contentmoderation_sport.py @@ -25,10 +25,12 @@ class AIContentmoderationSport(BaseModel): """ Meta parameter, designed to store your own extra information about a video entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. + processing. + + For example, if an AI-task was created automatically when you uploaded a video + with the AI auto-processing option (nudity detection, etc), then the ID of the + associated video for which the task was performed will be explicitly indicated + here. """ client_user_id: Optional[str] = None diff --git a/src/gcore/types/streaming/ai_task.py b/src/gcore/types/streaming/ai_task.py index fd114dea..f5f3c6e7 100644 --- a/src/gcore/types/streaming/ai_task.py +++ b/src/gcore/types/streaming/ai_task.py @@ -25,14 +25,20 @@ class TaskDataAITranscribe(BaseModel): audio_language: Optional[str] = None """Language in original audio (transcription only). - This value is used to determine the language from which to transcribe. If this - is not set, the system will run auto language identification and the subtitles - will be in the detected language. The method also works based on AI analysis. - It's fairly accurate, but if it's wrong, then set the language explicitly. + This value is used to determine the language from which to transcribe. + + If this is not set, the system will run auto language identification and the + subtitles will be in the detected language. The method also works based on AI + analysis. It's fairly accurate, but if it's wrong, then set the language + explicitly. + Additionally, when this is not set, we also support recognition of alternate - languages in the video (language code-switching). Language is set by 3-letter - language code according to ISO-639-2 (bibliographic code). We can process - languages: + languages in the video (language code-switching). + + Language is set by 3-letter language code according to ISO-639-2 (bibliographic + code). + + We can process languages: - 'afr': Afrikaans - 'alb': Albanian @@ -139,10 +145,12 @@ class TaskDataAITranscribe(BaseModel): """ Meta parameter, designed to store your own extra information about a video entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (transcribing, - translationing), then the ID of the associated video for which the task was - performed will be explicitly indicated here. + processing. + + For example, if an AI-task was created automatically when you uploaded a video + with the AI auto-processing option (transcribing, translationing), then the ID + of the associated video for which the task was performed will be explicitly + indicated here. """ client_user_id: Optional[str] = None @@ -156,6 +164,7 @@ class TaskDataAITranscribe(BaseModel): """ Indicates which language it is clearly necessary to translate into. If this is not set, the original language will be used from attribute "`audio_language`". + Please note that: - transcription into the original language is a free procedure, diff --git a/src/gcore/types/streaming/ai_task_create_params.py b/src/gcore/types/streaming/ai_task_create_params.py index 11bddf89..cbf354f3 100644 --- a/src/gcore/types/streaming/ai_task_create_params.py +++ b/src/gcore/types/streaming/ai_task_create_params.py @@ -20,14 +20,20 @@ class AITaskCreateParams(TypedDict, total=False): audio_language: str """Language in original audio (transcription only). - This value is used to determine the language from which to transcribe. If this - is not set, the system will run auto language identification and the subtitles - will be in the detected language. The method also works based on AI analysis. - It's fairly accurate, but if it's wrong, then set the language explicitly. + This value is used to determine the language from which to transcribe. + + If this is not set, the system will run auto language identification and the + subtitles will be in the detected language. The method also works based on AI + analysis. It's fairly accurate, but if it's wrong, then set the language + explicitly. + Additionally, when this is not set, we also support recognition of alternate - languages in the video (language code-switching). Language is set by 3-letter - language code according to ISO-639-2 (bibliographic code). We can process - languages: + languages in the video (language code-switching). + + Language is set by 3-letter language code according to ISO-639-2 (bibliographic + code). + + We can process languages: - 'afr': Afrikaans - 'alb': Albanian @@ -140,10 +146,12 @@ class AITaskCreateParams(TypedDict, total=False): """ Meta parameter, designed to store your own extra information about a video entity: video source, video id, etc. It is not used in any way in video - processing. For example, if an AI-task was created automatically when you - uploaded a video with the AI auto-processing option (nudity detection, etc), - then the ID of the associated video for which the task was performed will be - explicitly indicated here. + processing. + + For example, if an AI-task was created automatically when you uploaded a video + with the AI auto-processing option (nudity detection, etc), then the ID of the + associated video for which the task was performed will be explicitly indicated + here. """ client_user_id: str @@ -157,6 +165,7 @@ class AITaskCreateParams(TypedDict, total=False): """ Indicates which language it is clearly necessary to translate into. If this is not set, the original language will be used from attribute "`audio_language`". + Please note that: - transcription into the original language is a free procedure, diff --git a/src/gcore/types/streaming/ai_task_get_response.py b/src/gcore/types/streaming/ai_task_get_response.py index 8bd63299..293f55c4 100644 --- a/src/gcore/types/streaming/ai_task_get_response.py +++ b/src/gcore/types/streaming/ai_task_get_response.py @@ -65,10 +65,11 @@ class AITaskGetResponseResultAIResultsTranscribe(BaseModel): """ speech_detected: Optional[bool] = None - """ - Determines whether speech was detected or not. Please note: If the task is in - "SUCCESS" status and speech was not found in the entire file, then "false" will - be indicated here and the `subtitles` field will be empty. + """Determines whether speech was detected or not. + + Please note: If the task is in "SUCCESS" status and speech was not found in the + entire file, then "false" will be indicated here and the `subtitles` field will + be empty. """ subtitles: Optional[List[AITaskGetResponseResultAIResultsTranscribeSubtitle]] = None diff --git a/src/gcore/types/streaming/ai_task_list_params.py b/src/gcore/types/streaming/ai_task_list_params.py index b6499c1c..8fe3d727 100644 --- a/src/gcore/types/streaming/ai_task_list_params.py +++ b/src/gcore/types/streaming/ai_task_list_params.py @@ -17,8 +17,10 @@ class AITaskListParams(TypedDict, total=False): ordering: Literal["task_id", "status", "task_name", "started_at"] """ Which field to use when ordering the results: `task_id`, status, and - `task_name`. Sorting is done in ascending (ASC) order. If parameter is omitted - then "`started_at` DESC" is used for ordering by default. + `task_name`. Sorting is done in ascending (ASC) order. + + If parameter is omitted then "`started_at` DESC" is used for ordering by + default. """ page: int @@ -27,9 +29,13 @@ class AITaskListParams(TypedDict, total=False): search: str """ This is an field for combined text search in the following fields: `task_id`, - `task_name`, status, and `task_data`. Both full and partial searches are - possible inside specified above fields. For example, you can filter tasks of a - certain category, or tasks by a specific original file. Example: + `task_name`, status, and `task_data`. + + Both full and partial searches are possible inside specified above fields. For + example, you can filter tasks of a certain category, or tasks by a specific + original file. + + Example: - To filter tasks of Content Moderation NSFW method: `GET /streaming/ai/tasks?search=nsfw` diff --git a/src/gcore/types/streaming/clip.py b/src/gcore/types/streaming/clip.py index f5c0135a..b29471a8 100644 --- a/src/gcore/types/streaming/clip.py +++ b/src/gcore/types/streaming/clip.py @@ -12,34 +12,43 @@ class Clip(BaseModel): """ID of the clip""" duration: int - """ - Requested segment duration in seconds to be cut. Please, note that cutting is - based on the idea of instantly creating a clip, instead of precise timing. So - final segment may be: + """Requested segment duration in seconds to be cut. + + Please, note that cutting is based on the idea of instantly creating a clip, + instead of precise timing. So final segment may be: - Less than the specified value if there is less data in the DVR than the requested segment. - Greater than the specified value, because segment is aligned to the first and last key frames of already stored fragment in DVR, this way -1 and +1 chunks - can be added to left and right. Duration of cutted segment cannot be greater - than DVR duration for this stream. Therefore, to change the maximum, use - "`dvr_duration`" parameter of this stream. + can be added to left and right. + + Duration of cutted segment cannot be greater than DVR duration for this stream. + Therefore, to change the maximum, use "`dvr_duration`" parameter of this stream. """ created_at: Optional[str] = None """Creation date and time. Format is date time in ISO 8601""" expiration: Optional[int] = None - """ - Expire time of the clip via a public link. Unix timestamp in seconds, absolute - value. This is the time how long the instant clip will be stored in the server - memory and can be accessed via public HLS/MP4 links. Download and/or use the - instant clip before this time expires. After the time has expired, the clip is - deleted from memory and is no longer available via the link. You need to create - a new segment, or use `vod_required: true` attribute. If value is omitted, then - expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e. - `unix timestamp = + + 3600`). Allowed range: 1m <= expiration - <= 4h. Example: + """Expire time of the clip via a public link. + + Unix timestamp in seconds, absolute value. + + This is the time how long the instant clip will be stored in the server memory + and can be accessed via public HLS/MP4 links. Download and/or use the instant + clip before this time expires. + + After the time has expired, the clip is deleted from memory and is no longer + available via the link. You need to create a new segment, or use + `vod_required: true` attribute. + + If value is omitted, then expiration is counted as +3600 seconds (1 hour) to the + end of the clip (i.e. `unix timestamp = + + 3600`). + + Allowed range: 1m <= expiration <= 4h. + + Example: `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` """ @@ -65,11 +74,13 @@ class Clip(BaseModel): """List of available rendition heights""" start: Optional[int] = None - """ - Starting point of the segment to cut. Unix timestamp in seconds, absolute value. - Example: `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` If a value - from the past is specified, it is used as the starting point for the segment to - cut. If the value is omitted, then clip will start from now. + """Starting point of the segment to cut. + + Unix timestamp in seconds, absolute value. Example: + `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` + + If a value from the past is specified, it is used as the starting point for the + segment to cut. If the value is omitted, then clip will start from now. """ video_id: Optional[int] = None diff --git a/src/gcore/types/streaming/create_video_param.py b/src/gcore/types/streaming/create_video_param.py index aed1f153..111f0095 100644 --- a/src/gcore/types/streaming/create_video_param.py +++ b/src/gcore/types/streaming/create_video_param.py @@ -12,7 +12,9 @@ class CreateVideoParam(TypedDict, total=False): """Video name""" auto_transcribe_audio_language: Literal["disable", "auto", ""] - """Automatic creation of subtitles by transcribing the audio track. Values: + """Automatic creation of subtitles by transcribing the audio track. + + Values: - disable – Do not transcribe. - auto – Automatically detects the activation of the option based on the @@ -22,7 +24,9 @@ class CreateVideoParam(TypedDict, total=False): language spoken in the audio track, or when auto language detection fails. Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). List of languages is available in `audio_language` - attribute of API POST /streaming/ai/transcribe . Example: + attribute of API POST /streaming/ai/transcribe . + + Example: ``` auto_transcribe_audio_language: "auto" @@ -41,16 +45,23 @@ class CreateVideoParam(TypedDict, total=False): """Automatic translation of auto-transcribed subtitles to the specified language(s). - Can be used both together with `auto_transcribe_audio_language` option only. Use - it when you want to make automatic subtitles in languages other than the - original language in audio. Values: + Can be used both together with `auto_transcribe_audio_language` option only. + + Use it when you want to make automatic subtitles in languages other than the + original language in audio. + + Values: - disable – Do not translate. - default – There are 3 default languages: eng,fre,ger - \\ – Explicit language to translate to, or list of languages separated by a comma. Look at list of available languages in description of AI ASR task - creation. If several languages are specified for translation, a separate - subtitle will be generated for each language. Example: + creation. + + If several languages are specified for translation, a separate subtitle will be + generated for each language. + + Example: ``` auto_translate_subtitles_language: default @@ -79,9 +90,10 @@ class CreateVideoParam(TypedDict, total=False): """ custom_iframe_url: str - """ - Deprecated. Custom URL of IFrame for video player to be used in share panel in - player. Auto generated IFrame URL provided by default + """Deprecated. + + Custom URL of IFrame for video player to be used in share panel in player. Auto + generated IFrame URL provided by default """ description: str @@ -94,8 +106,11 @@ class CreateVideoParam(TypedDict, total=False): """Authorization HTTP request header. Will be used as credentials to authenticate a request to download a file - (specified in "`origin_url`" parameter) on an external server. Syntax: - `Authorization: ` Examples: + (specified in "`origin_url`" parameter) on an external server. + + Syntax: `Authorization: ` + + Examples: - "`origin_http_headers`": "Authorization: Basic ..." - "`origin_http_headers`": "Authorization: Bearer ..." @@ -121,16 +136,21 @@ class CreateVideoParam(TypedDict, total=False): """ poster: str - """ - Poster is your own static image which can be displayed before the video starts. + """Poster is your own static image which can be displayed before the video starts. + After uploading the video, the system will automatically create several screenshots (they will be stored in "screenshots" attribute) from which you can select an default screenshot. This "poster" field is for uploading your own image. Also use attribute "`screenshot_id`" to select poster as a default - screnshot. Attribute accepts single image as base64-encoded string + screnshot. + + Attribute accepts single image as base64-encoded string [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In - format: `data:[];base64,` MIME-types are image/jpeg, - image/webp, and image/png and file sizes up to 1Mb. Examples: + format: `data:[];base64,` + + MIME-types are image/jpeg, image/webp, and image/png and file sizes up to 1Mb. + + Examples: - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` - `data:image/png;base64,iVBORw0KGg...ggg==` @@ -141,13 +161,16 @@ class CreateVideoParam(TypedDict, total=False): """ Priority allows you to adjust the urgency of processing some videos before others in your account, if your algorithm requires it. For example, when there - are very urgent video and some regular ones that can wait in the queue. Value - range, integer [-10..10]. -10 is the lowest down-priority, 10 is the highest - up-priority. Default priority is 0. + are very urgent video and some regular ones that can wait in the queue. + + Value range, integer [-10..10]. -10 is the lowest down-priority, 10 is the + highest up-priority. Default priority is 0. """ projection: str - """Deprecated. Regulates the video format: + """Deprecated. + + Regulates the video format: - **regular** — plays the video as usual - **vr360** — plays the video in 360 degree mode @@ -166,28 +189,34 @@ class CreateVideoParam(TypedDict, total=False): remote_poster_url: str """ Poster URL to download from external resource, instead of uploading via "poster" - attribute. It has the same restrictions as "poster" attribute. + attribute. + + It has the same restrictions as "poster" attribute. """ remove_poster: bool """Set it to true to remove poster""" screenshot_id: int - """ - Default screenshot index. Specify an ID from the "screenshots" array, so that - the URL of the required screenshot appears in the "screenshot" attribute as the - default screenshot. By default 5 static screenshots will be taken from different - places in the video after transcoding. If the video is short, there may be fewer - screenshots. Counting from 0. A value of -1 sets the default screenshot to the - URL of your own image from the "poster" attribute. Look at "screenshot" - attribute in GET /videos/{`video_id`} for details. + """Default screenshot index. + + Specify an ID from the "screenshots" array, so that the URL of the required + screenshot appears in the "screenshot" attribute as the default screenshot. By + default 5 static screenshots will be taken from different places in the video + after transcoding. If the video is short, there may be fewer screenshots. + + Counting from 0. A value of -1 sets the default screenshot to the URL of your + own image from the "poster" attribute. + + Look at "screenshot" attribute in GET /videos/{`video_id`} for details. """ share_url: str - """ - Deprecated. Custom URL or iframe displayed in the link field when a user clicks - on a sharing button in player. If empty, the link field and social network - sharing is disabled + """Deprecated. + + Custom URL or iframe displayed in the link field when a user clicks on a sharing + button in player. If empty, the link field and social network sharing is + disabled """ source_bitrate_limit: bool @@ -200,16 +229,19 @@ class CreateVideoParam(TypedDict, total=False): By default `source_bitrate_limit: true` this option allows you to have the output bitrate not more than in the original video, thus to transcode video faster and to deliver it to end-viewers faster as well. At the same time, the - quality will be similar to the original. If for some reason you need more - byte-space in the output quality when encoding, you can set this option to - `source_bitrate_limit: false`. Then, when transcoding, the quality ceiling will - be raised from the bitrate of the original video to the maximum possible limit - specified in our the Product Documentation. For example, this may be needed - when: + quality will be similar to the original. + + If for some reason you need more byte-space in the output quality when encoding, + you can set this option to `source_bitrate_limit: false`. Then, when + transcoding, the quality ceiling will be raised from the bitrate of the original + video to the maximum possible limit specified in our the Product Documentation. + For example, this may be needed when: - to improve the visual quality parameters using PSNR, SSIM, VMAF metrics, - to improve the picture quality on dynamic scenes, - - etc. The option is applied only at the video creation stage and cannot be - changed later. If you want to re-transcode the video using new value, then you - need to create and upload a new video only. + - etc. + + The option is applied only at the video creation stage and cannot be changed + later. If you want to re-transcode the video using new value, then you need to + create and upload a new video only. """ diff --git a/src/gcore/types/streaming/playlist.py b/src/gcore/types/streaming/playlist.py index 677306e0..a6349c50 100644 --- a/src/gcore/types/streaming/playlist.py +++ b/src/gcore/types/streaming/playlist.py @@ -64,9 +64,10 @@ class Playlist(BaseModel): """A URL to a built-in HTML video player with the video inside. It can be inserted into an iframe on your website and the video will - automatically play in all browsers. The player can be opened or shared via this - direct link. Also the video player can be integrated into your web pages using - the Iframe tag. + automatically play in all browsers. + + The player can be opened or shared via this direct link. Also the video player + can be integrated into your web pages using the Iframe tag. Please see the details in `iframe_url` attribute of /videos/{id} method. """ @@ -97,6 +98,7 @@ class Playlist(BaseModel): video_ids: Optional[List[int]] = None """A list of VOD IDs included in the playlist. - Order of videos in a playlist reflects the order of IDs in the array. Maximum - video limit = 128. + Order of videos in a playlist reflects the order of IDs in the array. + + Maximum video limit = 128. """ diff --git a/src/gcore/types/streaming/playlist_create_params.py b/src/gcore/types/streaming/playlist_create_params.py index f8043bbe..c393d54f 100644 --- a/src/gcore/types/streaming/playlist_create_params.py +++ b/src/gcore/types/streaming/playlist_create_params.py @@ -64,9 +64,10 @@ class PlaylistCreateParams(TypedDict, total=False): """A URL to a built-in HTML video player with the video inside. It can be inserted into an iframe on your website and the video will - automatically play in all browsers. The player can be opened or shared via this - direct link. Also the video player can be integrated into your web pages using - the Iframe tag. + automatically play in all browsers. + + The player can be opened or shared via this direct link. Also the video player + can be integrated into your web pages using the Iframe tag. Please see the details in `iframe_url` attribute of /videos/{id} method. """ @@ -97,6 +98,7 @@ class PlaylistCreateParams(TypedDict, total=False): video_ids: Iterable[int] """A list of VOD IDs included in the playlist. - Order of videos in a playlist reflects the order of IDs in the array. Maximum - video limit = 128. + Order of videos in a playlist reflects the order of IDs in the array. + + Maximum video limit = 128. """ diff --git a/src/gcore/types/streaming/playlist_update_params.py b/src/gcore/types/streaming/playlist_update_params.py index a8f2a06e..ec9e9fd2 100644 --- a/src/gcore/types/streaming/playlist_update_params.py +++ b/src/gcore/types/streaming/playlist_update_params.py @@ -64,9 +64,10 @@ class PlaylistUpdateParams(TypedDict, total=False): """A URL to a built-in HTML video player with the video inside. It can be inserted into an iframe on your website and the video will - automatically play in all browsers. The player can be opened or shared via this - direct link. Also the video player can be integrated into your web pages using - the Iframe tag. + automatically play in all browsers. + + The player can be opened or shared via this direct link. Also the video player + can be integrated into your web pages using the Iframe tag. Please see the details in `iframe_url` attribute of /videos/{id} method. """ @@ -97,6 +98,7 @@ class PlaylistUpdateParams(TypedDict, total=False): video_ids: Iterable[int] """A list of VOD IDs included in the playlist. - Order of videos in a playlist reflects the order of IDs in the array. Maximum - video limit = 128. + Order of videos in a playlist reflects the order of IDs in the array. + + Maximum video limit = 128. """ diff --git a/src/gcore/types/streaming/playlist_video.py b/src/gcore/types/streaming/playlist_video.py index 309b5362..d271fb3b 100644 --- a/src/gcore/types/streaming/playlist_video.py +++ b/src/gcore/types/streaming/playlist_video.py @@ -13,7 +13,9 @@ class PlaylistVideo(BaseModel): """Video name""" auto_transcribe_audio_language: Optional[Literal["disable", "auto", ""]] = None - """Automatic creation of subtitles by transcribing the audio track. Values: + """Automatic creation of subtitles by transcribing the audio track. + + Values: - disable – Do not transcribe. - auto – Automatically detects the activation of the option based on the @@ -23,7 +25,9 @@ class PlaylistVideo(BaseModel): language spoken in the audio track, or when auto language detection fails. Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). List of languages is available in `audio_language` - attribute of API POST /streaming/ai/transcribe . Example: + attribute of API POST /streaming/ai/transcribe . + + Example: ``` auto_transcribe_audio_language: "auto" @@ -42,16 +46,23 @@ class PlaylistVideo(BaseModel): """Automatic translation of auto-transcribed subtitles to the specified language(s). - Can be used both together with `auto_transcribe_audio_language` option only. Use - it when you want to make automatic subtitles in languages other than the - original language in audio. Values: + Can be used both together with `auto_transcribe_audio_language` option only. + + Use it when you want to make automatic subtitles in languages other than the + original language in audio. + + Values: - disable – Do not translate. - default – There are 3 default languages: eng,fre,ger - \\ – Explicit language to translate to, or list of languages separated by a comma. Look at list of available languages in description of AI ASR task - creation. If several languages are specified for translation, a separate - subtitle will be generated for each language. Example: + creation. + + If several languages are specified for translation, a separate subtitle will be + generated for each language. + + Example: ``` auto_translate_subtitles_language: default @@ -80,9 +91,10 @@ class PlaylistVideo(BaseModel): """ custom_iframe_url: Optional[str] = None - """ - Deprecated. Custom URL of IFrame for video player to be used in share panel in - player. Auto generated IFrame URL provided by default + """Deprecated. + + Custom URL of IFrame for video player to be used in share panel in player. Auto + generated IFrame URL provided by default """ description: Optional[str] = None @@ -95,8 +107,11 @@ class PlaylistVideo(BaseModel): """Authorization HTTP request header. Will be used as credentials to authenticate a request to download a file - (specified in "`origin_url`" parameter) on an external server. Syntax: - `Authorization: ` Examples: + (specified in "`origin_url`" parameter) on an external server. + + Syntax: `Authorization: ` + + Examples: - "`origin_http_headers`": "Authorization: Basic ..." - "`origin_http_headers`": "Authorization: Bearer ..." @@ -122,16 +137,21 @@ class PlaylistVideo(BaseModel): """ poster: Optional[str] = None - """ - Poster is your own static image which can be displayed before the video starts. + """Poster is your own static image which can be displayed before the video starts. + After uploading the video, the system will automatically create several screenshots (they will be stored in "screenshots" attribute) from which you can select an default screenshot. This "poster" field is for uploading your own image. Also use attribute "`screenshot_id`" to select poster as a default - screnshot. Attribute accepts single image as base64-encoded string + screnshot. + + Attribute accepts single image as base64-encoded string [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In - format: `data:[];base64,` MIME-types are image/jpeg, - image/webp, and image/png and file sizes up to 1Mb. Examples: + format: `data:[];base64,` + + MIME-types are image/jpeg, image/webp, and image/png and file sizes up to 1Mb. + + Examples: - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` - `data:image/png;base64,iVBORw0KGg...ggg==` @@ -142,13 +162,16 @@ class PlaylistVideo(BaseModel): """ Priority allows you to adjust the urgency of processing some videos before others in your account, if your algorithm requires it. For example, when there - are very urgent video and some regular ones that can wait in the queue. Value - range, integer [-10..10]. -10 is the lowest down-priority, 10 is the highest - up-priority. Default priority is 0. + are very urgent video and some regular ones that can wait in the queue. + + Value range, integer [-10..10]. -10 is the lowest down-priority, 10 is the + highest up-priority. Default priority is 0. """ projection: Optional[str] = None - """Deprecated. Regulates the video format: + """Deprecated. + + Regulates the video format: - **regular** — plays the video as usual - **vr360** — plays the video in 360 degree mode @@ -167,28 +190,34 @@ class PlaylistVideo(BaseModel): remote_poster_url: Optional[str] = None """ Poster URL to download from external resource, instead of uploading via "poster" - attribute. It has the same restrictions as "poster" attribute. + attribute. + + It has the same restrictions as "poster" attribute. """ remove_poster: Optional[bool] = None """Set it to true to remove poster""" screenshot_id: Optional[int] = None - """ - Default screenshot index. Specify an ID from the "screenshots" array, so that - the URL of the required screenshot appears in the "screenshot" attribute as the - default screenshot. By default 5 static screenshots will be taken from different - places in the video after transcoding. If the video is short, there may be fewer - screenshots. Counting from 0. A value of -1 sets the default screenshot to the - URL of your own image from the "poster" attribute. Look at "screenshot" - attribute in GET /videos/{`video_id`} for details. + """Default screenshot index. + + Specify an ID from the "screenshots" array, so that the URL of the required + screenshot appears in the "screenshot" attribute as the default screenshot. By + default 5 static screenshots will be taken from different places in the video + after transcoding. If the video is short, there may be fewer screenshots. + + Counting from 0. A value of -1 sets the default screenshot to the URL of your + own image from the "poster" attribute. + + Look at "screenshot" attribute in GET /videos/{`video_id`} for details. """ share_url: Optional[str] = None - """ - Deprecated. Custom URL or iframe displayed in the link field when a user clicks - on a sharing button in player. If empty, the link field and social network - sharing is disabled + """Deprecated. + + Custom URL or iframe displayed in the link field when a user clicks on a sharing + button in player. If empty, the link field and social network sharing is + disabled """ source_bitrate_limit: Optional[bool] = None @@ -201,16 +230,19 @@ class PlaylistVideo(BaseModel): By default `source_bitrate_limit: true` this option allows you to have the output bitrate not more than in the original video, thus to transcode video faster and to deliver it to end-viewers faster as well. At the same time, the - quality will be similar to the original. If for some reason you need more - byte-space in the output quality when encoding, you can set this option to - `source_bitrate_limit: false`. Then, when transcoding, the quality ceiling will - be raised from the bitrate of the original video to the maximum possible limit - specified in our the Product Documentation. For example, this may be needed - when: + quality will be similar to the original. + + If for some reason you need more byte-space in the output quality when encoding, + you can set this option to `source_bitrate_limit: false`. Then, when + transcoding, the quality ceiling will be raised from the bitrate of the original + video to the maximum possible limit specified in our the Product Documentation. + For example, this may be needed when: - to improve the visual quality parameters using PSNR, SSIM, VMAF metrics, - to improve the picture quality on dynamic scenes, - - etc. The option is applied only at the video creation stage and cannot be - changed later. If you want to re-transcode the video using new value, then you - need to create and upload a new video only. + - etc. + + The option is applied only at the video creation stage and cannot be changed + later. If you want to re-transcode the video using new value, then you need to + create and upload a new video only. """ diff --git a/src/gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py b/src/gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py index 3516aa24..b8da4126 100644 --- a/src/gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py +++ b/src/gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py @@ -17,10 +17,13 @@ class StatisticGetUniqueViewersCdnParams(TypedDict, total=False): id: str """Filter by entity's id. - Put ID of a Live stream, VOD or a playlist to be calculated. If the value is - omitted, then the calculation is done for all videos/streams of the specified - type. When using this "id" parameter, be sure to specify the "type" parameter - too. If you do not specify a type, the "id" will be ignored. + Put ID of a Live stream, VOD or a playlist to be calculated. + + If the value is omitted, then the calculation is done for all videos/streams of + the specified type. + + When using this "id" parameter, be sure to specify the "type" parameter too. If + you do not specify a type, the "id" will be ignored. """ type: Literal["live", "vod", "playlist"] diff --git a/src/gcore/types/streaming/stream.py b/src/gcore/types/streaming/stream.py index 903a1515..8db7262a 100644 --- a/src/gcore/types/streaming/stream.py +++ b/src/gcore/types/streaming/stream.py @@ -11,9 +11,12 @@ class Stream(BaseModel): name: str - """ - Stream name. Often used as a human-readable name for the stream, but can contain - any text you wish. The values are not unique and may be repeated. Examples: + """Stream name. + + Often used as a human-readable name for the stream, but can contain any text you + wish. The values are not unique and may be repeated. + + Examples: - Conference in July - Stream #10003 @@ -28,8 +31,10 @@ class Stream(BaseModel): """Stream switch between on and off. This is not an indicator of the status "stream is receiving and it is LIVE", but - rather an on/off switch. When stream is switched off, there is no way to process - it: PULL is deactivated and PUSH will return an error. + rather an on/off switch. + + When stream is switched off, there is no way to process it: PULL is deactivated + and PUSH will return an error. - true – stream can be processed - false – stream is off, and cannot be processed @@ -38,9 +43,12 @@ class Stream(BaseModel): auto_record: Optional[bool] = None """Enables autotomatic recording of the stream when it started. - So you don't need to call recording manually. Result of recording is - automatically added to video hosting. For details see the - /streams/`start_recording` method and in knowledge base Values: + So you don't need to call recording manually. + + Result of recording is automatically added to video hosting. For details see the + /streams/`start_recording` method and in knowledge base + + Values: - true – auto recording is enabled - false – auto recording is disabled @@ -49,23 +57,28 @@ class Stream(BaseModel): backup_live: Optional[bool] = None """ State of receiving and transcoding master stream from source by backup server if - you pushing stream to "`backup_push_url`" or "`backup_push_url_srt`". Displays - the backup server status of PUSH method only. For PULL a "live" field is always - used, even when origin servers are switched using round robin scheduling (look - "uri" field for details). + you pushing stream to "`backup_push_url`" or "`backup_push_url_srt`". + + Displays the backup server status of PUSH method only. For PULL a "live" field + is always used, even when origin servers are switched using round robin + scheduling (look "uri" field for details). """ backup_push_url: Optional[str] = None """URL to PUSH master stream to our backup server using RTMP/S protocols. - Servers for the main and backup streams are distributed geographically. Mainly - sending one stream to main server is enough. But if you need a backup stream, - then this is the field to PUSH it. To use RTMPS just manually change the - protocol name from "rtmp://" to "rtmps://". The backup logs are as follows: In - PUSH mode, you initiate sending a stream from your machine. If your stream stops - or breaks for some reason and it stops coming to the main server, then after - 3-10 seconds of waiting the stream will turn off or the backup one will be - automatically turned on, if you are pushing it too. + Servers for the main and backup streams are distributed geographically. + + Mainly sending one stream to main server is enough. But if you need a backup + stream, then this is the field to PUSH it. + + To use RTMPS just manually change the protocol name from "rtmp://" to + "rtmps://". + + The backup logs are as follows: In PUSH mode, you initiate sending a stream from + your machine. If your stream stops or breaks for some reason and it stops coming + to the main server, then after 3-10 seconds of waiting the stream will turn off + or the backup one will be automatically turned on, if you are pushing it too. """ backup_push_url_srt: Optional[str] = None @@ -105,12 +118,15 @@ class Stream(BaseModel): dash_url: Optional[str] = None """MPEG-DASH output. - URL for transcoded result stream in MPEG-DASH format, with .mpd link. Low - Latency support: YES. This is CMAF-based MPEG-DASH stream. Encoder and packager - dynamically assemble the video stream with fMP4 fragments. Chunks have ±2-4 - seconds duration depending on the settings. All chunks for DASH are transferred - through CDN using chunk transfer technology, which allows to use all the - advantages of low latency delivery of DASH. + URL for transcoded result stream in MPEG-DASH format, with .mpd link. + + Low Latency support: YES. + + This is CMAF-based MPEG-DASH stream. Encoder and packager dynamically assemble + the video stream with fMP4 fragments. Chunks have ±2-4 seconds duration + depending on the settings. All chunks for DASH are transferred through CDN using + chunk transfer technology, which allows to use all the advantages of low latency + delivery of DASH. - by default low latency is ±4 sec, because it's stable for almost all last-mile use cases. @@ -124,8 +140,11 @@ class Stream(BaseModel): """DVR duration in seconds if DVR feature is enabled for the stream. So this is duration of how far the user can rewind the live stream. - `dvr_duration` range is [30...14400]. Maximum value is 4 hours = 14400 seconds. - If you need more, ask the Support Team please. + + `dvr_duration` range is [30...14400]. + + Maximum value is 4 hours = 14400 seconds. If you need more, ask the Support Team + please. """ dvr_enabled: Optional[bool] = None @@ -136,16 +155,17 @@ class Stream(BaseModel): """ finished_at_primary: Optional[str] = None - """Time when the stream ended for the last time. - - Datetime in ISO 8601. After restarting the stream, this value is not reset to - "null", and the time of the last/previous end is always displayed here. That is, - when the start time is greater than the end time, it means the current session - is still ongoing and the stream has not ended yet. If you want to see all - information about acitivity of the stream, you can get it from another method - /streaming/statistics/ffprobe. This method shows aggregated activity parameters - during a time, when stream was alive and transcoded. Also you can create graphs - to see the activity. For example + """Time when the stream ended for the last time. Datetime in ISO 8601. + + After restarting the stream, this value is not reset to "null", and the time of + the last/previous end is always displayed here. That is, when the start time is + greater than the end time, it means the current session is still ongoing and the + stream has not ended yet. + + If you want to see all information about acitivity of the stream, you can get it + from another method /streaming/statistics/ffprobe. This method shows aggregated + activity parameters during a time, when stream was alive and transcoded. Also + you can create graphs to see the activity. For example /streaming/statistics/ffprobe?interval=6000&`date_from`=2023-10-01&`date_to`=2023-10-11&`stream_id`=12345 """ @@ -156,12 +176,15 @@ class Stream(BaseModel): """HLS output. URL for transcoded result of stream in HLS CMAF format, with .m3u8 link. - Recommended for use for all HLS streams. Low Latency support: YES. This is - CMAF-based HLS stream. Encoder and packager dynamically assemble the video - stream with fMP4 fragments. Chunks have ±2-4 seconds duration depending on the - settings. All chunks for LL-HLS are transferred through CDN via dividing into - parts (small segments `#EXT-X-PART` of 0.5-1.0 sec duration), which allows to - use all the advantages of low latency delivery of LL-HLS. + Recommended for use for all HLS streams. + + Low Latency support: YES. + + This is CMAF-based HLS stream. Encoder and packager dynamically assemble the + video stream with fMP4 fragments. Chunks have ±2-4 seconds duration depending on + the settings. All chunks for LL-HLS are transferred through CDN via dividing + into parts (small segments `#EXT-X-PART` of 0.5-1.0 sec duration), which allows + to use all the advantages of low latency delivery of LL-HLS. - by default low latency is ±5 sec, because it's stable for almost all last-mile use cases. @@ -185,12 +208,18 @@ class Stream(BaseModel): """HLS output for legacy devices. URL for transcoded result of stream in HLS MPEG-TS (.ts) format, with .m3u8 - link. Low Latency support: NO. Some legacy devices or software may require - MPEG-TS (.ts) segments as a format for streaming, so we provide this options - keeping backward compatibility with any of your existing workflows. For other - cases it's better to use "`hls_cmaf_url`" instead. You can use this legacy HLSv6 - format based on MPEG-TS segmenter in parallel with main HLS CMAF. Both formats - are sharing same segments size, manifest length (DVR), etc. + link. + + Low Latency support: NO. + + Some legacy devices or software may require MPEG-TS (.ts) segments as a format + for streaming, so we provide this options keeping backward compatibility with + any of your existing workflows. For other cases it's better to use + "`hls_cmaf_url`" instead. + + You can use this legacy HLSv6 format based on MPEG-TS segmenter in parallel with + main HLS CMAF. Both formats are sharing same segments size, manifest length + (DVR), etc. It is also possible to use additional modifier-attributes: @@ -200,10 +229,13 @@ class Stream(BaseModel): length multiple of whole seconds, or a fractional number separated by a dot for chunks that are not multiples of seconds. This attribute allows you to determine duration in seconds at the level of analyzing the logs of CDN - requests and compare it with file size (so to use it in your analytics). Such - modifier attributes are applied manually and added to the link obtained from - this field. I.e. `?get_duration_sec=true` Example: - `https://demo.gvideo.io/mpegts/2675_19146/master_mpegts.m3u8?get_duration_sec=true` + requests and compare it with file size (so to use it in your analytics). + + Such modifier attributes are applied manually and added to the link obtained + from this field. I.e. `?get_duration_sec=true` + + Example: + `https://demo.gvideo.io/mpegts/2675_19146/master_mpegts.m3u8?get_duration_sec=true` ``` #EXTM3U @@ -230,14 +262,19 @@ class Stream(BaseModel): """A URL to a built-in HTML web player with the stream inside. It can be inserted into an iframe on your website and the video will - automatically play in all browsers. Please, remember that transcoded streams - from "`hls_cmaf_url`" with .m3u8 at the end, and from "`dash_url`" with .mpd at - the end are to be played inside video players only. For example: AVplayer on - iOS, Exoplayer on Android, HTML web player in browser, etc. General bowsers like - Chrome, Firefox, etc cannot play transcoded streams with .m3u8 and .mpd at the - end. The only exception is Safari, which can only play Apple's HLS .m3u8 format - with limits. That's why you may need to use this HTML web player. Please, look - Knowledge Base for details. Example of usage on a web page: + automatically play in all browsers. + + Please, remember that transcoded streams from "`hls_cmaf_url`" with .m3u8 at the + end, and from "`dash_url`" with .mpd at the end are to be played inside video + players only. For example: AVplayer on iOS, Exoplayer on Android, HTML web + player in browser, etc. General bowsers like Chrome, Firefox, etc cannot play + transcoded streams with .m3u8 and .mpd at the end. The only exception is Safari, + which can only play Apple's HLS .m3u8 format with limits. + + That's why you may need to use this HTML web player. Please, look Knowledge Base + for details. + + Example of usage on a web page: """ @@ -249,7 +286,9 @@ class Stream(BaseModel): """ Visualization mode for 360° streams, how the stream is rendered in our web player ONLY. If you would like to show video 360° in an external video player, - then use parameters of that video player. Modes: + then use parameters of that video player. + + Modes: - regular – regular “flat” stream - vr360 – display stream in 360° mode @@ -270,9 +309,11 @@ class Stream(BaseModel): """ push_url: Optional[str] = None - """ - URL to PUSH master stream to our main server using RTMP and RTMPS protocols. To - use RTMPS just manually change the protocol name from "rtmp://" to "rtmps://". + """URL to PUSH master stream to our main server using RTMP and RTMPS protocols. + + To use RTMPS just manually change the protocol name from "rtmp://" to + "rtmps://". + Use only 1 protocol of sending a master stream: eitheronly RTMP/S (`push_url`), or only SRT (`push_url_srt`). @@ -287,8 +328,9 @@ class Stream(BaseModel): Please note that 1 connection and 1 protocol can be used at a single moment in time per unique stream key input. Trying to send 2+ connection requests into - `push_url` to once, or 2+ protocols at once will not lead to a result. For - example, transcoding process will fail if: + `push_url` to once, or 2+ protocols at once will not lead to a result. + + For example, transcoding process will fail if: - you are pushing primary and backup RTMP to the same single `push_url` simultaneously @@ -303,31 +345,37 @@ class Stream(BaseModel): """ push_url_srt: Optional[str] = None - """ - URL to PUSH master stream to our main server using SRT protocol. Use only 1 - protocol of sending a master stream: eitheronly RTMP/S (`push_url`), or only SRT - (`push_url_srt`). + """URL to PUSH master stream to our main server using SRT protocol. + + Use only 1 protocol of sending a master stream: eitheronly RTMP/S (`push_url`), + or only SRT (`push_url_srt`). + + **Setup SRT latency on your sender side** - **Setup SRT latency on your sender side** SRT is designed as a low-latency - transport protocol, but real networks are not always stable and in some cases - the end-to-end path from the venue to the ingest point can be long. For this - reason, it is important to configure the latency parameter carefully to match - the actual network conditions. Small latency values may lead to packet loss when - jitter or retransmissions occur, while very large values introduce unnecessary - end-to-end delay. \\**Incorrect or low default value is one of the most common - reasons for packet loss, frames loss, and bad picture.\\** + SRT is designed as a low-latency transport protocol, but real networks are not + always stable and in some cases the end-to-end path from the venue to the ingest + point can be long. For this reason, it is important to configure the latency + parameter carefully to match the actual network conditions. + + Small latency values may lead to packet loss when jitter or retransmissions + occur, while very large values introduce unnecessary end-to-end delay. + \\**Incorrect or low default value is one of the most common reasons for packet + loss, frames loss, and bad picture.\\** We therefore recommend setting latency manually rather than relying on the default, to ensure the buffer is correctly sized for your environment. A practical range is 400–2000 ms, with the exact value chosen based on RTT, - jitter, and expected packet loss. Be sure to check and test SRT settings on your - sender side. The default values do not take into account your specific scenarios - and do not work well. If necessary, ask us and we will help you. + jitter, and expected packet loss. + + Be sure to check and test SRT settings on your sender side. The default values + do not take into account your specific scenarios and do not work well. If + necessary, ask us and we will help you. Please note that 1 connection and 1 protocol can be used at a single moment in time per unique stream key input. Trying to send 2+ connection requests into - `push_url_srt` to once, or 2+ protocols at once will not lead to a result. For - example, transcoding process will fail if: + `push_url_srt` to once, or 2+ protocols at once will not lead to a result. + + For example, transcoding process will fail if: - you are pushing primary and backup SRT to the same single `push_url_srt` simultaneously @@ -340,37 +388,52 @@ class Stream(BaseModel): push_url_whip: Optional[str] = None """URL to PUSH WebRTC stream to our server using WHIP protocol. - **WebRTC WHIP to LL-HLS and DASH** Video Streaming supports WebRTC HTTP Ingest - Protocol (WHIP), and WebRTC to HLS/DASH converter. As a result you can stream - from web broswers natively. **WebRTC WHIP server** We have dedicated WebRTC WHIP - servers in our infrastructure. WebRTC WHIP server organizes both signaling and - receives video data. Signaling is a term to describe communication between - WebRTC endpoints, needed to initiate and maintain a session. WHIP is an open - specification for a simple signaling protocol for starting WebRTC sessions in an - outgoing direction, (i.e., streaming from your device). There is the primary - link only for WHIP, so no backup link. **WebRTC stream encoding parameters** At - least one video and audio track both must be present in the stream: + **WebRTC WHIP to LL-HLS and DASH** + + Video Streaming supports WebRTC HTTP Ingest Protocol (WHIP), and WebRTC to + HLS/DASH converter. As a result you can stream from web broswers natively. + + **WebRTC WHIP server** + + We have dedicated WebRTC WHIP servers in our infrastructure. WebRTC WHIP server + organizes both signaling and receives video data. Signaling is a term to + describe communication between WebRTC endpoints, needed to initiate and maintain + a session. WHIP is an open specification for a simple signaling protocol for + starting WebRTC sessions in an outgoing direction, (i.e., streaming from your + device). + + There is the primary link only for WHIP, so no backup link. + + **WebRTC stream encoding parameters** + + At least one video and audio track both must be present in the stream: - Video must be encoded with H.264. - - Audio must be encoded with OPUS. Note. Specifically for WebRTC mode a method - of constant transcoding with an initial given resolution is used. This means - that if WebRTC in the end-user's browser decides to reduce the quality or - resolution of the master stream (to let say 360p) due to restrictions on the - end-user's device (network conditions, CPU consumption, etc.), the transcoder - will still continue to transcode the reduced stream to the initial resolution - (let say 1080p ABR). When the restrictions on the end-user's device are - removed, quiality will improve again. **WebRTC WHIP Client** We provide a - convenient WebRTC WHIP library for working in browsers. You can use our - library, or any other you prefer. Simple example of usage is here: - https://stackblitz.com/edit/stackblitz-starters-j2r9ar?file=index.html Also - try to use the feature in UI of the Customer Portal. In the Streaming section - inside the settings of a specific live stream, a new section "Quick start in - browser" has been added. + - Audio must be encoded with OPUS. + + Note. Specifically for WebRTC mode a method of constant transcoding with an + initial given resolution is used. This means that if WebRTC in the end-user's + browser decides to reduce the quality or resolution of the master stream (to let + say 360p) due to restrictions on the end-user's device (network conditions, CPU + consumption, etc.), the transcoder will still continue to transcode the reduced + stream to the initial resolution (let say 1080p ABR). When the restrictions on + the end-user's device are removed, quiality will improve again. + + **WebRTC WHIP Client** + + We provide a convenient WebRTC WHIP library for working in browsers. You can use + our library, or any other you prefer. Simple example of usage is here: + https://stackblitz.com/edit/stackblitz-starters-j2r9ar?file=index.html + + Also try to use the feature in UI of the Customer Portal. In the Streaming + section inside the settings of a specific live stream, a new section "Quick + start in browser" has been added. Please note that 1 connection and 1 protocol can be used at a single moment in time per unique stream key input. Trying to send 2+ connection requests into - `push_url_whip` to once, or 2+ protocols at once will not lead to a result. For - example, transcoding process will fail if: + `push_url_whip` to once, or 2+ protocols at once will not lead to a result. + + For example, transcoding process will fail if: - you are pushing primary and backup WHIP to the same single `push_url_whip` simultaneously @@ -389,7 +452,9 @@ class Stream(BaseModel): """Method of recording a stream. Specifies the source from which the stream will be recorded: original or - transcoded. Types: + transcoded. + + Types: - "origin" – To record RMTP/SRT/etc original clean media source. - "transcoded" – To record the output transcoded version of the stream, @@ -403,10 +468,12 @@ class Stream(BaseModel): """ An instant screenshot taken from a live stream, and available as a static JPEG image. Resolution 1080 pixels wide, or less if the original stream has a lower - resolution. Screenshot is taken every 10 seconds while the stream is live. This - field contains a link to the last screenshot created by the system. Screenshot - history is not stored, so if you need a series of screenshots over time, then - download them. + resolution. + + Screenshot is taken every 10 seconds while the stream is live. This field + contains a link to the last screenshot created by the system. Screenshot history + is not stored, so if you need a series of screenshots over time, then download + them. """ started_at_backup: Optional[str] = None @@ -418,36 +485,40 @@ class Stream(BaseModel): started_at_primary: Optional[str] = None """Time of the last session when main server started receiving the stream. - Datetime in ISO 8601. This means that if the stream was started 1 time, then - here will be the time it was started. If the stream was started several times, - or restarted on your side, then only the time of the last session is displayed - here. + Datetime in ISO 8601. + + This means that if the stream was started 1 time, then here will be the time it + was started. If the stream was started several times, or restarted on your side, + then only the time of the last session is displayed here. """ transcoded_qualities: Optional[List[str]] = None """Array of qualities to which live stream is transcoded""" transcoding_speed: Optional[float] = None - """Speed of transcoding the stream. Mainly it must be 1.0 for real-time processing. + """Speed of transcoding the stream. - May be less than 1.0 if your stream has problems in delivery due to your local - internet provider's conditions, or the stream does not meet stream inbound - requirements. See Knowledge Base for details. + Mainly it must be 1.0 for real-time processing. May be less than 1.0 if your + stream has problems in delivery due to your local internet provider's + conditions, or the stream does not meet stream inbound requirements. See + Knowledge Base for details. """ uri: Optional[str] = None - """ - When using PULL method, this is the URL to pull a stream from. You can specify - multiple addresses separated by a space (" "), so you can organize a backup - plan. In this case, the specified addresses will be selected one by one using - round robin scheduling. If the first address does not respond, then the next one - in the list will be automatically requested, returning to the first and so on in - a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 2 hours of - inactivity of your original stream, the system stops PULL requests and the - stream is deactivated (the "active" field switches to "false"). Please, note - that this field is for PULL only, so is not suitable for PUSH. Look at fields - "`push_url`" and "`push_url_srt`" from GET method. + """When using PULL method, this is the URL to pull a stream from. + + You can specify multiple addresses separated by a space (" "), so you can + organize a backup plan. In this case, the specified addresses will be selected + one by one using round robin scheduling. If the first address does not respond, + then the next one in the list will be automatically requested, returning to the + first and so on in a circle. Also, if the sucessfully working stream stops + sending data, then the next one will be selected according to the same scheme. + + After 2 hours of inactivity of your original stream, the system stops PULL + requests and the stream is deactivated (the "active" field switches to "false"). + + Please, note that this field is for PULL only, so is not suitable for PUSH. Look + at fields "`push_url`" and "`push_url_srt`" from GET method. """ video_height: Optional[float] = None diff --git a/src/gcore/types/streaming/stream_create_clip_params.py b/src/gcore/types/streaming/stream_create_clip_params.py index e8f0b107..5440a13d 100644 --- a/src/gcore/types/streaming/stream_create_clip_params.py +++ b/src/gcore/types/streaming/stream_create_clip_params.py @@ -9,40 +9,51 @@ class StreamCreateClipParams(TypedDict, total=False): duration: Required[int] - """ - Requested segment duration in seconds to be cut. Please, note that cutting is - based on the idea of instantly creating a clip, instead of precise timing. So - final segment may be: + """Requested segment duration in seconds to be cut. + + Please, note that cutting is based on the idea of instantly creating a clip, + instead of precise timing. So final segment may be: - Less than the specified value if there is less data in the DVR than the requested segment. - Greater than the specified value, because segment is aligned to the first and last key frames of already stored fragment in DVR, this way -1 and +1 chunks - can be added to left and right. Duration of cutted segment cannot be greater - than DVR duration for this stream. Therefore, to change the maximum, use - "`dvr_duration`" parameter of this stream. + can be added to left and right. + + Duration of cutted segment cannot be greater than DVR duration for this stream. + Therefore, to change the maximum, use "`dvr_duration`" parameter of this stream. """ expiration: int - """ - Expire time of the clip via a public link. Unix timestamp in seconds, absolute - value. This is the time how long the instant clip will be stored in the server - memory and can be accessed via public HLS/MP4 links. Download and/or use the - instant clip before this time expires. After the time has expired, the clip is - deleted from memory and is no longer available via the link. You need to create - a new segment, or use `vod_required: true` attribute. If value is omitted, then - expiration is counted as +3600 seconds (1 hour) to the end of the clip (i.e. - `unix timestamp = + + 3600`). Allowed range: 1m <= expiration - <= 4h. Example: + """Expire time of the clip via a public link. + + Unix timestamp in seconds, absolute value. + + This is the time how long the instant clip will be stored in the server memory + and can be accessed via public HLS/MP4 links. Download and/or use the instant + clip before this time expires. + + After the time has expired, the clip is deleted from memory and is no longer + available via the link. You need to create a new segment, or use + `vod_required: true` attribute. + + If value is omitted, then expiration is counted as +3600 seconds (1 hour) to the + end of the clip (i.e. `unix timestamp = + + 3600`). + + Allowed range: 1m <= expiration <= 4h. + + Example: `24.05.2024 14:00:00 (GMT) + 60 seconds of duration + 3600 seconds of expiration = 24.05.2024 15:01:00 (GMT) is Unix timestamp = 1716562860` """ start: int - """ - Starting point of the segment to cut. Unix timestamp in seconds, absolute value. - Example: `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` If a value - from the past is specified, it is used as the starting point for the segment to - cut. If the value is omitted, then clip will start from now. + """Starting point of the segment to cut. + + Unix timestamp in seconds, absolute value. Example: + `24.05.2024 14:00:00 (GMT) is Unix timestamp = 1716559200` + + If a value from the past is specified, it is used as the starting point for the + segment to cut. If the value is omitted, then clip will start from now. """ vod_required: bool diff --git a/src/gcore/types/streaming/stream_create_params.py b/src/gcore/types/streaming/stream_create_params.py index a8254826..50513e7d 100644 --- a/src/gcore/types/streaming/stream_create_params.py +++ b/src/gcore/types/streaming/stream_create_params.py @@ -10,9 +10,12 @@ class StreamCreateParams(TypedDict, total=False): name: Required[str] - """ - Stream name. Often used as a human-readable name for the stream, but can contain - any text you wish. The values are not unique and may be repeated. Examples: + """Stream name. + + Often used as a human-readable name for the stream, but can contain any text you + wish. The values are not unique and may be repeated. + + Examples: - Conference in July - Stream #10003 @@ -24,8 +27,10 @@ class StreamCreateParams(TypedDict, total=False): """Stream switch between on and off. This is not an indicator of the status "stream is receiving and it is LIVE", but - rather an on/off switch. When stream is switched off, there is no way to process - it: PULL is deactivated and PUSH will return an error. + rather an on/off switch. + + When stream is switched off, there is no way to process it: PULL is deactivated + and PUSH will return an error. - true – stream can be processed - false – stream is off, and cannot be processed @@ -34,9 +39,12 @@ class StreamCreateParams(TypedDict, total=False): auto_record: bool """Enables autotomatic recording of the stream when it started. - So you don't need to call recording manually. Result of recording is - automatically added to video hosting. For details see the - /streams/`start_recording` method and in knowledge base Values: + So you don't need to call recording manually. + + Result of recording is automatically added to video hosting. For details see the + /streams/`start_recording` method and in knowledge base + + Values: - true – auto recording is enabled - false – auto recording is disabled @@ -71,8 +79,11 @@ class StreamCreateParams(TypedDict, total=False): """DVR duration in seconds if DVR feature is enabled for the stream. So this is duration of how far the user can rewind the live stream. - `dvr_duration` range is [30...14400]. Maximum value is 4 hours = 14400 seconds. - If you need more, ask the Support Team please. + + `dvr_duration` range is [30...14400]. + + Maximum value is 4 hours = 14400 seconds. If you need more, ask the Support Team + please. """ dvr_enabled: bool @@ -98,7 +109,9 @@ class StreamCreateParams(TypedDict, total=False): """ Visualization mode for 360° streams, how the stream is rendered in our web player ONLY. If you would like to show video 360° in an external video player, - then use parameters of that video player. Modes: + then use parameters of that video player. + + Modes: - regular – regular “flat” stream - vr360 – display stream in 360° mode @@ -128,7 +141,9 @@ class StreamCreateParams(TypedDict, total=False): """Method of recording a stream. Specifies the source from which the stream will be recorded: original or - transcoded. Types: + transcoded. + + Types: - "origin" – To record RMTP/SRT/etc original clean media source. - "transcoded" – To record the output transcoded version of the stream, @@ -136,16 +151,18 @@ class StreamCreateParams(TypedDict, total=False): """ uri: str - """ - When using PULL method, this is the URL to pull a stream from. You can specify - multiple addresses separated by a space (" "), so you can organize a backup - plan. In this case, the specified addresses will be selected one by one using - round robin scheduling. If the first address does not respond, then the next one - in the list will be automatically requested, returning to the first and so on in - a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 2 hours of - inactivity of your original stream, the system stops PULL requests and the - stream is deactivated (the "active" field switches to "false"). Please, note - that this field is for PULL only, so is not suitable for PUSH. Look at fields - "`push_url`" and "`push_url_srt`" from GET method. + """When using PULL method, this is the URL to pull a stream from. + + You can specify multiple addresses separated by a space (" "), so you can + organize a backup plan. In this case, the specified addresses will be selected + one by one using round robin scheduling. If the first address does not respond, + then the next one in the list will be automatically requested, returning to the + first and so on in a circle. Also, if the sucessfully working stream stops + sending data, then the next one will be selected according to the same scheme. + + After 2 hours of inactivity of your original stream, the system stops PULL + requests and the stream is deactivated (the "active" field switches to "false"). + + Please, note that this field is for PULL only, so is not suitable for PUSH. Look + at fields "`push_url`" and "`push_url_srt`" from GET method. """ diff --git a/src/gcore/types/streaming/stream_update_params.py b/src/gcore/types/streaming/stream_update_params.py index ecff938d..da6d8478 100644 --- a/src/gcore/types/streaming/stream_update_params.py +++ b/src/gcore/types/streaming/stream_update_params.py @@ -14,9 +14,12 @@ class StreamUpdateParams(TypedDict, total=False): class Stream(TypedDict, total=False): name: Required[str] - """ - Stream name. Often used as a human-readable name for the stream, but can contain - any text you wish. The values are not unique and may be repeated. Examples: + """Stream name. + + Often used as a human-readable name for the stream, but can contain any text you + wish. The values are not unique and may be repeated. + + Examples: - Conference in July - Stream #10003 @@ -28,8 +31,10 @@ class Stream(TypedDict, total=False): """Stream switch between on and off. This is not an indicator of the status "stream is receiving and it is LIVE", but - rather an on/off switch. When stream is switched off, there is no way to process - it: PULL is deactivated and PUSH will return an error. + rather an on/off switch. + + When stream is switched off, there is no way to process it: PULL is deactivated + and PUSH will return an error. - true – stream can be processed - false – stream is off, and cannot be processed @@ -38,9 +43,12 @@ class Stream(TypedDict, total=False): auto_record: bool """Enables autotomatic recording of the stream when it started. - So you don't need to call recording manually. Result of recording is - automatically added to video hosting. For details see the - /streams/`start_recording` method and in knowledge base Values: + So you don't need to call recording manually. + + Result of recording is automatically added to video hosting. For details see the + /streams/`start_recording` method and in knowledge base + + Values: - true – auto recording is enabled - false – auto recording is disabled @@ -75,8 +83,11 @@ class Stream(TypedDict, total=False): """DVR duration in seconds if DVR feature is enabled for the stream. So this is duration of how far the user can rewind the live stream. - `dvr_duration` range is [30...14400]. Maximum value is 4 hours = 14400 seconds. - If you need more, ask the Support Team please. + + `dvr_duration` range is [30...14400]. + + Maximum value is 4 hours = 14400 seconds. If you need more, ask the Support Team + please. """ dvr_enabled: bool @@ -102,7 +113,9 @@ class Stream(TypedDict, total=False): """ Visualization mode for 360° streams, how the stream is rendered in our web player ONLY. If you would like to show video 360° in an external video player, - then use parameters of that video player. Modes: + then use parameters of that video player. + + Modes: - regular – regular “flat” stream - vr360 – display stream in 360° mode @@ -132,7 +145,9 @@ class Stream(TypedDict, total=False): """Method of recording a stream. Specifies the source from which the stream will be recorded: original or - transcoded. Types: + transcoded. + + Types: - "origin" – To record RMTP/SRT/etc original clean media source. - "transcoded" – To record the output transcoded version of the stream, @@ -140,16 +155,18 @@ class Stream(TypedDict, total=False): """ uri: str - """ - When using PULL method, this is the URL to pull a stream from. You can specify - multiple addresses separated by a space (" "), so you can organize a backup - plan. In this case, the specified addresses will be selected one by one using - round robin scheduling. If the first address does not respond, then the next one - in the list will be automatically requested, returning to the first and so on in - a circle. Also, if the sucessfully working stream stops sending data, then the - next one will be selected according to the same scheme. After 2 hours of - inactivity of your original stream, the system stops PULL requests and the - stream is deactivated (the "active" field switches to "false"). Please, note - that this field is for PULL only, so is not suitable for PUSH. Look at fields - "`push_url`" and "`push_url_srt`" from GET method. + """When using PULL method, this is the URL to pull a stream from. + + You can specify multiple addresses separated by a space (" "), so you can + organize a backup plan. In this case, the specified addresses will be selected + one by one using round robin scheduling. If the first address does not respond, + then the next one in the list will be automatically requested, returning to the + first and so on in a circle. Also, if the sucessfully working stream stops + sending data, then the next one will be selected according to the same scheme. + + After 2 hours of inactivity of your original stream, the system stops PULL + requests and the stream is deactivated (the "active" field switches to "false"). + + Please, note that this field is for PULL only, so is not suitable for PUSH. Look + at fields "`push_url`" and "`push_url_srt`" from GET method. """ diff --git a/src/gcore/types/streaming/video.py b/src/gcore/types/streaming/video.py index 42fff728..9af59437 100644 --- a/src/gcore/types/streaming/video.py +++ b/src/gcore/types/streaming/video.py @@ -26,13 +26,16 @@ class ConvertedVideo(BaseModel): A URL to a rendition file of the specified quality in MP4 format for downloading. - **Download methods** For each converted video, additional download endpoints are - available under `converted_videos`/`mp4_urls`. An MP4 download enpoints: + **Download methods** + + For each converted video, additional download endpoints are available under + `converted_videos`/`mp4_urls`. An MP4 download enpoints: - /videos/{`client_id`}\\__{slug}/{filename}.mp4 - /videos/{`client_id`}\\__{slug}/{filename}.mp4/download - - /videos/{`client_id`}\\__{slug}/{filename}.mp4/download={`custom_filename`} The - first option returns the file as is. Response will be: + - /videos/{`client_id`}\\__{slug}/{filename}.mp4/download={`custom_filename`} + + The first option returns the file as is. Response will be: ``` GET .mp4 @@ -54,7 +57,9 @@ class ConvertedVideo(BaseModel): The third option allows you to set a custom name for the file being downloaded. You can optionally specify a custom filename (just name excluding the .mp4 - extension) using the download= query. Filename constraints: + extension) using the download= query. + + Filename constraints: - Length: 1-255 characters - Must NOT include the .mp4 extension (it is added automatically) @@ -77,40 +82,55 @@ class ConvertedVideo(BaseModel): - Video with custom download filename: `https://demo-public.gvideo.io/videos/2675_1OFgHZ1FWZNNvx1A/qid3567v1_h264_4050_1080.mp4/download=highlights_v1.1_2025-05-30` - **Default MP4 file name structure** Link to the file {filename} contains - information about the encoding method using format: - `___.mp4` + **Default MP4 file name structure** + + Link to the file {filename} contains information about the encoding method using + format: `___.mp4` - `` – Internal quality identifier and file version. Please do not use it, can be changed at any time without any notice. - `` – Codec name that was used to encode the video, or audio codec if it is an audio-only file. - `` – Encoding bitrate in Kbps. - - `` – Video height, or word "audio" if it is an audio-only file. Note - that this link format has been applied since 14.08.2024. If the video entity - was uploaded earlier, links may have old simplified format. Example: - `/videos/{client_id}_{slug}/qid3567v1_h264_4050_1080.mp4` + - `` – Video height, or word "audio" if it is an audio-only file. + + Note that this link format has been applied since 14.08.2024. If the video + entity was uploaded earlier, links may have old simplified format. + + Example: `/videos/{client_id}_{slug}/qid3567v1_h264_4050_1080.mp4` **Dynamic speed limiting** This mode sets different limits for different users or for different types of content. The speed is adjusted based on requests with - the “speed” and “buffer” arguments. Example: `?speed=50k&buffer=500k` Read more - in Product Documentation in CDN section "Network limits". + the “speed” and “buffer” arguments. + + Example: `?speed=50k&buffer=500k` + + Read more in Product Documentation in CDN section "Network limits". + + **Secure token authentication (updated)** + + Access to MP4 download links can be protected using secure tokens passed as + query parameters. The token generation logic has been updated to allow + fine-grained protection per file and bitrate. - **Secure token authentication (updated)** Access to MP4 download links can be - protected using secure tokens passed as query parameters. The token generation - logic has been updated to allow fine-grained protection per file and bitrate. Token generation uses the entire MP4 path, which ensures the token only grants access to a specific quality/version of the video. This prevents unintended - access to other bitrate versions of an ABR stream. Token Query Parameters: + access to other bitrate versions of an ABR stream. + + Token Query Parameters: - token: The generated hash - expires: Expiration timestamp - speed: (optional) Speed limit in bytes/sec, or empty string - - buffer: (optional) Buffer size in bytes, or empty string Optional (for - IP-bound tokens): + - buffer: (optional) Buffer size in bytes, or empty string + + Optional (for IP-bound tokens): + - ip: The user’s IP address Example: - `?md5=QX39c77lbQKvYgMMAvpyMQ&expires=1743167062` Read more in Product - Documentation in Streaming section "Protected temporarily link". + `?md5=QX39c77lbQKvYgMMAvpyMQ&expires=1743167062` + + Read more in Product Documentation in Streaming section "Protected temporarily + link". """ name: Optional[str] = None @@ -178,22 +198,27 @@ class Video(BaseModel): dash_url: Optional[str] = None """ A URL to a master playlist MPEG-DASH (master.mpd) with CMAF or WebM based - chunks. Chunk type will be selected automatically for each quality: + chunks. + + Chunk type will be selected automatically for each quality: - CMAF for H264 and H265 codecs. - WebM for AV1 codec. This URL is a link to the main manifest. But you can also manually specify suffix-options that will allow you to change the manifest to your request: - `/videos/{client_id}_{slug}/master[-min-N][-max-N][-(h264|hevc|av1)].mpd` List - of suffix-options: + `/videos/{client_id}_{slug}/master[-min-N][-max-N][-(h264|hevc|av1)].mpd` + + List of suffix-options: - [-min-N] – ABR soft limitation of qualities from below. - [-max-N] – ABR soft limitation of qualities from above. - [-(h264|hevc|av1) – Video codec soft limitation. Applicable if the video was transcoded into multiple codecs H264, H265 and AV1 at once, but you want to return just 1 video codec in a manifest. Read the Product Documentation for - details. Read more what is ABR soft-limiting in the "`hls_url`" field above. + details. + + Read more what is ABR soft-limiting in the "`hls_url`" field above. Caution. Solely master.mpd is officially documented and intended for your use. Any additional internal manifests, sub-manifests, parameters, chunk names, file @@ -234,9 +259,9 @@ class Video(BaseModel): """ hls_url: Optional[str] = None - """ - A URL to a master playlist HLS (master.m3u8). Chunk type will be selected - automatically: + """A URL to a master playlist HLS (master.m3u8). + + Chunk type will be selected automatically: - TS if your video was encoded to H264 only. - CMAF if your video was encoded additionally to H265 and/or AV1 codecs (as @@ -246,6 +271,7 @@ class Video(BaseModel): You can also manually specify suffix-options that will allow you to change the manifest to your request: `/videos/{client_id}_{video_slug}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8` + List of suffix-options: - [-cmaf] – getting HLS CMAF version of the manifest. Look at the `hls_cmaf_url` @@ -257,12 +283,15 @@ class Video(BaseModel): - [-(h264|hevc|av1) – Video codec soft limitation. Applicable if the video was transcoded into multiple codecs H264, H265 and AV1 at once, but you want to return just 1 video codec in a manifest. Read the Product Documentation for - details. ABR soft-limiting: Soft limitation of the list of qualities allows - you to return not the entire list of transcoded qualities for a video, but - only those you need. For more details look at the Product Documentation. For - example, the video is available in 7 qualities from 360p to 4K, but you want - to return not more than 480p only due to the conditions of distribution of - content to a specific end-user (i.e. free account): + details. + + ABR soft-limiting: Soft limitation of the list of qualities allows you to return + not the entire list of transcoded qualities for a video, but only those you + need. For more details look at the Product Documentation. For example, the video + is available in 7 qualities from 360p to 4K, but you want to return not more + than 480p only due to the conditions of distribution of content to a specific + end-user (i.e. free account): + - To a generic `.../master.m3u8` manifest - Add a suffix-option to limit quality `.../master-max-480.m3u8` - Add a suffix-option to limit quality and codec @@ -280,24 +309,32 @@ class Video(BaseModel): """A URL to a built-in HTML video player with the video inside. It can be inserted into an iframe on your website and the video will - automatically play in all browsers. The player can be opened or shared via this - direct link. Also the video player can be integrated into your web pages using - the Iframe tag. Example of usage on a web page: + automatically play in all browsers. + + The player can be opened or shared via this direct link. Also the video player + can be integrated into your web pages using the Iframe tag. + + Example of usage on a web page: + There are some link modificators you can specify and add manually: - - ?`no_low_latency` – player is forced to use non-low-latency streams HLS MPEG-TS, instead of MPEG-DASH CMAF or HLS/LL-HLS CMAF. - - ?t=(integer) – time to start playback from specified point in the video. Applicable for VOD only. - - ?`sub_lang`=(language) – force subtitles to specific language (2 letters ISO 639 code of a language). + + - ?`no_low_latency` – player is forced to use non-low-latency streams HLS + MPEG-TS, instead of MPEG-DASH CMAF or HLS/LL-HLS CMAF. + - ?t=(integer) – time to start playback from specified point in the video. + Applicable for VOD only. + - ?`sub_lang`=(language) – force subtitles to specific language (2 letters ISO + 639 code of a language). - Read more in the Product Documentation. """ name: Optional[str] = None - """ - Title of the video. Often used as a human-readable name of the video, but can - contain any text you wish. The values are not unique and may be repeated. - Examples: + """Title of the video. + + Often used as a human-readable name of the video, but can contain any text you + wish. The values are not unique and may be repeated. Examples: - Educational training 2024-03-29 - Series X S3E14, The empire strikes back @@ -308,28 +345,42 @@ class Video(BaseModel): """Size of original file""" origin_url: Optional[str] = None - """ - URL to an original file from which the information for transcoding was taken. + """URL to an original file from which the information for transcoding was taken. + May contain a link for scenarios: - If the video was downloaded from another origin - If the video is a recording of a live stream - - Otherwise it is "null" **Copy from another server** URL to an original file - that was downloaded. Look at method "Copy from another server" in POST - /videos. **Recording of an original live stream** URL to the original - non-transcoded stream recording with original quality, saved in MP4 format. - File is created immediately after the completion of the stream recording. The - stream from which the recording was made is reflected in "`stream_id`" field. - Can be used for internal operations when a recording needs to be received - faster than the transcoded versions are ready. But this version is not - intended for public distribution. Views and downloads occur in the usual way, - like viewing an MP4 rendition. The MP4 file becomes available for downloading - when the video entity "status" changes from "new" to "pending". The file is - stored for 7 days, after which it will be automatically deleted. Format of URL - is `/videos/_/origin__.mp4` Where: + - Otherwise it is "null" + + **Copy from another server** + + URL to an original file that was downloaded. Look at method "Copy from another + server" in POST /videos. + + **Recording of an original live stream** + + URL to the original non-transcoded stream recording with original quality, saved + in MP4 format. File is created immediately after the completion of the stream + recording. The stream from which the recording was made is reflected in + "`stream_id`" field. + + Can be used for internal operations when a recording needs to be received faster + than the transcoded versions are ready. But this version is not intended for + public distribution. Views and downloads occur in the usual way, like viewing an + MP4 rendition. + + The MP4 file becomes available for downloading when the video entity "status" + changes from "new" to "pending". The file is stored for 7 days, after which it + will be automatically deleted. + + Format of URL is `/videos/_/origin__.mp4` Where: + - `` – Encoding bitrate in Kbps. - - `` – Video height. This is a premium feature, available only upon - request through your manager or support team. + - `` – Video height. + + This is a premium feature, available only upon request through your manager or + support team. """ origin_video_duration: Optional[int] = None @@ -338,8 +389,11 @@ class Video(BaseModel): poster: Optional[str] = None """ Poster is your own static image which can be displayed before the video begins - playing. This is often a frame of the video or a custom title screen. Field - contains a link to your own uploaded image. Also look at "screenshot" attribute. + playing. This is often a frame of the video or a custom title screen. + + Field contains a link to your own uploaded image. + + Also look at "screenshot" attribute. """ poster_thumb: Optional[str] = None @@ -371,29 +425,34 @@ class Video(BaseModel): The image is selected from an array of all screenshots based on the “`screenshot_id`” attribute. If you use your own "poster", the link to it will - be here too. Our video player uses this field to display the static image before - the video starts playing. As soon as the user hits "play" the image will go - away. If you use your own external video player, then you can use the value of - this field to set the poster/thumbnail in your player. Example: + be here too. + + Our video player uses this field to display the static image before the video + starts playing. As soon as the user hits "play" the image will go away. If you + use your own external video player, then you can use the value of this field to + set the poster/thumbnail in your player. + + Example: - `video_js`.poster: `api.screenshot` - clappr.poster: `api.screenshot` """ screenshot_id: Optional[int] = None - """ - ID of auto generated screenshots to be used for default screenshot. Counting - from 0. A value of -1 sets the "screenshot" attribute to the URL of your own - image from the "poster" attribute. + """ID of auto generated screenshots to be used for default screenshot. + + Counting from 0. A value of -1 sets the "screenshot" attribute to the URL of + your own image from the "poster" attribute. """ screenshots: Optional[List[str]] = None """Array of auto generated screenshots from the video. By default 5 static screenshots are taken from different places in the video. If - the video is short, there may be fewer screenshots. Screenshots are created - automatically, so they may contain not very good frames from the video. To use - your own image look at "poster" attribute. + the video is short, there may be fewer screenshots. + + Screenshots are created automatically, so they may contain not very good frames + from the video. To use your own image look at "poster" attribute. """ share_url: Optional[str] = None @@ -407,7 +466,10 @@ class Video(BaseModel): """ A unique alphanumeric identifier used in public URLs to retrieve and view the video. It is unique for each video, generated randomly and set automatically by - the system. Format of usage in URL is \\**.../videos/{`client_id`}\\__{slug}/...\\** + the system. + + Format of usage in URL is \\**.../videos/{`client_id`}\\__{slug}/...\\** + Example: - Player: /videos/`12345_neAq1bYZ2` diff --git a/src/gcore/types/streaming/video_list_params.py b/src/gcore/types/streaming/video_list_params.py index 2a7e4e9a..91cc9504 100644 --- a/src/gcore/types/streaming/video_list_params.py +++ b/src/gcore/types/streaming/video_list_params.py @@ -38,8 +38,10 @@ class VideoListParams(TypedDict, total=False): If set, the video list is filtered by one combined SQL criterion: - - id={s} OR slug={s} OR name like {s} i.e. "/videos?search=1000" returns list of - videos where id=1000 or slug=1000 or name contains "1000". + - id={s} OR slug={s} OR name like {s} + + i.e. "/videos?search=1000" returns list of videos where id=1000 or slug=1000 or + name contains "1000". """ status: str diff --git a/src/gcore/types/streaming/video_update_params.py b/src/gcore/types/streaming/video_update_params.py index db5ed39f..d1ad1c8a 100644 --- a/src/gcore/types/streaming/video_update_params.py +++ b/src/gcore/types/streaming/video_update_params.py @@ -12,7 +12,9 @@ class VideoUpdateParams(TypedDict, total=False): """Video name""" auto_transcribe_audio_language: Literal["disable", "auto", ""] - """Automatic creation of subtitles by transcribing the audio track. Values: + """Automatic creation of subtitles by transcribing the audio track. + + Values: - disable – Do not transcribe. - auto – Automatically detects the activation of the option based on the @@ -22,7 +24,9 @@ class VideoUpdateParams(TypedDict, total=False): language spoken in the audio track, or when auto language detection fails. Language is set by 3-letter language code according to ISO-639-2 (bibliographic code). List of languages is available in `audio_language` - attribute of API POST /streaming/ai/transcribe . Example: + attribute of API POST /streaming/ai/transcribe . + + Example: ``` auto_transcribe_audio_language: "auto" @@ -41,16 +45,23 @@ class VideoUpdateParams(TypedDict, total=False): """Automatic translation of auto-transcribed subtitles to the specified language(s). - Can be used both together with `auto_transcribe_audio_language` option only. Use - it when you want to make automatic subtitles in languages other than the - original language in audio. Values: + Can be used both together with `auto_transcribe_audio_language` option only. + + Use it when you want to make automatic subtitles in languages other than the + original language in audio. + + Values: - disable – Do not translate. - default – There are 3 default languages: eng,fre,ger - \\ – Explicit language to translate to, or list of languages separated by a comma. Look at list of available languages in description of AI ASR task - creation. If several languages are specified for translation, a separate - subtitle will be generated for each language. Example: + creation. + + If several languages are specified for translation, a separate subtitle will be + generated for each language. + + Example: ``` auto_translate_subtitles_language: default @@ -79,9 +90,10 @@ class VideoUpdateParams(TypedDict, total=False): """ custom_iframe_url: str - """ - Deprecated. Custom URL of IFrame for video player to be used in share panel in - player. Auto generated IFrame URL provided by default + """Deprecated. + + Custom URL of IFrame for video player to be used in share panel in player. Auto + generated IFrame URL provided by default """ description: str @@ -94,8 +106,11 @@ class VideoUpdateParams(TypedDict, total=False): """Authorization HTTP request header. Will be used as credentials to authenticate a request to download a file - (specified in "`origin_url`" parameter) on an external server. Syntax: - `Authorization: ` Examples: + (specified in "`origin_url`" parameter) on an external server. + + Syntax: `Authorization: ` + + Examples: - "`origin_http_headers`": "Authorization: Basic ..." - "`origin_http_headers`": "Authorization: Bearer ..." @@ -121,16 +136,21 @@ class VideoUpdateParams(TypedDict, total=False): """ poster: str - """ - Poster is your own static image which can be displayed before the video starts. + """Poster is your own static image which can be displayed before the video starts. + After uploading the video, the system will automatically create several screenshots (they will be stored in "screenshots" attribute) from which you can select an default screenshot. This "poster" field is for uploading your own image. Also use attribute "`screenshot_id`" to select poster as a default - screnshot. Attribute accepts single image as base64-encoded string + screnshot. + + Attribute accepts single image as base64-encoded string [(RFC 2397 – The "data" URL scheme)](https://www.rfc-editor.org/rfc/rfc2397). In - format: `data:[];base64,` MIME-types are image/jpeg, - image/webp, and image/png and file sizes up to 1Mb. Examples: + format: `data:[];base64,` + + MIME-types are image/jpeg, image/webp, and image/png and file sizes up to 1Mb. + + Examples: - `data:image/jpeg;base64,/9j/4AA...qf/2Q==` - `data:image/png;base64,iVBORw0KGg...ggg==` @@ -141,13 +161,16 @@ class VideoUpdateParams(TypedDict, total=False): """ Priority allows you to adjust the urgency of processing some videos before others in your account, if your algorithm requires it. For example, when there - are very urgent video and some regular ones that can wait in the queue. Value - range, integer [-10..10]. -10 is the lowest down-priority, 10 is the highest - up-priority. Default priority is 0. + are very urgent video and some regular ones that can wait in the queue. + + Value range, integer [-10..10]. -10 is the lowest down-priority, 10 is the + highest up-priority. Default priority is 0. """ projection: str - """Deprecated. Regulates the video format: + """Deprecated. + + Regulates the video format: - **regular** — plays the video as usual - **vr360** — plays the video in 360 degree mode @@ -166,28 +189,34 @@ class VideoUpdateParams(TypedDict, total=False): remote_poster_url: str """ Poster URL to download from external resource, instead of uploading via "poster" - attribute. It has the same restrictions as "poster" attribute. + attribute. + + It has the same restrictions as "poster" attribute. """ remove_poster: bool """Set it to true to remove poster""" screenshot_id: int - """ - Default screenshot index. Specify an ID from the "screenshots" array, so that - the URL of the required screenshot appears in the "screenshot" attribute as the - default screenshot. By default 5 static screenshots will be taken from different - places in the video after transcoding. If the video is short, there may be fewer - screenshots. Counting from 0. A value of -1 sets the default screenshot to the - URL of your own image from the "poster" attribute. Look at "screenshot" - attribute in GET /videos/{`video_id`} for details. + """Default screenshot index. + + Specify an ID from the "screenshots" array, so that the URL of the required + screenshot appears in the "screenshot" attribute as the default screenshot. By + default 5 static screenshots will be taken from different places in the video + after transcoding. If the video is short, there may be fewer screenshots. + + Counting from 0. A value of -1 sets the default screenshot to the URL of your + own image from the "poster" attribute. + + Look at "screenshot" attribute in GET /videos/{`video_id`} for details. """ share_url: str - """ - Deprecated. Custom URL or iframe displayed in the link field when a user clicks - on a sharing button in player. If empty, the link field and social network - sharing is disabled + """Deprecated. + + Custom URL or iframe displayed in the link field when a user clicks on a sharing + button in player. If empty, the link field and social network sharing is + disabled """ source_bitrate_limit: bool @@ -200,16 +229,19 @@ class VideoUpdateParams(TypedDict, total=False): By default `source_bitrate_limit: true` this option allows you to have the output bitrate not more than in the original video, thus to transcode video faster and to deliver it to end-viewers faster as well. At the same time, the - quality will be similar to the original. If for some reason you need more - byte-space in the output quality when encoding, you can set this option to - `source_bitrate_limit: false`. Then, when transcoding, the quality ceiling will - be raised from the bitrate of the original video to the maximum possible limit - specified in our the Product Documentation. For example, this may be needed - when: + quality will be similar to the original. + + If for some reason you need more byte-space in the output quality when encoding, + you can set this option to `source_bitrate_limit: false`. Then, when + transcoding, the quality ceiling will be raised from the bitrate of the original + video to the maximum possible limit specified in our the Product Documentation. + For example, this may be needed when: - to improve the visual quality parameters using PSNR, SSIM, VMAF metrics, - to improve the picture quality on dynamic scenes, - - etc. The option is applied only at the video creation stage and cannot be - changed later. If you want to re-transcode the video using new value, then you - need to create and upload a new video only. + - etc. + + The option is applied only at the video creation stage and cannot be changed + later. If you want to re-transcode the video using new value, then you need to + create and upload a new video only. """ diff --git a/src/gcore/types/waap/domains/advanced_rule_create_params.py b/src/gcore/types/waap/domains/advanced_rule_create_params.py index 019e227a..e761c89f 100644 --- a/src/gcore/types/waap/domains/advanced_rule_create_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_create_params.py @@ -27,7 +27,9 @@ class AdvancedRuleCreateParams(TypedDict, total=False): """A CEL syntax expression that contains the rule's conditions. Allowed objects are: request, whois, session, response, tags, - `user_defined_tags`, `user_agent`, `client_data`. More info can be found here: + `user_defined_tags`, `user_agent`, `client_data`. + + More info can be found here: https://gcore.com/docs/waap/waap-rules/advanced-rules """ @@ -35,13 +37,16 @@ class AdvancedRuleCreateParams(TypedDict, total=False): """The description assigned to the rule""" phase: Optional[Literal["access", "header_filter", "body_filter"]] - """The WAAP request/response phase for applying the rule. + """The WAAP request/response phase for applying the rule. Default is "access". + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + + The "`header_filter`" phase is responsible for modifying the HTTP headers of a + response before they are sent back to the client. - Default is "access". The "access" phase is responsible for modifying the request - before it is sent to the origin server. The "`header_filter`" phase is - responsible for modifying the HTTP headers of a response before they are sent - back to the client. The "`body_filter`" phase is responsible for modifying the - body of a response before it is sent back to the client. + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. """ diff --git a/src/gcore/types/waap/domains/advanced_rule_list_params.py b/src/gcore/types/waap/domains/advanced_rule_list_params.py index 385857d7..dfa975c3 100644 --- a/src/gcore/types/waap/domains/advanced_rule_list_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_list_params.py @@ -46,11 +46,14 @@ class AdvancedRuleListParams(TypedDict, total=False): """Determine the field to order results by""" phase: Literal["access", "header_filter", "body_filter"] - """ - Filter rules based on the WAAP request/response phase for applying the rule. The - "access" phase is responsible for modifying the request before it is sent to the - origin server. The "`header_filter`" phase is responsible for modifying the HTTP - headers of a response before they are sent back to the client. The - "`body_filter`" phase is responsible for modifying the body of a response before - it is sent back to the client. + """Filter rules based on the WAAP request/response phase for applying the rule. + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + + The "`header_filter`" phase is responsible for modifying the HTTP headers of a + response before they are sent back to the client. + + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. """ diff --git a/src/gcore/types/waap/domains/advanced_rule_update_params.py b/src/gcore/types/waap/domains/advanced_rule_update_params.py index 90e297cb..d77ee76e 100644 --- a/src/gcore/types/waap/domains/advanced_rule_update_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_update_params.py @@ -27,20 +27,25 @@ class AdvancedRuleUpdateParams(TypedDict, total=False): """The name assigned to the rule""" phase: Optional[Literal["access", "header_filter", "body_filter"]] - """ - The WAAP request/response phase for applying the rule. The "access" phase is - responsible for modifying the request before it is sent to the origin server. + """The WAAP request/response phase for applying the rule. + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + The "`header_filter`" phase is responsible for modifying the HTTP headers of a - response before they are sent back to the client. The "`body_filter`" phase is - responsible for modifying the body of a response before it is sent back to the - client. + response before they are sent back to the client. + + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. """ source: Optional[str] """A CEL syntax expression that contains the rule's conditions. Allowed objects are: request, whois, session, response, tags, - `user_defined_tags`, `user_agent`, `client_data`. More info can be found here: + `user_defined_tags`, `user_agent`, `client_data`. + + More info can be found here: https://gcore.com/docs/waap/waap-rules/advanced-rules """ diff --git a/src/gcore/types/waap/domains/waap_advanced_rule.py b/src/gcore/types/waap/domains/waap_advanced_rule.py index d9160d4c..c9c4529a 100644 --- a/src/gcore/types/waap/domains/waap_advanced_rule.py +++ b/src/gcore/types/waap/domains/waap_advanced_rule.py @@ -69,7 +69,9 @@ class WaapAdvancedRule(BaseModel): """A CEL syntax expression that contains the rule's conditions. Allowed objects are: request, whois, session, response, tags, - `user_defined_tags`, `user_agent`, `client_data`. More info can be found here: + `user_defined_tags`, `user_agent`, `client_data`. + + More info can be found here: https://gcore.com/docs/waap/waap-rules/advanced-rules """ @@ -77,11 +79,14 @@ class WaapAdvancedRule(BaseModel): """The description assigned to the rule""" phase: Optional[Literal["access", "header_filter", "body_filter"]] = None - """The WAAP request/response phase for applying the rule. + """The WAAP request/response phase for applying the rule. Default is "access". + + The "access" phase is responsible for modifying the request before it is sent to + the origin server. + + The "`header_filter`" phase is responsible for modifying the HTTP headers of a + response before they are sent back to the client. - Default is "access". The "access" phase is responsible for modifying the request - before it is sent to the origin server. The "`header_filter`" phase is - responsible for modifying the HTTP headers of a response before they are sent - back to the client. The "`body_filter`" phase is responsible for modifying the - body of a response before it is sent back to the client. + The "`body_filter`" phase is responsible for modifying the body of a response + before it is sent back to the client. """ From 25605419cf1878d28e77251f44246b68212efb8a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Sep 2025 19:27:49 +0000 Subject: [PATCH 11/23] chore: improve example values --- tests/api_resources/cloud/baremetal/test_servers.py | 8 ++++---- tests/api_resources/cloud/k8s/test_clusters.py | 8 ++++---- .../api_resources/cloud/load_balancers/test_listeners.py | 8 ++++---- tests/api_resources/cloud/test_load_balancers.py | 4 ++-- tests/api_resources/cloud/users/test_role_assignments.py | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/api_resources/cloud/baremetal/test_servers.py b/tests/api_resources/cloud/baremetal/test_servers.py index 355896d0..7482ef7b 100644 --- a/tests/api_resources/cloud/baremetal/test_servers.py +++ b/tests/api_resources/cloud/baremetal/test_servers.py @@ -51,9 +51,9 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "fields": [ { "base_field": 10, - "field_name": "field_name", + "field_name": None, "field_value": [45046, 45047], - "value": "value", + "value": None, } ], }, @@ -255,9 +255,9 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "fields": [ { "base_field": 10, - "field_name": "field_name", + "field_name": None, "field_value": [45046, 45047], - "value": "value", + "value": None, } ], }, diff --git a/tests/api_resources/cloud/k8s/test_clusters.py b/tests/api_resources/cloud/k8s/test_clusters.py index 1cb521cd..219f9e08 100644 --- a/tests/api_resources/cloud/k8s/test_clusters.py +++ b/tests/api_resources/cloud/k8s/test_clusters.py @@ -100,7 +100,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: { "base_field": 10, "field_value": [45046, 45047], - "value": "value", + "value": None, } ], "profile_template": 29, @@ -216,7 +216,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: { "base_field": 10, "field_value": [45046, 45047], - "value": "value", + "value": None, } ], "profile_template": 29, @@ -675,7 +675,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> { "base_field": 10, "field_value": [45046, 45047], - "value": "value", + "value": None, } ], "profile_template": 29, @@ -791,7 +791,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> { "base_field": 10, "field_value": [45046, 45047], - "value": "value", + "value": None, } ], "profile_template": 29, diff --git a/tests/api_resources/cloud/load_balancers/test_listeners.py b/tests/api_resources/cloud/load_balancers/test_listeners.py index ac026380..2605c9f6 100644 --- a/tests/api_resources/cloud/load_balancers/test_listeners.py +++ b/tests/api_resources/cloud/load_balancers/test_listeners.py @@ -45,7 +45,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: sni_secret_id=["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], timeout_client_data=50000, timeout_member_connect=50000, - timeout_member_data=0, + timeout_member_data=None, user_list=[ { "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", @@ -111,7 +111,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: sni_secret_id=["af4a64e7-03ca-470f-9a09-b77d54c5abd8", "12b43d95-d420-4c79-a883-49bf146cbdff"], timeout_client_data=50000, timeout_member_connect=50000, - timeout_member_data=0, + timeout_member_data=None, user_list=[ { "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", @@ -338,7 +338,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> sni_secret_id=["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], timeout_client_data=50000, timeout_member_connect=50000, - timeout_member_data=0, + timeout_member_data=None, user_list=[ { "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", @@ -404,7 +404,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> sni_secret_id=["af4a64e7-03ca-470f-9a09-b77d54c5abd8", "12b43d95-d420-4c79-a883-49bf146cbdff"], timeout_client_data=50000, timeout_member_connect=50000, - timeout_member_data=0, + timeout_member_data=None, user_list=[ { "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", diff --git a/tests/api_resources/cloud/test_load_balancers.py b/tests/api_resources/cloud/test_load_balancers.py index f1ba8d09..85a8fdb7 100644 --- a/tests/api_resources/cloud/test_load_balancers.py +++ b/tests/api_resources/cloud/test_load_balancers.py @@ -106,7 +106,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: "sni_secret_id": ["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], "timeout_client_data": 50000, "timeout_member_connect": 50000, - "timeout_member_data": 0, + "timeout_member_data": None, "user_list": [ { "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", @@ -574,7 +574,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> "sni_secret_id": ["f2e734d0-fa2b-42c2-ad33-4c6db5101e00", "eb121225-7ded-4ff3-ae1f-599e145dd7cb"], "timeout_client_data": 50000, "timeout_member_connect": 50000, - "timeout_member_data": 0, + "timeout_member_data": None, "user_list": [ { "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5", diff --git a/tests/api_resources/cloud/users/test_role_assignments.py b/tests/api_resources/cloud/users/test_role_assignments.py index 2c74e087..d4ffeb4c 100644 --- a/tests/api_resources/cloud/users/test_role_assignments.py +++ b/tests/api_resources/cloud/users/test_role_assignments.py @@ -35,7 +35,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: role="ClientAdministrator", user_id=777, client_id=8, - project_id=0, + project_id=None, ) assert_matches_type(RoleAssignment, role_assignment, path=["response"]) @@ -81,7 +81,7 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: role="ClientAdministrator", user_id=777, client_id=8, - project_id=0, + project_id=None, ) assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) @@ -199,7 +199,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> role="ClientAdministrator", user_id=777, client_id=8, - project_id=0, + project_id=None, ) assert_matches_type(RoleAssignment, role_assignment, path=["response"]) @@ -245,7 +245,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> role="ClientAdministrator", user_id=777, client_id=8, - project_id=0, + project_id=None, ) assert_matches_type(RoleAssignmentUpdateDelete, role_assignment, path=["response"]) From 92ed2a3c8dc7cef28a4e72dcc051822ef879f952 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 23 Sep 2025 09:00:09 +0000 Subject: [PATCH 12/23] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index bf3f4fca..9d77d289 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e543fc395c453a5bb59daf3463c5bbaf7fde7a7ffc957225eb2986c35d2c97ed.yml openapi_spec_hash: b4be9c9d643d7d20c45dcffe381d1595 -config_hash: cd9ebeaa0d08830a9e995e37db3cd6e1 +config_hash: fee4391924d7ea28b2bb5e5d81c8778f From 0199b8ccce3fc74ba60586b9cbe6411b29bf9ece Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 23 Sep 2025 12:14:58 +0000 Subject: [PATCH 13/23] feat(api): aggregated API specs update --- .stats.yml | 4 +- .../resources/cloud/k8s/clusters/clusters.py | 16 ++++++ .../cloud/k8s/clusters/pools/pools.py | 4 +- .../types/cloud/k8s/cluster_create_params.py | 40 +++++++++++++ .../types/cloud/k8s/cluster_update_params.py | 56 ++++++++++++++++++- .../cloud/k8s/clusters/pool_update_params.py | 2 +- src/gcore/types/cloud/k8s/k8s_cluster.py | 36 ++++++++++++ .../api_resources/cloud/k8s/test_clusters.py | 32 +++++++++++ 8 files changed, 183 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9d77d289..3932b1fa 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-e543fc395c453a5bb59daf3463c5bbaf7fde7a7ffc957225eb2986c35d2c97ed.yml -openapi_spec_hash: b4be9c9d643d7d20c45dcffe381d1595 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-71ebc8da15fdc297934029972bf2536f4abc6a167b38df66cf8c3f5a0d69bf4a.yml +openapi_spec_hash: ac7c9a26fa95888ecb41f32b35f9a7ec config_hash: fee4391924d7ea28b2bb5e5d81c8778f diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index 3e3f3398..cda6a936 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -86,6 +86,7 @@ def create( name: str, pools: Iterable[cluster_create_params.Pool], version: str, + add_ons: cluster_create_params.AddOns | Omit = omit, authentication: Optional[cluster_create_params.Authentication] | Omit = omit, autoscaler_config: Optional[Dict[str, str]] | Omit = omit, cni: Optional[cluster_create_params.Cni] | Omit = omit, @@ -118,6 +119,8 @@ def create( version: The version of the k8s cluster + add_ons: Cluster add-ons configuration + authentication: Authentication settings autoscaler_config: Cluster autoscaler configuration. @@ -220,6 +223,7 @@ def create( "name": name, "pools": pools, "version": version, + "add_ons": add_ons, "authentication": authentication, "autoscaler_config": autoscaler_config, "cni": cni, @@ -248,6 +252,7 @@ def update( *, project_id: int | None = None, region_id: int | None = None, + add_ons: cluster_update_params.AddOns | Omit = omit, authentication: Optional[cluster_update_params.Authentication] | Omit = omit, autoscaler_config: Optional[Dict[str, str]] | Omit = omit, cni: Optional[cluster_update_params.Cni] | Omit = omit, @@ -264,6 +269,8 @@ def update( Update k8s cluster Args: + add_ons: Cluster add-ons configuration + authentication: Authentication settings autoscaler_config: Cluster autoscaler configuration. @@ -348,6 +355,7 @@ def update( f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=maybe_transform( { + "add_ons": add_ons, "authentication": authentication, "autoscaler_config": autoscaler_config, "cni": cni, @@ -681,6 +689,7 @@ async def create( name: str, pools: Iterable[cluster_create_params.Pool], version: str, + add_ons: cluster_create_params.AddOns | Omit = omit, authentication: Optional[cluster_create_params.Authentication] | Omit = omit, autoscaler_config: Optional[Dict[str, str]] | Omit = omit, cni: Optional[cluster_create_params.Cni] | Omit = omit, @@ -713,6 +722,8 @@ async def create( version: The version of the k8s cluster + add_ons: Cluster add-ons configuration + authentication: Authentication settings autoscaler_config: Cluster autoscaler configuration. @@ -815,6 +826,7 @@ async def create( "name": name, "pools": pools, "version": version, + "add_ons": add_ons, "authentication": authentication, "autoscaler_config": autoscaler_config, "cni": cni, @@ -843,6 +855,7 @@ async def update( *, project_id: int | None = None, region_id: int | None = None, + add_ons: cluster_update_params.AddOns | Omit = omit, authentication: Optional[cluster_update_params.Authentication] | Omit = omit, autoscaler_config: Optional[Dict[str, str]] | Omit = omit, cni: Optional[cluster_update_params.Cni] | Omit = omit, @@ -859,6 +872,8 @@ async def update( Update k8s cluster Args: + add_ons: Cluster add-ons configuration + authentication: Authentication settings autoscaler_config: Cluster autoscaler configuration. @@ -943,6 +958,7 @@ async def update( f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=await async_maybe_transform( { + "add_ons": add_ons, "authentication": authentication, "autoscaler_config": autoscaler_config, "cni": cni, diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index 18e410c3..72cb9321 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -187,7 +187,7 @@ def update( min_node_count: Minimum node count - node_count: Current node count + node_count: This field is deprecated. Please use the cluster pool resize handler instead. taints: Taints applied to the cluster pool @@ -549,7 +549,7 @@ async def update( min_node_count: Minimum node count - node_count: Current node count + node_count: This field is deprecated. Please use the cluster pool resize handler instead. taints: Taints applied to the cluster pool diff --git a/src/gcore/types/cloud/k8s/cluster_create_params.py b/src/gcore/types/cloud/k8s/cluster_create_params.py index d0b1050e..c49852c6 100644 --- a/src/gcore/types/cloud/k8s/cluster_create_params.py +++ b/src/gcore/types/cloud/k8s/cluster_create_params.py @@ -5,11 +5,14 @@ from typing import Dict, List, Iterable, Optional from typing_extensions import Literal, Required, TypedDict +from ...._types import SequenceNotStr from ..laas_index_retention_policy_param import LaasIndexRetentionPolicyParam __all__ = [ "ClusterCreateParams", "Pool", + "AddOns", + "AddOnsSlurm", "Authentication", "AuthenticationOidc", "Cni", @@ -39,6 +42,9 @@ class ClusterCreateParams(TypedDict, total=False): version: Required[str] """The version of the k8s cluster""" + add_ons: AddOns + """Cluster add-ons configuration""" + authentication: Optional[Authentication] """Authentication settings""" @@ -177,6 +183,40 @@ class Pool(TypedDict, total=False): """Taints applied to the cluster pool""" +class AddOnsSlurm(TypedDict, total=False): + enabled: Required[Literal[True]] + """The Slurm add-on will be enabled in the cluster. + + This add-on is only supported in clusters running Kubernetes v1.31 and v1.32 + with at least 1 GPU cluster pool and VAST NFS support enabled. + """ + + file_share_id: Required[str] + """ID of a VAST file share to be used as Slurm storage. + + The Slurm add-on will create separate Persistent Volume Claims for different + purposes (controller spool, worker spool, jail) on that file share. + + The file share must have `root_squash` disabled, while `path_length` and + `allowed_characters` settings must be set to `NPL`. + """ + + ssh_key_ids: Required[SequenceNotStr[str]] + """IDs of SSH keys to authorize for SSH connection to Slurm login nodes.""" + + worker_count: Required[int] + """Size of the worker pool, i.e. the number of Slurm worker nodes. + + Each Slurm worker node will be backed by a Pod scheduled on one of cluster's GPU + nodes. + """ + + +class AddOns(TypedDict, total=False): + slurm: AddOnsSlurm + """Slurm add-on configuration""" + + class AuthenticationOidc(TypedDict, total=False): client_id: Optional[str] """Client ID""" diff --git a/src/gcore/types/cloud/k8s/cluster_update_params.py b/src/gcore/types/cloud/k8s/cluster_update_params.py index 32011180..01670802 100644 --- a/src/gcore/types/cloud/k8s/cluster_update_params.py +++ b/src/gcore/types/cloud/k8s/cluster_update_params.py @@ -2,13 +2,18 @@ from __future__ import annotations -from typing import Dict, List, Iterable, Optional -from typing_extensions import Literal, Required, TypedDict +from typing import Dict, List, Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict +from ...._types import SequenceNotStr from ..laas_index_retention_policy_param import LaasIndexRetentionPolicyParam __all__ = [ "ClusterUpdateParams", + "AddOns", + "AddOnsSlurm", + "AddOnsSlurmK8sClusterSlurmAddonEnableV2Serializer", + "AddOnsSlurmK8sClusterSlurmAddonDisableV2Serializer", "Authentication", "AuthenticationOidc", "Cni", @@ -24,6 +29,9 @@ class ClusterUpdateParams(TypedDict, total=False): region_id: int + add_ons: AddOns + """Cluster add-ons configuration""" + authentication: Optional[Authentication] """Authentication settings""" @@ -97,6 +105,50 @@ class ClusterUpdateParams(TypedDict, total=False): """Logging configuration""" +class AddOnsSlurmK8sClusterSlurmAddonEnableV2Serializer(TypedDict, total=False): + enabled: Required[Literal[True]] + """The Slurm add-on will be enabled in the cluster. + + This add-on is only supported in clusters running Kubernetes v1.31 and v1.32 + with at least 1 GPU cluster pool and VAST NFS support enabled. + """ + + file_share_id: Required[str] + """ID of a VAST file share to be used as Slurm storage. + + The Slurm add-on will create separate Persistent Volume Claims for different + purposes (controller spool, worker spool, jail) on that file share. + + The file share must have `root_squash` disabled, while `path_length` and + `allowed_characters` settings must be set to `NPL`. + """ + + ssh_key_ids: Required[SequenceNotStr[str]] + """IDs of SSH keys to authorize for SSH connection to Slurm login nodes.""" + + worker_count: Required[int] + """Size of the worker pool, i.e. the number of Slurm worker nodes. + + Each Slurm worker node will be backed by a Pod scheduled on one of cluster's GPU + nodes. + """ + + +class AddOnsSlurmK8sClusterSlurmAddonDisableV2Serializer(TypedDict, total=False): + enabled: Required[bool] + """The Slurm add-on will be disabled in the cluster.""" + + +AddOnsSlurm: TypeAlias = Union[ + AddOnsSlurmK8sClusterSlurmAddonEnableV2Serializer, AddOnsSlurmK8sClusterSlurmAddonDisableV2Serializer +] + + +class AddOns(TypedDict, total=False): + slurm: AddOnsSlurm + """Slurm add-on configuration""" + + class AuthenticationOidc(TypedDict, total=False): client_id: Optional[str] """Client ID""" diff --git a/src/gcore/types/cloud/k8s/clusters/pool_update_params.py b/src/gcore/types/cloud/k8s/clusters/pool_update_params.py index 877e80ca..16a46ed7 100644 --- a/src/gcore/types/cloud/k8s/clusters/pool_update_params.py +++ b/src/gcore/types/cloud/k8s/clusters/pool_update_params.py @@ -28,7 +28,7 @@ class PoolUpdateParams(TypedDict, total=False): """Minimum node count""" node_count: Optional[int] - """Current node count""" + """This field is deprecated. Please use the cluster pool resize handler instead.""" taints: Optional[Dict[str, str]] """Taints applied to the cluster pool""" diff --git a/src/gcore/types/cloud/k8s/k8s_cluster.py b/src/gcore/types/cloud/k8s/k8s_cluster.py index 1df10feb..a93825fd 100644 --- a/src/gcore/types/cloud/k8s/k8s_cluster.py +++ b/src/gcore/types/cloud/k8s/k8s_cluster.py @@ -10,6 +10,8 @@ __all__ = [ "K8sCluster", + "AddOns", + "AddOnsSlurm", "Csi", "CsiNfs", "Authentication", @@ -21,6 +23,37 @@ ] +class AddOnsSlurm(BaseModel): + enabled: bool + """Indicates whether Slurm add-on is deployed in the cluster. + + This add-on is only supported in clusters running Kubernetes v1.31 and v1.32 + with at least 1 GPU cluster pool. + """ + + file_share_id: Optional[str] = None + """ID of a VAST file share used as Slurm storage. + + The Slurm add-on creates separate Persistent Volume Claims for different + purposes (controller spool, worker spool, jail) on that file share. + """ + + ssh_key_ids: Optional[List[str]] = None + """IDs of SSH keys authorized for SSH connection to Slurm login nodes.""" + + worker_count: Optional[int] = None + """Size of the worker pool, i.e. number of worker nodes. + + Each Slurm worker node is backed by a Pod scheduled on one of cluster's GPU + nodes. + """ + + +class AddOns(BaseModel): + slurm: AddOnsSlurm + """Slurm add-on configuration""" + + class CsiNfs(BaseModel): vast_enabled: bool """Indicates the status of VAST NFS integration""" @@ -135,6 +168,9 @@ class K8sCluster(BaseModel): id: str """Cluster pool uuid""" + add_ons: AddOns + """Cluster add-ons configuration""" + created_at: str """Function creation date""" diff --git a/tests/api_resources/cloud/k8s/test_clusters.py b/tests/api_resources/cloud/k8s/test_clusters.py index 219f9e08..800f7316 100644 --- a/tests/api_resources/cloud/k8s/test_clusters.py +++ b/tests/api_resources/cloud/k8s/test_clusters.py @@ -66,6 +66,14 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: } ], version="1.28.1", + add_ons={ + "slurm": { + "enabled": True, + "file_share_id": "cbc94d0e-06c6-4d12-9e86-9782ba14fc8c", + "ssh_key_ids": ["25735292-bd97-44b0-a1af-d7eab876261d", "efc01f3a-35b9-4385-89f9-e38439093ee7"], + "worker_count": 2, + } + }, authentication={ "oidc": { "client_id": "kubernetes", @@ -183,6 +191,14 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: cluster_name="cluster_name", project_id=0, region_id=0, + add_ons={ + "slurm": { + "enabled": True, + "file_share_id": "cbc94d0e-06c6-4d12-9e86-9782ba14fc8c", + "ssh_key_ids": ["25735292-bd97-44b0-a1af-d7eab876261d", "efc01f3a-35b9-4385-89f9-e38439093ee7"], + "worker_count": 2, + } + }, authentication={ "oidc": { "client_id": "kubernetes", @@ -641,6 +657,14 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> } ], version="1.28.1", + add_ons={ + "slurm": { + "enabled": True, + "file_share_id": "cbc94d0e-06c6-4d12-9e86-9782ba14fc8c", + "ssh_key_ids": ["25735292-bd97-44b0-a1af-d7eab876261d", "efc01f3a-35b9-4385-89f9-e38439093ee7"], + "worker_count": 2, + } + }, authentication={ "oidc": { "client_id": "kubernetes", @@ -758,6 +782,14 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> cluster_name="cluster_name", project_id=0, region_id=0, + add_ons={ + "slurm": { + "enabled": True, + "file_share_id": "cbc94d0e-06c6-4d12-9e86-9782ba14fc8c", + "ssh_key_ids": ["25735292-bd97-44b0-a1af-d7eab876261d", "efc01f3a-35b9-4385-89f9-e38439093ee7"], + "worker_count": 2, + } + }, authentication={ "oidc": { "client_id": "kubernetes", From de1f58fa170146142a9f871d8b69c42158e72d9e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 24 Sep 2025 10:43:49 +0000 Subject: [PATCH 14/23] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3932b1fa..cda32772 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-71ebc8da15fdc297934029972bf2536f4abc6a167b38df66cf8c3f5a0d69bf4a.yml -openapi_spec_hash: ac7c9a26fa95888ecb41f32b35f9a7ec +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-be6f9c6c28bd770713d6e945c3f39f5137cef8294b04e4b8dfe05d221d27bef0.yml +openapi_spec_hash: af720572990100486b48af60a6a2e077 config_hash: fee4391924d7ea28b2bb5e5d81c8778f From 0e7967b1f6be77cac807f5a1e3d3483c9151902b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 24 Sep 2025 13:38:47 +0000 Subject: [PATCH 15/23] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/_client.py | 10 +- src/gcore/resources/cloud/audit_logs.py | 8 +- .../resources/cloud/baremetal/flavors.py | 8 +- src/gcore/resources/cloud/baremetal/images.py | 8 +- .../resources/cloud/baremetal/servers.py | 24 ++- .../resources/cloud/billing_reservations.py | 16 +- src/gcore/resources/cloud/cost_reports.py | 24 ++- .../cloud/file_shares/access_rules.py | 24 ++- .../cloud/file_shares/file_shares.py | 48 +++-- src/gcore/resources/cloud/floating_ips.py | 56 ++++-- .../cloud/gpu_baremetal_clusters/flavors.py | 8 +- .../gpu_baremetal_clusters.py | 64 ++++-- .../cloud/gpu_baremetal_clusters/images.py | 32 ++- .../gpu_baremetal_clusters/interfaces.py | 8 +- .../cloud/gpu_baremetal_clusters/servers.py | 56 ++++-- .../resources/cloud/inference/api_keys.py | 40 +++- .../inference/applications/deployments.py | 40 +++- .../cloud/inference/applications/templates.py | 16 +- .../inference/deployments/deployments.py | 64 ++++-- .../cloud/inference/deployments/logs.py | 8 +- .../resources/cloud/inference/flavors.py | 16 +- .../resources/cloud/inference/inference.py | 8 +- .../cloud/inference/registry_credentials.py | 40 +++- .../resources/cloud/inference/secrets.py | 40 +++- .../resources/cloud/instances/flavors.py | 8 +- src/gcore/resources/cloud/instances/images.py | 48 +++-- .../resources/cloud/instances/instances.py | 112 ++++++++--- .../resources/cloud/instances/interfaces.py | 24 ++- .../resources/cloud/instances/metrics.py | 8 +- src/gcore/resources/cloud/ip_ranges.py | 8 +- .../resources/cloud/k8s/clusters/clusters.py | 72 +++++-- .../resources/cloud/k8s/clusters/nodes.py | 16 +- .../cloud/k8s/clusters/pools/nodes.py | 16 +- .../cloud/k8s/clusters/pools/pools.py | 48 +++-- src/gcore/resources/cloud/k8s/flavors.py | 8 +- src/gcore/resources/cloud/k8s/k8s.py | 8 +- .../resources/cloud/load_balancers/flavors.py | 8 +- .../load_balancers/l7_policies/l7_policies.py | 40 +++- .../cloud/load_balancers/l7_policies/rules.py | 40 +++- .../cloud/load_balancers/listeners.py | 40 +++- .../cloud/load_balancers/load_balancers.py | 56 ++++-- .../resources/cloud/load_balancers/metrics.py | 8 +- .../load_balancers/pools/health_monitors.py | 16 +- .../cloud/load_balancers/pools/members.py | 16 +- .../cloud/load_balancers/pools/pools.py | 40 +++- .../cloud/load_balancers/statuses.py | 16 +- .../resources/cloud/networks/networks.py | 40 +++- src/gcore/resources/cloud/networks/routers.py | 56 ++++-- src/gcore/resources/cloud/networks/subnets.py | 40 +++- src/gcore/resources/cloud/placement_groups.py | 32 ++- src/gcore/resources/cloud/projects.py | 32 ++- src/gcore/resources/cloud/quotas/quotas.py | 24 ++- src/gcore/resources/cloud/quotas/requests.py | 32 ++- src/gcore/resources/cloud/regions.py | 12 +- .../resources/cloud/registries/artifacts.py | 16 +- .../resources/cloud/registries/registries.py | 40 +++- .../cloud/registries/repositories.py | 16 +- src/gcore/resources/cloud/registries/tags.py | 8 +- src/gcore/resources/cloud/registries/users.py | 48 +++-- .../reserved_fixed_ips/reserved_fixed_ips.py | 32 ++- .../resources/cloud/reserved_fixed_ips/vip.py | 40 +++- src/gcore/resources/cloud/secrets.py | 32 ++- .../resources/cloud/security_groups/rules.py | 24 ++- .../cloud/security_groups/security_groups.py | 56 ++++-- src/gcore/resources/cloud/ssh_keys.py | 40 +++- src/gcore/resources/cloud/tasks.py | 28 ++- src/gcore/resources/cloud/usage_reports.py | 8 +- .../resources/cloud/users/role_assignments.py | 32 ++- src/gcore/resources/cloud/volumes.py | 80 ++++++-- src/gcore/resources/dns/dns.py | 12 +- src/gcore/resources/dns/locations.py | 28 ++- src/gcore/resources/dns/metrics.py | 8 +- src/gcore/resources/dns/pickers/pickers.py | 4 +- src/gcore/resources/dns/pickers/presets.py | 8 +- src/gcore/resources/dns/zones/dnssec.py | 16 +- src/gcore/resources/dns/zones/rrsets.py | 48 +++-- src/gcore/resources/dns/zones/zones.py | 80 +++++--- src/gcore/resources/fastedge/apps/apps.py | 40 ++-- src/gcore/resources/fastedge/apps/logs.py | 8 +- src/gcore/resources/fastedge/binaries.py | 32 ++- src/gcore/resources/fastedge/fastedge.py | 4 +- src/gcore/resources/fastedge/kv_stores.py | 32 ++- src/gcore/resources/fastedge/secrets.py | 48 +++-- src/gcore/resources/fastedge/statistics.py | 16 +- src/gcore/resources/fastedge/templates.py | 40 +++- src/gcore/resources/iam/api_tokens.py | 32 ++- src/gcore/resources/iam/iam.py | 4 +- src/gcore/resources/iam/users.py | 36 +++- src/gcore/resources/security/bgp_announces.py | 16 +- src/gcore/resources/security/events.py | 8 +- .../resources/security/profile_templates.py | 8 +- src/gcore/resources/security/profiles.py | 48 +++-- .../resources/storage/buckets/buckets.py | 24 ++- src/gcore/resources/storage/buckets/cors.py | 16 +- .../resources/storage/buckets/lifecycle.py | 16 +- src/gcore/resources/storage/buckets/policy.py | 24 ++- src/gcore/resources/storage/credentials.py | 8 +- src/gcore/resources/storage/locations.py | 8 +- src/gcore/resources/storage/statistics.py | 16 +- src/gcore/resources/storage/storage.py | 64 ++++-- src/gcore/resources/streaming/ai_tasks.py | 28 ++- src/gcore/resources/streaming/broadcasts.py | 48 +++-- src/gcore/resources/streaming/directories.py | 40 +++- src/gcore/resources/streaming/players.py | 40 ++-- src/gcore/resources/streaming/playlists.py | 48 +++-- src/gcore/resources/streaming/quality_sets.py | 16 +- src/gcore/resources/streaming/restreams.py | 40 +++- src/gcore/resources/streaming/statistics.py | 184 +++++++++++++----- .../resources/streaming/streams/overlays.py | 48 +++-- .../resources/streaming/streams/streams.py | 72 +++++-- .../resources/streaming/videos/subtitles.py | 40 +++- .../resources/streaming/videos/videos.py | 56 ++++-- src/gcore/resources/waap/advanced_rules.py | 8 +- src/gcore/resources/waap/custom_page_sets.py | 48 +++-- .../resources/waap/domains/advanced_rules.py | 48 +++-- .../resources/waap/domains/api_discovery.py | 48 +++-- .../resources/waap/domains/api_path_groups.py | 8 +- src/gcore/resources/waap/domains/api_paths.py | 40 +++- .../resources/waap/domains/custom_rules.py | 56 ++++-- src/gcore/resources/waap/domains/domains.py | 44 +++-- .../resources/waap/domains/firewall_rules.py | 56 ++++-- .../waap/domains/insight_silences.py | 40 +++- src/gcore/resources/waap/domains/insights.py | 24 ++- src/gcore/resources/waap/domains/settings.py | 16 +- .../resources/waap/domains/statistics.py | 48 +++-- src/gcore/resources/waap/insights.py | 8 +- src/gcore/resources/waap/ip_info/ip_info.py | 64 ++++-- src/gcore/resources/waap/ip_info/metrics.py | 8 +- src/gcore/resources/waap/organizations.py | 8 +- src/gcore/resources/waap/statistics.py | 8 +- src/gcore/resources/waap/tags.py | 4 +- src/gcore/resources/waap/waap.py | 4 +- 133 files changed, 3042 insertions(+), 1052 deletions(-) diff --git a/.stats.yml b/.stats.yml index cda32772..29162beb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-be6f9c6c28bd770713d6e945c3f39f5137cef8294b04e4b8dfe05d221d27bef0.yml -openapi_spec_hash: af720572990100486b48af60a6a2e077 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-529e656a1e2b65a9adec55ae8207a9bc5a2bdd9c7adf846627aab1fa721f8e66.yml +openapi_spec_hash: 83d94f9375542b87f0227c982076ac1f config_hash: fee4391924d7ea28b2bb5e5d81c8778f diff --git a/src/gcore/_client.py b/src/gcore/_client.py index 837f0881..51d339d9 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -113,6 +113,7 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") + self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -197,7 +198,7 @@ def copy( params = set_default_query http_client = http_client or self._client - return self.__class__( + client = self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -210,6 +211,8 @@ def copy( default_query=params, **_extra_kwargs, ) + client._base_url_overridden = self._base_url_overridden or base_url is not None + return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) @@ -340,6 +343,7 @@ def __init__( if base_url is None: base_url = os.environ.get("GCORE_BASE_URL") + self._base_url_overridden = base_url is not None if base_url is None: base_url = f"https://api.gcore.com" @@ -424,7 +428,7 @@ def copy( params = set_default_query http_client = http_client or self._client - return self.__class__( + client = self.__class__( api_key=api_key or self.api_key, cloud_project_id=cloud_project_id or self.cloud_project_id, cloud_region_id=cloud_region_id or self.cloud_region_id, @@ -437,6 +441,8 @@ def copy( default_query=params, **_extra_kwargs, ) + client._base_url_overridden = self._base_url_overridden or base_url is not None + return client # Alias for `copy` for nicer inline usage, e.g. # client.with_options(timeout=10).foo.create(...) diff --git a/src/gcore/resources/cloud/audit_logs.py b/src/gcore/resources/cloud/audit_logs.py index 0e942e4e..0c1a5060 100644 --- a/src/gcore/resources/cloud/audit_logs.py +++ b/src/gcore/resources/cloud/audit_logs.py @@ -206,7 +206,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions", + "/cloud/v1/user_actions" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/user_actions", page=SyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, @@ -415,7 +417,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/user_actions", + "/cloud/v1/user_actions" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/user_actions", page=AsyncOffsetPage[AuditLogEntry], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/baremetal/flavors.py b/src/gcore/resources/cloud/baremetal/flavors.py index 454b0c7f..202234f1 100644 --- a/src/gcore/resources/cloud/baremetal/flavors.py +++ b/src/gcore/resources/cloud/baremetal/flavors.py @@ -93,7 +93,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -187,7 +189,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmflavors/{project_id}/{region_id}", + f"/cloud/v1/bmflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/images.py b/src/gcore/resources/cloud/baremetal/images.py index 16f4d22c..ddb9f507 100644 --- a/src/gcore/resources/cloud/baremetal/images.py +++ b/src/gcore/resources/cloud/baremetal/images.py @@ -90,7 +90,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -178,7 +180,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/bmimages/{project_id}/{region_id}", + f"/cloud/v1/bmimages/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bmimages/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/baremetal/servers.py b/src/gcore/resources/cloud/baremetal/servers.py index a41d040d..eb158861 100644 --- a/src/gcore/resources/cloud/baremetal/servers.py +++ b/src/gcore/resources/cloud/baremetal/servers.py @@ -161,7 +161,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -299,7 +301,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", page=SyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -382,7 +386,9 @@ def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=maybe_transform( { "image_id": image_id, @@ -648,7 +654,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -786,7 +794,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/bminstances/{project_id}/{region_id}", + f"/cloud/v1/bminstances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}", page=AsyncOffsetPage[BaremetalServer], options=make_request_options( extra_headers=extra_headers, @@ -869,7 +879,9 @@ async def rebuild( if not server_id: raise ValueError(f"Expected a non-empty value for `server_id` but received {server_id!r}") return await self._post( - f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", + f"/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/bminstances/{project_id}/{region_id}/{server_id}/rebuild", body=await async_maybe_transform( { "image_id": image_id, diff --git a/src/gcore/resources/cloud/billing_reservations.py b/src/gcore/resources/cloud/billing_reservations.py index c25bd06c..ed15046f 100644 --- a/src/gcore/resources/cloud/billing_reservations.py +++ b/src/gcore/resources/cloud/billing_reservations.py @@ -120,7 +120,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations", + "/cloud/v1/reservations" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservations", page=SyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +176,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -276,7 +280,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/reservations", + "/cloud/v1/reservations" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservations", page=AsyncOffsetPage[BillingReservation], options=make_request_options( extra_headers=extra_headers, @@ -330,7 +336,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v1/reservations/{reservation_id}", + f"/cloud/v1/reservations/{reservation_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reservations/{reservation_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/cost_reports.py b/src/gcore/resources/cloud/cost_reports.py index 1ee323ee..6871f862 100644 --- a/src/gcore/resources/cloud/cost_reports.py +++ b/src/gcore/resources/cloud/cost_reports.py @@ -150,7 +150,9 @@ def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/totals", body=maybe_transform( { "time_from": time_from, @@ -261,7 +263,9 @@ def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", body=maybe_transform( { "regions": regions, @@ -390,7 +394,9 @@ def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/resources", body=maybe_transform( { "time_from": time_from, @@ -535,7 +541,9 @@ async def get_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/totals", + "/cloud/v1/cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/totals", body=await async_maybe_transform( { "time_from": time_from, @@ -646,7 +654,9 @@ async def get_aggregated_monthly( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/reservation_cost_report/totals", + "/cloud/v1/reservation_cost_report/totals" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/reservation_cost_report/totals", body=await async_maybe_transform( { "regions": regions, @@ -775,7 +785,9 @@ async def get_detailed( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/cost_report/resources", + "/cloud/v1/cost_report/resources" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/cost_report/resources", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/file_shares/access_rules.py b/src/gcore/resources/cloud/file_shares/access_rules.py index 6750a7c5..fa8f4a08 100644 --- a/src/gcore/resources/cloud/file_shares/access_rules.py +++ b/src/gcore/resources/cloud/file_shares/access_rules.py @@ -88,7 +88,9 @@ def create( 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._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=maybe_transform( { "access_mode": access_mode, @@ -140,7 +142,9 @@ def list( 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._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -191,7 +195,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -263,7 +269,9 @@ async def create( 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._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", body=await async_maybe_transform( { "access_mode": access_mode, @@ -315,7 +323,9 @@ async def list( 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._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -366,7 +376,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `access_rule_id` but received {access_rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/access_rule/{access_rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/file_shares/file_shares.py b/src/gcore/resources/cloud/file_shares/file_shares.py index da32da6f..6451d59c 100644 --- a/src/gcore/resources/cloud/file_shares/file_shares.py +++ b/src/gcore/resources/cloud/file_shares/file_shares.py @@ -206,7 +206,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -294,7 +296,9 @@ 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/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=maybe_transform( { "name": name, @@ -355,7 +359,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", page=SyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -413,7 +419,9 @@ def delete( 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._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -458,7 +466,9 @@ def get( 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._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -506,7 +516,9 @@ def resize( 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._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -681,7 +693,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -769,7 +783,9 @@ 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/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", body=await async_maybe_transform( { "name": name, @@ -830,7 +846,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/file_shares/{project_id}/{region_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}", page=AsyncOffsetPage[FileShare], options=make_request_options( extra_headers=extra_headers, @@ -888,7 +906,9 @@ async def delete( 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._delete( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -933,7 +953,9 @@ async def get( 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._get( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -981,7 +1003,9 @@ async def resize( 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._post( - f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", + f"/cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/file_shares/{project_id}/{region_id}/{file_share_id}/extend", body=await async_maybe_transform({"size": size}, file_share_resize_params.FileShareResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 15e8f12e..68cc504c 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -100,7 +100,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", body=maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -176,7 +178,9 @@ def update( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._patch( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", body=maybe_transform({"tags": tags}, floating_ip_update_params.FloatingIPUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -230,7 +234,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", page=SyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -288,7 +294,9 @@ def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -333,7 +341,9 @@ def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=maybe_transform( { "port_id": port_id, @@ -385,7 +395,9 @@ def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -424,7 +436,9 @@ def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -584,7 +598,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", body=await async_maybe_transform( { "fixed_ip_address": fixed_ip_address, @@ -660,7 +676,9 @@ async def update( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._patch( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", body=await async_maybe_transform({"tags": tags}, floating_ip_update_params.FloatingIPUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -714,7 +732,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/floatingips/{project_id}/{region_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}", page=AsyncOffsetPage[FloatingIPDetailed], options=make_request_options( extra_headers=extra_headers, @@ -772,7 +792,9 @@ async def delete( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._delete( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -817,7 +839,9 @@ async def assign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/assign", body=await async_maybe_transform( { "port_id": port_id, @@ -869,7 +893,9 @@ async def get( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._get( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -908,7 +934,9 @@ async def unassign( if not floating_ip_id: raise ValueError(f"Expected a non-empty value for `floating_ip_id` but received {floating_ip_id!r}") return await self._post( - f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", + f"/cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id}/unassign", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py index 19df3189..dc44954b 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/flavors.py @@ -80,7 +80,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -157,7 +159,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, 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 752eced7..e3a913c6 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 @@ -156,7 +156,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=maybe_transform( { "flavor": flavor, @@ -220,7 +222,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=SyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -291,7 +295,9 @@ def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -348,7 +354,9 @@ def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -387,7 +395,9 @@ def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -426,7 +436,9 @@ def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -478,7 +490,9 @@ def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=maybe_transform( { "nodes": nodes, @@ -530,7 +544,9 @@ def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, @@ -789,7 +805,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", body=await async_maybe_transform( { "flavor": flavor, @@ -853,7 +871,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters", page=AsyncOffsetPage[GPUBaremetalCluster], options=make_request_options( extra_headers=extra_headers, @@ -924,7 +944,9 @@ async def delete( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -981,7 +1003,9 @@ async def get( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1020,7 +1044,9 @@ async def powercycle_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1059,7 +1085,9 @@ async def reboot_all_servers( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", + f"/cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/ai/clusters/{project_id}/{region_id}/{cluster_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1111,7 +1139,9 @@ async def rebuild( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/rebuild", body=await async_maybe_transform( { "nodes": nodes, @@ -1163,7 +1193,9 @@ async def resize( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize", body=await async_maybe_transform( {"instances_count": instances_count}, gpu_baremetal_cluster_resize_params.GPUBaremetalClusterResizeParams, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py index 7b550f98..00229194 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/images.py @@ -79,7 +79,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -124,7 +126,9 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -205,7 +209,9 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -280,7 +286,9 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=maybe_transform( { "name": name, @@ -422,7 +430,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -467,7 +477,9 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -548,7 +560,9 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -623,7 +637,9 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/images" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/images", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py index 63371d8e..c12ccc5f 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py @@ -71,7 +71,9 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -131,7 +133,9 @@ async def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{cluster_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py index cdbce6a7..38694509 100644 --- a/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py +++ b/src/gcore/resources/cloud/gpu_baremetal_clusters/servers.py @@ -143,7 +143,9 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=SyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -209,7 +211,9 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -488,7 +492,9 @@ def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -547,7 +553,9 @@ def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -593,7 +601,9 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -632,7 +642,9 @@ def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -671,7 +683,9 @@ def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -788,7 +802,9 @@ def list( if not cluster_id: raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") return self._get_api_list( - f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/servers", page=AsyncOffsetPage[GPUBaremetalClusterServer], options=make_request_options( extra_headers=extra_headers, @@ -854,7 +870,9 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", + f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/node/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1135,7 +1153,9 @@ async def attach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -1194,7 +1214,9 @@ async def detach_interface( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, @@ -1240,7 +1262,9 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1279,7 +1303,9 @@ async def powercycle( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/powercycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1318,7 +1344,9 @@ async def reboot( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", + f"/cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ai/clusters/{project_id}/{region_id}/{instance_id}/reboot", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/api_keys.py b/src/gcore/resources/cloud/inference/api_keys.py index fcd8860c..2bca0a73 100644 --- a/src/gcore/resources/cloud/inference/api_keys.py +++ b/src/gcore/resources/cloud/inference/api_keys.py @@ -84,7 +84,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", body=maybe_transform( { "name": name, @@ -135,7 +137,9 @@ def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -178,7 +182,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", page=SyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -233,7 +239,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -273,7 +281,9 @@ def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -340,7 +350,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", body=await async_maybe_transform( { "name": name, @@ -391,7 +403,9 @@ async def update( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", body=await async_maybe_transform({"description": description}, api_key_update_params.APIKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -434,7 +448,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/api_keys", + f"/cloud/v3/inference/{project_id}/api_keys" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys", page=AsyncOffsetPage[InferenceAPIKey], options=make_request_options( extra_headers=extra_headers, @@ -489,7 +505,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,7 +547,9 @@ async def get( if not api_key_name: raise ValueError(f"Expected a non-empty value for `api_key_name` but received {api_key_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}", + f"/cloud/v3/inference/{project_id}/api_keys/{api_key_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/api_keys/{api_key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/applications/deployments.py b/src/gcore/resources/cloud/inference/applications/deployments.py index 7b62f2c2..717dbba4 100644 --- a/src/gcore/resources/cloud/inference/applications/deployments.py +++ b/src/gcore/resources/cloud/inference/applications/deployments.py @@ -93,7 +93,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", body=maybe_transform( { "application_name": application_name, @@ -140,7 +142,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -182,7 +186,9 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -226,7 +232,9 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -279,7 +287,9 @@ def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -361,7 +371,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", body=await async_maybe_transform( { "application_name": application_name, @@ -408,7 +420,9 @@ async def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments", + f"/cloud/v3/inference/applications/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -450,7 +464,9 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -494,7 +510,9 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -547,7 +565,9 @@ async def patch( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, diff --git a/src/gcore/resources/cloud/inference/applications/templates.py b/src/gcore/resources/cloud/inference/applications/templates.py index d888a399..ab2fe2cb 100644 --- a/src/gcore/resources/cloud/inference/applications/templates.py +++ b/src/gcore/resources/cloud/inference/applications/templates.py @@ -58,7 +58,9 @@ def list( required to create a fully functional application deployment. """ return self._get( - "/cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -97,7 +99,9 @@ def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -143,7 +147,9 @@ async def list( required to create a fully functional application deployment. """ return await self._get( - "/cloud/v3/inference/applications/catalog", + "/cloud/v3/inference/applications/catalog" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/applications/catalog", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -182,7 +188,9 @@ async def get( if not application_name: raise ValueError(f"Expected a non-empty value for `application_name` but received {application_name!r}") return await self._get( - f"/cloud/v3/inference/applications/catalog/{application_name}", + f"/cloud/v3/inference/applications/catalog/{application_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/applications/catalog/{application_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/deployments.py b/src/gcore/resources/cloud/inference/deployments/deployments.py index 40f311ba..b5d41185 100644 --- a/src/gcore/resources/cloud/inference/deployments/deployments.py +++ b/src/gcore/resources/cloud/inference/deployments/deployments.py @@ -147,7 +147,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", body=maybe_transform( { "containers": containers, @@ -263,7 +265,9 @@ def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=maybe_transform( { "api_keys": api_keys, @@ -325,7 +329,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", page=SyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -376,7 +382,9 @@ def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -416,7 +424,9 @@ def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -457,7 +467,9 @@ def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -505,7 +517,9 @@ def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -553,7 +567,9 @@ def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -840,7 +856,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", body=await async_maybe_transform( { "containers": containers, @@ -956,7 +974,9 @@ async def update( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._patch( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", body=await async_maybe_transform( { "api_keys": api_keys, @@ -1018,7 +1038,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments", + f"/cloud/v3/inference/{project_id}/deployments" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments", page=AsyncOffsetPage[InferenceDeployment], options=make_request_options( extra_headers=extra_headers, @@ -1069,7 +1091,9 @@ async def delete( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._delete( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1109,7 +1133,9 @@ async def get( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1150,7 +1176,9 @@ async def get_api_key( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/apikey", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1198,7 +1226,9 @@ async def start( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/start" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/start", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1246,7 +1276,9 @@ async def stop( raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/stop", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/deployments/logs.py b/src/gcore/resources/cloud/inference/deployments/logs.py index 3a46cbd0..e243a63a 100644 --- a/src/gcore/resources/cloud/inference/deployments/logs.py +++ b/src/gcore/resources/cloud/inference/deployments/logs.py @@ -91,7 +91,9 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=SyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, @@ -178,7 +180,9 @@ def list( if not deployment_name: raise ValueError(f"Expected a non-empty value for `deployment_name` but received {deployment_name!r}") return self._get_api_list( - f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", + f"/cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/deployments/{deployment_name}/logs", page=AsyncOffsetPage[InferenceDeploymentLog], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/cloud/inference/flavors.py b/src/gcore/resources/cloud/inference/flavors.py index c9934320..6009835e 100644 --- a/src/gcore/resources/cloud/inference/flavors.py +++ b/src/gcore/resources/cloud/inference/flavors.py @@ -73,7 +73,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/flavors", page=SyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -119,7 +121,9 @@ def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return self._get( - f"/cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -178,7 +182,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v3/inference/flavors", + "/cloud/v3/inference/flavors" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/flavors", page=AsyncOffsetPage[InferenceFlavor], options=make_request_options( extra_headers=extra_headers, @@ -224,7 +230,9 @@ async def get( if not flavor_name: raise ValueError(f"Expected a non-empty value for `flavor_name` but received {flavor_name!r}") return await self._get( - f"/cloud/v3/inference/flavors/{flavor_name}", + f"/cloud/v3/inference/flavors/{flavor_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/flavors/{flavor_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/inference.py b/src/gcore/resources/cloud/inference/inference.py index 86dd2f3c..8b2b1ca1 100644 --- a/src/gcore/resources/cloud/inference/inference.py +++ b/src/gcore/resources/cloud/inference/inference.py @@ -123,7 +123,9 @@ def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return self._get( - "/cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +189,9 @@ async def get_capacity_by_region( ) -> InferenceRegionCapacityList: """Get inference capacity by region""" return await self._get( - "/cloud/v3/inference/capacity", + "/cloud/v3/inference/capacity" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v3/inference/capacity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/inference/registry_credentials.py b/src/gcore/resources/cloud/inference/registry_credentials.py index c34dfc0a..0baea891 100644 --- a/src/gcore/resources/cloud/inference/registry_credentials.py +++ b/src/gcore/resources/cloud/inference/registry_credentials.py @@ -86,7 +86,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", body=maybe_transform( { "name": name, @@ -137,7 +139,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", page=SyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -189,7 +193,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -229,7 +235,9 @@ def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -278,7 +286,9 @@ def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=maybe_transform( { "password": password, @@ -354,7 +364,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", body=await async_maybe_transform( { "name": name, @@ -405,7 +417,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/registry_credentials", + f"/cloud/v3/inference/{project_id}/registry_credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials", page=AsyncOffsetPage[InferenceRegistryCredentials], options=make_request_options( extra_headers=extra_headers, @@ -457,7 +471,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -497,7 +513,9 @@ async def get( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -546,7 +564,9 @@ async def replace( if not credential_name: raise ValueError(f"Expected a non-empty value for `credential_name` but received {credential_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", + f"/cloud/v3/inference/{project_id}/registry_credentials/{credential_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/registry_credentials/{credential_name}", body=await async_maybe_transform( { "password": password, diff --git a/src/gcore/resources/cloud/inference/secrets.py b/src/gcore/resources/cloud/inference/secrets.py index 6b168d22..9ff5126f 100644 --- a/src/gcore/resources/cloud/inference/secrets.py +++ b/src/gcore/resources/cloud/inference/secrets.py @@ -79,7 +79,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", body=maybe_transform( { "data": data, @@ -130,7 +132,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", page=SyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -182,7 +186,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -222,7 +228,9 @@ def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -268,7 +276,9 @@ def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", body=maybe_transform( { "data": data, @@ -340,7 +350,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", body=await async_maybe_transform( { "data": data, @@ -391,7 +403,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v3/inference/{project_id}/secrets", + f"/cloud/v3/inference/{project_id}/secrets" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets", page=AsyncOffsetPage[InferenceSecret], options=make_request_options( extra_headers=extra_headers, @@ -443,7 +457,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -483,7 +499,9 @@ async def get( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._get( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,7 +547,9 @@ async def replace( if not secret_name: raise ValueError(f"Expected a non-empty value for `secret_name` but received {secret_name!r}") return await self._put( - f"/cloud/v3/inference/{project_id}/secrets/{secret_name}", + f"/cloud/v3/inference/{project_id}/secrets/{secret_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/inference/{project_id}/secrets/{secret_name}", body=await async_maybe_transform( { "data": data, diff --git a/src/gcore/resources/cloud/instances/flavors.py b/src/gcore/resources/cloud/instances/flavors.py index 23ba0073..63158c8b 100644 --- a/src/gcore/resources/cloud/instances/flavors.py +++ b/src/gcore/resources/cloud/instances/flavors.py @@ -85,7 +85,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -169,7 +171,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/flavors/{project_id}/{region_id}", + f"/cloud/v1/flavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/flavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/instances/images.py b/src/gcore/resources/cloud/instances/images.py index e863821c..16fc7ca0 100644 --- a/src/gcore/resources/cloud/instances/images.py +++ b/src/gcore/resources/cloud/instances/images.py @@ -110,7 +110,9 @@ def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", body=maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -176,7 +178,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -230,7 +234,9 @@ def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -336,7 +342,9 @@ def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -453,7 +461,9 @@ def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -536,7 +546,9 @@ def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -702,7 +714,9 @@ async def update( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._patch( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", body=await async_maybe_transform( { "hw_firmware_type": hw_firmware_type, @@ -768,7 +782,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -822,7 +838,9 @@ async def delete( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._delete( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -928,7 +946,9 @@ async def create_from_volume( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/images/{project_id}/{region_id}", + f"/cloud/v1/images/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -1045,7 +1065,9 @@ async def get( if not image_id: raise ValueError(f"Expected a non-empty value for `image_id` but received {image_id!r}") return await self._get( - f"/cloud/v1/images/{project_id}/{region_id}/{image_id}", + f"/cloud/v1/images/{project_id}/{region_id}/{image_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/images/{project_id}/{region_id}/{image_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1128,7 +1150,9 @@ async def upload( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/downloadimage/{project_id}/{region_id}", + f"/cloud/v1/downloadimage/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/downloadimage/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/instances.py b/src/gcore/resources/cloud/instances/instances.py index 27eab660..fd1f3a36 100644 --- a/src/gcore/resources/cloud/instances/instances.py +++ b/src/gcore/resources/cloud/instances/instances.py @@ -235,7 +235,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -372,7 +374,9 @@ def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -521,7 +525,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", page=SyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -615,7 +621,9 @@ def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -766,7 +774,9 @@ def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=maybe_transform( { "action": action, @@ -936,7 +946,9 @@ def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -1031,7 +1043,9 @@ def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=maybe_transform( { "name": name, @@ -1077,7 +1091,9 @@ def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1116,7 +1132,9 @@ def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1172,7 +1190,9 @@ def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1214,7 +1234,9 @@ def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1261,7 +1283,9 @@ def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1343,7 +1367,9 @@ def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1435,7 +1461,9 @@ def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=maybe_transform( { "name": name, @@ -1613,7 +1641,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}", + f"/cloud/v2/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -1750,7 +1780,9 @@ async def update( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._patch( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", body=await async_maybe_transform({"name": name}, instance_update_params.InstanceUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1899,7 +1931,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/instances/{project_id}/{region_id}", + f"/cloud/v1/instances/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}", page=AsyncOffsetPage[Instance], options=make_request_options( extra_headers=extra_headers, @@ -1993,7 +2027,9 @@ async def delete( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._delete( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2144,7 +2180,9 @@ async def action( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", + f"/cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action", body=await async_maybe_transform( { "action": action, @@ -2314,7 +2352,9 @@ async def add_to_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/put_into_servergroup", body=await async_maybe_transform( {"servergroup_id": servergroup_id}, instance_add_to_placement_group_params.InstanceAddToPlacementGroupParams, @@ -2409,7 +2449,9 @@ async def assign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/addsecuritygroup", body=await async_maybe_transform( { "name": name, @@ -2455,7 +2497,9 @@ async def disable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/disable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -2494,7 +2538,9 @@ async def enable_port_security( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._post( - f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", + f"/cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ports/{project_id}/{region_id}/{port_id}/enable_port_security", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -2550,7 +2596,9 @@ async def get( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -2592,7 +2640,9 @@ async def get_console( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2639,7 +2689,9 @@ async def remove_from_placement_group( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/remove_from_servergroup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -2721,7 +2773,9 @@ async def resize( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/changeflavor", body=await async_maybe_transform({"flavor_id": flavor_id}, instance_resize_params.InstanceResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -2813,7 +2867,9 @@ async def unassign_security_group( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/delsecuritygroup", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/instances/interfaces.py b/src/gcore/resources/cloud/instances/interfaces.py index 8336732b..cff96437 100644 --- a/src/gcore/resources/cloud/instances/interfaces.py +++ b/src/gcore/resources/cloud/instances/interfaces.py @@ -77,7 +77,9 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -309,7 +311,9 @@ def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=maybe_transform( { "ddos_profile": ddos_profile, @@ -661,7 +665,9 @@ def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=maybe_transform( { "ip_address": ip_address, @@ -728,7 +734,9 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._get( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/interfaces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -960,7 +968,9 @@ async def attach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface", body=await async_maybe_transform( { "ddos_profile": ddos_profile, @@ -1234,7 +1244,9 @@ async def detach( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/detach_interface", body=await async_maybe_transform( { "ip_address": ip_address, diff --git a/src/gcore/resources/cloud/instances/metrics.py b/src/gcore/resources/cloud/instances/metrics.py index c24b208c..77f2ea82 100644 --- a/src/gcore/resources/cloud/instances/metrics.py +++ b/src/gcore/resources/cloud/instances/metrics.py @@ -87,7 +87,9 @@ def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -166,7 +168,9 @@ async def list( if not instance_id: raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") return await self._post( - f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", + f"/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/instances/{project_id}/{region_id}/{instance_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/ip_ranges.py b/src/gcore/resources/cloud/ip_ranges.py index d807001b..4e66a509 100644 --- a/src/gcore/resources/cloud/ip_ranges.py +++ b/src/gcore/resources/cloud/ip_ranges.py @@ -70,7 +70,9 @@ def list( duplicate prefixes are not returned. """ return self._get( - "/cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -129,7 +131,9 @@ async def list( duplicate prefixes are not returned. """ return await self._get( - "/cloud/public/v1/ipranges/egress", + "/cloud/public/v1/ipranges/egress" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/public/v1/ipranges/egress", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/clusters.py b/src/gcore/resources/cloud/k8s/clusters/clusters.py index cda6a936..7399935c 100644 --- a/src/gcore/resources/cloud/k8s/clusters/clusters.py +++ b/src/gcore/resources/cloud/k8s/clusters/clusters.py @@ -216,7 +216,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", body=maybe_transform( { "keypair": keypair, @@ -352,7 +354,9 @@ def update( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=maybe_transform( { "add_ons": add_ons, @@ -399,7 +403,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,7 +447,9 @@ def delete( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -484,7 +492,9 @@ def get( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -523,7 +533,9 @@ def get_certificate( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -562,7 +574,9 @@ def get_kubeconfig( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -601,7 +615,9 @@ def list_versions_for_upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -643,7 +659,9 @@ def upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", body=maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -819,7 +837,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", body=await async_maybe_transform( { "keypair": keypair, @@ -955,7 +975,9 @@ async def update( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", body=await async_maybe_transform( { "add_ons": add_ons, @@ -1002,7 +1024,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1044,7 +1068,9 @@ async def delete( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1087,7 +1113,9 @@ async def get( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1126,7 +1154,9 @@ async def get_certificate( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1165,7 +1195,9 @@ async def get_kubeconfig( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/config", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1204,7 +1236,9 @@ async def list_versions_for_upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1246,7 +1280,9 @@ async def upgrade( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/upgrade", body=await async_maybe_transform({"version": version}, cluster_upgrade_params.ClusterUpgradeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/k8s/clusters/nodes.py b/src/gcore/resources/cloud/k8s/clusters/nodes.py index 4518d8b9..6ab3f1ba 100644 --- a/src/gcore/resources/cloud/k8s/clusters/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/nodes.py @@ -76,7 +76,9 @@ def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -124,7 +126,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +191,9 @@ async def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -235,7 +241,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py index 797c0e6e..fedba09c 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/nodes.py @@ -79,7 +79,9 @@ def list( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -130,7 +132,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -196,7 +200,9 @@ async def list( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -247,7 +253,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `instance_id` but received {instance_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/instances/{instance_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py index 72cb9321..38dfa4a7 100644 --- a/src/gcore/resources/cloud/k8s/clusters/pools/pools.py +++ b/src/gcore/resources/cloud/k8s/clusters/pools/pools.py @@ -130,7 +130,9 @@ def create( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", body=maybe_transform( { "flavor_id": flavor_id, @@ -208,7 +210,9 @@ def update( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", body=maybe_transform( { "auto_healing_enabled": auto_healing_enabled, @@ -258,7 +262,9 @@ def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -300,7 +306,9 @@ def delete( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -342,7 +350,9 @@ def get( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -387,7 +397,9 @@ def resize( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", body=maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -492,7 +504,9 @@ async def create( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", body=await async_maybe_transform( { "flavor_id": flavor_id, @@ -570,7 +584,9 @@ async def update( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._patch( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", body=await async_maybe_transform( { "auto_healing_enabled": auto_healing_enabled, @@ -620,7 +636,9 @@ async def list( if not cluster_name: raise ValueError(f"Expected a non-empty value for `cluster_name` but received {cluster_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -662,7 +680,9 @@ async def delete( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._delete( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -704,7 +724,9 @@ async def get( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._get( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -749,7 +771,9 @@ async def resize( if not pool_name: raise ValueError(f"Expected a non-empty value for `pool_name` but received {pool_name!r}") return await self._post( - f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", + f"/cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/pools/{pool_name}/resize", body=await async_maybe_transform({"node_count": node_count}, pool_resize_params.PoolResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/k8s/flavors.py b/src/gcore/resources/cloud/k8s/flavors.py index 0823633e..4996c836 100644 --- a/src/gcore/resources/cloud/k8s/flavors.py +++ b/src/gcore/resources/cloud/k8s/flavors.py @@ -79,7 +79,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/k8s/{project_id}/{region_id}/flavors", + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -155,7 +157,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/k8s/{project_id}/{region_id}/flavors", + f"/cloud/v1/k8s/{project_id}/{region_id}/flavors" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/k8s/{project_id}/{region_id}/flavors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/k8s/k8s.py b/src/gcore/resources/cloud/k8s/k8s.py index f3ac5aff..2c10d310 100644 --- a/src/gcore/resources/cloud/k8s/k8s.py +++ b/src/gcore/resources/cloud/k8s/k8s.py @@ -92,7 +92,9 @@ def list_versions( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions", + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -157,7 +159,9 @@ async def list_versions( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions", + f"/cloud/v2/k8s/{project_id}/{region_id}/create_versions" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/k8s/{project_id}/{region_id}/create_versions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/flavors.py b/src/gcore/resources/cloud/load_balancers/flavors.py index 8d126cd7..c24a04dd 100644 --- a/src/gcore/resources/cloud/load_balancers/flavors.py +++ b/src/gcore/resources/cloud/load_balancers/flavors.py @@ -76,7 +76,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -143,7 +145,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbflavors/{project_id}/{region_id}", + f"/cloud/v1/lbflavors/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbflavors/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, 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..a82dce40 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 @@ -118,7 +118,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", body=maybe_transform( { "action": action, @@ -168,7 +170,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -207,7 +211,9 @@ def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -246,7 +252,9 @@ def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -314,7 +322,9 @@ def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=maybe_transform( { "action": action, @@ -565,7 +575,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", body=await async_maybe_transform( { "action": action, @@ -615,7 +627,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -654,7 +668,9 @@ async def delete( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -693,7 +709,9 @@ async def get( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -761,7 +779,9 @@ async def replace( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", body=await async_maybe_transform( { "action": action, 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..374c1173 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -106,7 +106,9 @@ def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=maybe_transform( { "compare_type": compare_type, @@ -156,7 +158,9 @@ def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -198,7 +202,9 @@ def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -240,7 +246,9 @@ def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -312,7 +320,9 @@ def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=maybe_transform( { "compare_type": compare_type, @@ -575,7 +585,9 @@ async def create( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._post( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", body=await async_maybe_transform( { "compare_type": compare_type, @@ -625,7 +637,9 @@ async def list( if not l7policy_id: raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -667,7 +681,9 @@ async def delete( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._delete( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -709,7 +725,9 @@ async def get( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._get( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -781,7 +799,9 @@ async def replace( if not l7rule_id: raise ValueError(f"Expected a non-empty value for `l7rule_id` but received {l7rule_id!r}") return await self._put( - f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}/rules/{l7rule_id}", body=await async_maybe_transform( { "compare_type": compare_type, diff --git a/src/gcore/resources/cloud/load_balancers/listeners.py b/src/gcore/resources/cloud/load_balancers/listeners.py index dff543de..28652805 100644 --- a/src/gcore/resources/cloud/load_balancers/listeners.py +++ b/src/gcore/resources/cloud/load_balancers/listeners.py @@ -127,7 +127,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", body=maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -219,7 +221,9 @@ def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -279,7 +283,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -334,7 +340,9 @@ def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -382,7 +390,9 @@ def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -650,7 +660,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", body=await async_maybe_transform( { "loadbalancer_id": loadbalancer_id, @@ -742,7 +754,9 @@ async def update( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._patch( - f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lblisteners/{project_id}/{region_id}/{listener_id}", body=await async_maybe_transform( { "allowed_cidrs": allowed_cidrs, @@ -802,7 +816,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -857,7 +873,9 @@ async def delete( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._delete( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -905,7 +923,9 @@ async def get( if not listener_id: raise ValueError(f"Expected a non-empty value for `listener_id` but received {listener_id!r}") return await self._get( - f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", + f"/cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lblisteners/{project_id}/{region_id}/{listener_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/load_balancers/load_balancers.py b/src/gcore/resources/cloud/load_balancers/load_balancers.py index cd013254..e36d8665 100644 --- a/src/gcore/resources/cloud/load_balancers/load_balancers.py +++ b/src/gcore/resources/cloud/load_balancers/load_balancers.py @@ -207,7 +207,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", body=maybe_transform( { "flavor": flavor, @@ -299,7 +301,9 @@ def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=maybe_transform( { "logging": logging, @@ -377,7 +381,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", page=SyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -435,7 +441,9 @@ def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -477,7 +485,9 @@ def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=maybe_transform({"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -523,7 +533,9 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -575,7 +587,9 @@ def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -892,7 +906,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", body=await async_maybe_transform( { "flavor": flavor, @@ -984,7 +1000,9 @@ async def update( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._patch( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", body=await async_maybe_transform( { "logging": logging, @@ -1062,7 +1080,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}", page=AsyncOffsetPage[LoadBalancer], options=make_request_options( extra_headers=extra_headers, @@ -1120,7 +1140,9 @@ async def delete( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._delete( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1162,7 +1184,9 @@ async def failover( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover", body=await async_maybe_transform( {"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams ), @@ -1210,7 +1234,9 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1262,7 +1288,9 @@ async def resize( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize", body=await async_maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/cloud/load_balancers/metrics.py b/src/gcore/resources/cloud/load_balancers/metrics.py index 38ecf843..bedfa5eb 100644 --- a/src/gcore/resources/cloud/load_balancers/metrics.py +++ b/src/gcore/resources/cloud/load_balancers/metrics.py @@ -81,7 +81,9 @@ def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=maybe_transform( { "time_interval": time_interval, @@ -154,7 +156,9 @@ async def list( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._post( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/metrics", body=await async_maybe_transform( { "time_interval": time_interval, diff --git a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py index cc1baa93..c262d9a8 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py +++ b/src/gcore/resources/cloud/load_balancers/pools/health_monitors.py @@ -115,7 +115,9 @@ def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=maybe_transform( { "delay": delay, @@ -177,7 +179,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -274,7 +278,9 @@ async def create( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", body=await async_maybe_transform( { "delay": delay, @@ -336,7 +342,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/healthmonitor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 29d440f7..2ef413c0 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -131,7 +131,9 @@ def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=maybe_transform( { "address": address, @@ -195,7 +197,9 @@ def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -311,7 +315,9 @@ async def add( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member", body=await async_maybe_transform( { "address": address, @@ -375,7 +381,9 @@ async def remove( if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}/member/{member_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/pools/pools.py b/src/gcore/resources/cloud/load_balancers/pools/pools.py index 18e7807a..b34a707e 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/pools.py +++ b/src/gcore/resources/cloud/load_balancers/pools/pools.py @@ -147,7 +147,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", body=maybe_transform( { "lb_algorithm": lb_algorithm, @@ -265,7 +267,9 @@ def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=maybe_transform( { "ca_secret_id": ca_secret_id, @@ -331,7 +335,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -387,7 +393,9 @@ def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -432,7 +440,9 @@ def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -708,7 +718,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", body=await async_maybe_transform( { "lb_algorithm": lb_algorithm, @@ -826,7 +838,9 @@ async def update( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._patch( - f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/lbpools/{project_id}/{region_id}/{pool_id}", body=await async_maybe_transform( { "ca_secret_id": ca_secret_id, @@ -892,7 +906,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -948,7 +964,9 @@ async def delete( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._delete( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -993,7 +1011,9 @@ async def get( if not pool_id: raise ValueError(f"Expected a non-empty value for `pool_id` but received {pool_id!r}") return await self._get( - f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", + f"/cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/lbpools/{project_id}/{region_id}/{pool_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/load_balancers/statuses.py b/src/gcore/resources/cloud/load_balancers/statuses.py index 624132ba..97ac74d7 100644 --- a/src/gcore/resources/cloud/load_balancers/statuses.py +++ b/src/gcore/resources/cloud/load_balancers/statuses.py @@ -69,7 +69,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -108,7 +110,9 @@ def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -165,7 +169,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -204,7 +210,9 @@ async def get( if not loadbalancer_id: raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}") return await self._get( - f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", + f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/networks.py b/src/gcore/resources/cloud/networks/networks.py index d2a7615a..bc252d25 100644 --- a/src/gcore/resources/cloud/networks/networks.py +++ b/src/gcore/resources/cloud/networks/networks.py @@ -120,7 +120,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -253,7 +255,9 @@ def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=maybe_transform( { "name": name, @@ -320,7 +324,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", page=SyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -380,7 +386,9 @@ def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -457,7 +465,9 @@ def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -542,7 +552,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -675,7 +687,9 @@ async def update( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._patch( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", body=await async_maybe_transform( { "name": name, @@ -742,7 +756,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/networks/{project_id}/{region_id}", + f"/cloud/v1/networks/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}", page=AsyncOffsetPage[Network], options=make_request_options( extra_headers=extra_headers, @@ -802,7 +818,9 @@ async def delete( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._delete( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -879,7 +897,9 @@ async def get( if not network_id: raise ValueError(f"Expected a non-empty value for `network_id` but received {network_id!r}") return await self._get( - f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}", + f"/cloud/v1/networks/{project_id}/{region_id}/{network_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/networks/{project_id}/{region_id}/{network_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/routers.py b/src/gcore/resources/cloud/networks/routers.py index 52cf6cf8..018bfae0 100644 --- a/src/gcore/resources/cloud/networks/routers.py +++ b/src/gcore/resources/cloud/networks/routers.py @@ -92,7 +92,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -149,7 +151,9 @@ def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=maybe_transform( { "external_gateway_info": external_gateway_info, @@ -199,7 +203,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", page=SyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -249,7 +255,9 @@ def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -301,7 +309,9 @@ def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=maybe_transform( { "subnet_id": subnet_id, @@ -350,7 +360,9 @@ def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=maybe_transform({"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -390,7 +402,9 @@ def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -459,7 +473,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -516,7 +532,9 @@ async def update( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._patch( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", body=await async_maybe_transform( { "external_gateway_info": external_gateway_info, @@ -566,7 +584,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/routers/{project_id}/{region_id}", + f"/cloud/v1/routers/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}", page=AsyncOffsetPage[Router], options=make_request_options( extra_headers=extra_headers, @@ -616,7 +636,9 @@ async def delete( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._delete( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -668,7 +690,9 @@ async def attach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/attach", body=await async_maybe_transform( { "subnet_id": subnet_id, @@ -717,7 +741,9 @@ async def detach_subnet( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._post( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}/detach", body=await async_maybe_transform( {"subnet_id": subnet_id}, router_detach_subnet_params.RouterDetachSubnetParams ), @@ -759,7 +785,9 @@ async def get( if not router_id: raise ValueError(f"Expected a non-empty value for `router_id` but received {router_id!r}") return await self._get( - f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}", + f"/cloud/v1/routers/{project_id}/{region_id}/{router_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/routers/{project_id}/{region_id}/{router_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/networks/subnets.py b/src/gcore/resources/cloud/networks/subnets.py index 052a2327..baf4173e 100644 --- a/src/gcore/resources/cloud/networks/subnets.py +++ b/src/gcore/resources/cloud/networks/subnets.py @@ -125,7 +125,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", body=maybe_transform( { "cidr": cidr, @@ -287,7 +289,9 @@ def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=maybe_transform( { "dns_nameservers": dns_nameservers, @@ -373,7 +377,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", page=SyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -434,7 +440,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -479,7 +487,9 @@ def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -583,7 +593,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", body=await async_maybe_transform( { "cidr": cidr, @@ -745,7 +757,9 @@ async def update( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._patch( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", body=await async_maybe_transform( { "dns_nameservers": dns_nameservers, @@ -831,7 +845,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/subnets/{project_id}/{region_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}", page=AsyncOffsetPage[Subnet], options=make_request_options( extra_headers=extra_headers, @@ -892,7 +908,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -937,7 +955,9 @@ async def get( if not subnet_id: raise ValueError(f"Expected a non-empty value for `subnet_id` but received {subnet_id!r}") return await self._get( - f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", + f"/cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/subnets/{project_id}/{region_id}/{subnet_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/placement_groups.py b/src/gcore/resources/cloud/placement_groups.py index bb5119c8..d06de2c4 100644 --- a/src/gcore/resources/cloud/placement_groups.py +++ b/src/gcore/resources/cloud/placement_groups.py @@ -80,7 +80,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -123,7 +125,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -162,7 +166,9 @@ def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -201,7 +207,9 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -264,7 +272,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -307,7 +317,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -346,7 +358,9 @@ async def delete( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._delete( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -385,7 +399,9 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/servergroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/servergroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index cb6c69b4..316da27f 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -83,7 +83,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", body=maybe_transform( { "name": name, @@ -142,7 +142,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", page=SyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -193,7 +193,9 @@ def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._delete( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -226,7 +228,9 @@ def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -267,7 +271,9 @@ def replace( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._put( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", body=maybe_transform( { "name": name, @@ -339,7 +345,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", body=await async_maybe_transform( { "name": name, @@ -398,7 +404,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/projects", + "/cloud/v1/projects" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/projects", page=AsyncOffsetPage[Project], options=make_request_options( extra_headers=extra_headers, @@ -449,7 +455,9 @@ async def delete( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._delete( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -482,7 +490,9 @@ async def get( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._get( - f"/cloud/v1/projects/{project_id}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -523,7 +533,9 @@ async def replace( 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}", + f"/cloud/v1/projects/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/projects/{project_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/quotas/quotas.py b/src/gcore/resources/cloud/quotas/quotas.py index 915d900d..3adb5a00 100644 --- a/src/gcore/resources/cloud/quotas/quotas.py +++ b/src/gcore/resources/cloud/quotas/quotas.py @@ -65,7 +65,9 @@ def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return self._get( - "/cloud/v2/client_quotas", + "/cloud/v2/client_quotas" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -103,7 +105,9 @@ def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -136,7 +140,9 @@ def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -180,7 +186,9 @@ async def get_all( ) -> QuotaGetAllResponse: """Get combined client quotas, including both regional and global quotas.""" return await self._get( - "/cloud/v2/client_quotas", + "/cloud/v2/client_quotas" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/client_quotas", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -218,7 +226,9 @@ async def get_by_region( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v2/regional_quotas/{client_id}/{region_id}", + f"/cloud/v2/regional_quotas/{client_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/regional_quotas/{client_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -251,7 +261,9 @@ async def get_global( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/global_quotas/{client_id}", + f"/cloud/v2/global_quotas/{client_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/global_quotas/{client_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/quotas/requests.py b/src/gcore/resources/cloud/quotas/requests.py index 6857110a..128238fc 100644 --- a/src/gcore/resources/cloud/quotas/requests.py +++ b/src/gcore/resources/cloud/quotas/requests.py @@ -79,7 +79,9 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", body=maybe_transform( { "description": description, @@ -127,7 +129,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", page=SyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -173,7 +177,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -206,7 +212,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -267,7 +275,9 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", body=await async_maybe_transform( { "description": description, @@ -315,7 +325,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v2/limits_request", + "/cloud/v2/limits_request" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v2/limits_request", page=AsyncOffsetPage[RequestListResponse], options=make_request_options( extra_headers=extra_headers, @@ -361,7 +373,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -394,7 +408,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/cloud/v2/limits_request/{request_id}", + f"/cloud/v2/limits_request/{request_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/limits_request/{request_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/regions.py b/src/gcore/resources/cloud/regions.py index b9d06835..c2ed0980 100644 --- a/src/gcore/resources/cloud/regions.py +++ b/src/gcore/resources/cloud/regions.py @@ -85,7 +85,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions", + "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", page=SyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -138,7 +138,9 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -211,7 +213,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/regions", + "/cloud/v1/regions" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/regions", page=AsyncOffsetPage[Region], options=make_request_options( extra_headers=extra_headers, @@ -264,7 +266,9 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/regions/{region_id}", + f"/cloud/v1/regions/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/regions/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/cloud/registries/artifacts.py b/src/gcore/resources/cloud/registries/artifacts.py index 4b07607a..b9ed4772 100644 --- a/src/gcore/resources/cloud/registries/artifacts.py +++ b/src/gcore/resources/cloud/registries/artifacts.py @@ -72,7 +72,9 @@ def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -116,7 +118,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -177,7 +181,9 @@ async def list( if not repository_name: raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -221,7 +227,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `digest` but received {digest!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/registries.py b/src/gcore/resources/cloud/registries/registries.py index 0ba3414e..7d41597b 100644 --- a/src/gcore/resources/cloud/registries/registries.py +++ b/src/gcore/resources/cloud/registries/registries.py @@ -129,7 +129,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -172,7 +174,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -210,7 +214,9 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -247,7 +253,9 @@ def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -287,7 +295,9 @@ def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=maybe_transform({"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -371,7 +381,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, @@ -414,7 +426,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}", + f"/cloud/v1/registries/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -452,7 +466,9 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -489,7 +505,9 @@ async def get( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -529,7 +547,9 @@ async def resize( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/resize", body=await async_maybe_transform( {"storage_limit": storage_limit}, registry_resize_params.RegistryResizeParams ), diff --git a/src/gcore/resources/cloud/registries/repositories.py b/src/gcore/resources/cloud/registries/repositories.py index d0c860a9..0a3a776d 100644 --- a/src/gcore/resources/cloud/registries/repositories.py +++ b/src/gcore/resources/cloud/registries/repositories.py @@ -69,7 +69,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -110,7 +112,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -168,7 +172,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -209,7 +215,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `repository_name` but received {repository_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/tags.py b/src/gcore/resources/cloud/registries/tags.py index 74f68017..9c1812de 100644 --- a/src/gcore/resources/cloud/registries/tags.py +++ b/src/gcore/resources/cloud/registries/tags.py @@ -78,7 +78,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -146,7 +148,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/repositories/{repository_name}/artifacts/{digest}/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index 5225429a..c7f5e4e6 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -92,7 +92,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=maybe_transform( { "duration": duration, @@ -145,7 +147,9 @@ def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=maybe_transform( { "duration": duration, @@ -189,7 +193,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -228,7 +234,9 @@ def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -268,7 +276,9 @@ def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -307,7 +317,9 @@ def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -381,7 +393,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", body=await async_maybe_transform( { "duration": duration, @@ -434,7 +448,9 @@ async def update( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._patch( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", body=await async_maybe_transform( { "duration": duration, @@ -478,7 +494,9 @@ async def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._get( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -517,7 +535,9 @@ async def delete( region_id = self._client._get_cloud_region_id_path_param() extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -557,7 +577,9 @@ async def create_multiple( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/batch", body=await async_maybe_transform({"users": users}, user_create_multiple_params.UserCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -596,7 +618,9 @@ async def refresh_secret( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", + f"/cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/registries/{project_id}/{region_id}/{registry_id}/users/{user_id}/refresh_secret", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), 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 beacc819..2441bca0 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 @@ -274,7 +274,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=maybe_transform( { "type": type, @@ -352,7 +354,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=SyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -409,7 +413,9 @@ def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -448,7 +454,9 @@ def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -987,7 +995,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", body=await async_maybe_transform( { "type": type, @@ -1065,7 +1075,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}", page=AsyncOffsetPage[ReservedFixedIP], options=make_request_options( extra_headers=extra_headers, @@ -1122,7 +1134,9 @@ async def delete( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._delete( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1161,7 +1175,9 @@ async def get( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py index 966a51e0..947e07af 100644 --- a/src/gcore/resources/cloud/reserved_fixed_ips/vip.py +++ b/src/gcore/resources/cloud/reserved_fixed_ips/vip.py @@ -79,7 +79,9 @@ def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -118,7 +120,9 @@ def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -160,7 +164,9 @@ def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -205,7 +211,9 @@ def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -248,7 +256,9 @@ def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), @@ -311,7 +321,9 @@ async def list_candidate_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/available_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -350,7 +362,9 @@ async def list_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._get( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,7 +406,9 @@ async def replace_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._put( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_replace_connected_ports_params.VipReplaceConnectedPortsParams ), @@ -437,7 +453,9 @@ async def toggle( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}", body=await async_maybe_transform({"is_vip": is_vip}, vip_toggle_params.VipToggleParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -480,7 +498,9 @@ async def update_connected_ports( if not port_id: raise ValueError(f"Expected a non-empty value for `port_id` but received {port_id!r}") return await self._patch( - f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", + f"/cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/reserved_fixed_ips/{project_id}/{region_id}/{port_id}/connected_devices", body=await async_maybe_transform( {"port_ids": port_ids}, vip_update_connected_ports_params.VipUpdateConnectedPortsParams ), diff --git a/src/gcore/resources/cloud/secrets.py b/src/gcore/resources/cloud/secrets.py index 9c2020f1..4dacbb6c 100644 --- a/src/gcore/resources/cloud/secrets.py +++ b/src/gcore/resources/cloud/secrets.py @@ -86,7 +86,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", page=SyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -142,7 +144,9 @@ def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +191,9 @@ def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -236,7 +242,9 @@ def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", body=maybe_transform( { "name": name, @@ -353,7 +361,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/secrets/{project_id}/{region_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}", page=AsyncOffsetPage[Secret], options=make_request_options( extra_headers=extra_headers, @@ -409,7 +419,9 @@ async def delete( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._delete( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -454,7 +466,9 @@ async def get( if not secret_id: raise ValueError(f"Expected a non-empty value for `secret_id` but received {secret_id!r}") return await self._get( - f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", + f"/cloud/v1/secrets/{project_id}/{region_id}/{secret_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/secrets/{project_id}/{region_id}/{secret_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -503,7 +517,9 @@ async def upload_tls_certificate( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v2/secrets/{project_id}/{region_id}", + f"/cloud/v2/secrets/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/secrets/{project_id}/{region_id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/cloud/security_groups/rules.py b/src/gcore/resources/cloud/security_groups/rules.py index aacd3921..4886e5bd 100644 --- a/src/gcore/resources/cloud/security_groups/rules.py +++ b/src/gcore/resources/cloud/security_groups/rules.py @@ -126,7 +126,9 @@ def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=maybe_transform( { "description": description, @@ -179,7 +181,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -273,7 +277,9 @@ def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=maybe_transform( { "direction": direction, @@ -397,7 +403,9 @@ async def create( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/rules", body=await async_maybe_transform( { "description": description, @@ -450,7 +458,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -544,7 +554,9 @@ async def replace( if not rule_id: raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") return await self._put( - f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", + f"/cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygrouprules/{project_id}/{region_id}/{rule_id}", body=await async_maybe_transform( { "direction": direction, diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 5961799b..30e98b08 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -97,7 +97,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", body=maybe_transform( { "security_group": security_group, @@ -172,7 +174,9 @@ def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=maybe_transform( { "changed_rules": changed_rules, @@ -228,7 +232,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", page=SyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -281,7 +287,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -323,7 +331,9 @@ def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -363,7 +373,9 @@ def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -402,7 +414,9 @@ def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -469,7 +483,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", body=await async_maybe_transform( { "security_group": security_group, @@ -544,7 +560,9 @@ async def update( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._patch( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", body=await async_maybe_transform( { "changed_rules": changed_rules, @@ -600,7 +618,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/securitygroups/{project_id}/{region_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}", page=AsyncOffsetPage[SecurityGroup], options=make_request_options( extra_headers=extra_headers, @@ -653,7 +673,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -695,7 +717,9 @@ async def copy( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/copy", body=await async_maybe_transform({"name": name}, security_group_copy_params.SecurityGroupCopyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -735,7 +759,9 @@ async def get( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._get( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -774,7 +800,9 @@ async def revert_to_default( if not group_id: raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") return await self._post( - f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", + f"/cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/securitygroups/{project_id}/{region_id}/{group_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index 061b0876..970602db 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -90,7 +90,9 @@ def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._post( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", body=maybe_transform( { "name": name, @@ -141,7 +143,9 @@ def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=maybe_transform({"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -186,7 +190,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", page=SyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -239,7 +245,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -279,7 +287,9 @@ def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -352,7 +362,9 @@ async def create( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return await self._post( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", body=await async_maybe_transform( { "name": name, @@ -403,7 +415,9 @@ async def update( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._patch( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", body=await async_maybe_transform( {"shared_in_project": shared_in_project}, ssh_key_update_params.SSHKeyUpdateParams ), @@ -450,7 +464,9 @@ def list( if project_id is None: project_id = self._client._get_cloud_project_id_path_param() return self._get_api_list( - f"/cloud/v1/ssh_keys/{project_id}", + f"/cloud/v1/ssh_keys/{project_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}", page=AsyncOffsetPage[SSHKey], options=make_request_options( extra_headers=extra_headers, @@ -503,7 +519,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -543,7 +561,9 @@ async def get( if not ssh_key_id: raise ValueError(f"Expected a non-empty value for `ssh_key_id` but received {ssh_key_id!r}") return await self._get( - f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", + f"/cloud/v1/ssh_keys/{project_id}/{ssh_key_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/ssh_keys/{project_id}/{ssh_key_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index 3e374c10..d44ec604 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -194,7 +194,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks", + "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", page=SyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -251,7 +251,9 @@ def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -296,7 +298,9 @@ def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -331,7 +335,9 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -503,7 +509,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/tasks", + "/cloud/v1/tasks" if self._client._base_url_overridden else "https://api.gcore.com//cloud/v1/tasks", page=AsyncOffsetPage[Task], options=make_request_options( extra_headers=extra_headers, @@ -560,7 +566,9 @@ async def acknowledge_all( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/cloud/v1/tasks/acknowledge_all", + "/cloud/v1/tasks/acknowledge_all" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/tasks/acknowledge_all", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -605,7 +613,9 @@ async def acknowledge_one( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/cloud/v1/tasks/{task_id}/acknowledge", + f"/cloud/v1/tasks/{task_id}/acknowledge" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}/acknowledge", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -640,7 +650,9 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/cloud/v1/tasks/{task_id}", + f"/cloud/v1/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/usage_reports.py b/src/gcore/resources/cloud/usage_reports.py index 8758b3ab..c9795e74 100644 --- a/src/gcore/resources/cloud/usage_reports.py +++ b/src/gcore/resources/cloud/usage_reports.py @@ -139,7 +139,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/usage_report", + "/cloud/v1/usage_report" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/usage_report", body=maybe_transform( { "time_from": time_from, @@ -277,7 +279,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/usage_report", + "/cloud/v1/usage_report" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/usage_report", body=await async_maybe_transform( { "time_from": time_from, diff --git a/src/gcore/resources/cloud/users/role_assignments.py b/src/gcore/resources/cloud/users/role_assignments.py index 2f16d40d..ad4a9d8b 100644 --- a/src/gcore/resources/cloud/users/role_assignments.py +++ b/src/gcore/resources/cloud/users/role_assignments.py @@ -85,7 +85,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", body=maybe_transform( { "role": role, @@ -139,7 +141,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", body=maybe_transform( { "role": role, @@ -191,7 +195,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", page=SyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -237,7 +243,9 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ return self._delete( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -300,7 +308,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", body=await async_maybe_transform( { "role": role, @@ -354,7 +364,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", body=await async_maybe_transform( { "role": role, @@ -406,7 +418,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/cloud/v1/users/assignments", + "/cloud/v1/users/assignments" + if self._client._base_url_overridden + else "https://api.gcore.com//cloud/v1/users/assignments", page=AsyncOffsetPage[RoleAssignment], options=make_request_options( extra_headers=extra_headers, @@ -452,7 +466,9 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ return await self._delete( - f"/cloud/v1/users/assignments/{assignment_id}", + f"/cloud/v1/users/assignments/{assignment_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/users/assignments/{assignment_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/cloud/volumes.py b/src/gcore/resources/cloud/volumes.py index b1b577eb..27dc684a 100644 --- a/src/gcore/resources/cloud/volumes.py +++ b/src/gcore/resources/cloud/volumes.py @@ -288,7 +288,9 @@ def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", body=maybe_transform( { "image_id": image_id, @@ -374,7 +376,9 @@ def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=maybe_transform( { "name": name, @@ -456,7 +460,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", page=SyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -525,7 +531,9 @@ def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -582,7 +590,9 @@ def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=maybe_transform( { "instance_id": instance_id, @@ -639,7 +649,9 @@ def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=maybe_transform({"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -688,7 +700,9 @@ def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -736,7 +750,9 @@ def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -786,7 +802,9 @@ def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -835,7 +853,9 @@ def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1516,7 +1536,9 @@ async def create( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", body=await async_maybe_transform( { "image_id": image_id, @@ -1602,7 +1624,9 @@ async def update( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._patch( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", body=await async_maybe_transform( { "name": name, @@ -1684,7 +1708,9 @@ def list( if region_id is None: region_id = self._client._get_cloud_region_id_path_param() return self._get_api_list( - f"/cloud/v1/volumes/{project_id}/{region_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}", page=AsyncOffsetPage[Volume], options=make_request_options( extra_headers=extra_headers, @@ -1753,7 +1779,9 @@ async def delete( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._delete( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1810,7 +1838,9 @@ async def attach_to_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/attach", body=await async_maybe_transform( { "instance_id": instance_id, @@ -1867,7 +1897,9 @@ async def change_type( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/retype", body=await async_maybe_transform( {"volume_type": volume_type}, volume_change_type_params.VolumeChangeTypeParams ), @@ -1918,7 +1950,9 @@ async def detach_from_instance( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", + f"/cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v2/volumes/{project_id}/{region_id}/{volume_id}/detach", body=await async_maybe_transform( {"instance_id": instance_id}, volume_detach_from_instance_params.VolumeDetachFromInstanceParams ), @@ -1966,7 +2000,9 @@ async def get( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._get( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -2016,7 +2052,9 @@ async def resize( if not volume_id: raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/extend", body=await async_maybe_transform({"size": size}, volume_resize_params.VolumeResizeParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -2065,7 +2103,9 @@ async def revert_to_last_snapshot( raise ValueError(f"Expected a non-empty value for `volume_id` but received {volume_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", + f"/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/revert", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/dns.py b/src/gcore/resources/dns/dns.py index 099fe2fd..edad6bbe 100644 --- a/src/gcore/resources/dns/dns.py +++ b/src/gcore/resources/dns/dns.py @@ -104,7 +104,9 @@ def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return self._get( - "/dns/v2/platform/info", + "/dns/v2/platform/info" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -141,7 +143,7 @@ def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/lookup", + "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -207,7 +209,9 @@ async def get_account_overview( ) -> DNSGetAccountOverviewResponse: """Get info about client""" return await self._get( - "/dns/v2/platform/info", + "/dns/v2/platform/info" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/platform/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -244,7 +248,7 @@ async def lookup( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/lookup", + "/dns/v2/lookup" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/lookup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/locations.py b/src/gcore/resources/dns/locations.py index 3b571e04..a6c27797 100644 --- a/src/gcore/resources/dns/locations.py +++ b/src/gcore/resources/dns/locations.py @@ -54,7 +54,7 @@ def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return self._get( - "/dns/v2/locations", + "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -73,7 +73,9 @@ def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return self._get( - "/dns/v2/locations/continents", + "/dns/v2/locations/continents" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -92,7 +94,9 @@ def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return self._get( - "/dns/v2/locations/countries", + "/dns/v2/locations/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -111,7 +115,9 @@ def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return self._get( - "/dns/v2/locations/regions", + "/dns/v2/locations/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -151,7 +157,7 @@ async def list( ) -> LocationListResponse: """List of All locations continents/countries/regions.""" return await self._get( - "/dns/v2/locations", + "/dns/v2/locations" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/locations", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -170,7 +176,9 @@ async def list_continents( ) -> LocationListContinentsResponse: """List of All locations continents.""" return await self._get( - "/dns/v2/locations/continents", + "/dns/v2/locations/continents" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/continents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -189,7 +197,9 @@ async def list_countries( ) -> LocationListCountriesResponse: """List of All locations countries.""" return await self._get( - "/dns/v2/locations/countries", + "/dns/v2/locations/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -208,7 +218,9 @@ async def list_regions( ) -> LocationListRegionsResponse: """List of All locations regions.""" return await self._get( - "/dns/v2/locations/regions", + "/dns/v2/locations/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/locations/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/metrics.py b/src/gcore/resources/dns/metrics.py index 3359b610..90cbb48b 100644 --- a/src/gcore/resources/dns/metrics.py +++ b/src/gcore/resources/dns/metrics.py @@ -82,7 +82,9 @@ def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return self._get( - "/dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -160,7 +162,9 @@ async def list( """ extra_headers = {"Accept": "plain/text", **(extra_headers or {})} return await self._get( - "/dns/v2/monitor/metrics", + "/dns/v2/monitor/metrics" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/monitor/metrics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/dns/pickers/pickers.py b/src/gcore/resources/dns/pickers/pickers.py index c08f6586..5cbf16a7 100644 --- a/src/gcore/resources/dns/pickers/pickers.py +++ b/src/gcore/resources/dns/pickers/pickers.py @@ -63,7 +63,7 @@ def list( ) -> PickerListResponse: """Returns list of picker""" return self._get( - "/dns/v2/pickers", + "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -107,7 +107,7 @@ async def list( ) -> PickerListResponse: """Returns list of picker""" return await self._get( - "/dns/v2/pickers", + "/dns/v2/pickers" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/pickers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/pickers/presets.py b/src/gcore/resources/dns/pickers/presets.py index a816c8cc..6a8db18b 100644 --- a/src/gcore/resources/dns/pickers/presets.py +++ b/src/gcore/resources/dns/pickers/presets.py @@ -51,7 +51,9 @@ def list( ) -> PresetListResponse: """Returns list of picker preset""" return self._get( - "/dns/v2/pickers/presets", + "/dns/v2/pickers/presets" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -91,7 +93,9 @@ async def list( ) -> PresetListResponse: """Returns list of picker preset""" return await self._get( - "/dns/v2/pickers/presets", + "/dns/v2/pickers/presets" + if self._client._base_url_overridden + else "https://api.gcore.com//dns/v2/pickers/presets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/dnssec.py b/src/gcore/resources/dns/zones/dnssec.py index e91a9d09..c5dcb39b 100644 --- a/src/gcore/resources/dns/zones/dnssec.py +++ b/src/gcore/resources/dns/zones/dnssec.py @@ -69,7 +69,9 @@ def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", body=maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -103,7 +105,9 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -158,7 +162,9 @@ async def update( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", body=await async_maybe_transform({"enabled": enabled}, dnssec_update_params.DnssecUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -192,7 +198,9 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/dnssec", + f"/dns/v2/zones/{name}/dnssec" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/dnssec", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/dns/zones/rrsets.py b/src/gcore/resources/dns/zones/rrsets.py index 15085076..18f66d20 100644 --- a/src/gcore/resources/dns/zones/rrsets.py +++ b/src/gcore/resources/dns/zones/rrsets.py @@ -222,7 +222,9 @@ def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -276,7 +278,9 @@ def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -327,7 +331,9 @@ def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -366,7 +372,9 @@ def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -411,7 +419,9 @@ def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -470,7 +480,9 @@ def replace( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=maybe_transform( { "resource_records": resource_records, @@ -678,7 +690,9 @@ async def create( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, @@ -732,7 +746,9 @@ async def list( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/rrsets", + f"/dns/v2/zones/{zone_name}/rrsets" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/rrsets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -783,7 +799,9 @@ async def delete( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._delete( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -822,7 +840,9 @@ async def get( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -867,7 +887,9 @@ async def get_failover_logs( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}/failover/log", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -926,7 +948,9 @@ async def replace( if not rrset_type: raise ValueError(f"Expected a non-empty value for `rrset_type` but received {rrset_type!r}") return await self._put( - f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", + f"/dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/{rrset_name}/{rrset_type}", body=await async_maybe_transform( { "resource_records": resource_records, diff --git a/src/gcore/resources/dns/zones/zones.py b/src/gcore/resources/dns/zones/zones.py index 765d77eb..7092460c 100644 --- a/src/gcore/resources/dns/zones/zones.py +++ b/src/gcore/resources/dns/zones/zones.py @@ -143,7 +143,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", body=maybe_transform( { "name": name, @@ -225,7 +225,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -283,7 +283,9 @@ def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._delete( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -318,7 +320,9 @@ def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -351,7 +355,9 @@ def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -384,7 +390,9 @@ def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._patch( - f"/dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -417,7 +425,9 @@ def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._get( - f"/dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -450,7 +460,9 @@ def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -521,7 +533,9 @@ def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return self._get( - f"/dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -594,7 +608,9 @@ def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return self._post( - f"/dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", body=maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -667,7 +683,9 @@ def replace( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return self._put( - f"/dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{path_name}", body=maybe_transform( { "body_name": body_name, @@ -780,7 +798,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", body=await async_maybe_transform( { "name": name, @@ -862,7 +880,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/dns/v2/zones", + "/dns/v2/zones" if self._client._base_url_overridden else "https://api.gcore.com//dns/v2/zones", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -920,7 +938,9 @@ async def delete( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._delete( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -955,7 +975,9 @@ async def check_delegation_status( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/analyze/{name}/delegation-status", + f"/dns/v2/analyze/{name}/delegation-status" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/analyze/{name}/delegation-status", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -988,7 +1010,9 @@ async def disable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/disable", + f"/dns/v2/zones/{name}/disable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/disable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1021,7 +1045,9 @@ async def enable( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._patch( - f"/dns/v2/zones/{name}/enable", + f"/dns/v2/zones/{name}/enable" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/enable", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1054,7 +1080,9 @@ async def export( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._get( - f"/dns/v2/zones/{zone_name}/export", + f"/dns/v2/zones/{zone_name}/export" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/export", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1087,7 +1115,9 @@ async def get( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}", + f"/dns/v2/zones/{name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1158,7 +1188,9 @@ async def get_statistics( if not name: raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") return await self._get( - f"/dns/v2/zones/{name}/statistics", + f"/dns/v2/zones/{name}/statistics" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{name}/statistics", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1231,7 +1263,9 @@ async def import_( if not zone_name: raise ValueError(f"Expected a non-empty value for `zone_name` but received {zone_name!r}") return await self._post( - f"/dns/v2/zones/{zone_name}/import", + f"/dns/v2/zones/{zone_name}/import" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{zone_name}/import", body=await async_maybe_transform(body, zone_import_params.ZoneImportParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1304,7 +1338,9 @@ async def replace( if not path_name: raise ValueError(f"Expected a non-empty value for `path_name` but received {path_name!r}") return await self._put( - f"/dns/v2/zones/{path_name}", + f"/dns/v2/zones/{path_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//dns/v2/zones/{path_name}", body=await async_maybe_transform( { "body_name": body_name, diff --git a/src/gcore/resources/fastedge/apps/apps.py b/src/gcore/resources/fastedge/apps/apps.py index 21e9fb4c..6344b4c8 100644 --- a/src/gcore/resources/fastedge/apps/apps.py +++ b/src/gcore/resources/fastedge/apps/apps.py @@ -121,7 +121,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", body=maybe_transform( { "binary": binary, @@ -208,7 +208,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=maybe_transform( { "binary": binary, @@ -305,7 +307,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", page=SyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -355,7 +357,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -386,7 +390,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -418,7 +424,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -514,7 +522,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", body=await async_maybe_transform( { "binary": binary, @@ -601,7 +609,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=await async_maybe_transform( { "binary": binary, @@ -698,7 +708,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/apps", + "/fastedge/v1/apps" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/apps", page=AsyncOffsetPageFastedgeApps[AppShort], options=make_request_options( extra_headers=extra_headers, @@ -748,7 +758,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -779,7 +791,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -811,7 +825,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/apps/{id}", + f"/fastedge/v1/apps/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}", body=await async_maybe_transform(body, app_replace_params.AppReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/fastedge/apps/logs.py b/src/gcore/resources/fastedge/apps/logs.py index 8f589ab0..c38308f9 100644 --- a/src/gcore/resources/fastedge/apps/logs.py +++ b/src/gcore/resources/fastedge/apps/logs.py @@ -94,7 +94,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", page=SyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, @@ -187,7 +189,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/fastedge/v1/apps/{id}/logs", + f"/fastedge/v1/apps/{id}/logs" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/apps/{id}/logs", page=AsyncOffsetPageFastedgeAppLogs[Log], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/fastedge/binaries.py b/src/gcore/resources/fastedge/binaries.py index c88f90da..142fa332 100644 --- a/src/gcore/resources/fastedge/binaries.py +++ b/src/gcore/resources/fastedge/binaries.py @@ -67,7 +67,9 @@ def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return self._post( - "/fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries/raw", body=read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -87,7 +89,9 @@ def list( ) -> BinaryListResponse: """List binaries""" return self._get( - "/fastedge/v1/binaries", + "/fastedge/v1/binaries" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +123,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -150,7 +156,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -203,7 +211,9 @@ async def create( """ extra_headers = {"Content-Type": "application/octet-stream", **(extra_headers or {})} return await self._post( - "/fastedge/v1/binaries/raw", + "/fastedge/v1/binaries/raw" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries/raw", body=await async_read_file_content(body), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -223,7 +233,9 @@ async def list( ) -> BinaryListResponse: """List binaries""" return await self._get( - "/fastedge/v1/binaries", + "/fastedge/v1/binaries" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/binaries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -255,7 +267,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -286,7 +300,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/binaries/{id}", + f"/fastedge/v1/binaries/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/binaries/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/fastedge.py b/src/gcore/resources/fastedge/fastedge.py index d4ba7cf3..43091582 100644 --- a/src/gcore/resources/fastedge/fastedge.py +++ b/src/gcore/resources/fastedge/fastedge.py @@ -123,7 +123,7 @@ def get_account_overview( ) -> Client: """Get status and limits for the client""" return self._get( - "/fastedge/v1/me", + "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,7 +187,7 @@ async def get_account_overview( ) -> Client: """Get status and limits for the client""" return await self._get( - "/fastedge/v1/me", + "/fastedge/v1/me" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/fastedge/kv_stores.py b/src/gcore/resources/fastedge/kv_stores.py index 42193e54..a39f434b 100644 --- a/src/gcore/resources/fastedge/kv_stores.py +++ b/src/gcore/resources/fastedge/kv_stores.py @@ -72,7 +72,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", body=maybe_transform( { "byod": byod, @@ -112,7 +112,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -148,7 +148,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -179,7 +181,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -216,7 +220,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", body=maybe_transform( { "byod": byod, @@ -280,7 +286,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", body=await async_maybe_transform( { "byod": byod, @@ -320,7 +326,7 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/kv", + "/fastedge/v1/kv" if self._client._base_url_overridden else "https://api.gcore.com//fastedge/v1/kv", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -356,7 +362,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -387,7 +395,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -424,7 +434,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/kv/{id}", + f"/fastedge/v1/kv/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/kv/{id}", body=await async_maybe_transform( { "byod": byod, diff --git a/src/gcore/resources/fastedge/secrets.py b/src/gcore/resources/fastedge/secrets.py index 81685e61..32e39e18 100644 --- a/src/gcore/resources/fastedge/secrets.py +++ b/src/gcore/resources/fastedge/secrets.py @@ -83,7 +83,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", body=maybe_transform( { "name": name, @@ -131,7 +133,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=maybe_transform( { "comment": comment, @@ -175,7 +179,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -220,7 +226,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -255,7 +263,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -295,7 +305,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=maybe_transform( { "name": name, @@ -363,7 +375,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", body=await async_maybe_transform( { "name": name, @@ -411,7 +425,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "comment": comment, @@ -455,7 +471,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/secrets", + "/fastedge/v1/secrets" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/secrets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -500,7 +518,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -535,7 +555,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -575,7 +597,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/secrets/{id}", + f"/fastedge/v1/secrets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/secrets/{id}", body=await async_maybe_transform( { "name": name, diff --git a/src/gcore/resources/fastedge/statistics.py b/src/gcore/resources/fastedge/statistics.py index 4b344931..2768b1c7 100644 --- a/src/gcore/resources/fastedge/statistics.py +++ b/src/gcore/resources/fastedge/statistics.py @@ -83,7 +83,9 @@ def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -141,7 +143,9 @@ def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -220,7 +224,9 @@ async def get_call_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/calls", + "/fastedge/v1/stats/calls" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/calls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -278,7 +284,9 @@ async def get_duration_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/fastedge/v1/stats/app_duration", + "/fastedge/v1/stats/app_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/stats/app_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/fastedge/templates.py b/src/gcore/resources/fastedge/templates.py index d58d3110..55ba0f87 100644 --- a/src/gcore/resources/fastedge/templates.py +++ b/src/gcore/resources/fastedge/templates.py @@ -93,7 +93,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", body=maybe_transform( { "binary_id": binary_id, @@ -149,7 +151,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", page=SyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -197,7 +201,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -232,7 +238,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -281,7 +289,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", body=maybe_transform( { "binary_id": binary_id, @@ -361,7 +371,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", body=await async_maybe_transform( { "binary_id": binary_id, @@ -417,7 +429,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/fastedge/v1/template", + "/fastedge/v1/template" + if self._client._base_url_overridden + else "https://api.gcore.com//fastedge/v1/template", page=AsyncOffsetPageFastedgeTemplates[TemplateShort], options=make_request_options( extra_headers=extra_headers, @@ -465,7 +479,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -500,7 +516,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -549,7 +567,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/fastedge/v1/template/{id}", + f"/fastedge/v1/template/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//fastedge/v1/template/{id}", body=await async_maybe_transform( { "binary_id": binary_id, diff --git a/src/gcore/resources/iam/api_tokens.py b/src/gcore/resources/iam/api_tokens.py index e99827be..e6031ed5 100644 --- a/src/gcore/resources/iam/api_tokens.py +++ b/src/gcore/resources/iam/api_tokens.py @@ -80,7 +80,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", body=maybe_transform( { "client_user": client_user, @@ -147,7 +149,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -196,7 +200,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -228,7 +234,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -293,7 +301,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", body=await async_maybe_transform( { "client_user": client_user, @@ -360,7 +370,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens", + f"/iam/clients/{client_id}/tokens" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -409,7 +421,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,7 +455,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/clients/{client_id}/tokens/{token_id}", + f"/iam/clients/{client_id}/tokens/{token_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/tokens/{token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/iam.py b/src/gcore/resources/iam/iam.py index 7f409c61..0072cb39 100644 --- a/src/gcore/resources/iam/iam.py +++ b/src/gcore/resources/iam/iam.py @@ -75,7 +75,7 @@ def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return self._get( - "/iam/clients/me", + "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -123,7 +123,7 @@ async def get_account_overview( ) -> AccountOverview: """Get information about your profile, users and other account details.""" return await self._get( - "/iam/clients/me", + "/iam/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//iam/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/iam/users.py b/src/gcore/resources/iam/users.py index f411d577..9337eadb 100644 --- a/src/gcore/resources/iam/users.py +++ b/src/gcore/resources/iam/users.py @@ -104,7 +104,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", body=maybe_transform( { "auth_types": auth_types, @@ -156,7 +158,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users", + "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", page=SyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -202,7 +204,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -233,7 +237,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -283,7 +289,9 @@ def invite( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/iam/clients/invite_user", + "/iam/clients/invite_user" + if self._client._base_url_overridden + else "https://api.gcore.com//iam/clients/invite_user", body=maybe_transform( { "client_id": client_id, @@ -377,7 +385,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", body=await async_maybe_transform( { "auth_types": auth_types, @@ -429,7 +439,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/iam/users", + "/iam/users" if self._client._base_url_overridden else "https://api.gcore.com//iam/users", page=AsyncOffsetPage[User], options=make_request_options( extra_headers=extra_headers, @@ -475,7 +485,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/iam/clients/{client_id}/client-users/{user_id}", + f"/iam/clients/{client_id}/client-users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/clients/{client_id}/client-users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -506,7 +518,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/iam/users/{user_id}", + f"/iam/users/{user_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//iam/users/{user_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -556,7 +570,9 @@ async def invite( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/iam/clients/invite_user", + "/iam/clients/invite_user" + if self._client._base_url_overridden + else "https://api.gcore.com//iam/clients/invite_user", body=await async_maybe_transform( { "client_id": client_id, diff --git a/src/gcore/resources/security/bgp_announces.py b/src/gcore/resources/security/bgp_announces.py index 26b3bc96..50000889 100644 --- a/src/gcore/resources/security/bgp_announces.py +++ b/src/gcore/resources/security/bgp_announces.py @@ -74,7 +74,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -122,7 +124,9 @@ def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", body=maybe_transform( { "announce": announce, @@ -191,7 +195,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -239,7 +245,9 @@ async def toggle( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/sifter/v2/protected_addresses/announces", + "/security/sifter/v2/protected_addresses/announces" + if self._client._base_url_overridden + else "https://api.gcore.com//security/sifter/v2/protected_addresses/announces", body=await async_maybe_transform( { "announce": announce, diff --git a/src/gcore/resources/security/events.py b/src/gcore/resources/security/events.py index e0699398..a9cc8e57 100644 --- a/src/gcore/resources/security/events.py +++ b/src/gcore/resources/security/events.py @@ -88,7 +88,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs" + if self._client._base_url_overridden + else "https://api.gcore.com//security/notifier/v1/event_logs", page=SyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +176,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/security/notifier/v1/event_logs", + "/security/notifier/v1/event_logs" + if self._client._base_url_overridden + else "https://api.gcore.com//security/notifier/v1/event_logs", page=AsyncOffsetPage[ClientView], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/security/profile_templates.py b/src/gcore/resources/security/profile_templates.py index 307f3c0d..c4a4459e 100644 --- a/src/gcore/resources/security/profile_templates.py +++ b/src/gcore/resources/security/profile_templates.py @@ -55,7 +55,9 @@ def list( profile. Client receives only common and created for him profile templates. """ return self._get( - "/security/iaas/profile-templates", + "/security/iaas/profile-templates" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -99,7 +101,9 @@ async def list( profile. Client receives only common and created for him profile templates. """ return await self._get( - "/security/iaas/profile-templates", + "/security/iaas/profile-templates" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/profile-templates", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/security/profiles.py b/src/gcore/resources/security/profiles.py index 8394bd69..b54bb4af 100644 --- a/src/gcore/resources/security/profiles.py +++ b/src/gcore/resources/security/profiles.py @@ -78,7 +78,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", body=maybe_transform( { "fields": fields, @@ -122,7 +124,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -168,7 +172,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -199,7 +205,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -234,7 +242,9 @@ def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", body=maybe_transform( { "fields": fields, @@ -280,7 +290,9 @@ def replace( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", body=maybe_transform( { "fields": fields, @@ -346,7 +358,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", body=await async_maybe_transform( { "fields": fields, @@ -390,7 +404,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/security/iaas/v2/profiles", + "/security/iaas/v2/profiles" + if self._client._base_url_overridden + else "https://api.gcore.com//security/iaas/v2/profiles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -436,7 +452,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -467,7 +485,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -502,7 +522,9 @@ async def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}/recreate", + f"/security/iaas/v2/profiles/{id}/recreate" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}/recreate", body=await async_maybe_transform( { "fields": fields, @@ -548,7 +570,9 @@ async def replace( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/security/iaas/v2/profiles/{id}", + f"/security/iaas/v2/profiles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//security/iaas/v2/profiles/{id}", body=await async_maybe_transform( { "fields": fields, diff --git a/src/gcore/resources/storage/buckets/buckets.py b/src/gcore/resources/storage/buckets/buckets.py index e6c589fa..4f2b6b24 100644 --- a/src/gcore/resources/storage/buckets/buckets.py +++ b/src/gcore/resources/storage/buckets/buckets.py @@ -108,7 +108,9 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -148,7 +150,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets", + f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}/s3/buckets", page=SyncOffsetPage[Bucket], options=make_request_options( extra_headers=extra_headers, @@ -196,7 +200,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -266,7 +272,9 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -306,7 +314,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets", + f"/storage/provisioning/v2/storage/{storage_id}/s3/buckets" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}/s3/buckets", page=AsyncOffsetPage[Bucket], options=make_request_options( extra_headers=extra_headers, @@ -354,7 +364,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/cors.py b/src/gcore/resources/storage/buckets/cors.py index 77a3e045..2cbefd77 100644 --- a/src/gcore/resources/storage/buckets/cors.py +++ b/src/gcore/resources/storage/buckets/cors.py @@ -74,7 +74,9 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", body=maybe_transform({"allowed_origins": allowed_origins}, cor_create_params.CorCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -111,7 +113,9 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -172,7 +176,9 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", body=await async_maybe_transform({"allowed_origins": allowed_origins}, cor_create_params.CorCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -209,7 +215,9 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/cors", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/lifecycle.py b/src/gcore/resources/storage/buckets/lifecycle.py index b80dffaf..60182808 100644 --- a/src/gcore/resources/storage/buckets/lifecycle.py +++ b/src/gcore/resources/storage/buckets/lifecycle.py @@ -78,7 +78,9 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", body=maybe_transform({"expiration_days": expiration_days}, lifecycle_create_params.LifecycleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -115,7 +117,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -181,7 +185,9 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", body=await async_maybe_transform( {"expiration_days": expiration_days}, lifecycle_create_params.LifecycleCreateParams ), @@ -220,7 +226,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/lifecycle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/buckets/policy.py b/src/gcore/resources/storage/buckets/policy.py index cca549f9..41c123c5 100644 --- a/src/gcore/resources/storage/buckets/policy.py +++ b/src/gcore/resources/storage/buckets/policy.py @@ -71,7 +71,9 @@ def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -109,7 +111,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -144,7 +148,9 @@ def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -204,7 +210,9 @@ async def create( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -242,7 +250,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -277,7 +287,9 @@ async def get( if not bucket_name: raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}") return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", + f"/storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/s3/bucket/{bucket_name}/policy", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/storage/credentials.py b/src/gcore/resources/storage/credentials.py index 1db372ae..ee32e77e 100644 --- a/src/gcore/resources/storage/credentials.py +++ b/src/gcore/resources/storage/credentials.py @@ -85,7 +85,9 @@ def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/credentials", + f"/storage/provisioning/v1/storage/{storage_id}/credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/credentials", body=maybe_transform( { "delete_sftp_password": delete_sftp_password, @@ -167,7 +169,9 @@ async def recreate( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/credentials", + f"/storage/provisioning/v1/storage/{storage_id}/credentials" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/credentials", body=await async_maybe_transform( { "delete_sftp_password": delete_sftp_password, diff --git a/src/gcore/resources/storage/locations.py b/src/gcore/resources/storage/locations.py index bce1aa37..be55ab51 100644 --- a/src/gcore/resources/storage/locations.py +++ b/src/gcore/resources/storage/locations.py @@ -69,7 +69,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v2/locations", + "/storage/provisioning/v2/locations" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v2/locations", page=SyncOffsetPage[Location], options=make_request_options( extra_headers=extra_headers, @@ -135,7 +137,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v2/locations", + "/storage/provisioning/v2/locations" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v2/locations", page=AsyncOffsetPage[Location], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/storage/statistics.py b/src/gcore/resources/storage/statistics.py index dbaf7b6e..25cbc05c 100644 --- a/src/gcore/resources/storage/statistics.py +++ b/src/gcore/resources/storage/statistics.py @@ -82,7 +82,9 @@ def get_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/stats/v1/storage/usage/total", + "/storage/stats/v1/storage/usage/total" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/stats/v1/storage/usage/total", body=maybe_transform( { "from_": from_, @@ -149,7 +151,9 @@ def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/stats/v1/storage/usage/series", + "/storage/stats/v1/storage/usage/series" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/stats/v1/storage/usage/series", body=maybe_transform( { "from_": from_, @@ -229,7 +233,9 @@ async def get_usage_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/stats/v1/storage/usage/total", + "/storage/stats/v1/storage/usage/total" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/stats/v1/storage/usage/total", body=await async_maybe_transform( { "from_": from_, @@ -296,7 +302,9 @@ async def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/stats/v1/storage/usage/series", + "/storage/stats/v1/storage/usage/series" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/stats/v1/storage/usage/series", body=await async_maybe_transform( { "from_": from_, diff --git a/src/gcore/resources/storage/storage.py b/src/gcore/resources/storage/storage.py index c3a2d71e..26ee34ae 100644 --- a/src/gcore/resources/storage/storage.py +++ b/src/gcore/resources/storage/storage.py @@ -138,7 +138,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/storage/provisioning/v2/storage", + "/storage/provisioning/v2/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v2/storage", body=maybe_transform( { "location": location, @@ -188,7 +190,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/storage/provisioning/v2/storage/{storage_id}", + f"/storage/provisioning/v2/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}", body=maybe_transform( { "expires": expires, @@ -260,7 +264,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v3/storage", + "/storage/provisioning/v3/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v3/storage", page=SyncOffsetPage[Storage], options=make_request_options( extra_headers=extra_headers, @@ -312,7 +318,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -344,7 +352,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -379,7 +389,9 @@ def link_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -413,7 +425,9 @@ def restore( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/restore", + f"/storage/provisioning/v1/storage/{storage_id}/restore" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/restore", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -452,7 +466,9 @@ def unlink_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -542,7 +558,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/storage/provisioning/v2/storage", + "/storage/provisioning/v2/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v2/storage", body=await async_maybe_transform( { "location": location, @@ -592,7 +610,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/storage/provisioning/v2/storage/{storage_id}", + f"/storage/provisioning/v2/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v2/storage/{storage_id}", body=await async_maybe_transform( { "expires": expires, @@ -664,7 +684,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/storage/provisioning/v3/storage", + "/storage/provisioning/v3/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//storage/provisioning/v3/storage", page=AsyncOffsetPage[Storage], options=make_request_options( extra_headers=extra_headers, @@ -716,7 +738,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -748,7 +772,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/storage/provisioning/v1/storage/{storage_id}", + f"/storage/provisioning/v1/storage/{storage_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -783,7 +809,9 @@ async def link_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/link", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -817,7 +845,9 @@ async def restore( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/restore", + f"/storage/provisioning/v1/storage/{storage_id}/restore" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/restore", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -858,7 +888,9 @@ async def unlink_ssh_key( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", + f"/storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink" + if self._client._base_url_overridden + else f"https://api.gcore.com//storage/provisioning/v1/storage/{storage_id}/key/{key_id}/unlink", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/ai_tasks.py b/src/gcore/resources/streaming/ai_tasks.py index 6811e64c..02a61389 100644 --- a/src/gcore/resources/streaming/ai_tasks.py +++ b/src/gcore/resources/streaming/ai_tasks.py @@ -351,7 +351,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", body=maybe_transform( { "task_name": task_name, @@ -437,7 +437,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", page=SyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -490,7 +490,9 @@ def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._post( - f"/streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -562,7 +564,9 @@ def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -641,7 +645,7 @@ def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/ai/info", + "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -983,7 +987,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", body=await async_maybe_transform( { "task_name": task_name, @@ -1069,7 +1073,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/ai/tasks", + "/streaming/ai/tasks" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/tasks", page=AsyncPageStreamingAI[AITask], options=make_request_options( extra_headers=extra_headers, @@ -1122,7 +1126,9 @@ async def cancel( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._post( - f"/streaming/ai/tasks/{task_id}/cancel", + f"/streaming/ai/tasks/{task_id}/cancel" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}/cancel", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1194,7 +1200,9 @@ async def get( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/streaming/ai/tasks/{task_id}", + f"/streaming/ai/tasks/{task_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/ai/tasks/{task_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1273,7 +1281,7 @@ async def get_ai_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/ai/info", + "/streaming/ai/info" if self._client._base_url_overridden else "https://api.gcore.com//streaming/ai/info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/streaming/broadcasts.py b/src/gcore/resources/streaming/broadcasts.py index 757bde4d..2435c18a 100644 --- a/src/gcore/resources/streaming/broadcasts.py +++ b/src/gcore/resources/streaming/broadcasts.py @@ -78,7 +78,9 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", body=maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -111,7 +113,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", body=maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -148,7 +152,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", page=SyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -185,7 +191,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -216,7 +224,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -247,7 +257,9 @@ def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -310,7 +322,9 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_create_params.BroadcastCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -343,7 +357,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", body=await async_maybe_transform({"broadcast": broadcast}, broadcast_update_params.BroadcastUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -380,7 +396,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/broadcasts", + "/streaming/broadcasts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/broadcasts", page=AsyncPageStreaming[Broadcast], options=make_request_options( extra_headers=extra_headers, @@ -417,7 +435,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -448,7 +468,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}", + f"/streaming/broadcasts/{broadcast_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -479,7 +501,9 @@ async def get_spectators_count( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/broadcasts/{broadcast_id}/spectators", + f"/streaming/broadcasts/{broadcast_id}/spectators" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/broadcasts/{broadcast_id}/spectators", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/directories.py b/src/gcore/resources/streaming/directories.py index 3c45afb6..a67d8d61 100644 --- a/src/gcore/resources/streaming/directories.py +++ b/src/gcore/resources/streaming/directories.py @@ -72,7 +72,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/directories", + "/streaming/directories" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories", body=maybe_transform( { "name": name, @@ -117,7 +119,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", body=maybe_transform( { "name": name, @@ -166,7 +170,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -199,7 +205,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -222,7 +230,9 @@ def get_tree( This endpoint returns hierarchical data about directories in video hosting. """ return self._get( - "/streaming/directories/tree", + "/streaming/directories/tree" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -279,7 +289,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/directories", + "/streaming/directories" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories", body=await async_maybe_transform( { "name": name, @@ -324,7 +336,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", body=await async_maybe_transform( { "name": name, @@ -373,7 +387,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -406,7 +422,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/directories/{directory_id}", + f"/streaming/directories/{directory_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/directories/{directory_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -429,7 +447,9 @@ async def get_tree( This endpoint returns hierarchical data about directories in video hosting. """ return await self._get( - "/streaming/directories/tree", + "/streaming/directories/tree" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/directories/tree", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/players.py b/src/gcore/resources/streaming/players.py index b2590c29..e7717e34 100644 --- a/src/gcore/resources/streaming/players.py +++ b/src/gcore/resources/streaming/players.py @@ -72,7 +72,7 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", body=maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -109,7 +109,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", body=maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -144,7 +146,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", page=SyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -181,7 +183,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -212,7 +216,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -244,7 +250,9 @@ def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - f"/streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -301,7 +309,7 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", body=await async_maybe_transform({"player": player}, player_create_params.PlayerCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -338,7 +346,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", body=await async_maybe_transform({"player": player}, player_update_params.PlayerUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -373,7 +383,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/players", + "/streaming/players" if self._client._base_url_overridden else "https://api.gcore.com//streaming/players", page=AsyncPageStreaming[Player], options=make_request_options( extra_headers=extra_headers, @@ -410,7 +420,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,7 +453,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/players/{player_id}", + f"/streaming/players/{player_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -473,7 +487,9 @@ async def preview( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - f"/streaming/players/{player_id}/preview", + f"/streaming/players/{player_id}/preview" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/players/{player_id}/preview", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/playlists.py b/src/gcore/resources/streaming/playlists.py index aea53517..a7804425 100644 --- a/src/gcore/resources/streaming/playlists.py +++ b/src/gcore/resources/streaming/playlists.py @@ -221,7 +221,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", body=maybe_transform( { "active": active, @@ -356,7 +358,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", body=maybe_transform( { "active": active, @@ -409,7 +413,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", page=SyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -446,7 +452,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -477,7 +485,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -508,7 +518,9 @@ def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -710,7 +722,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", body=await async_maybe_transform( { "active": active, @@ -845,7 +859,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", body=await async_maybe_transform( { "active": active, @@ -898,7 +914,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/playlists", + "/streaming/playlists" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/playlists", page=AsyncPageStreaming[Playlist], options=make_request_options( extra_headers=extra_headers, @@ -935,7 +953,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -966,7 +986,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}", + f"/streaming/playlists/{playlist_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -997,7 +1019,9 @@ async def list_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/playlists/{playlist_id}/videos", + f"/streaming/playlists/{playlist_id}/videos" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/playlists/{playlist_id}/videos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py index d91c5569..7bd710f3 100644 --- a/src/gcore/resources/streaming/quality_sets.py +++ b/src/gcore/resources/streaming/quality_sets.py @@ -98,7 +98,9 @@ def list( is a paid feature. """ return self._get( - "/streaming/quality_sets", + "/streaming/quality_sets" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -148,7 +150,9 @@ def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - "/streaming/quality_sets/default", + "/streaming/quality_sets/default" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets/default", body=maybe_transform( { "live": live, @@ -240,7 +244,9 @@ async def list( is a paid feature. """ return await self._get( - "/streaming/quality_sets", + "/streaming/quality_sets" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -290,7 +296,9 @@ async def set_default( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - "/streaming/quality_sets/default", + "/streaming/quality_sets/default" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/quality_sets/default", body=await async_maybe_transform( { "live": live, diff --git a/src/gcore/resources/streaming/restreams.py b/src/gcore/resources/streaming/restreams.py index 91f24ab2..2be0770f 100644 --- a/src/gcore/resources/streaming/restreams.py +++ b/src/gcore/resources/streaming/restreams.py @@ -67,7 +67,9 @@ def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", body=maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -100,7 +102,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", body=maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -135,7 +139,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", page=SyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -172,7 +178,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -203,7 +211,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -256,7 +266,9 @@ async def create( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", body=await async_maybe_transform({"restream": restream}, restream_create_params.RestreamCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -289,7 +301,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", body=await async_maybe_transform({"restream": restream}, restream_update_params.RestreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -324,7 +338,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/restreams", + "/streaming/restreams" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/restreams", page=AsyncPageStreaming[Restream], options=make_request_options( extra_headers=extra_headers, @@ -361,7 +377,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,7 +410,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/restreams/{restream_id}", + f"/streaming/restreams/{restream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/restreams/{restream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/statistics.py b/src/gcore/resources/streaming/statistics.py index 82b2a1f6..913d43c1 100644 --- a/src/gcore/resources/streaming/statistics.py +++ b/src/gcore/resources/streaming/statistics.py @@ -124,7 +124,9 @@ def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -192,7 +194,9 @@ def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -261,7 +265,9 @@ def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -323,7 +329,9 @@ def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -376,7 +384,9 @@ def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/max_stream", + "/streaming/statistics/max_stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -430,7 +440,9 @@ def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/popular", + "/streaming/statistics/popular" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -481,7 +493,9 @@ def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/storage", + "/streaming/statistics/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -533,7 +547,9 @@ def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/stream", + "/streaming/statistics/stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -609,7 +625,9 @@ def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/uniqs", + "/streaming/statistics/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -713,7 +731,9 @@ def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -788,7 +808,9 @@ def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/views", + "/streaming/statistics/views" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -847,7 +869,9 @@ def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/browsers", + "/streaming/statistics/browsers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -899,7 +923,9 @@ def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/countries", + "/streaming/statistics/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -952,7 +978,9 @@ def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/hosts", + "/streaming/statistics/hosts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1005,7 +1033,9 @@ def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/systems", + "/streaming/statistics/systems" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1058,7 +1088,9 @@ def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/embeds", + "/streaming/statistics/embeds" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1111,7 +1143,9 @@ def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/regions", + "/streaming/statistics/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1175,7 +1209,9 @@ def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/heatmap", + "/streaming/statistics/heatmap" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1227,7 +1263,9 @@ def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1277,7 +1315,9 @@ def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1342,7 +1382,9 @@ def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1411,7 +1453,9 @@ def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1473,7 +1517,9 @@ def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1551,7 +1597,9 @@ async def get_ffprobes( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/ffprobe", + "/streaming/statistics/ffprobe" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/ffprobe", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1619,7 +1667,9 @@ async def get_live_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/viewers", + "/streaming/statistics/stream/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1688,7 +1738,9 @@ async def get_live_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration", + "/streaming/statistics/stream/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1750,7 +1802,9 @@ async def get_live_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream/watching_duration/total", + "/streaming/statistics/stream/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1803,7 +1857,9 @@ async def get_max_streams_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/max_stream", + "/streaming/statistics/max_stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/max_stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1857,7 +1913,9 @@ async def get_popular_videos( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/popular", + "/streaming/statistics/popular" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/popular", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1908,7 +1966,9 @@ async def get_storage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/storage", + "/streaming/statistics/storage" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/storage", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1960,7 +2020,9 @@ async def get_stream_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/stream", + "/streaming/statistics/stream" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/stream", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2036,7 +2098,9 @@ async def get_unique_viewers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/uniqs", + "/streaming/statistics/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2140,7 +2204,9 @@ async def get_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/cdn/uniqs", + "/streaming/statistics/cdn/uniqs" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/cdn/uniqs", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2215,7 +2281,9 @@ async def get_views( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/views", + "/streaming/statistics/views" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/views", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2274,7 +2342,9 @@ async def get_views_by_browsers( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/browsers", + "/streaming/statistics/browsers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/browsers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2326,7 +2396,9 @@ async def get_views_by_country( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/countries", + "/streaming/statistics/countries" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/countries", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2379,7 +2451,9 @@ async def get_views_by_hostname( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/hosts", + "/streaming/statistics/hosts" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/hosts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2432,7 +2506,9 @@ async def get_views_by_operating_system( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/systems", + "/streaming/statistics/systems" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/systems", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2485,7 +2561,9 @@ async def get_views_by_referer( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/embeds", + "/streaming/statistics/embeds" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/embeds", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2538,7 +2616,9 @@ async def get_views_by_region( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/regions", + "/streaming/statistics/regions" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/regions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2602,7 +2682,9 @@ async def get_views_heatmap( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/heatmap", + "/streaming/statistics/heatmap" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/heatmap", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2654,7 +2736,9 @@ async def get_vod_storage_volume( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/storage_duration", + "/streaming/statistics/vod/storage_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/storage_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2704,7 +2788,9 @@ async def get_vod_transcoding_duration( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/transcoding_duration", + "/streaming/statistics/vod/transcoding_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/transcoding_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2769,7 +2855,9 @@ async def get_vod_unique_viewers_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/viewers", + "/streaming/statistics/vod/viewers" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/viewers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2838,7 +2926,9 @@ async def get_vod_watch_time_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration", + "/streaming/statistics/vod/watching_duration" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -2900,7 +2990,9 @@ async def get_vod_watch_time_total_cdn( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/streaming/statistics/vod/watching_duration/total", + "/streaming/statistics/vod/watching_duration/total" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/statistics/vod/watching_duration/total", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/streaming/streams/overlays.py b/src/gcore/resources/streaming/streams/overlays.py index 780f045b..8f37a1e4 100644 --- a/src/gcore/resources/streaming/streams/overlays.py +++ b/src/gcore/resources/streaming/streams/overlays.py @@ -131,7 +131,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -183,7 +185,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", body=maybe_transform( { "height": height, @@ -225,7 +229,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -258,7 +264,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -290,7 +298,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -322,7 +332,9 @@ def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -436,7 +448,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_create_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -488,7 +502,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", body=await async_maybe_transform( { "height": height, @@ -530,7 +546,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -563,7 +581,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -595,7 +615,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/overlays/{overlay_id}", + f"/streaming/streams/{stream_id}/overlays/{overlay_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays/{overlay_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -627,7 +649,9 @@ async def update_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}/overlays", + f"/streaming/streams/{stream_id}/overlays" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/overlays", body=await async_maybe_transform(body, Iterable[overlay_update_multiple_params.Body]), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index acc3a7f3..33a7b0fc 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -255,7 +255,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", body=maybe_transform( { "name": name, @@ -308,7 +308,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", body=maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -347,7 +349,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", page=SyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -409,7 +411,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -441,7 +445,9 @@ def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -572,7 +578,9 @@ def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", body=maybe_transform( { "duration": duration, @@ -612,7 +620,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -663,7 +673,9 @@ def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -734,7 +746,9 @@ def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -771,7 +785,9 @@ def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return self._put( - f"/streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -992,7 +1008,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", body=await async_maybe_transform( { "name": name, @@ -1045,7 +1061,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", body=await async_maybe_transform({"stream": stream}, stream_update_params.StreamUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1084,7 +1102,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/streams", + "/streaming/streams" if self._client._base_url_overridden else "https://api.gcore.com//streaming/streams", page=AsyncPageStreaming[Stream], options=make_request_options( extra_headers=extra_headers, @@ -1146,7 +1164,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1178,7 +1198,9 @@ async def clear_dvr( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._put( - f"/streaming/streams/{stream_id}/dvr_cleanup", + f"/streaming/streams/{stream_id}/dvr_cleanup" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/dvr_cleanup", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1309,7 +1331,9 @@ async def create_clip( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", body=await async_maybe_transform( { "duration": duration, @@ -1349,7 +1373,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}", + f"/streaming/streams/{stream_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1400,7 +1426,9 @@ async def list_clips( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/streams/{stream_id}/clip_recording", + f"/streaming/streams/{stream_id}/clip_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/clip_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1471,7 +1499,9 @@ async def start_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/start_recording", + f"/streaming/streams/{stream_id}/start_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/start_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1508,7 +1538,9 @@ async def stop_recording( timeout: Override the client-level default timeout for this request, in seconds """ return await self._put( - f"/streaming/streams/{stream_id}/stop_recording", + f"/streaming/streams/{stream_id}/stop_recording" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/streams/{stream_id}/stop_recording", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/subtitles.py b/src/gcore/resources/streaming/videos/subtitles.py index 5930fd58..fe18befd 100644 --- a/src/gcore/resources/streaming/videos/subtitles.py +++ b/src/gcore/resources/streaming/videos/subtitles.py @@ -134,7 +134,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", body=maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -188,7 +190,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", body=maybe_transform( { "language": language, @@ -227,7 +231,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -260,7 +266,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -292,7 +300,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -411,7 +421,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", body=await async_maybe_transform(body, subtitle_create_params.SubtitleCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -465,7 +477,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", body=await async_maybe_transform( { "language": language, @@ -504,7 +518,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles", + f"/streaming/videos/{video_id}/subtitles" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -537,7 +553,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -569,7 +587,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/subtitles/{id}", + f"/streaming/videos/{video_id}/subtitles/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/subtitles/{id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index 256d7d6f..6c6aec17 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -161,7 +161,7 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", body=maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -422,7 +422,9 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", body=maybe_transform( { "name": name, @@ -520,7 +522,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", page=SyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -579,7 +581,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -631,7 +635,9 @@ def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/streaming/videos/batch", + "/streaming/videos/batch" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/batch", body=maybe_transform({"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams), options=make_request_options( extra_headers=extra_headers, @@ -684,7 +690,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -748,7 +756,9 @@ def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -782,7 +792,9 @@ def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._get( - "/streaming/videos/names", + "/streaming/videos/names" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -912,7 +924,7 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", body=await async_maybe_transform({"video": video}, video_create_params.VideoCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1173,7 +1185,9 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", body=await async_maybe_transform( { "name": name, @@ -1271,7 +1285,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/streaming/videos", + "/streaming/videos" if self._client._base_url_overridden else "https://api.gcore.com//streaming/videos", page=AsyncPageStreaming[Video], options=make_request_options( extra_headers=extra_headers, @@ -1330,7 +1344,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1382,7 +1398,9 @@ async def create_multiple( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/streaming/videos/batch", + "/streaming/videos/batch" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/batch", body=await async_maybe_transform( {"videos": videos}, video_create_multiple_params.VideoCreateMultipleParams ), @@ -1439,7 +1457,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}", + f"/streaming/videos/{video_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1503,7 +1523,9 @@ async def get_parameters_for_direct_upload( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/streaming/videos/{video_id}/upload", + f"/streaming/videos/{video_id}/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//streaming/videos/{video_id}/upload", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1537,7 +1559,9 @@ async def list_names( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._get( - "/streaming/videos/names", + "/streaming/videos/names" + if self._client._base_url_overridden + else "https://api.gcore.com//streaming/videos/names", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/advanced_rules.py b/src/gcore/resources/waap/advanced_rules.py index 6f4aca32..855bd508 100644 --- a/src/gcore/resources/waap/advanced_rules.py +++ b/src/gcore/resources/waap/advanced_rules.py @@ -51,7 +51,9 @@ def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return self._get( - "/waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -91,7 +93,9 @@ async def list( ) -> WaapAdvancedRuleDescriptorList: """Retrieve an advanced rules descriptor""" return await self._get( - "/waap/v1/advanced-rules/descriptor", + "/waap/v1/advanced-rules/descriptor" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/advanced-rules/descriptor", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/custom_page_sets.py b/src/gcore/resources/waap/custom_page_sets.py index 11d40a03..78e82b31 100644 --- a/src/gcore/resources/waap/custom_page_sets.py +++ b/src/gcore/resources/waap/custom_page_sets.py @@ -88,7 +88,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", body=maybe_transform( { "name": name, @@ -152,7 +154,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", body=maybe_transform( { "block": block, @@ -210,7 +214,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", page=SyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -258,7 +264,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -291,7 +299,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -349,7 +359,9 @@ def preview( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - "/waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/preview-custom-page", body=maybe_transform( { "error": error, @@ -430,7 +442,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", body=await async_maybe_transform( { "name": name, @@ -494,7 +508,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", body=await async_maybe_transform( { "block": block, @@ -552,7 +568,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/custom-page-sets", + "/waap/v1/custom-page-sets" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/custom-page-sets", page=AsyncOffsetPage[WaapCustomPageSet], options=make_request_options( extra_headers=extra_headers, @@ -600,7 +618,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -633,7 +653,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/custom-page-sets/{set_id}", + f"/waap/v1/custom-page-sets/{set_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/custom-page-sets/{set_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -691,7 +713,9 @@ async def preview( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - "/waap/v1/preview-custom-page", + "/waap/v1/preview-custom-page" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/preview-custom-page", body=await async_maybe_transform( { "error": error, diff --git a/src/gcore/resources/waap/domains/advanced_rules.py b/src/gcore/resources/waap/domains/advanced_rules.py index f46e4f46..2bfd7a2a 100644 --- a/src/gcore/resources/waap/domains/advanced_rules.py +++ b/src/gcore/resources/waap/domains/advanced_rules.py @@ -104,7 +104,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", body=maybe_transform( { "action": action, @@ -184,7 +186,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -278,7 +282,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", page=SyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -332,7 +338,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -368,7 +376,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -410,7 +420,9 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -497,7 +509,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", body=await async_maybe_transform( { "action": action, @@ -577,7 +591,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -671,7 +687,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/advanced-rules", + f"/waap/v1/domains/{domain_id}/advanced-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules", page=AsyncOffsetPage[WaapAdvancedRule], options=make_request_options( extra_headers=extra_headers, @@ -725,7 +743,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -761,7 +781,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -803,7 +825,9 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/advanced-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_discovery.py b/src/gcore/resources/waap/domains/api_discovery.py index 426426f5..df3a60cf 100644 --- a/src/gcore/resources/waap/domains/api_discovery.py +++ b/src/gcore/resources/waap/domains/api_discovery.py @@ -82,7 +82,9 @@ def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -115,7 +117,9 @@ def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -180,7 +184,9 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", page=SyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -231,7 +237,9 @@ def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -281,7 +289,9 @@ def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", body=maybe_transform( { "description_file_location": description_file_location, @@ -334,7 +344,9 @@ def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", body=maybe_transform( { "file_data": file_data, @@ -400,7 +412,9 @@ async def get_scan_result( if not scan_id: raise ValueError(f"Expected a non-empty value for `scan_id` but received {scan_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results/{scan_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -433,7 +447,9 @@ async def get_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -498,7 +514,9 @@ def list_scan_results( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-discovery/scan-results", + f"/waap/v1/domains/{domain_id}/api-discovery/scan-results" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan-results", page=AsyncOffsetPage[WaapAPIScanResult], options=make_request_options( extra_headers=extra_headers, @@ -549,7 +567,9 @@ async def scan_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/scan", + f"/waap/v1/domains/{domain_id}/api-discovery/scan" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/scan", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -599,7 +619,9 @@ async def update_settings( timeout: Override the client-level default timeout for this request, in seconds """ return await self._patch( - f"/waap/v1/domains/{domain_id}/api-discovery/settings", + f"/waap/v1/domains/{domain_id}/api-discovery/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/settings", body=await async_maybe_transform( { "description_file_location": description_file_location, @@ -652,7 +674,9 @@ async def upload_openapi( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-discovery/upload", + f"/waap/v1/domains/{domain_id}/api-discovery/upload" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-discovery/upload", body=await async_maybe_transform( { "file_data": file_data, diff --git a/src/gcore/resources/waap/domains/api_path_groups.py b/src/gcore/resources/waap/domains/api_path_groups.py index a6b25b2e..b75e11b4 100644 --- a/src/gcore/resources/waap/domains/api_path_groups.py +++ b/src/gcore/resources/waap/domains/api_path_groups.py @@ -65,7 +65,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +121,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/api-path-groups", + f"/waap/v1/domains/{domain_id}/api-path-groups" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-path-groups", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/api_paths.py b/src/gcore/resources/waap/domains/api_paths.py index ea3057ec..df8cefbc 100644 --- a/src/gcore/resources/waap/domains/api_paths.py +++ b/src/gcore/resources/waap/domains/api_paths.py @@ -84,7 +84,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", body=maybe_transform( { "http_scheme": http_scheme, @@ -143,7 +145,9 @@ def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", body=maybe_transform( { "api_groups": api_groups, @@ -238,7 +242,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", page=SyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -297,7 +303,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -335,7 +343,9 @@ def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -402,7 +412,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", body=await async_maybe_transform( { "http_scheme": http_scheme, @@ -461,7 +473,9 @@ async def update( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", body=await async_maybe_transform( { "api_groups": api_groups, @@ -556,7 +570,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/api-paths", + f"/waap/v1/domains/{domain_id}/api-paths" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths", page=AsyncOffsetPage[WaapAPIPath], options=make_request_options( extra_headers=extra_headers, @@ -615,7 +631,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -653,7 +671,9 @@ async def get( if not path_id: raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/api-paths/{path_id}", + f"/waap/v1/domains/{domain_id}/api-paths/{path_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/api-paths/{path_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/custom_rules.py b/src/gcore/resources/waap/domains/custom_rules.py index e81e575e..e98cf62e 100644 --- a/src/gcore/resources/waap/domains/custom_rules.py +++ b/src/gcore/resources/waap/domains/custom_rules.py @@ -93,7 +93,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", body=maybe_transform( { "action": action, @@ -156,7 +158,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -226,7 +230,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", page=SyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -279,7 +285,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -316,7 +324,9 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -355,7 +365,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -397,7 +409,9 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -468,7 +482,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", body=await async_maybe_transform( { "action": action, @@ -531,7 +547,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -601,7 +619,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/custom-rules", + f"/waap/v1/domains/{domain_id}/custom-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules", page=AsyncOffsetPage[WaapCustomRule], options=make_request_options( extra_headers=extra_headers, @@ -654,7 +674,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -691,7 +713,9 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams ), @@ -730,7 +754,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -772,7 +798,9 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/domains.py b/src/gcore/resources/waap/domains/domains.py index 644191c1..9cf7af61 100644 --- a/src/gcore/resources/waap/domains/domains.py +++ b/src/gcore/resources/waap/domains/domains.py @@ -198,7 +198,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", body=maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -247,7 +249,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains", + "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", page=SyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -298,7 +300,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -331,7 +335,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -364,7 +370,9 @@ def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -402,7 +410,9 @@ def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -500,7 +510,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", body=await async_maybe_transform({"status": status}, domain_update_params.DomainUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -549,7 +561,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/domains", + "/waap/v1/domains" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/domains", page=AsyncOffsetPage[WaapSummaryDomain], options=make_request_options( extra_headers=extra_headers, @@ -600,7 +612,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -633,7 +647,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}", + f"/waap/v1/domains/{domain_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -666,7 +682,9 @@ async def list_rule_sets( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/rule-sets", + f"/waap/v1/domains/{domain_id}/rule-sets" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/rule-sets", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -704,7 +722,9 @@ async def toggle_policy( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", + f"/waap/v1/domains/{domain_id}/policies/{policy_id}/toggle" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/policies/{policy_id}/toggle", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/firewall_rules.py b/src/gcore/resources/waap/domains/firewall_rules.py index 3dbdde0b..fc6c2b83 100644 --- a/src/gcore/resources/waap/domains/firewall_rules.py +++ b/src/gcore/resources/waap/domains/firewall_rules.py @@ -91,7 +91,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", body=maybe_transform( { "action": action, @@ -153,7 +155,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=maybe_transform( { "action": action, @@ -223,7 +227,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", page=SyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -276,7 +282,9 @@ def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -313,7 +321,9 @@ def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -352,7 +362,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -394,7 +406,9 @@ def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -463,7 +477,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", body=await async_maybe_transform( { "action": action, @@ -525,7 +541,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", body=await async_maybe_transform( { "action": action, @@ -595,7 +613,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/firewall-rules", + f"/waap/v1/domains/{domain_id}/firewall-rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules", page=AsyncOffsetPage[WaapFirewallRule], options=make_request_options( extra_headers=extra_headers, @@ -648,7 +668,9 @@ async def delete( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -685,7 +707,9 @@ async def delete_multiple( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", + f"/waap/v1/domains/{domain_id}/firewall-rules/bulk_delete" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/bulk_delete", body=await async_maybe_transform( {"rule_ids": rule_ids}, firewall_rule_delete_multiple_params.FirewallRuleDeleteMultipleParams ), @@ -724,7 +748,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -766,7 +792,9 @@ async def toggle( raise ValueError(f"Expected a non-empty value for `action` but received {action!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", + f"/waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/firewall-rules/{rule_id}/{action}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insight_silences.py b/src/gcore/resources/waap/domains/insight_silences.py index 8b57783e..8d81b5e7 100644 --- a/src/gcore/resources/waap/domains/insight_silences.py +++ b/src/gcore/resources/waap/domains/insight_silences.py @@ -93,7 +93,9 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ return self._post( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", body=maybe_transform( { "author": author, @@ -153,7 +155,9 @@ def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=maybe_transform( { "author": author, @@ -228,7 +232,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", page=SyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -283,7 +289,9 @@ def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -321,7 +329,9 @@ def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -392,7 +402,9 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ return await self._post( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", body=await async_maybe_transform( { "author": author, @@ -452,7 +464,9 @@ async def update( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._patch( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", body=await async_maybe_transform( { "author": author, @@ -527,7 +541,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insight-silences", + f"/waap/v1/domains/{domain_id}/insight-silences" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences", page=AsyncOffsetPage[WaapInsightSilence], options=make_request_options( extra_headers=extra_headers, @@ -582,7 +598,9 @@ async def delete( raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -620,7 +638,9 @@ async def get( if not silence_id: raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}", + f"/waap/v1/domains/{domain_id}/insight-silences/{silence_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insight-silences/{silence_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/insights.py b/src/gcore/resources/waap/domains/insights.py index 924fe5e2..068c932d 100644 --- a/src/gcore/resources/waap/domains/insights.py +++ b/src/gcore/resources/waap/domains/insights.py @@ -106,7 +106,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", page=SyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -158,7 +160,9 @@ def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -199,7 +203,9 @@ def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", body=maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -289,7 +295,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/insights", + f"/waap/v1/domains/{domain_id}/insights" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights", page=AsyncOffsetPage[WaapInsight], options=make_request_options( extra_headers=extra_headers, @@ -341,7 +349,9 @@ async def get( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -382,7 +392,9 @@ async def replace( if not insight_id: raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}") return await self._put( - f"/waap/v1/domains/{domain_id}/insights/{insight_id}", + f"/waap/v1/domains/{domain_id}/insights/{insight_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/insights/{insight_id}", body=await async_maybe_transform({"status": status}, insight_replace_params.InsightReplaceParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/gcore/resources/waap/domains/settings.py b/src/gcore/resources/waap/domains/settings.py index fcaabeaa..fe8edb00 100644 --- a/src/gcore/resources/waap/domains/settings.py +++ b/src/gcore/resources/waap/domains/settings.py @@ -74,7 +74,9 @@ def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._patch( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", body=maybe_transform( { "api": api, @@ -114,7 +116,9 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -175,7 +179,9 @@ async def update( """ extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._patch( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", body=await async_maybe_transform( { "api": api, @@ -215,7 +221,9 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/settings", + f"/waap/v1/domains/{domain_id}/settings" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/settings", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/gcore/resources/waap/domains/statistics.py b/src/gcore/resources/waap/domains/statistics.py index 94514578..b912f295 100644 --- a/src/gcore/resources/waap/domains/statistics.py +++ b/src/gcore/resources/waap/domains/statistics.py @@ -98,7 +98,9 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", page=SyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -161,7 +163,9 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", page=SyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -227,7 +231,9 @@ def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -280,7 +286,9 @@ def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -374,7 +382,9 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", page=SyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -440,7 +450,9 @@ def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - f"/waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -520,7 +532,9 @@ def get_ddos_attacks( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-attacks", + f"/waap/v1/domains/{domain_id}/ddos-attacks" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-attacks", page=AsyncOffsetPage[WaapDDOSAttack], options=make_request_options( extra_headers=extra_headers, @@ -583,7 +597,9 @@ def get_ddos_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/ddos-info", + f"/waap/v1/domains/{domain_id}/ddos-info" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/ddos-info", page=AsyncOffsetPage[WaapDDOSInfo], options=make_request_options( extra_headers=extra_headers, @@ -649,7 +665,9 @@ async def get_events_aggregated( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/stats", + f"/waap/v1/domains/{domain_id}/stats" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/stats", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -702,7 +720,9 @@ async def get_request_details( if not request_id: raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") return await self._get( - f"/waap/v1/domains/{domain_id}/requests/{request_id}/details", + f"/waap/v1/domains/{domain_id}/requests/{request_id}/details" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests/{request_id}/details", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -796,7 +816,9 @@ def get_requests_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - f"/waap/v1/domains/{domain_id}/requests", + f"/waap/v1/domains/{domain_id}/requests" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/requests", page=AsyncOffsetPage[WaapRequestSummary], options=make_request_options( extra_headers=extra_headers, @@ -862,7 +884,9 @@ async def get_traffic_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - f"/waap/v1/domains/{domain_id}/traffic", + f"/waap/v1/domains/{domain_id}/traffic" + if self._client._base_url_overridden + else f"https://api.gcore.com//waap/v1/domains/{domain_id}/traffic", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/insights.py b/src/gcore/resources/waap/insights.py index 5de0a968..8b9a2234 100644 --- a/src/gcore/resources/waap/insights.py +++ b/src/gcore/resources/waap/insights.py @@ -87,7 +87,9 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types", + "/waap/v1/security-insights/types" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/security-insights/types", page=SyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, @@ -172,7 +174,9 @@ def list_types( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/security-insights/types", + "/waap/v1/security-insights/types" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/security-insights/types", page=AsyncOffsetPage[WaapInsightType], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/ip_info/ip_info.py b/src/gcore/resources/waap/ip_info/ip_info.py index 0c0050f2..2e1fbd71 100644 --- a/src/gcore/resources/waap/ip_info/ip_info.py +++ b/src/gcore/resources/waap/ip_info/ip_info.py @@ -95,7 +95,9 @@ def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -142,7 +144,9 @@ def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -189,7 +193,9 @@ def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -229,7 +235,9 @@ def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -274,7 +282,9 @@ def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -323,7 +333,9 @@ def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -372,7 +384,9 @@ def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -415,7 +429,9 @@ def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -479,7 +495,9 @@ async def get_attack_time_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-time-series", + "/waap/v1/ip-info/attack-time-series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-time-series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -526,7 +544,9 @@ async def get_blocked_requests( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/blocked-requests", + "/waap/v1/ip-info/blocked-requests" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/blocked-requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -573,7 +593,9 @@ async def get_ddos_attack_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ddos", + "/waap/v1/ip-info/ddos" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ddos", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -613,7 +635,9 @@ async def get_ip_info( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/ip-info", + "/waap/v1/ip-info/ip-info" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/ip-info", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -658,7 +682,9 @@ async def get_top_urls( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-urls", + "/waap/v1/ip-info/top-urls" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-urls", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -707,7 +733,9 @@ async def get_top_user_agents( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-user-agents", + "/waap/v1/ip-info/top-user-agents" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-user-agents", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -756,7 +784,9 @@ async def get_top_user_sessions( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/top-sessions", + "/waap/v1/ip-info/top-sessions" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/top-sessions", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -799,7 +829,9 @@ async def list_attacked_countries( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/attack-map", + "/waap/v1/ip-info/attack-map" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/attack-map", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/ip_info/metrics.py b/src/gcore/resources/waap/ip_info/metrics.py index dd60d037..7d04cbd5 100644 --- a/src/gcore/resources/waap/ip_info/metrics.py +++ b/src/gcore/resources/waap/ip_info/metrics.py @@ -77,7 +77,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -149,7 +151,9 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/ip-info/counts", + "/waap/v1/ip-info/counts" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/ip-info/counts", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/organizations.py b/src/gcore/resources/waap/organizations.py index 07a8bc66..9a12a3c4 100644 --- a/src/gcore/resources/waap/organizations.py +++ b/src/gcore/resources/waap/organizations.py @@ -82,7 +82,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations", + "/waap/v1/organizations" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/organizations", page=SyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, @@ -160,7 +162,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/organizations", + "/waap/v1/organizations" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/organizations", page=AsyncOffsetPage[WaapOrganization], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/statistics.py b/src/gcore/resources/waap/statistics.py index e383f236..23840a49 100644 --- a/src/gcore/resources/waap/statistics.py +++ b/src/gcore/resources/waap/statistics.py @@ -87,7 +87,9 @@ def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return self._get( - "/waap/v1/statistics/series", + "/waap/v1/statistics/series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -169,7 +171,9 @@ async def get_usage_series( timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( - "/waap/v1/statistics/series", + "/waap/v1/statistics/series" + if self._client._base_url_overridden + else "https://api.gcore.com//waap/v1/statistics/series", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/gcore/resources/waap/tags.py b/src/gcore/resources/waap/tags.py index 879f3f47..543f186c 100644 --- a/src/gcore/resources/waap/tags.py +++ b/src/gcore/resources/waap/tags.py @@ -88,7 +88,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags", + "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", page=SyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, @@ -174,7 +174,7 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( - "/waap/v1/tags", + "/waap/v1/tags" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/tags", page=AsyncOffsetPage[WaapTag], options=make_request_options( extra_headers=extra_headers, diff --git a/src/gcore/resources/waap/waap.py b/src/gcore/resources/waap/waap.py index d5509b5f..01f7d84c 100644 --- a/src/gcore/resources/waap/waap.py +++ b/src/gcore/resources/waap/waap.py @@ -147,7 +147,7 @@ def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return self._get( - "/waap/v1/clients/me", + "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -219,7 +219,7 @@ async def get_account_overview( ) -> WaapGetAccountOverviewResponse: """Get information about WAAP service for the client""" return await self._get( - "/waap/v1/clients/me", + "/waap/v1/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//waap/v1/clients/me", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), From ed887c6e0fbdd63a8a6b904b1fafe41f08f179d2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 25 Sep 2025 07:43:07 +0000 Subject: [PATCH 16/23] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 29162beb..c571d3d7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-529e656a1e2b65a9adec55ae8207a9bc5a2bdd9c7adf846627aab1fa721f8e66.yml -openapi_spec_hash: 83d94f9375542b87f0227c982076ac1f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-da84a23d077729a2f9b3fddd8875bcfaa746d424a20bb24042c5a75c4f26cd9c.yml +openapi_spec_hash: 779e938deb4b2bbf7439e759411b2612 config_hash: fee4391924d7ea28b2bb5e5d81c8778f From 7850a7ab9fea3dc47e3cb568b94dffaedb219b6a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 25 Sep 2025 09:21:02 +0000 Subject: [PATCH 17/23] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index c571d3d7..ffc7f790 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-da84a23d077729a2f9b3fddd8875bcfaa746d424a20bb24042c5a75c4f26cd9c.yml openapi_spec_hash: 779e938deb4b2bbf7439e759411b2612 -config_hash: fee4391924d7ea28b2bb5e5d81c8778f +config_hash: fb616a3673c89cafa4b40ebf35b912e3 From 634f34b96fb7e74f7566493af8716f90d85016b9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 25 Sep 2025 14:30:24 +0000 Subject: [PATCH 18/23] feat(cloud): enable TF for floating IPs --- .stats.yml | 6 +++--- src/gcore/resources/cloud/cloud.py | 24 +++++++++++++++++++++++ src/gcore/resources/cloud/floating_ips.py | 10 ++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index ffc7f790..7a48049f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-da84a23d077729a2f9b3fddd8875bcfaa746d424a20bb24042c5a75c4f26cd9c.yml -openapi_spec_hash: 779e938deb4b2bbf7439e759411b2612 -config_hash: fb616a3673c89cafa4b40ebf35b912e3 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0f2def526562974411b1e35ca95e3090a7d407c1cb60d111b08167da8ffc7d90.yml +openapi_spec_hash: b1c7de35e2926455753274c2f4c567bb +config_hash: ae97def27b01f1398b799f2463b56aa0 diff --git a/src/gcore/resources/cloud/cloud.py b/src/gcore/resources/cloud/cloud.py index bd70d20c..eee5ccd6 100644 --- a/src/gcore/resources/cloud/cloud.py +++ b/src/gcore/resources/cloud/cloud.py @@ -263,6 +263,10 @@ def volumes(self) -> VolumesResource: @cached_property def floating_ips(self) -> FloatingIPsResource: + """A floating IP is a static IP address that points to one of your Instances. + + It allows you to redirect network traffic to any of your Instances in the same datacenter. + """ return FloatingIPsResource(self._client) @cached_property @@ -388,6 +392,10 @@ def volumes(self) -> AsyncVolumesResource: @cached_property def floating_ips(self) -> AsyncFloatingIPsResource: + """A floating IP is a static IP address that points to one of your Instances. + + It allows you to redirect network traffic to any of your Instances in the same datacenter. + """ return AsyncFloatingIPsResource(self._client) @cached_property @@ -516,6 +524,10 @@ def volumes(self) -> VolumesResourceWithRawResponse: @cached_property def floating_ips(self) -> FloatingIPsResourceWithRawResponse: + """A floating IP is a static IP address that points to one of your Instances. + + It allows you to redirect network traffic to any of your Instances in the same datacenter. + """ return FloatingIPsResourceWithRawResponse(self._cloud.floating_ips) @cached_property @@ -625,6 +637,10 @@ def volumes(self) -> AsyncVolumesResourceWithRawResponse: @cached_property def floating_ips(self) -> AsyncFloatingIPsResourceWithRawResponse: + """A floating IP is a static IP address that points to one of your Instances. + + It allows you to redirect network traffic to any of your Instances in the same datacenter. + """ return AsyncFloatingIPsResourceWithRawResponse(self._cloud.floating_ips) @cached_property @@ -734,6 +750,10 @@ def volumes(self) -> VolumesResourceWithStreamingResponse: @cached_property def floating_ips(self) -> FloatingIPsResourceWithStreamingResponse: + """A floating IP is a static IP address that points to one of your Instances. + + It allows you to redirect network traffic to any of your Instances in the same datacenter. + """ return FloatingIPsResourceWithStreamingResponse(self._cloud.floating_ips) @cached_property @@ -843,6 +863,10 @@ def volumes(self) -> AsyncVolumesResourceWithStreamingResponse: @cached_property def floating_ips(self) -> AsyncFloatingIPsResourceWithStreamingResponse: + """A floating IP is a static IP address that points to one of your Instances. + + It allows you to redirect network traffic to any of your Instances in the same datacenter. + """ return AsyncFloatingIPsResourceWithStreamingResponse(self._cloud.floating_ips) @cached_property diff --git a/src/gcore/resources/cloud/floating_ips.py b/src/gcore/resources/cloud/floating_ips.py index 68cc504c..d969f166 100644 --- a/src/gcore/resources/cloud/floating_ips.py +++ b/src/gcore/resources/cloud/floating_ips.py @@ -33,6 +33,11 @@ class FloatingIPsResource(SyncAPIResource): + """A floating IP is a static IP address that points to one of your Instances. + + It allows you to redirect network traffic to any of your Instances in the same datacenter. + """ + @cached_property def with_raw_response(self) -> FloatingIPsResourceWithRawResponse: """ @@ -531,6 +536,11 @@ def delete_and_poll( class AsyncFloatingIPsResource(AsyncAPIResource): + """A floating IP is a static IP address that points to one of your Instances. + + It allows you to redirect network traffic to any of your Instances in the same datacenter. + """ + @cached_property def with_raw_response(self) -> AsyncFloatingIPsResourceWithRawResponse: """ From b1cf92bceab80a2be084cdfba9defc591836b059 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 26 Sep 2025 10:10:45 +0000 Subject: [PATCH 19/23] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7a48049f..eb1d14c1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-0f2def526562974411b1e35ca95e3090a7d407c1cb60d111b08167da8ffc7d90.yml -openapi_spec_hash: b1c7de35e2926455753274c2f4c567bb +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-50ea4cb2cfb59cc83930457f5119efe716bf23a7cc5d6c6949b25ed842b4bc9a.yml +openapi_spec_hash: e75a52f3a96070ecb451fff82a33e94d config_hash: ae97def27b01f1398b799f2463b56aa0 From cca7d4370f030a91152dd87193f47b319778e80a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Sep 2025 14:10:31 +0000 Subject: [PATCH 20/23] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index eb1d14c1..ea4c0bb8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-50ea4cb2cfb59cc83930457f5119efe716bf23a7cc5d6c6949b25ed842b4bc9a.yml -openapi_spec_hash: e75a52f3a96070ecb451fff82a33e94d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8547b524a14d0f5e0093396c4e0e1afab2fe239396910617c009402b547cba46.yml +openapi_spec_hash: 8768c88e22bbe1d3042539be56ea8469 config_hash: ae97def27b01f1398b799f2463b56aa0 From e5961ca7683a89bf6e551bd4bedd82c1b76e4052 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Sep 2025 16:19:51 +0000 Subject: [PATCH 21/23] fix(client): correctly generate K8sClusterSlurmAddonV2Serializers --- .stats.yml | 6 +- api.md | 1 + .../gpu_baremetal_clusters.py | 178 ++++++++++++++++++ src/gcore/types/cloud/__init__.py | 1 + .../gpu_baremetal_cluster_action_params.py | 46 +++++ .../types/cloud/k8s/cluster_update_params.py | 2 +- .../cloud/test_gpu_baremetal_clusters.py | 108 +++++++++++ 7 files changed, 338 insertions(+), 4 deletions(-) create mode 100644 src/gcore/types/cloud/gpu_baremetal_cluster_action_params.py diff --git a/.stats.yml b/.stats.yml index ea4c0bb8..076e10de 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 524 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8547b524a14d0f5e0093396c4e0e1afab2fe239396910617c009402b547cba46.yml +configured_endpoints: 525 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d59e09eb6882032973e42339edbc5170a0d695dcb127e28e29109f1a1f088afd.yml openapi_spec_hash: 8768c88e22bbe1d3042539be56ea8469 -config_hash: ae97def27b01f1398b799f2463b56aa0 +config_hash: b9ce342bbc2dc553f1ef41dc1ccf9084 diff --git a/api.md b/api.md index 56d6038b..19a53ae1 100644 --- a/api.md +++ b/api.md @@ -770,6 +770,7 @@ Methods: - client.cloud.gpu_baremetal_clusters.create(\*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.gpu_baremetal_clusters.list(\*, project_id, region_id, \*\*params) -> SyncOffsetPage[GPUBaremetalCluster] - client.cloud.gpu_baremetal_clusters.delete(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.gpu_baremetal_clusters.action(cluster_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.gpu_baremetal_clusters.get(cluster_id, \*, project_id, region_id) -> GPUBaremetalCluster - client.cloud.gpu_baremetal_clusters.powercycle_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1List - client.cloud.gpu_baremetal_clusters.reboot_all_servers(cluster_id, \*, project_id, region_id) -> GPUBaremetalClusterServerV1List 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 e3a913c6..75e92cde 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 @@ -52,6 +52,7 @@ from ....pagination import SyncOffsetPage, AsyncOffsetPage from ....types.cloud import ( gpu_baremetal_cluster_list_params, + gpu_baremetal_cluster_action_params, gpu_baremetal_cluster_create_params, gpu_baremetal_cluster_delete_params, gpu_baremetal_cluster_resize_params, @@ -59,6 +60,7 @@ ) from ...._base_client import AsyncPaginator, make_request_options from ....types.cloud.task_id_list import TaskIDList +from ....types.cloud.tag_update_map_param import TagUpdateMapParam from ....types.cloud.gpu_baremetal_cluster import GPUBaremetalCluster from ....types.cloud.gpu_baremetal_clusters.gpu_baremetal_cluster_server_v1_list import GPUBaremetalClusterServerV1List @@ -316,6 +318,88 @@ def delete( cast_to=TaskIDList, ) + def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["update_tags"], + tags: Optional[TagUpdateMapParam], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """Perform a specific action on a baremetal GPU cluster. + + Available actions: update + tags. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + action: Action name + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return self._post( + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/action" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/action", + body=maybe_transform( + { + "action": action, + "tags": tags, + }, + gpu_baremetal_cluster_action_params.GPUBaremetalClusterActionParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + def get( self, cluster_id: str, @@ -965,6 +1049,88 @@ async def delete( cast_to=TaskIDList, ) + async def action( + self, + cluster_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["update_tags"], + tags: Optional[TagUpdateMapParam], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + """Perform a specific action on a baremetal GPU cluster. + + Available actions: update + tags. + + Args: + project_id: Project ID + + region_id: Region ID + + cluster_id: Cluster unique identifier + + action: Action name + + tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide + key-value pairs to add or update tags. Set tag values to `null` to remove tags. + Unspecified tags remain unchanged. Read-only tags are always preserved and + cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not cluster_id: + raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}") + return await self._post( + f"/cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/action" + if self._client._base_url_overridden + else f"https://api.gcore.com//cloud/v3/gpu/baremetal/{project_id}/{region_id}/clusters/{cluster_id}/action", + body=await async_maybe_transform( + { + "action": action, + "tags": tags, + }, + gpu_baremetal_cluster_action_params.GPUBaremetalClusterActionParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + async def get( self, cluster_id: str, @@ -1376,6 +1542,9 @@ def __init__(self, gpu_baremetal_clusters: GPUBaremetalClustersResource) -> None self.delete = to_raw_response_wrapper( gpu_baremetal_clusters.delete, ) + self.action = to_raw_response_wrapper( + gpu_baremetal_clusters.action, + ) self.get = to_raw_response_wrapper( gpu_baremetal_clusters.get, ) @@ -1422,6 +1591,9 @@ def __init__(self, gpu_baremetal_clusters: AsyncGPUBaremetalClustersResource) -> self.delete = async_to_raw_response_wrapper( gpu_baremetal_clusters.delete, ) + self.action = async_to_raw_response_wrapper( + gpu_baremetal_clusters.action, + ) self.get = async_to_raw_response_wrapper( gpu_baremetal_clusters.get, ) @@ -1468,6 +1640,9 @@ def __init__(self, gpu_baremetal_clusters: GPUBaremetalClustersResource) -> None self.delete = to_streamed_response_wrapper( gpu_baremetal_clusters.delete, ) + self.action = to_streamed_response_wrapper( + gpu_baremetal_clusters.action, + ) self.get = to_streamed_response_wrapper( gpu_baremetal_clusters.get, ) @@ -1514,6 +1689,9 @@ def __init__(self, gpu_baremetal_clusters: AsyncGPUBaremetalClustersResource) -> self.delete = async_to_streamed_response_wrapper( gpu_baremetal_clusters.delete, ) + self.action = async_to_streamed_response_wrapper( + gpu_baremetal_clusters.action, + ) self.get = async_to_streamed_response_wrapper( gpu_baremetal_clusters.get, ) diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 21972950..852d56df 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -166,6 +166,7 @@ from .laas_index_retention_policy_param import LaasIndexRetentionPolicyParam as LaasIndexRetentionPolicyParam from .load_balancer_member_connectivity import LoadBalancerMemberConnectivity as LoadBalancerMemberConnectivity from .volume_detach_from_instance_params import VolumeDetachFromInstanceParams as VolumeDetachFromInstanceParams +from .gpu_baremetal_cluster_action_params import GPUBaremetalClusterActionParams as GPUBaremetalClusterActionParams from .gpu_baremetal_cluster_create_params import GPUBaremetalClusterCreateParams as GPUBaremetalClusterCreateParams from .gpu_baremetal_cluster_delete_params import GPUBaremetalClusterDeleteParams as GPUBaremetalClusterDeleteParams from .gpu_baremetal_cluster_resize_params import GPUBaremetalClusterResizeParams as GPUBaremetalClusterResizeParams diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_action_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_action_params.py new file mode 100644 index 00000000..66c88a9f --- /dev/null +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_action_params.py @@ -0,0 +1,46 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +from .tag_update_map_param import TagUpdateMapParam + +__all__ = ["GPUBaremetalClusterActionParams"] + + +class GPUBaremetalClusterActionParams(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + action: Required[Literal["update_tags"]] + """Action name""" + + tags: Required[Optional[TagUpdateMapParam]] + """Update key-value tags using JSON Merge Patch semantics (RFC 7386). + + Provide key-value pairs to add or update tags. Set tag values to `null` to + remove tags. Unspecified tags remain unchanged. Read-only tags are always + preserved and cannot be modified. + + **Examples:** + + - **Add/update tags:** + `{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or + updates existing ones. + - **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags. + - **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only + tags are preserved). + - **Partial update:** `{'tags': {'environment': 'staging'}}` only updates + specified tags. + - **Mixed operations:** + `{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}` + adds/updates 'environment' and '`cost_center`' while removing + '`deprecated_tag`', preserving other existing tags. + - **Replace all:** first delete existing tags with null values, then add new + ones in the same request. + """ diff --git a/src/gcore/types/cloud/k8s/cluster_update_params.py b/src/gcore/types/cloud/k8s/cluster_update_params.py index 01670802..46e02a9d 100644 --- a/src/gcore/types/cloud/k8s/cluster_update_params.py +++ b/src/gcore/types/cloud/k8s/cluster_update_params.py @@ -135,7 +135,7 @@ class AddOnsSlurmK8sClusterSlurmAddonEnableV2Serializer(TypedDict, total=False): class AddOnsSlurmK8sClusterSlurmAddonDisableV2Serializer(TypedDict, total=False): - enabled: Required[bool] + enabled: Required[Literal[False]] """The Slurm add-on will be disabled in the cluster.""" diff --git a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py index b6a7547c..9fc01cc9 100644 --- a/tests/api_resources/cloud/test_gpu_baremetal_clusters.py +++ b/tests/api_resources/cloud/test_gpu_baremetal_clusters.py @@ -204,6 +204,60 @@ def test_path_params_delete(self, client: Gcore) -> None: region_id=7, ) + @parametrize + def test_method_action(self, client: Gcore) -> None: + gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_raw_response_action(self, client: Gcore) -> None: + response = client.cloud.gpu_baremetal_clusters.with_raw_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + def test_streaming_response_action(self, client: Gcore) -> None: + with client.cloud.gpu_baremetal_clusters.with_streaming_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_action(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + client.cloud.gpu_baremetal_clusters.with_raw_response.action( + cluster_id="", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + @parametrize def test_method_get(self, client: Gcore) -> None: gpu_baremetal_cluster = client.cloud.gpu_baremetal_clusters.get( @@ -642,6 +696,60 @@ async def test_path_params_delete(self, async_client: AsyncGcore) -> None: region_id=7, ) + @parametrize + async def test_method_action(self, async_client: AsyncGcore) -> None: + gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_raw_response_action(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.gpu_baremetal_clusters.with_raw_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + gpu_baremetal_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + @parametrize + async def test_streaming_response_action(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.gpu_baremetal_clusters.with_streaming_response.action( + cluster_id="1aaaab48-10d0-46d9-80cc-85209284ceb4", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + gpu_baremetal_cluster = await response.parse() + assert_matches_type(TaskIDList, gpu_baremetal_cluster, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_action(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cluster_id` but received ''"): + await async_client.cloud.gpu_baremetal_clusters.with_raw_response.action( + cluster_id="", + project_id=1, + region_id=7, + action="update_tags", + tags={"foo": "my-tag-value"}, + ) + @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: gpu_baremetal_cluster = await async_client.cloud.gpu_baremetal_clusters.get( From e07d4e7427042c2996c6dae86f70f0cc86a8d6d5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 30 Sep 2025 05:01:04 +0000 Subject: [PATCH 22/23] feat(cdn): add API support --- .stats.yml | 4 +- api.md | 314 ++ src/gcore/_client.py | 9 + src/gcore/pagination.py | 137 + src/gcore/resources/__init__.py | 14 + src/gcore/resources/cdn/__init__.py | 201 ++ src/gcore/resources/cdn/audit_log.py | 406 +++ src/gcore/resources/cdn/cdn.py | 957 ++++++ src/gcore/resources/cdn/certificates.py | 1062 +++++++ src/gcore/resources/cdn/ip_ranges.py | 224 ++ src/gcore/resources/cdn/logs/__init__.py | 33 + src/gcore/resources/cdn/logs/logs.py | 1424 +++++++++ src/gcore/resources/cdn/logs/settings.py | 1081 +++++++ .../resources/cdn/logs_uploader/__init__.py | 61 + .../resources/cdn/logs_uploader/configs.py | 868 ++++++ .../cdn/logs_uploader/logs_uploader.py | 166 ++ .../resources/cdn/logs_uploader/policies.py | 1060 +++++++ .../resources/cdn/logs_uploader/targets.py | 811 +++++ src/gcore/resources/cdn/metrics.py | 419 +++ src/gcore/resources/cdn/network_capacity.py | 139 + src/gcore/resources/cdn/origin_groups.py | 1496 ++++++++++ src/gcore/resources/cdn/resources/__init__.py | 47 + .../resources/cdn/resources/resources.py | 2060 +++++++++++++ src/gcore/resources/cdn/resources/rules.py | 1027 +++++++ src/gcore/resources/cdn/resources/shield.py | 259 ++ src/gcore/resources/cdn/rule_templates.py | 883 ++++++ src/gcore/resources/cdn/shields.py | 139 + src/gcore/resources/cdn/statistics.py | 1408 +++++++++ .../resources/cdn/trusted_ca_certificates.py | 592 ++++ src/gcore/types/cdn/__init__.py | 80 + src/gcore/types/cdn/audit_log_list_params.py | 73 + src/gcore/types/cdn/ca_certificate.py | 53 + src/gcore/types/cdn/ca_certificate_list.py | 10 + src/gcore/types/cdn/cdn_account.py | 86 + src/gcore/types/cdn/cdn_account_limits.py | 27 + src/gcore/types/cdn/cdn_audit_log_entry.py | 66 + src/gcore/types/cdn/cdn_available_features.py | 46 + .../cdn/cdn_list_purge_statuses_params.py | 67 + src/gcore/types/cdn/cdn_log_entry.py | 70 + src/gcore/types/cdn/cdn_metrics.py | 22 + src/gcore/types/cdn/cdn_metrics_groups.py | 13 + src/gcore/types/cdn/cdn_metrics_values.py | 19 + src/gcore/types/cdn/cdn_resource.py | 1977 +++++++++++++ src/gcore/types/cdn/cdn_resource_list.py | 10 + .../types/cdn/cdn_update_account_params.py | 15 + .../types/cdn/certificate_create_params.py | 51 + .../cdn/certificate_get_status_params.py | 14 + .../types/cdn/certificate_list_params.py | 29 + .../types/cdn/certificate_replace_params.py | 39 + src/gcore/types/cdn/log_download_params.py | 279 ++ src/gcore/types/cdn/log_list_params.py | 273 ++ src/gcore/types/cdn/logs/__init__.py | 7 + src/gcore/types/cdn/logs/log_settings.py | 172 ++ .../types/cdn/logs/setting_create_params.py | 200 ++ .../types/cdn/logs/setting_update_params.py | 200 ++ src/gcore/types/cdn/logs_aggregated_stats.py | 23 + src/gcore/types/cdn/logs_uploader/__init__.py | 23 + .../cdn/logs_uploader/config_create_params.py | 32 + .../cdn/logs_uploader/config_list_params.py | 16 + .../logs_uploader/config_replace_params.py | 32 + .../cdn/logs_uploader/config_update_params.py | 32 + .../cdn/logs_uploader/logs_uploader_config.py | 51 + .../logs_uploader_config_list.py | 10 + .../cdn/logs_uploader/logs_uploader_policy.py | 73 + .../logs_uploader_policy_list.py | 10 + .../cdn/logs_uploader/logs_uploader_target.py | 236 ++ .../logs_uploader_target_list.py | 10 + .../cdn/logs_uploader/policy_create_params.py | 61 + .../policy_list_fields_response.py | 8 + .../cdn/logs_uploader/policy_list_params.py | 16 + .../logs_uploader/policy_replace_params.py | 61 + .../cdn/logs_uploader/policy_update_params.py | 61 + .../cdn/logs_uploader/target_create_params.py | 249 ++ .../cdn/logs_uploader/target_list_params.py | 16 + .../logs_uploader/target_replace_params.py | 249 ++ .../cdn/logs_uploader/target_update_params.py | 249 ++ .../types/cdn/logs_uploader_validation.py | 23 + src/gcore/types/cdn/metric_list_params.py | 168 ++ src/gcore/types/cdn/network_capacity.py | 22 + .../types/cdn/origin_group_create_params.py | 184 ++ .../types/cdn/origin_group_list_params.py | 24 + .../types/cdn/origin_group_replace_params.py | 190 ++ .../types/cdn/origin_group_update_params.py | 190 ++ src/gcore/types/cdn/origin_groups.py | 212 ++ src/gcore/types/cdn/origin_groups_list.py | 10 + src/gcore/types/cdn/public_ip_list.py | 15 + src/gcore/types/cdn/public_network_list.py | 15 + src/gcore/types/cdn/purge_status.py | 55 + .../types/cdn/resource_aggregated_stats.py | 80 + src/gcore/types/cdn/resource_create_params.py | 1825 ++++++++++++ src/gcore/types/cdn/resource_list_params.py | 107 + .../types/cdn/resource_prefetch_params.py | 17 + src/gcore/types/cdn/resource_purge_params.py | 71 + .../types/cdn/resource_replace_params.py | 1803 ++++++++++++ src/gcore/types/cdn/resource_update_params.py | 1794 +++++++++++ src/gcore/types/cdn/resource_usage_stats.py | 111 + src/gcore/types/cdn/resources/__init__.py | 11 + .../types/cdn/resources/cdn_resource_rule.py | 1695 +++++++++++ .../types/cdn/resources/origin_shielding.py | 15 + .../types/cdn/resources/rule_create_params.py | 1652 +++++++++++ .../types/cdn/resources/rule_list_response.py | 10 + .../cdn/resources/rule_replace_params.py | 1654 +++++++++++ .../types/cdn/resources/rule_update_params.py | 1654 +++++++++++ .../cdn/resources/shield_replace_params.py | 16 + src/gcore/types/cdn/rule_template.py | 1666 +++++++++++ .../types/cdn/rule_template_create_params.py | 1636 +++++++++++ src/gcore/types/cdn/rule_template_list.py | 10 + .../types/cdn/rule_template_replace_params.py | 1636 +++++++++++ .../types/cdn/rule_template_update_params.py | 1636 +++++++++++ .../types/cdn/shield_aggregated_stats.py | 23 + src/gcore/types/cdn/shield_list_response.py | 25 + src/gcore/types/cdn/ssl_detail.py | 62 + src/gcore/types/cdn/ssl_detail_list.py | 10 + src/gcore/types/cdn/ssl_request_status.py | 135 + ...tistic_get_logs_usage_aggregated_params.py | 42 + .../statistic_get_logs_usage_series_params.py | 35 + ...ic_get_resource_usage_aggregated_params.py | 151 + ...tistic_get_resource_usage_series_params.py | 131 + ...stic_get_shield_usage_aggregated_params.py | 42 + ...tatistic_get_shield_usage_series_params.py | 25 + .../trusted_ca_certificate_create_params.py | 23 + .../cdn/trusted_ca_certificate_list_params.py | 29 + .../trusted_ca_certificate_replace_params.py | 15 + src/gcore/types/cdn/usage_series_stats.py | 31 + tests/api_resources/cdn/__init__.py | 1 + tests/api_resources/cdn/logs/__init__.py | 1 + tests/api_resources/cdn/logs/test_settings.py | 568 ++++ .../cdn/logs_uploader/__init__.py | 1 + .../cdn/logs_uploader/test_configs.py | 572 ++++ .../cdn/logs_uploader/test_policies.py | 572 ++++ .../cdn/logs_uploader/test_targets.py | 668 +++++ tests/api_resources/cdn/resources/__init__.py | 1 + .../api_resources/cdn/resources/test_rules.py | 2101 +++++++++++++ .../cdn/resources/test_shield.py | 164 ++ tests/api_resources/cdn/test_audit_log.py | 171 ++ tests/api_resources/cdn/test_certificates.py | 686 +++++ tests/api_resources/cdn/test_ip_ranges.py | 124 + tests/api_resources/cdn/test_logs.py | 437 +++ tests/api_resources/cdn/test_metrics.py | 134 + .../cdn/test_network_capacity.py | 74 + tests/api_resources/cdn/test_origin_groups.py | 971 ++++++ tests/api_resources/cdn/test_resources.py | 2617 +++++++++++++++++ .../api_resources/cdn/test_rule_templates.py | 2035 +++++++++++++ tests/api_resources/cdn/test_shields.py | 74 + tests/api_resources/cdn/test_statistics.py | 608 ++++ .../cdn/test_trusted_ca_certificates.py | 355 +++ tests/api_resources/test_cdn.py | 320 ++ 147 files changed, 56956 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/cdn/__init__.py create mode 100644 src/gcore/resources/cdn/audit_log.py create mode 100644 src/gcore/resources/cdn/cdn.py create mode 100644 src/gcore/resources/cdn/certificates.py create mode 100644 src/gcore/resources/cdn/ip_ranges.py create mode 100644 src/gcore/resources/cdn/logs/__init__.py create mode 100644 src/gcore/resources/cdn/logs/logs.py create mode 100644 src/gcore/resources/cdn/logs/settings.py create mode 100644 src/gcore/resources/cdn/logs_uploader/__init__.py create mode 100644 src/gcore/resources/cdn/logs_uploader/configs.py create mode 100644 src/gcore/resources/cdn/logs_uploader/logs_uploader.py create mode 100644 src/gcore/resources/cdn/logs_uploader/policies.py create mode 100644 src/gcore/resources/cdn/logs_uploader/targets.py create mode 100644 src/gcore/resources/cdn/metrics.py create mode 100644 src/gcore/resources/cdn/network_capacity.py create mode 100644 src/gcore/resources/cdn/origin_groups.py create mode 100644 src/gcore/resources/cdn/resources/__init__.py create mode 100644 src/gcore/resources/cdn/resources/resources.py create mode 100644 src/gcore/resources/cdn/resources/rules.py create mode 100644 src/gcore/resources/cdn/resources/shield.py create mode 100644 src/gcore/resources/cdn/rule_templates.py create mode 100644 src/gcore/resources/cdn/shields.py create mode 100644 src/gcore/resources/cdn/statistics.py create mode 100644 src/gcore/resources/cdn/trusted_ca_certificates.py create mode 100644 src/gcore/types/cdn/__init__.py create mode 100644 src/gcore/types/cdn/audit_log_list_params.py create mode 100644 src/gcore/types/cdn/ca_certificate.py create mode 100644 src/gcore/types/cdn/ca_certificate_list.py create mode 100644 src/gcore/types/cdn/cdn_account.py create mode 100644 src/gcore/types/cdn/cdn_account_limits.py create mode 100644 src/gcore/types/cdn/cdn_audit_log_entry.py create mode 100644 src/gcore/types/cdn/cdn_available_features.py create mode 100644 src/gcore/types/cdn/cdn_list_purge_statuses_params.py create mode 100644 src/gcore/types/cdn/cdn_log_entry.py create mode 100644 src/gcore/types/cdn/cdn_metrics.py create mode 100644 src/gcore/types/cdn/cdn_metrics_groups.py create mode 100644 src/gcore/types/cdn/cdn_metrics_values.py create mode 100644 src/gcore/types/cdn/cdn_resource.py create mode 100644 src/gcore/types/cdn/cdn_resource_list.py create mode 100644 src/gcore/types/cdn/cdn_update_account_params.py create mode 100644 src/gcore/types/cdn/certificate_create_params.py create mode 100644 src/gcore/types/cdn/certificate_get_status_params.py create mode 100644 src/gcore/types/cdn/certificate_list_params.py create mode 100644 src/gcore/types/cdn/certificate_replace_params.py create mode 100644 src/gcore/types/cdn/log_download_params.py create mode 100644 src/gcore/types/cdn/log_list_params.py create mode 100644 src/gcore/types/cdn/logs/__init__.py create mode 100644 src/gcore/types/cdn/logs/log_settings.py create mode 100644 src/gcore/types/cdn/logs/setting_create_params.py create mode 100644 src/gcore/types/cdn/logs/setting_update_params.py create mode 100644 src/gcore/types/cdn/logs_aggregated_stats.py create mode 100644 src/gcore/types/cdn/logs_uploader/__init__.py create mode 100644 src/gcore/types/cdn/logs_uploader/config_create_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/config_list_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/config_replace_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/config_update_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/logs_uploader_config.py create mode 100644 src/gcore/types/cdn/logs_uploader/logs_uploader_config_list.py create mode 100644 src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py create mode 100644 src/gcore/types/cdn/logs_uploader/logs_uploader_policy_list.py create mode 100644 src/gcore/types/cdn/logs_uploader/logs_uploader_target.py create mode 100644 src/gcore/types/cdn/logs_uploader/logs_uploader_target_list.py create mode 100644 src/gcore/types/cdn/logs_uploader/policy_create_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/policy_list_fields_response.py create mode 100644 src/gcore/types/cdn/logs_uploader/policy_list_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/policy_replace_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/policy_update_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/target_create_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/target_list_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/target_replace_params.py create mode 100644 src/gcore/types/cdn/logs_uploader/target_update_params.py create mode 100644 src/gcore/types/cdn/logs_uploader_validation.py create mode 100644 src/gcore/types/cdn/metric_list_params.py create mode 100644 src/gcore/types/cdn/network_capacity.py create mode 100644 src/gcore/types/cdn/origin_group_create_params.py create mode 100644 src/gcore/types/cdn/origin_group_list_params.py create mode 100644 src/gcore/types/cdn/origin_group_replace_params.py create mode 100644 src/gcore/types/cdn/origin_group_update_params.py create mode 100644 src/gcore/types/cdn/origin_groups.py create mode 100644 src/gcore/types/cdn/origin_groups_list.py create mode 100644 src/gcore/types/cdn/public_ip_list.py create mode 100644 src/gcore/types/cdn/public_network_list.py create mode 100644 src/gcore/types/cdn/purge_status.py create mode 100644 src/gcore/types/cdn/resource_aggregated_stats.py create mode 100644 src/gcore/types/cdn/resource_create_params.py create mode 100644 src/gcore/types/cdn/resource_list_params.py create mode 100644 src/gcore/types/cdn/resource_prefetch_params.py create mode 100644 src/gcore/types/cdn/resource_purge_params.py create mode 100644 src/gcore/types/cdn/resource_replace_params.py create mode 100644 src/gcore/types/cdn/resource_update_params.py create mode 100644 src/gcore/types/cdn/resource_usage_stats.py create mode 100644 src/gcore/types/cdn/resources/__init__.py create mode 100644 src/gcore/types/cdn/resources/cdn_resource_rule.py create mode 100644 src/gcore/types/cdn/resources/origin_shielding.py create mode 100644 src/gcore/types/cdn/resources/rule_create_params.py create mode 100644 src/gcore/types/cdn/resources/rule_list_response.py create mode 100644 src/gcore/types/cdn/resources/rule_replace_params.py create mode 100644 src/gcore/types/cdn/resources/rule_update_params.py create mode 100644 src/gcore/types/cdn/resources/shield_replace_params.py create mode 100644 src/gcore/types/cdn/rule_template.py create mode 100644 src/gcore/types/cdn/rule_template_create_params.py create mode 100644 src/gcore/types/cdn/rule_template_list.py create mode 100644 src/gcore/types/cdn/rule_template_replace_params.py create mode 100644 src/gcore/types/cdn/rule_template_update_params.py create mode 100644 src/gcore/types/cdn/shield_aggregated_stats.py create mode 100644 src/gcore/types/cdn/shield_list_response.py create mode 100644 src/gcore/types/cdn/ssl_detail.py create mode 100644 src/gcore/types/cdn/ssl_detail_list.py create mode 100644 src/gcore/types/cdn/ssl_request_status.py create mode 100644 src/gcore/types/cdn/statistic_get_logs_usage_aggregated_params.py create mode 100644 src/gcore/types/cdn/statistic_get_logs_usage_series_params.py create mode 100644 src/gcore/types/cdn/statistic_get_resource_usage_aggregated_params.py create mode 100644 src/gcore/types/cdn/statistic_get_resource_usage_series_params.py create mode 100644 src/gcore/types/cdn/statistic_get_shield_usage_aggregated_params.py create mode 100644 src/gcore/types/cdn/statistic_get_shield_usage_series_params.py create mode 100644 src/gcore/types/cdn/trusted_ca_certificate_create_params.py create mode 100644 src/gcore/types/cdn/trusted_ca_certificate_list_params.py create mode 100644 src/gcore/types/cdn/trusted_ca_certificate_replace_params.py create mode 100644 src/gcore/types/cdn/usage_series_stats.py create mode 100644 tests/api_resources/cdn/__init__.py create mode 100644 tests/api_resources/cdn/logs/__init__.py create mode 100644 tests/api_resources/cdn/logs/test_settings.py create mode 100644 tests/api_resources/cdn/logs_uploader/__init__.py create mode 100644 tests/api_resources/cdn/logs_uploader/test_configs.py create mode 100644 tests/api_resources/cdn/logs_uploader/test_policies.py create mode 100644 tests/api_resources/cdn/logs_uploader/test_targets.py create mode 100644 tests/api_resources/cdn/resources/__init__.py create mode 100644 tests/api_resources/cdn/resources/test_rules.py create mode 100644 tests/api_resources/cdn/resources/test_shield.py create mode 100644 tests/api_resources/cdn/test_audit_log.py create mode 100644 tests/api_resources/cdn/test_certificates.py create mode 100644 tests/api_resources/cdn/test_ip_ranges.py create mode 100644 tests/api_resources/cdn/test_logs.py create mode 100644 tests/api_resources/cdn/test_metrics.py create mode 100644 tests/api_resources/cdn/test_network_capacity.py create mode 100644 tests/api_resources/cdn/test_origin_groups.py create mode 100644 tests/api_resources/cdn/test_resources.py create mode 100644 tests/api_resources/cdn/test_rule_templates.py create mode 100644 tests/api_resources/cdn/test_shields.py create mode 100644 tests/api_resources/cdn/test_statistics.py create mode 100644 tests/api_resources/cdn/test_trusted_ca_certificates.py create mode 100644 tests/api_resources/test_cdn.py diff --git a/.stats.yml b/.stats.yml index 076e10de..28d74a32 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 525 +configured_endpoints: 612 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-d59e09eb6882032973e42339edbc5170a0d695dcb127e28e29109f1a1f088afd.yml openapi_spec_hash: 8768c88e22bbe1d3042539be56ea8469 -config_hash: b9ce342bbc2dc553f1ef41dc1ccf9084 +config_hash: 11eb703eee66609eba76695b18f8cb4a diff --git a/api.md b/api.md index 19a53ae1..b15ab5ea 100644 --- a/api.md +++ b/api.md @@ -2076,3 +2076,317 @@ Methods: - client.storage.buckets.policy.create(bucket_name, \*, storage_id) -> None - client.storage.buckets.policy.delete(bucket_name, \*, storage_id) -> None - client.storage.buckets.policy.get(bucket_name, \*, storage_id) -> PolicyGetResponse + +# Cdn + +Types: + +```python +from gcore.types.cdn import CdnAccount, CdnAccountLimits, CdnAvailableFeatures, PurgeStatus +``` + +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.update_account(\*\*params) -> CdnAccount + +## Resources + +Types: + +```python +from gcore.types.cdn import CdnResource, CdnResourceList +``` + +Methods: + +- client.cdn.resources.create(\*\*params) -> CdnResource +- client.cdn.resources.update(resource_id, \*\*params) -> CdnResource +- client.cdn.resources.list(\*\*params) -> CdnResourceList +- client.cdn.resources.delete(resource_id) -> None +- client.cdn.resources.get(resource_id) -> CdnResource +- client.cdn.resources.prefetch(resource_id, \*\*params) -> None +- client.cdn.resources.prevalidate_ssl_le_certificate(resource_id) -> None +- client.cdn.resources.purge(resource_id, \*\*params) -> None +- client.cdn.resources.replace(resource_id, \*\*params) -> CdnResource + +### Shield + +Types: + +```python +from gcore.types.cdn.resources import OriginShielding, OriginShieldingUpdated +``` + +Methods: + +- client.cdn.resources.shield.get(resource_id) -> OriginShielding +- client.cdn.resources.shield.replace(resource_id, \*\*params) -> object + +### Rules + +Types: + +```python +from gcore.types.cdn.resources import CdnResourceRule, RuleListResponse +``` + +Methods: + +- client.cdn.resources.rules.create(resource_id, \*\*params) -> CdnResourceRule +- client.cdn.resources.rules.update(rule_id, \*, resource_id, \*\*params) -> CdnResourceRule +- client.cdn.resources.rules.list(resource_id) -> RuleListResponse +- client.cdn.resources.rules.delete(rule_id, \*, resource_id) -> None +- client.cdn.resources.rules.get(rule_id, \*, resource_id) -> CdnResourceRule +- client.cdn.resources.rules.replace(rule_id, \*, resource_id, \*\*params) -> CdnResourceRule + +## Shields + +Types: + +```python +from gcore.types.cdn import ShieldListResponse +``` + +Methods: + +- client.cdn.shields.list() -> ShieldListResponse + +## OriginGroups + +Types: + +```python +from gcore.types.cdn import OriginGroups, OriginGroupsList +``` + +Methods: + +- client.cdn.origin_groups.create(\*\*params) -> OriginGroups +- client.cdn.origin_groups.update(origin_group_id, \*\*params) -> OriginGroups +- client.cdn.origin_groups.list(\*\*params) -> OriginGroupsList +- client.cdn.origin_groups.delete(origin_group_id) -> None +- client.cdn.origin_groups.get(origin_group_id) -> OriginGroups +- client.cdn.origin_groups.replace(origin_group_id, \*\*params) -> OriginGroups + +## RuleTemplates + +Types: + +```python +from gcore.types.cdn import RuleTemplate, RuleTemplateList +``` + +Methods: + +- client.cdn.rule_templates.create(\*\*params) -> RuleTemplate +- client.cdn.rule_templates.update(rule_template_id, \*\*params) -> RuleTemplate +- client.cdn.rule_templates.list() -> RuleTemplateList +- client.cdn.rule_templates.delete(rule_template_id) -> None +- client.cdn.rule_templates.get(rule_template_id) -> RuleTemplate +- client.cdn.rule_templates.replace(rule_template_id, \*\*params) -> RuleTemplate + +## Certificates + +Types: + +```python +from gcore.types.cdn import SslDetail, SslDetailList, SslRequestStatus +``` + +Methods: + +- client.cdn.certificates.create(\*\*params) -> None +- client.cdn.certificates.list(\*\*params) -> SslDetailList +- client.cdn.certificates.delete(ssl_id) -> None +- client.cdn.certificates.force_retry(cert_id) -> None +- client.cdn.certificates.get(ssl_id) -> SslDetail +- client.cdn.certificates.get_status(cert_id, \*\*params) -> SslRequestStatus +- client.cdn.certificates.renew(cert_id) -> None +- client.cdn.certificates.replace(ssl_id, \*\*params) -> SslDetail + +## TrustedCaCertificates + +Types: + +```python +from gcore.types.cdn import CaCertificate, CaCertificateList +``` + +Methods: + +- client.cdn.trusted_ca_certificates.create(\*\*params) -> CaCertificate +- client.cdn.trusted_ca_certificates.list(\*\*params) -> CaCertificateList +- client.cdn.trusted_ca_certificates.delete(id) -> None +- client.cdn.trusted_ca_certificates.get(id) -> CaCertificate +- client.cdn.trusted_ca_certificates.replace(id, \*\*params) -> CaCertificate + +## AuditLog + +Types: + +```python +from gcore.types.cdn import CdnAuditLogEntry +``` + +Methods: + +- client.cdn.audit_log.list(\*\*params) -> SyncOffsetPage[CdnAuditLogEntry] +- client.cdn.audit_log.get(log_id) -> CdnAuditLogEntry + +## Logs + +Types: + +```python +from gcore.types.cdn import CdnLogEntry +``` + +Methods: + +- client.cdn.logs.list(\*\*params) -> SyncOffsetPageCdnLogs[Data] +- client.cdn.logs.download(\*\*params) -> BinaryAPIResponse + +### Settings + +Types: + +```python +from gcore.types.cdn.logs import LogSettings +``` + +Methods: + +- client.cdn.logs.settings.create(\*\*params) -> None +- client.cdn.logs.settings.update(\*\*params) -> None +- client.cdn.logs.settings.delete() -> None +- client.cdn.logs.settings.get() -> LogSettings + +## LogsUploader + +Types: + +```python +from gcore.types.cdn import LogsUploaderValidation +``` + +### Policies + +Types: + +```python +from gcore.types.cdn.logs_uploader import ( + LogsUploaderPolicy, + LogsUploaderPolicyList, + PolicyListFieldsResponse, +) +``` + +Methods: + +- client.cdn.logs_uploader.policies.create(\*\*params) -> LogsUploaderPolicy +- client.cdn.logs_uploader.policies.update(id, \*\*params) -> LogsUploaderPolicy +- client.cdn.logs_uploader.policies.list(\*\*params) -> LogsUploaderPolicyList +- client.cdn.logs_uploader.policies.delete(id) -> None +- client.cdn.logs_uploader.policies.get(id) -> LogsUploaderPolicy +- client.cdn.logs_uploader.policies.list_fields() -> PolicyListFieldsResponse +- client.cdn.logs_uploader.policies.replace(id, \*\*params) -> LogsUploaderPolicy + +### Targets + +Types: + +```python +from gcore.types.cdn.logs_uploader import LogsUploaderTarget, LogsUploaderTargetList +``` + +Methods: + +- client.cdn.logs_uploader.targets.create(\*\*params) -> LogsUploaderTarget +- client.cdn.logs_uploader.targets.update(id, \*\*params) -> LogsUploaderTarget +- client.cdn.logs_uploader.targets.list(\*\*params) -> LogsUploaderTargetList +- client.cdn.logs_uploader.targets.delete(id) -> None +- client.cdn.logs_uploader.targets.get(id) -> LogsUploaderTarget +- client.cdn.logs_uploader.targets.replace(id, \*\*params) -> LogsUploaderTarget +- client.cdn.logs_uploader.targets.validate(id) -> LogsUploaderValidation + +### Configs + +Types: + +```python +from gcore.types.cdn.logs_uploader import LogsUploaderConfig, LogsUploaderConfigList +``` + +Methods: + +- client.cdn.logs_uploader.configs.create(\*\*params) -> LogsUploaderConfig +- client.cdn.logs_uploader.configs.update(id, \*\*params) -> LogsUploaderConfig +- client.cdn.logs_uploader.configs.list(\*\*params) -> LogsUploaderConfigList +- client.cdn.logs_uploader.configs.delete(id) -> None +- client.cdn.logs_uploader.configs.get(id) -> LogsUploaderConfig +- client.cdn.logs_uploader.configs.replace(id, \*\*params) -> LogsUploaderConfig +- client.cdn.logs_uploader.configs.validate(id) -> LogsUploaderValidation + +## Statistics + +Types: + +```python +from gcore.types.cdn import ( + LogsAggregatedStats, + ResourceAggregatedStats, + ResourceUsageStats, + ShieldAggregatedStats, + UsageSeriesStats, +) +``` + +Methods: + +- client.cdn.statistics.get_logs_usage_aggregated(\*\*params) -> LogsAggregatedStats +- client.cdn.statistics.get_logs_usage_series(\*\*params) -> UsageSeriesStats +- client.cdn.statistics.get_resource_usage_aggregated(\*\*params) -> ResourceAggregatedStats +- client.cdn.statistics.get_resource_usage_series(\*\*params) -> ResourceUsageStats +- client.cdn.statistics.get_shield_usage_aggregated(\*\*params) -> ShieldAggregatedStats +- client.cdn.statistics.get_shield_usage_series(\*\*params) -> UsageSeriesStats + +## NetworkCapacity + +Types: + +```python +from gcore.types.cdn import NetworkCapacity +``` + +Methods: + +- client.cdn.network_capacity.list() -> NetworkCapacity + +## Metrics + +Types: + +```python +from gcore.types.cdn import CdnMetrics, CdnMetricsGroups, CdnMetricsValues +``` + +Methods: + +- client.cdn.metrics.list(\*\*params) -> CdnMetrics + +## IPRanges + +Types: + +```python +from gcore.types.cdn import PublicIPList, PublicNetworkList +``` + +Methods: + +- client.cdn.ip_ranges.list() -> PublicNetworkList +- client.cdn.ip_ranges.list_ips() -> PublicIPList diff --git a/src/gcore/_client.py b/src/gcore/_client.py index 51d339d9..3aaf9b6f 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -28,6 +28,7 @@ SyncAPIClient, AsyncAPIClient, ) +from .resources.cdn import cdn from .resources.dns import dns from .resources.iam import iam from .resources.waap import waap @@ -49,6 +50,7 @@ class Gcore(SyncAPIClient): security: security.SecurityResource dns: dns.DNSResource storage: storage.StorageResource + cdn: cdn.CdnResource with_raw_response: GcoreWithRawResponse with_streaming_response: GcoreWithStreamedResponse @@ -136,6 +138,7 @@ def __init__( self.security = security.SecurityResource(self) self.dns = dns.DNSResource(self) self.storage = storage.StorageResource(self) + self.cdn = cdn.CdnResource(self) self.with_raw_response = GcoreWithRawResponse(self) self.with_streaming_response = GcoreWithStreamedResponse(self) @@ -279,6 +282,7 @@ class AsyncGcore(AsyncAPIClient): security: security.AsyncSecurityResource dns: dns.AsyncDNSResource storage: storage.AsyncStorageResource + cdn: cdn.AsyncCdnResource with_raw_response: AsyncGcoreWithRawResponse with_streaming_response: AsyncGcoreWithStreamedResponse @@ -366,6 +370,7 @@ def __init__( self.security = security.AsyncSecurityResource(self) self.dns = dns.AsyncDNSResource(self) self.storage = storage.AsyncStorageResource(self) + self.cdn = cdn.AsyncCdnResource(self) self.with_raw_response = AsyncGcoreWithRawResponse(self) self.with_streaming_response = AsyncGcoreWithStreamedResponse(self) @@ -510,6 +515,7 @@ def __init__(self, client: Gcore) -> None: self.security = security.SecurityResourceWithRawResponse(client.security) self.dns = dns.DNSResourceWithRawResponse(client.dns) self.storage = storage.StorageResourceWithRawResponse(client.storage) + self.cdn = cdn.CdnResourceWithRawResponse(client.cdn) class AsyncGcoreWithRawResponse: @@ -522,6 +528,7 @@ def __init__(self, client: AsyncGcore) -> None: self.security = security.AsyncSecurityResourceWithRawResponse(client.security) self.dns = dns.AsyncDNSResourceWithRawResponse(client.dns) self.storage = storage.AsyncStorageResourceWithRawResponse(client.storage) + self.cdn = cdn.AsyncCdnResourceWithRawResponse(client.cdn) class GcoreWithStreamedResponse: @@ -534,6 +541,7 @@ def __init__(self, client: Gcore) -> None: self.security = security.SecurityResourceWithStreamingResponse(client.security) self.dns = dns.DNSResourceWithStreamingResponse(client.dns) self.storage = storage.StorageResourceWithStreamingResponse(client.storage) + self.cdn = cdn.CdnResourceWithStreamingResponse(client.cdn) class AsyncGcoreWithStreamedResponse: @@ -546,6 +554,7 @@ def __init__(self, client: AsyncGcore) -> None: self.security = security.AsyncSecurityResourceWithStreamingResponse(client.security) self.dns = dns.AsyncDNSResourceWithStreamingResponse(client.dns) self.storage = storage.AsyncStorageResourceWithStreamingResponse(client.storage) + self.cdn = cdn.AsyncCdnResourceWithStreamingResponse(client.cdn) Client = Gcore diff --git a/src/gcore/pagination.py b/src/gcore/pagination.py index 57bab8f9..24edbc64 100644 --- a/src/gcore/pagination.py +++ b/src/gcore/pagination.py @@ -22,6 +22,11 @@ "AsyncPageStreamingAI", "SyncPageStreaming", "AsyncPageStreaming", + "SyncOffsetPageCdn", + "AsyncOffsetPageCdn", + "OffsetPageCdnLogsMeta", + "SyncOffsetPageCdnLogs", + "AsyncOffsetPageCdnLogs", ] _BaseModelT = TypeVar("_BaseModelT", bound=BaseModel) @@ -357,3 +362,135 @@ def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseM **(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}), }, ) + + +class SyncOffsetPageCdn(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + items: List[_T] + + @override + def _get_page_items(self) -> List[_T]: + items = self.items + if not items: + return [] + return items + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + return PageInfo(params={"offset": current_count}) + + @classmethod + def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003 + return cls.construct( + None, + **{ + **(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}), + }, + ) + + +class AsyncOffsetPageCdn(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + items: List[_T] + + @override + def _get_page_items(self) -> List[_T]: + items = self.items + if not items: + return [] + return items + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + return PageInfo(params={"offset": current_count}) + + @classmethod + def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003 + return cls.construct( + None, + **{ + **(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}), + }, + ) + + +class OffsetPageCdnLogsMeta(BaseModel): + count: Optional[int] = None + + +class SyncOffsetPageCdnLogs(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + data: List[_T] + meta: Optional[OffsetPageCdnLogsMeta] = None + + @override + def _get_page_items(self) -> List[_T]: + data = self.data + if not data: + return [] + return data + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + count = None + if self.meta is not None: + if self.meta.count is not None: + count = self.meta.count + if count is None: + return None + + if current_count < count: + return PageInfo(params={"offset": current_count}) + + return None + + +class AsyncOffsetPageCdnLogs(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + data: List[_T] + meta: Optional[OffsetPageCdnLogsMeta] = None + + @override + def _get_page_items(self) -> List[_T]: + data = self.data + if not data: + return [] + return data + + @override + def next_page_info(self) -> Optional[PageInfo]: + offset = self._options.params.get("offset") or 0 + if not isinstance(offset, int): + raise ValueError(f'Expected "offset" param to be an integer but got {offset}') + + length = len(self._get_page_items()) + current_count = offset + length + + count = None + if self.meta is not None: + if self.meta.count is not None: + count = self.meta.count + if count is None: + return None + + if current_count < count: + return PageInfo(params={"offset": current_count}) + + return None diff --git a/src/gcore/resources/__init__.py b/src/gcore/resources/__init__.py index e8e92c1e..c8aaa6a7 100644 --- a/src/gcore/resources/__init__.py +++ b/src/gcore/resources/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .cdn import ( + CdnResource, + AsyncCdnResource, + CdnResourceWithRawResponse, + AsyncCdnResourceWithRawResponse, + CdnResourceWithStreamingResponse, + AsyncCdnResourceWithStreamingResponse, +) from .dns import ( DNSResource, AsyncDNSResource, @@ -114,4 +122,10 @@ "AsyncStorageResourceWithRawResponse", "StorageResourceWithStreamingResponse", "AsyncStorageResourceWithStreamingResponse", + "CdnResource", + "AsyncCdnResource", + "CdnResourceWithRawResponse", + "AsyncCdnResourceWithRawResponse", + "CdnResourceWithStreamingResponse", + "AsyncCdnResourceWithStreamingResponse", ] diff --git a/src/gcore/resources/cdn/__init__.py b/src/gcore/resources/cdn/__init__.py new file mode 100644 index 00000000..83661f58 --- /dev/null +++ b/src/gcore/resources/cdn/__init__.py @@ -0,0 +1,201 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .cdn import ( + CdnResource, + AsyncCdnResource, + CdnResourceWithRawResponse, + AsyncCdnResourceWithRawResponse, + CdnResourceWithStreamingResponse, + AsyncCdnResourceWithStreamingResponse, +) +from .logs import ( + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, +) +from .metrics import ( + MetricsResource, + AsyncMetricsResource, + MetricsResourceWithRawResponse, + AsyncMetricsResourceWithRawResponse, + MetricsResourceWithStreamingResponse, + AsyncMetricsResourceWithStreamingResponse, +) +from .shields import ( + ShieldsResource, + AsyncShieldsResource, + ShieldsResourceWithRawResponse, + AsyncShieldsResourceWithRawResponse, + ShieldsResourceWithStreamingResponse, + AsyncShieldsResourceWithStreamingResponse, +) +from .audit_log import ( + AuditLogResource, + AsyncAuditLogResource, + AuditLogResourceWithRawResponse, + AsyncAuditLogResourceWithRawResponse, + AuditLogResourceWithStreamingResponse, + AsyncAuditLogResourceWithStreamingResponse, +) +from .ip_ranges import ( + IPRangesResource, + AsyncIPRangesResource, + IPRangesResourceWithRawResponse, + AsyncIPRangesResourceWithRawResponse, + IPRangesResourceWithStreamingResponse, + AsyncIPRangesResourceWithStreamingResponse, +) +from .resources import ( + ResourcesResource, + AsyncResourcesResource, + ResourcesResourceWithRawResponse, + AsyncResourcesResourceWithRawResponse, + ResourcesResourceWithStreamingResponse, + AsyncResourcesResourceWithStreamingResponse, +) +from .statistics import ( + StatisticsResource, + AsyncStatisticsResource, + StatisticsResourceWithRawResponse, + AsyncStatisticsResourceWithRawResponse, + StatisticsResourceWithStreamingResponse, + AsyncStatisticsResourceWithStreamingResponse, +) +from .certificates import ( + CertificatesResource, + AsyncCertificatesResource, + CertificatesResourceWithRawResponse, + AsyncCertificatesResourceWithRawResponse, + CertificatesResourceWithStreamingResponse, + AsyncCertificatesResourceWithStreamingResponse, +) +from .logs_uploader import ( + LogsUploaderResource, + AsyncLogsUploaderResource, + LogsUploaderResourceWithRawResponse, + AsyncLogsUploaderResourceWithRawResponse, + LogsUploaderResourceWithStreamingResponse, + AsyncLogsUploaderResourceWithStreamingResponse, +) +from .origin_groups import ( + OriginGroupsResource, + AsyncOriginGroupsResource, + OriginGroupsResourceWithRawResponse, + AsyncOriginGroupsResourceWithRawResponse, + OriginGroupsResourceWithStreamingResponse, + AsyncOriginGroupsResourceWithStreamingResponse, +) +from .rule_templates import ( + RuleTemplatesResource, + AsyncRuleTemplatesResource, + RuleTemplatesResourceWithRawResponse, + AsyncRuleTemplatesResourceWithRawResponse, + RuleTemplatesResourceWithStreamingResponse, + AsyncRuleTemplatesResourceWithStreamingResponse, +) +from .network_capacity import ( + NetworkCapacityResource, + AsyncNetworkCapacityResource, + NetworkCapacityResourceWithRawResponse, + AsyncNetworkCapacityResourceWithRawResponse, + NetworkCapacityResourceWithStreamingResponse, + AsyncNetworkCapacityResourceWithStreamingResponse, +) +from .trusted_ca_certificates import ( + TrustedCaCertificatesResource, + AsyncTrustedCaCertificatesResource, + TrustedCaCertificatesResourceWithRawResponse, + AsyncTrustedCaCertificatesResourceWithRawResponse, + TrustedCaCertificatesResourceWithStreamingResponse, + AsyncTrustedCaCertificatesResourceWithStreamingResponse, +) + +__all__ = [ + "ResourcesResource", + "AsyncResourcesResource", + "ResourcesResourceWithRawResponse", + "AsyncResourcesResourceWithRawResponse", + "ResourcesResourceWithStreamingResponse", + "AsyncResourcesResourceWithStreamingResponse", + "ShieldsResource", + "AsyncShieldsResource", + "ShieldsResourceWithRawResponse", + "AsyncShieldsResourceWithRawResponse", + "ShieldsResourceWithStreamingResponse", + "AsyncShieldsResourceWithStreamingResponse", + "OriginGroupsResource", + "AsyncOriginGroupsResource", + "OriginGroupsResourceWithRawResponse", + "AsyncOriginGroupsResourceWithRawResponse", + "OriginGroupsResourceWithStreamingResponse", + "AsyncOriginGroupsResourceWithStreamingResponse", + "RuleTemplatesResource", + "AsyncRuleTemplatesResource", + "RuleTemplatesResourceWithRawResponse", + "AsyncRuleTemplatesResourceWithRawResponse", + "RuleTemplatesResourceWithStreamingResponse", + "AsyncRuleTemplatesResourceWithStreamingResponse", + "CertificatesResource", + "AsyncCertificatesResource", + "CertificatesResourceWithRawResponse", + "AsyncCertificatesResourceWithRawResponse", + "CertificatesResourceWithStreamingResponse", + "AsyncCertificatesResourceWithStreamingResponse", + "TrustedCaCertificatesResource", + "AsyncTrustedCaCertificatesResource", + "TrustedCaCertificatesResourceWithRawResponse", + "AsyncTrustedCaCertificatesResourceWithRawResponse", + "TrustedCaCertificatesResourceWithStreamingResponse", + "AsyncTrustedCaCertificatesResourceWithStreamingResponse", + "AuditLogResource", + "AsyncAuditLogResource", + "AuditLogResourceWithRawResponse", + "AsyncAuditLogResourceWithRawResponse", + "AuditLogResourceWithStreamingResponse", + "AsyncAuditLogResourceWithStreamingResponse", + "LogsResource", + "AsyncLogsResource", + "LogsResourceWithRawResponse", + "AsyncLogsResourceWithRawResponse", + "LogsResourceWithStreamingResponse", + "AsyncLogsResourceWithStreamingResponse", + "LogsUploaderResource", + "AsyncLogsUploaderResource", + "LogsUploaderResourceWithRawResponse", + "AsyncLogsUploaderResourceWithRawResponse", + "LogsUploaderResourceWithStreamingResponse", + "AsyncLogsUploaderResourceWithStreamingResponse", + "StatisticsResource", + "AsyncStatisticsResource", + "StatisticsResourceWithRawResponse", + "AsyncStatisticsResourceWithRawResponse", + "StatisticsResourceWithStreamingResponse", + "AsyncStatisticsResourceWithStreamingResponse", + "NetworkCapacityResource", + "AsyncNetworkCapacityResource", + "NetworkCapacityResourceWithRawResponse", + "AsyncNetworkCapacityResourceWithRawResponse", + "NetworkCapacityResourceWithStreamingResponse", + "AsyncNetworkCapacityResourceWithStreamingResponse", + "MetricsResource", + "AsyncMetricsResource", + "MetricsResourceWithRawResponse", + "AsyncMetricsResourceWithRawResponse", + "MetricsResourceWithStreamingResponse", + "AsyncMetricsResourceWithStreamingResponse", + "IPRangesResource", + "AsyncIPRangesResource", + "IPRangesResourceWithRawResponse", + "AsyncIPRangesResourceWithRawResponse", + "IPRangesResourceWithStreamingResponse", + "AsyncIPRangesResourceWithStreamingResponse", + "CdnResource", + "AsyncCdnResource", + "CdnResourceWithRawResponse", + "AsyncCdnResourceWithRawResponse", + "CdnResourceWithStreamingResponse", + "AsyncCdnResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cdn/audit_log.py b/src/gcore/resources/cdn/audit_log.py new file mode 100644 index 00000000..1df531f5 --- /dev/null +++ b/src/gcore/resources/cdn/audit_log.py @@ -0,0 +1,406 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import audit_log_list_params +from ...pagination import SyncOffsetPage, AsyncOffsetPage +from ..._base_client import AsyncPaginator, make_request_options +from ...types.cdn.cdn_audit_log_entry import CdnAuditLogEntry + +__all__ = ["AuditLogResource", "AsyncAuditLogResource"] + + +class AuditLogResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AuditLogResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AuditLogResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AuditLogResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AuditLogResourceWithStreamingResponse(self) + + def list( + self, + *, + client_id: int | Omit = omit, + limit: int | Omit = omit, + max_requested_at: str | Omit = omit, + method: str | Omit = omit, + min_requested_at: str | Omit = omit, + offset: int | Omit = omit, + path: str | Omit = omit, + remote_ip_address: str | Omit = omit, + status_code: int | Omit = omit, + token_id: int | Omit = omit, + user_id: 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, + ) -> SyncOffsetPage[CdnAuditLogEntry]: + """ + Get information about all CDN activity logs records. + + Args: + client_id: Client ID. + + limit: Maximum number of items in response. + + max_requested_at: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + You can specify a date with a time separated by a space, or just a date. + + Examples: + + - &`max_requested_at`=2021-05-05 12:00:00 + - &`max_requested_at`=2021-05-05 + + method: HTTP method type of requests. + + Use upper case only. + + Example: + + - ?method=DELETE + + min_requested_at: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + You can specify a date with a time separated by a space, or just a date. + + Examples: + + - &`min_requested_at`=2021-05-05 12:00:00 + - &`min_requested_at`=2021-05-05 + + offset: Offset relative to the beginning of activity logs. + + path: Path that a requested URL should contain. + + remote_ip_address: IP address or part of it from which requests are sent. + + status_code: Status code returned in the response. + + Specify the first numbers of a status code to get requests for a group of status + codes. + + To filter the activity logs by 4xx codes, use: + + - &`status_code`=4 - + + token_id: Permanent API token ID. Requests made with this token should be displayed. + + user_id: User ID. + + 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 + """ + return self._get_api_list( + "/cdn/activity_log/requests" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/activity_log/requests", + page=SyncOffsetPage[CdnAuditLogEntry], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "client_id": client_id, + "limit": limit, + "max_requested_at": max_requested_at, + "method": method, + "min_requested_at": min_requested_at, + "offset": offset, + "path": path, + "remote_ip_address": remote_ip_address, + "status_code": status_code, + "token_id": token_id, + "user_id": user_id, + }, + audit_log_list_params.AuditLogListParams, + ), + ), + model=CdnAuditLogEntry, + ) + + def get( + self, + log_id: int, + *, + # 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, + ) -> CdnAuditLogEntry: + """ + Get information about CDN activity logs record. + + Args: + log_id: Activity logs record ID. + + 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 + """ + return self._get( + f"/cdn/activity_log/requests/{log_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/activity_log/requests/{log_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAuditLogEntry, + ) + + +class AsyncAuditLogResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAuditLogResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncAuditLogResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAuditLogResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncAuditLogResourceWithStreamingResponse(self) + + def list( + self, + *, + client_id: int | Omit = omit, + limit: int | Omit = omit, + max_requested_at: str | Omit = omit, + method: str | Omit = omit, + min_requested_at: str | Omit = omit, + offset: int | Omit = omit, + path: str | Omit = omit, + remote_ip_address: str | Omit = omit, + status_code: int | Omit = omit, + token_id: int | Omit = omit, + user_id: 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, + ) -> AsyncPaginator[CdnAuditLogEntry, AsyncOffsetPage[CdnAuditLogEntry]]: + """ + Get information about all CDN activity logs records. + + Args: + client_id: Client ID. + + limit: Maximum number of items in response. + + max_requested_at: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + You can specify a date with a time separated by a space, or just a date. + + Examples: + + - &`max_requested_at`=2021-05-05 12:00:00 + - &`max_requested_at`=2021-05-05 + + method: HTTP method type of requests. + + Use upper case only. + + Example: + + - ?method=DELETE + + min_requested_at: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + You can specify a date with a time separated by a space, or just a date. + + Examples: + + - &`min_requested_at`=2021-05-05 12:00:00 + - &`min_requested_at`=2021-05-05 + + offset: Offset relative to the beginning of activity logs. + + path: Path that a requested URL should contain. + + remote_ip_address: IP address or part of it from which requests are sent. + + status_code: Status code returned in the response. + + Specify the first numbers of a status code to get requests for a group of status + codes. + + To filter the activity logs by 4xx codes, use: + + - &`status_code`=4 - + + token_id: Permanent API token ID. Requests made with this token should be displayed. + + user_id: User ID. + + 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 + """ + return self._get_api_list( + "/cdn/activity_log/requests" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/activity_log/requests", + page=AsyncOffsetPage[CdnAuditLogEntry], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "client_id": client_id, + "limit": limit, + "max_requested_at": max_requested_at, + "method": method, + "min_requested_at": min_requested_at, + "offset": offset, + "path": path, + "remote_ip_address": remote_ip_address, + "status_code": status_code, + "token_id": token_id, + "user_id": user_id, + }, + audit_log_list_params.AuditLogListParams, + ), + ), + model=CdnAuditLogEntry, + ) + + async def get( + self, + log_id: int, + *, + # 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, + ) -> CdnAuditLogEntry: + """ + Get information about CDN activity logs record. + + Args: + log_id: Activity logs record ID. + + 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 + """ + return await self._get( + f"/cdn/activity_log/requests/{log_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/activity_log/requests/{log_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAuditLogEntry, + ) + + +class AuditLogResourceWithRawResponse: + def __init__(self, audit_log: AuditLogResource) -> None: + self._audit_log = audit_log + + self.list = to_raw_response_wrapper( + audit_log.list, + ) + self.get = to_raw_response_wrapper( + audit_log.get, + ) + + +class AsyncAuditLogResourceWithRawResponse: + def __init__(self, audit_log: AsyncAuditLogResource) -> None: + self._audit_log = audit_log + + self.list = async_to_raw_response_wrapper( + audit_log.list, + ) + self.get = async_to_raw_response_wrapper( + audit_log.get, + ) + + +class AuditLogResourceWithStreamingResponse: + def __init__(self, audit_log: AuditLogResource) -> None: + self._audit_log = audit_log + + self.list = to_streamed_response_wrapper( + audit_log.list, + ) + self.get = to_streamed_response_wrapper( + audit_log.get, + ) + + +class AsyncAuditLogResourceWithStreamingResponse: + def __init__(self, audit_log: AsyncAuditLogResource) -> None: + self._audit_log = audit_log + + self.list = async_to_streamed_response_wrapper( + audit_log.list, + ) + self.get = async_to_streamed_response_wrapper( + audit_log.get, + ) diff --git a/src/gcore/resources/cdn/cdn.py b/src/gcore/resources/cdn/cdn.py new file mode 100644 index 00000000..430498dc --- /dev/null +++ b/src/gcore/resources/cdn/cdn.py @@ -0,0 +1,957 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .metrics import ( + MetricsResource, + AsyncMetricsResource, + MetricsResourceWithRawResponse, + AsyncMetricsResourceWithRawResponse, + MetricsResourceWithStreamingResponse, + AsyncMetricsResourceWithStreamingResponse, +) +from .shields import ( + ShieldsResource, + AsyncShieldsResource, + ShieldsResourceWithRawResponse, + AsyncShieldsResourceWithRawResponse, + ShieldsResourceWithStreamingResponse, + AsyncShieldsResourceWithStreamingResponse, +) +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 .audit_log import ( + AuditLogResource, + AsyncAuditLogResource, + AuditLogResourceWithRawResponse, + AsyncAuditLogResourceWithRawResponse, + AuditLogResourceWithStreamingResponse, + AsyncAuditLogResourceWithStreamingResponse, +) +from .ip_ranges import ( + IPRangesResource, + AsyncIPRangesResource, + IPRangesResourceWithRawResponse, + AsyncIPRangesResourceWithRawResponse, + IPRangesResourceWithStreamingResponse, + AsyncIPRangesResourceWithStreamingResponse, +) +from .logs.logs import ( + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, +) +from .statistics import ( + StatisticsResource, + AsyncStatisticsResource, + StatisticsResourceWithRawResponse, + AsyncStatisticsResourceWithRawResponse, + StatisticsResourceWithStreamingResponse, + AsyncStatisticsResourceWithStreamingResponse, +) +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import cdn_update_account_params, cdn_list_purge_statuses_params +from ...pagination import SyncOffsetPageCdn, AsyncOffsetPageCdn +from .certificates import ( + CertificatesResource, + AsyncCertificatesResource, + CertificatesResourceWithRawResponse, + AsyncCertificatesResourceWithRawResponse, + CertificatesResourceWithStreamingResponse, + AsyncCertificatesResourceWithStreamingResponse, +) +from .origin_groups import ( + OriginGroupsResource, + AsyncOriginGroupsResource, + OriginGroupsResourceWithRawResponse, + AsyncOriginGroupsResourceWithRawResponse, + OriginGroupsResourceWithStreamingResponse, + AsyncOriginGroupsResourceWithStreamingResponse, +) +from ..._base_client import AsyncPaginator, make_request_options +from .rule_templates import ( + RuleTemplatesResource, + AsyncRuleTemplatesResource, + RuleTemplatesResourceWithRawResponse, + AsyncRuleTemplatesResourceWithRawResponse, + RuleTemplatesResourceWithStreamingResponse, + AsyncRuleTemplatesResourceWithStreamingResponse, +) +from .network_capacity import ( + NetworkCapacityResource, + AsyncNetworkCapacityResource, + NetworkCapacityResourceWithRawResponse, + AsyncNetworkCapacityResourceWithRawResponse, + NetworkCapacityResourceWithStreamingResponse, + AsyncNetworkCapacityResourceWithStreamingResponse, +) +from .resources.resources import ( + ResourcesResource, + AsyncResourcesResource, + ResourcesResourceWithRawResponse, + AsyncResourcesResourceWithRawResponse, + ResourcesResourceWithStreamingResponse, + AsyncResourcesResourceWithStreamingResponse, +) +from ...types.cdn.cdn_account import CdnAccount +from .trusted_ca_certificates import ( + TrustedCaCertificatesResource, + AsyncTrustedCaCertificatesResource, + TrustedCaCertificatesResourceWithRawResponse, + AsyncTrustedCaCertificatesResourceWithRawResponse, + TrustedCaCertificatesResourceWithStreamingResponse, + AsyncTrustedCaCertificatesResourceWithStreamingResponse, +) +from ...types.cdn.purge_status import PurgeStatus +from .logs_uploader.logs_uploader import ( + LogsUploaderResource, + AsyncLogsUploaderResource, + LogsUploaderResourceWithRawResponse, + AsyncLogsUploaderResourceWithRawResponse, + LogsUploaderResourceWithStreamingResponse, + AsyncLogsUploaderResourceWithStreamingResponse, +) +from ...types.cdn.cdn_account_limits import CdnAccountLimits +from ...types.cdn.cdn_available_features import CdnAvailableFeatures + +__all__ = ["CdnResource", "AsyncCdnResource"] + + +class CdnResource(SyncAPIResource): + @cached_property + def resources(self) -> ResourcesResource: + return ResourcesResource(self._client) + + @cached_property + def shields(self) -> ShieldsResource: + return ShieldsResource(self._client) + + @cached_property + def origin_groups(self) -> OriginGroupsResource: + return OriginGroupsResource(self._client) + + @cached_property + def rule_templates(self) -> RuleTemplatesResource: + return RuleTemplatesResource(self._client) + + @cached_property + def certificates(self) -> CertificatesResource: + return CertificatesResource(self._client) + + @cached_property + def trusted_ca_certificates(self) -> TrustedCaCertificatesResource: + return TrustedCaCertificatesResource(self._client) + + @cached_property + def audit_log(self) -> AuditLogResource: + return AuditLogResource(self._client) + + @cached_property + def logs(self) -> LogsResource: + return LogsResource(self._client) + + @cached_property + def logs_uploader(self) -> LogsUploaderResource: + return LogsUploaderResource(self._client) + + @cached_property + def statistics(self) -> StatisticsResource: + return StatisticsResource(self._client) + + @cached_property + def network_capacity(self) -> NetworkCapacityResource: + return NetworkCapacityResource(self._client) + + @cached_property + def metrics(self) -> MetricsResource: + return MetricsResource(self._client) + + @cached_property + def ip_ranges(self) -> IPRangesResource: + return IPRangesResource(self._client) + + @cached_property + def with_raw_response(self) -> CdnResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return CdnResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CdnResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return CdnResourceWithStreamingResponse(self) + + def get_account_limits( + 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, + ) -> CdnAccountLimits: + """Get information about CDN service limits.""" + return self._get( + "/cdn/clients/me/limits" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/clients/me/limits", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAccountLimits, + ) + + def get_account_overview( + 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, + ) -> CdnAccount: + """Get information about CDN service.""" + return self._get( + "/cdn/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//cdn/clients/me", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAccount, + ) + + def get_available_features( + 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, + ) -> CdnAvailableFeatures: + """Get information about available CDN features.""" + return self._get( + "/cdn/clients/me/features" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/clients/me/features", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAvailableFeatures, + ) + + def list_purge_statuses( + self, + *, + cname: str | Omit = omit, + from_created: str | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + purge_type: str | Omit = omit, + status: str | Omit = omit, + to_created: 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, + ) -> SyncOffsetPageCdn[PurgeStatus]: + """ + Get purges history. + + Args: + cname: Purges associated with a specific resource CNAME. + + Example: + + - &cname=example.com + + from_created: Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Examples: + + - &`from_created`=2021-06-14T00:00:00Z + - &`from_created`=2021-06-14T00:00:00.000Z + + limit: Maximum number of purges in the response. + + offset: Number of purge requests in the response to skip starting from the beginning of + the requested period. + + purge_type: Purge requests with a certain purge type. + + Possible values: + + - **`purge_by_pattern`** - Purge by Pattern. + - **`purge_by_url`** - Purge by URL. + - **`purge_all`** - Purge All. + + status: Purge with a certain status. + + Possible values: + + - **In progress** + - **Successful** + - **Failed** + - **Status report disabled** + + to_created: End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &`to_created`=2021-06-15T00:00:00Z + - &`to_created`=2021-06-15T00:00:00.000Z + + 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 + """ + return self._get_api_list( + "/cdn/purge_statuses" if self._client._base_url_overridden else "https://api.gcore.com//cdn/purge_statuses", + page=SyncOffsetPageCdn[PurgeStatus], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "cname": cname, + "from_created": from_created, + "limit": limit, + "offset": offset, + "purge_type": purge_type, + "status": status, + "to_created": to_created, + }, + cdn_list_purge_statuses_params.CdnListPurgeStatusesParams, + ), + ), + model=PurgeStatus, + ) + + def update_account( + self, + *, + utilization_level: 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, + ) -> CdnAccount: + """ + Change information about CDN service. + + Args: + utilization_level: CDN traffic usage limit in gigabytes. + + When the limit is reached, we will send an email notification. + + 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 + """ + return self._patch( + "/cdn/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//cdn/clients/me", + body=maybe_transform( + {"utilization_level": utilization_level}, cdn_update_account_params.CdnUpdateAccountParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAccount, + ) + + +class AsyncCdnResource(AsyncAPIResource): + @cached_property + def resources(self) -> AsyncResourcesResource: + return AsyncResourcesResource(self._client) + + @cached_property + def shields(self) -> AsyncShieldsResource: + return AsyncShieldsResource(self._client) + + @cached_property + def origin_groups(self) -> AsyncOriginGroupsResource: + return AsyncOriginGroupsResource(self._client) + + @cached_property + def rule_templates(self) -> AsyncRuleTemplatesResource: + return AsyncRuleTemplatesResource(self._client) + + @cached_property + def certificates(self) -> AsyncCertificatesResource: + return AsyncCertificatesResource(self._client) + + @cached_property + def trusted_ca_certificates(self) -> AsyncTrustedCaCertificatesResource: + return AsyncTrustedCaCertificatesResource(self._client) + + @cached_property + def audit_log(self) -> AsyncAuditLogResource: + return AsyncAuditLogResource(self._client) + + @cached_property + def logs(self) -> AsyncLogsResource: + return AsyncLogsResource(self._client) + + @cached_property + def logs_uploader(self) -> AsyncLogsUploaderResource: + return AsyncLogsUploaderResource(self._client) + + @cached_property + def statistics(self) -> AsyncStatisticsResource: + return AsyncStatisticsResource(self._client) + + @cached_property + def network_capacity(self) -> AsyncNetworkCapacityResource: + return AsyncNetworkCapacityResource(self._client) + + @cached_property + def metrics(self) -> AsyncMetricsResource: + return AsyncMetricsResource(self._client) + + @cached_property + def ip_ranges(self) -> AsyncIPRangesResource: + return AsyncIPRangesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncCdnResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncCdnResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCdnResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncCdnResourceWithStreamingResponse(self) + + async def get_account_limits( + 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, + ) -> CdnAccountLimits: + """Get information about CDN service limits.""" + return await self._get( + "/cdn/clients/me/limits" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/clients/me/limits", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAccountLimits, + ) + + async def get_account_overview( + 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, + ) -> CdnAccount: + """Get information about CDN service.""" + return await self._get( + "/cdn/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//cdn/clients/me", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAccount, + ) + + async def get_available_features( + 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, + ) -> CdnAvailableFeatures: + """Get information about available CDN features.""" + return await self._get( + "/cdn/clients/me/features" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/clients/me/features", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAvailableFeatures, + ) + + def list_purge_statuses( + self, + *, + cname: str | Omit = omit, + from_created: str | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + purge_type: str | Omit = omit, + status: str | Omit = omit, + to_created: 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, + ) -> AsyncPaginator[PurgeStatus, AsyncOffsetPageCdn[PurgeStatus]]: + """ + Get purges history. + + Args: + cname: Purges associated with a specific resource CNAME. + + Example: + + - &cname=example.com + + from_created: Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Examples: + + - &`from_created`=2021-06-14T00:00:00Z + - &`from_created`=2021-06-14T00:00:00.000Z + + limit: Maximum number of purges in the response. + + offset: Number of purge requests in the response to skip starting from the beginning of + the requested period. + + purge_type: Purge requests with a certain purge type. + + Possible values: + + - **`purge_by_pattern`** - Purge by Pattern. + - **`purge_by_url`** - Purge by URL. + - **`purge_all`** - Purge All. + + status: Purge with a certain status. + + Possible values: + + - **In progress** + - **Successful** + - **Failed** + - **Status report disabled** + + to_created: End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &`to_created`=2021-06-15T00:00:00Z + - &`to_created`=2021-06-15T00:00:00.000Z + + 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 + """ + return self._get_api_list( + "/cdn/purge_statuses" if self._client._base_url_overridden else "https://api.gcore.com//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( + { + "cname": cname, + "from_created": from_created, + "limit": limit, + "offset": offset, + "purge_type": purge_type, + "status": status, + "to_created": to_created, + }, + cdn_list_purge_statuses_params.CdnListPurgeStatusesParams, + ), + ), + model=PurgeStatus, + ) + + async def update_account( + self, + *, + utilization_level: 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, + ) -> CdnAccount: + """ + Change information about CDN service. + + Args: + utilization_level: CDN traffic usage limit in gigabytes. + + When the limit is reached, we will send an email notification. + + 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 + """ + return await self._patch( + "/cdn/clients/me" if self._client._base_url_overridden else "https://api.gcore.com//cdn/clients/me", + body=await async_maybe_transform( + {"utilization_level": utilization_level}, cdn_update_account_params.CdnUpdateAccountParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnAccount, + ) + + +class CdnResourceWithRawResponse: + def __init__(self, cdn: CdnResource) -> None: + self._cdn = cdn + + self.get_account_limits = to_raw_response_wrapper( + cdn.get_account_limits, + ) + self.get_account_overview = to_raw_response_wrapper( + cdn.get_account_overview, + ) + self.get_available_features = to_raw_response_wrapper( + cdn.get_available_features, + ) + self.list_purge_statuses = to_raw_response_wrapper( + cdn.list_purge_statuses, + ) + self.update_account = to_raw_response_wrapper( + cdn.update_account, + ) + + @cached_property + def resources(self) -> ResourcesResourceWithRawResponse: + return ResourcesResourceWithRawResponse(self._cdn.resources) + + @cached_property + def shields(self) -> ShieldsResourceWithRawResponse: + return ShieldsResourceWithRawResponse(self._cdn.shields) + + @cached_property + def origin_groups(self) -> OriginGroupsResourceWithRawResponse: + return OriginGroupsResourceWithRawResponse(self._cdn.origin_groups) + + @cached_property + def rule_templates(self) -> RuleTemplatesResourceWithRawResponse: + return RuleTemplatesResourceWithRawResponse(self._cdn.rule_templates) + + @cached_property + def certificates(self) -> CertificatesResourceWithRawResponse: + return CertificatesResourceWithRawResponse(self._cdn.certificates) + + @cached_property + def trusted_ca_certificates(self) -> TrustedCaCertificatesResourceWithRawResponse: + return TrustedCaCertificatesResourceWithRawResponse(self._cdn.trusted_ca_certificates) + + @cached_property + def audit_log(self) -> AuditLogResourceWithRawResponse: + return AuditLogResourceWithRawResponse(self._cdn.audit_log) + + @cached_property + def logs(self) -> LogsResourceWithRawResponse: + return LogsResourceWithRawResponse(self._cdn.logs) + + @cached_property + def logs_uploader(self) -> LogsUploaderResourceWithRawResponse: + return LogsUploaderResourceWithRawResponse(self._cdn.logs_uploader) + + @cached_property + def statistics(self) -> StatisticsResourceWithRawResponse: + return StatisticsResourceWithRawResponse(self._cdn.statistics) + + @cached_property + def network_capacity(self) -> NetworkCapacityResourceWithRawResponse: + return NetworkCapacityResourceWithRawResponse(self._cdn.network_capacity) + + @cached_property + def metrics(self) -> MetricsResourceWithRawResponse: + return MetricsResourceWithRawResponse(self._cdn.metrics) + + @cached_property + def ip_ranges(self) -> IPRangesResourceWithRawResponse: + return IPRangesResourceWithRawResponse(self._cdn.ip_ranges) + + +class AsyncCdnResourceWithRawResponse: + def __init__(self, cdn: AsyncCdnResource) -> None: + self._cdn = cdn + + self.get_account_limits = async_to_raw_response_wrapper( + cdn.get_account_limits, + ) + self.get_account_overview = async_to_raw_response_wrapper( + cdn.get_account_overview, + ) + self.get_available_features = async_to_raw_response_wrapper( + cdn.get_available_features, + ) + self.list_purge_statuses = async_to_raw_response_wrapper( + cdn.list_purge_statuses, + ) + self.update_account = async_to_raw_response_wrapper( + cdn.update_account, + ) + + @cached_property + def resources(self) -> AsyncResourcesResourceWithRawResponse: + return AsyncResourcesResourceWithRawResponse(self._cdn.resources) + + @cached_property + def shields(self) -> AsyncShieldsResourceWithRawResponse: + return AsyncShieldsResourceWithRawResponse(self._cdn.shields) + + @cached_property + def origin_groups(self) -> AsyncOriginGroupsResourceWithRawResponse: + return AsyncOriginGroupsResourceWithRawResponse(self._cdn.origin_groups) + + @cached_property + def rule_templates(self) -> AsyncRuleTemplatesResourceWithRawResponse: + return AsyncRuleTemplatesResourceWithRawResponse(self._cdn.rule_templates) + + @cached_property + def certificates(self) -> AsyncCertificatesResourceWithRawResponse: + return AsyncCertificatesResourceWithRawResponse(self._cdn.certificates) + + @cached_property + def trusted_ca_certificates(self) -> AsyncTrustedCaCertificatesResourceWithRawResponse: + return AsyncTrustedCaCertificatesResourceWithRawResponse(self._cdn.trusted_ca_certificates) + + @cached_property + def audit_log(self) -> AsyncAuditLogResourceWithRawResponse: + return AsyncAuditLogResourceWithRawResponse(self._cdn.audit_log) + + @cached_property + def logs(self) -> AsyncLogsResourceWithRawResponse: + return AsyncLogsResourceWithRawResponse(self._cdn.logs) + + @cached_property + def logs_uploader(self) -> AsyncLogsUploaderResourceWithRawResponse: + return AsyncLogsUploaderResourceWithRawResponse(self._cdn.logs_uploader) + + @cached_property + def statistics(self) -> AsyncStatisticsResourceWithRawResponse: + return AsyncStatisticsResourceWithRawResponse(self._cdn.statistics) + + @cached_property + def network_capacity(self) -> AsyncNetworkCapacityResourceWithRawResponse: + return AsyncNetworkCapacityResourceWithRawResponse(self._cdn.network_capacity) + + @cached_property + def metrics(self) -> AsyncMetricsResourceWithRawResponse: + return AsyncMetricsResourceWithRawResponse(self._cdn.metrics) + + @cached_property + def ip_ranges(self) -> AsyncIPRangesResourceWithRawResponse: + return AsyncIPRangesResourceWithRawResponse(self._cdn.ip_ranges) + + +class CdnResourceWithStreamingResponse: + def __init__(self, cdn: CdnResource) -> None: + self._cdn = cdn + + self.get_account_limits = to_streamed_response_wrapper( + cdn.get_account_limits, + ) + self.get_account_overview = to_streamed_response_wrapper( + cdn.get_account_overview, + ) + self.get_available_features = to_streamed_response_wrapper( + cdn.get_available_features, + ) + self.list_purge_statuses = to_streamed_response_wrapper( + cdn.list_purge_statuses, + ) + self.update_account = to_streamed_response_wrapper( + cdn.update_account, + ) + + @cached_property + def resources(self) -> ResourcesResourceWithStreamingResponse: + return ResourcesResourceWithStreamingResponse(self._cdn.resources) + + @cached_property + def shields(self) -> ShieldsResourceWithStreamingResponse: + return ShieldsResourceWithStreamingResponse(self._cdn.shields) + + @cached_property + def origin_groups(self) -> OriginGroupsResourceWithStreamingResponse: + return OriginGroupsResourceWithStreamingResponse(self._cdn.origin_groups) + + @cached_property + def rule_templates(self) -> RuleTemplatesResourceWithStreamingResponse: + return RuleTemplatesResourceWithStreamingResponse(self._cdn.rule_templates) + + @cached_property + def certificates(self) -> CertificatesResourceWithStreamingResponse: + return CertificatesResourceWithStreamingResponse(self._cdn.certificates) + + @cached_property + def trusted_ca_certificates(self) -> TrustedCaCertificatesResourceWithStreamingResponse: + return TrustedCaCertificatesResourceWithStreamingResponse(self._cdn.trusted_ca_certificates) + + @cached_property + def audit_log(self) -> AuditLogResourceWithStreamingResponse: + return AuditLogResourceWithStreamingResponse(self._cdn.audit_log) + + @cached_property + def logs(self) -> LogsResourceWithStreamingResponse: + return LogsResourceWithStreamingResponse(self._cdn.logs) + + @cached_property + def logs_uploader(self) -> LogsUploaderResourceWithStreamingResponse: + return LogsUploaderResourceWithStreamingResponse(self._cdn.logs_uploader) + + @cached_property + def statistics(self) -> StatisticsResourceWithStreamingResponse: + return StatisticsResourceWithStreamingResponse(self._cdn.statistics) + + @cached_property + def network_capacity(self) -> NetworkCapacityResourceWithStreamingResponse: + return NetworkCapacityResourceWithStreamingResponse(self._cdn.network_capacity) + + @cached_property + def metrics(self) -> MetricsResourceWithStreamingResponse: + return MetricsResourceWithStreamingResponse(self._cdn.metrics) + + @cached_property + def ip_ranges(self) -> IPRangesResourceWithStreamingResponse: + return IPRangesResourceWithStreamingResponse(self._cdn.ip_ranges) + + +class AsyncCdnResourceWithStreamingResponse: + def __init__(self, cdn: AsyncCdnResource) -> None: + self._cdn = cdn + + self.get_account_limits = async_to_streamed_response_wrapper( + cdn.get_account_limits, + ) + self.get_account_overview = async_to_streamed_response_wrapper( + cdn.get_account_overview, + ) + self.get_available_features = async_to_streamed_response_wrapper( + cdn.get_available_features, + ) + self.list_purge_statuses = async_to_streamed_response_wrapper( + cdn.list_purge_statuses, + ) + self.update_account = async_to_streamed_response_wrapper( + cdn.update_account, + ) + + @cached_property + def resources(self) -> AsyncResourcesResourceWithStreamingResponse: + return AsyncResourcesResourceWithStreamingResponse(self._cdn.resources) + + @cached_property + def shields(self) -> AsyncShieldsResourceWithStreamingResponse: + return AsyncShieldsResourceWithStreamingResponse(self._cdn.shields) + + @cached_property + def origin_groups(self) -> AsyncOriginGroupsResourceWithStreamingResponse: + return AsyncOriginGroupsResourceWithStreamingResponse(self._cdn.origin_groups) + + @cached_property + def rule_templates(self) -> AsyncRuleTemplatesResourceWithStreamingResponse: + return AsyncRuleTemplatesResourceWithStreamingResponse(self._cdn.rule_templates) + + @cached_property + def certificates(self) -> AsyncCertificatesResourceWithStreamingResponse: + return AsyncCertificatesResourceWithStreamingResponse(self._cdn.certificates) + + @cached_property + def trusted_ca_certificates(self) -> AsyncTrustedCaCertificatesResourceWithStreamingResponse: + return AsyncTrustedCaCertificatesResourceWithStreamingResponse(self._cdn.trusted_ca_certificates) + + @cached_property + def audit_log(self) -> AsyncAuditLogResourceWithStreamingResponse: + return AsyncAuditLogResourceWithStreamingResponse(self._cdn.audit_log) + + @cached_property + def logs(self) -> AsyncLogsResourceWithStreamingResponse: + return AsyncLogsResourceWithStreamingResponse(self._cdn.logs) + + @cached_property + def logs_uploader(self) -> AsyncLogsUploaderResourceWithStreamingResponse: + return AsyncLogsUploaderResourceWithStreamingResponse(self._cdn.logs_uploader) + + @cached_property + def statistics(self) -> AsyncStatisticsResourceWithStreamingResponse: + return AsyncStatisticsResourceWithStreamingResponse(self._cdn.statistics) + + @cached_property + def network_capacity(self) -> AsyncNetworkCapacityResourceWithStreamingResponse: + return AsyncNetworkCapacityResourceWithStreamingResponse(self._cdn.network_capacity) + + @cached_property + def metrics(self) -> AsyncMetricsResourceWithStreamingResponse: + return AsyncMetricsResourceWithStreamingResponse(self._cdn.metrics) + + @cached_property + def ip_ranges(self) -> AsyncIPRangesResourceWithStreamingResponse: + return AsyncIPRangesResourceWithStreamingResponse(self._cdn.ip_ranges) diff --git a/src/gcore/resources/cdn/certificates.py b/src/gcore/resources/cdn/certificates.py new file mode 100644 index 00000000..343090f3 --- /dev/null +++ b/src/gcore/resources/cdn/certificates.py @@ -0,0 +1,1062 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import overload + +import httpx + +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given +from ..._utils import required_args, maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import ( + certificate_list_params, + certificate_create_params, + certificate_replace_params, + certificate_get_status_params, +) +from ..._base_client import make_request_options +from ...types.cdn.ssl_detail import SslDetail +from ...types.cdn.ssl_detail_list import SslDetailList +from ...types.cdn.ssl_request_status import SslRequestStatus + +__all__ = ["CertificatesResource", "AsyncCertificatesResource"] + + +class CertificatesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CertificatesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return CertificatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CertificatesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return CertificatesResourceWithStreamingResponse(self) + + @overload + def create( + self, + *, + name: str, + ssl_certificate: str, + ssl_private_key: str, + validate_root_ca: bool | 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, + ) -> None: + """ + Add an SSL certificate for content delivery over HTTPS protocol. + + Enter all strings of the certificate(s) and the private key into one string + parameter. Each certificate and the private key in chain should be separated by + the "\n" symbol, as shown in the example. + + Additionally, you can add a Let's Encrypt certificate. In this case, certificate + and private key will be generated automatically after attaching this certificate + to your CDN resource. + + Args: + name: SSL certificate name. + + It must be unique. + + ssl_certificate: Public part of the SSL certificate. + + All chain of the SSL certificate should be added. + + ssl_private_key: Private key of the SSL certificate. + + validate_root_ca: Defines whether to check the SSL certificate for a signature from a trusted + certificate authority. + + Possible values: + + - **true** - SSL certificate must be verified to be signed by a trusted + certificate authority. + - **false** - SSL certificate will not be verified to be signed by a trusted + certificate authority. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def create( + self, + *, + automated: bool, + name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Add an SSL certificate for content delivery over HTTPS protocol. + + Enter all strings of the certificate(s) and the private key into one string + parameter. Each certificate and the private key in chain should be separated by + the "\n" symbol, as shown in the example. + + Additionally, you can add a Let's Encrypt certificate. In this case, certificate + and private key will be generated automatically after attaching this certificate + to your CDN resource. + + Args: + automated: Must be **true** to issue certificate automatically. + + name: SSL certificate name. It must be unique. + + 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 + """ + ... + + @required_args(["name", "ssl_certificate", "ssl_private_key"], ["automated", "name"]) + def create( + self, + *, + name: str, + ssl_certificate: str | Omit = omit, + ssl_private_key: str | Omit = omit, + validate_root_ca: bool | Omit = omit, + automated: bool | 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, + ) -> None: + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + "/cdn/sslData" if self._client._base_url_overridden else "https://api.gcore.com//cdn/sslData", + body=maybe_transform( + { + "name": name, + "ssl_certificate": ssl_certificate, + "ssl_private_key": ssl_private_key, + "validate_root_ca": validate_root_ca, + "automated": automated, + }, + certificate_create_params.CertificateCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def list( + self, + *, + automated: bool | Omit = omit, + resource_id: int | Omit = omit, + validity_not_after_lte: 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, + ) -> SslDetailList: + """ + Get information about SSL certificates. + + Args: + automated: How the SSL certificate was issued. + + Possible values: + + - **true** – Certificate was issued automatically. + - **false** – Certificate was added by a user. + + resource_id: CDN resource ID for which certificates are requested. + + validity_not_after_lte: Date and time when the certificate become untrusted (ISO 8601/RFC 3339 format, + UTC.) + + Response will contain only certificates valid until the specified time. + + 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 + """ + return self._get( + "/cdn/sslData" if self._client._base_url_overridden else "https://api.gcore.com//cdn/sslData", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "automated": automated, + "resource_id": resource_id, + "validity_not_after_lte": validity_not_after_lte, + }, + certificate_list_params.CertificateListParams, + ), + ), + cast_to=SslDetailList, + ) + + def delete( + self, + ssl_id: int, + *, + # 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, + ) -> None: + """ + Delete SSL certificate + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/sslData/{ssl_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def force_retry( + self, + cert_id: int, + *, + # 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, + ) -> None: + """ + Force retry issuance of Let's Encrypt certificate if the previous attempt was + failed. + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/cdn/sslData/{cert_id}/force-retry" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{cert_id}/force-retry", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + ssl_id: int, + *, + # 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, + ) -> SslDetail: + """ + Get SSL certificate details + + Args: + 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 + """ + return self._get( + f"/cdn/sslData/{ssl_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SslDetail, + ) + + def get_status( + self, + cert_id: int, + *, + exclude: SequenceNotStr[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, + ) -> SslRequestStatus: + """ + Get details about the latest Let's Encrypt certificate issuing attempt for the + CDN resource. Returns attempts in all statuses. + + Args: + exclude: Listed fields will be excluded from the response. + + 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 + """ + return self._get( + f"/cdn/sslData/{cert_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{cert_id}/status", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"exclude": exclude}, certificate_get_status_params.CertificateGetStatusParams), + ), + cast_to=SslRequestStatus, + ) + + def renew( + self, + cert_id: int, + *, + # 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, + ) -> None: + """Renew free Let's Encrypt certificate for the CDN resource. + + It can take up to + fifteen minutes. + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/cdn/sslData/{cert_id}/renew" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{cert_id}/renew", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def replace( + self, + ssl_id: int, + *, + name: str, + ssl_certificate: str, + ssl_private_key: str, + validate_root_ca: bool | 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, + ) -> SslDetail: + """ + Change SSL certificate + + Args: + name: SSL certificate name. + + It must be unique. + + ssl_certificate: Public part of the SSL certificate. + + All chain of the SSL certificate should be added. + + ssl_private_key: Private key of the SSL certificate. + + validate_root_ca: Defines whether to check the SSL certificate for a signature from a trusted + certificate authority. + + Possible values: + + - **true** - SSL certificate must be verified to be signed by a trusted + certificate authority. + - **false** - SSL certificate will not be verified to be signed by a trusted + certificate authority. + + 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 + """ + return self._put( + f"/cdn/sslData/{ssl_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + body=maybe_transform( + { + "name": name, + "ssl_certificate": ssl_certificate, + "ssl_private_key": ssl_private_key, + "validate_root_ca": validate_root_ca, + }, + certificate_replace_params.CertificateReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SslDetail, + ) + + +class AsyncCertificatesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCertificatesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncCertificatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCertificatesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncCertificatesResourceWithStreamingResponse(self) + + @overload + async def create( + self, + *, + name: str, + ssl_certificate: str, + ssl_private_key: str, + validate_root_ca: bool | 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, + ) -> None: + """ + Add an SSL certificate for content delivery over HTTPS protocol. + + Enter all strings of the certificate(s) and the private key into one string + parameter. Each certificate and the private key in chain should be separated by + the "\n" symbol, as shown in the example. + + Additionally, you can add a Let's Encrypt certificate. In this case, certificate + and private key will be generated automatically after attaching this certificate + to your CDN resource. + + Args: + name: SSL certificate name. + + It must be unique. + + ssl_certificate: Public part of the SSL certificate. + + All chain of the SSL certificate should be added. + + ssl_private_key: Private key of the SSL certificate. + + validate_root_ca: Defines whether to check the SSL certificate for a signature from a trusted + certificate authority. + + Possible values: + + - **true** - SSL certificate must be verified to be signed by a trusted + certificate authority. + - **false** - SSL certificate will not be verified to be signed by a trusted + certificate authority. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def create( + self, + *, + automated: bool, + name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """ + Add an SSL certificate for content delivery over HTTPS protocol. + + Enter all strings of the certificate(s) and the private key into one string + parameter. Each certificate and the private key in chain should be separated by + the "\n" symbol, as shown in the example. + + Additionally, you can add a Let's Encrypt certificate. In this case, certificate + and private key will be generated automatically after attaching this certificate + to your CDN resource. + + Args: + automated: Must be **true** to issue certificate automatically. + + name: SSL certificate name. It must be unique. + + 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 + """ + ... + + @required_args(["name", "ssl_certificate", "ssl_private_key"], ["automated", "name"]) + async def create( + self, + *, + name: str, + ssl_certificate: str | Omit = omit, + ssl_private_key: str | Omit = omit, + validate_root_ca: bool | Omit = omit, + automated: bool | 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, + ) -> None: + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + "/cdn/sslData" if self._client._base_url_overridden else "https://api.gcore.com//cdn/sslData", + body=await async_maybe_transform( + { + "name": name, + "ssl_certificate": ssl_certificate, + "ssl_private_key": ssl_private_key, + "validate_root_ca": validate_root_ca, + "automated": automated, + }, + certificate_create_params.CertificateCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def list( + self, + *, + automated: bool | Omit = omit, + resource_id: int | Omit = omit, + validity_not_after_lte: 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, + ) -> SslDetailList: + """ + Get information about SSL certificates. + + Args: + automated: How the SSL certificate was issued. + + Possible values: + + - **true** – Certificate was issued automatically. + - **false** – Certificate was added by a user. + + resource_id: CDN resource ID for which certificates are requested. + + validity_not_after_lte: Date and time when the certificate become untrusted (ISO 8601/RFC 3339 format, + UTC.) + + Response will contain only certificates valid until the specified time. + + 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 + """ + return await self._get( + "/cdn/sslData" if self._client._base_url_overridden else "https://api.gcore.com//cdn/sslData", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "automated": automated, + "resource_id": resource_id, + "validity_not_after_lte": validity_not_after_lte, + }, + certificate_list_params.CertificateListParams, + ), + ), + cast_to=SslDetailList, + ) + + async def delete( + self, + ssl_id: int, + *, + # 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, + ) -> None: + """ + Delete SSL certificate + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/sslData/{ssl_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def force_retry( + self, + cert_id: int, + *, + # 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, + ) -> None: + """ + Force retry issuance of Let's Encrypt certificate if the previous attempt was + failed. + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/cdn/sslData/{cert_id}/force-retry" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{cert_id}/force-retry", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + ssl_id: int, + *, + # 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, + ) -> SslDetail: + """ + Get SSL certificate details + + Args: + 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 + """ + return await self._get( + f"/cdn/sslData/{ssl_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SslDetail, + ) + + async def get_status( + self, + cert_id: int, + *, + exclude: SequenceNotStr[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, + ) -> SslRequestStatus: + """ + Get details about the latest Let's Encrypt certificate issuing attempt for the + CDN resource. Returns attempts in all statuses. + + Args: + exclude: Listed fields will be excluded from the response. + + 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 + """ + return await self._get( + f"/cdn/sslData/{cert_id}/status" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{cert_id}/status", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"exclude": exclude}, certificate_get_status_params.CertificateGetStatusParams + ), + ), + cast_to=SslRequestStatus, + ) + + async def renew( + self, + cert_id: int, + *, + # 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, + ) -> None: + """Renew free Let's Encrypt certificate for the CDN resource. + + It can take up to + fifteen minutes. + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/cdn/sslData/{cert_id}/renew" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{cert_id}/renew", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def replace( + self, + ssl_id: int, + *, + name: str, + ssl_certificate: str, + ssl_private_key: str, + validate_root_ca: bool | 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, + ) -> SslDetail: + """ + Change SSL certificate + + Args: + name: SSL certificate name. + + It must be unique. + + ssl_certificate: Public part of the SSL certificate. + + All chain of the SSL certificate should be added. + + ssl_private_key: Private key of the SSL certificate. + + validate_root_ca: Defines whether to check the SSL certificate for a signature from a trusted + certificate authority. + + Possible values: + + - **true** - SSL certificate must be verified to be signed by a trusted + certificate authority. + - **false** - SSL certificate will not be verified to be signed by a trusted + certificate authority. + + 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 + """ + return await self._put( + f"/cdn/sslData/{ssl_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslData/{ssl_id}", + body=await async_maybe_transform( + { + "name": name, + "ssl_certificate": ssl_certificate, + "ssl_private_key": ssl_private_key, + "validate_root_ca": validate_root_ca, + }, + certificate_replace_params.CertificateReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SslDetail, + ) + + +class CertificatesResourceWithRawResponse: + def __init__(self, certificates: CertificatesResource) -> None: + self._certificates = certificates + + self.create = to_raw_response_wrapper( + certificates.create, + ) + self.list = to_raw_response_wrapper( + certificates.list, + ) + self.delete = to_raw_response_wrapper( + certificates.delete, + ) + self.force_retry = to_raw_response_wrapper( + certificates.force_retry, + ) + self.get = to_raw_response_wrapper( + certificates.get, + ) + self.get_status = to_raw_response_wrapper( + certificates.get_status, + ) + self.renew = to_raw_response_wrapper( + certificates.renew, + ) + self.replace = to_raw_response_wrapper( + certificates.replace, + ) + + +class AsyncCertificatesResourceWithRawResponse: + def __init__(self, certificates: AsyncCertificatesResource) -> None: + self._certificates = certificates + + self.create = async_to_raw_response_wrapper( + certificates.create, + ) + self.list = async_to_raw_response_wrapper( + certificates.list, + ) + self.delete = async_to_raw_response_wrapper( + certificates.delete, + ) + self.force_retry = async_to_raw_response_wrapper( + certificates.force_retry, + ) + self.get = async_to_raw_response_wrapper( + certificates.get, + ) + self.get_status = async_to_raw_response_wrapper( + certificates.get_status, + ) + self.renew = async_to_raw_response_wrapper( + certificates.renew, + ) + self.replace = async_to_raw_response_wrapper( + certificates.replace, + ) + + +class CertificatesResourceWithStreamingResponse: + def __init__(self, certificates: CertificatesResource) -> None: + self._certificates = certificates + + self.create = to_streamed_response_wrapper( + certificates.create, + ) + self.list = to_streamed_response_wrapper( + certificates.list, + ) + self.delete = to_streamed_response_wrapper( + certificates.delete, + ) + self.force_retry = to_streamed_response_wrapper( + certificates.force_retry, + ) + self.get = to_streamed_response_wrapper( + certificates.get, + ) + self.get_status = to_streamed_response_wrapper( + certificates.get_status, + ) + self.renew = to_streamed_response_wrapper( + certificates.renew, + ) + self.replace = to_streamed_response_wrapper( + certificates.replace, + ) + + +class AsyncCertificatesResourceWithStreamingResponse: + def __init__(self, certificates: AsyncCertificatesResource) -> None: + self._certificates = certificates + + self.create = async_to_streamed_response_wrapper( + certificates.create, + ) + self.list = async_to_streamed_response_wrapper( + certificates.list, + ) + self.delete = async_to_streamed_response_wrapper( + certificates.delete, + ) + self.force_retry = async_to_streamed_response_wrapper( + certificates.force_retry, + ) + self.get = async_to_streamed_response_wrapper( + certificates.get, + ) + self.get_status = async_to_streamed_response_wrapper( + certificates.get_status, + ) + self.renew = async_to_streamed_response_wrapper( + certificates.renew, + ) + self.replace = async_to_streamed_response_wrapper( + certificates.replace, + ) diff --git a/src/gcore/resources/cdn/ip_ranges.py b/src/gcore/resources/cdn/ip_ranges.py new file mode 100644 index 00000000..1480fb8e --- /dev/null +++ b/src/gcore/resources/cdn/ip_ranges.py @@ -0,0 +1,224 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.cdn.public_ip_list import PublicIPList +from ...types.cdn.public_network_list import PublicNetworkList + +__all__ = ["IPRangesResource", "AsyncIPRangesResource"] + + +class IPRangesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> IPRangesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return IPRangesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> IPRangesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return IPRangesResourceWithStreamingResponse(self) + + def list( + 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, + ) -> PublicNetworkList: + """ + Get all CDN networks that can be used to pull content from your origin. + + This list is updated periodically. If you want to use network from this list to + configure IP ACL on your origin, you need to independently monitor its + relevance. We recommend using a script for automatically update IP ACL. + + This request does not require authorization. + """ + return self._get( + "/cdn/public-net-list" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/public-net-list", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PublicNetworkList, + ) + + def list_ips( + 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, + ) -> PublicIPList: + """ + Get all IP addresses of CDN servers that can be used to pull content from your + origin. + + This list is updated periodically. If you want to use IP from this list to + configure IP ACL in your origin, you need to independently monitor its + relevance. We recommend using a script to automatically update IP ACL. + + This request does not require authorization. + """ + return self._get( + "/cdn/public-ip-list" if self._client._base_url_overridden else "https://api.gcore.com//cdn/public-ip-list", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PublicIPList, + ) + + +class AsyncIPRangesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncIPRangesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncIPRangesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncIPRangesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncIPRangesResourceWithStreamingResponse(self) + + async def list( + 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, + ) -> PublicNetworkList: + """ + Get all CDN networks that can be used to pull content from your origin. + + This list is updated periodically. If you want to use network from this list to + configure IP ACL on your origin, you need to independently monitor its + relevance. We recommend using a script for automatically update IP ACL. + + This request does not require authorization. + """ + return await self._get( + "/cdn/public-net-list" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/public-net-list", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PublicNetworkList, + ) + + async def list_ips( + 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, + ) -> PublicIPList: + """ + Get all IP addresses of CDN servers that can be used to pull content from your + origin. + + This list is updated periodically. If you want to use IP from this list to + configure IP ACL in your origin, you need to independently monitor its + relevance. We recommend using a script to automatically update IP ACL. + + This request does not require authorization. + """ + return await self._get( + "/cdn/public-ip-list" if self._client._base_url_overridden else "https://api.gcore.com//cdn/public-ip-list", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PublicIPList, + ) + + +class IPRangesResourceWithRawResponse: + def __init__(self, ip_ranges: IPRangesResource) -> None: + self._ip_ranges = ip_ranges + + self.list = to_raw_response_wrapper( + ip_ranges.list, + ) + self.list_ips = to_raw_response_wrapper( + ip_ranges.list_ips, + ) + + +class AsyncIPRangesResourceWithRawResponse: + def __init__(self, ip_ranges: AsyncIPRangesResource) -> None: + self._ip_ranges = ip_ranges + + self.list = async_to_raw_response_wrapper( + ip_ranges.list, + ) + self.list_ips = async_to_raw_response_wrapper( + ip_ranges.list_ips, + ) + + +class IPRangesResourceWithStreamingResponse: + def __init__(self, ip_ranges: IPRangesResource) -> None: + self._ip_ranges = ip_ranges + + self.list = to_streamed_response_wrapper( + ip_ranges.list, + ) + self.list_ips = to_streamed_response_wrapper( + ip_ranges.list_ips, + ) + + +class AsyncIPRangesResourceWithStreamingResponse: + def __init__(self, ip_ranges: AsyncIPRangesResource) -> None: + self._ip_ranges = ip_ranges + + self.list = async_to_streamed_response_wrapper( + ip_ranges.list, + ) + self.list_ips = async_to_streamed_response_wrapper( + ip_ranges.list_ips, + ) diff --git a/src/gcore/resources/cdn/logs/__init__.py b/src/gcore/resources/cdn/logs/__init__.py new file mode 100644 index 00000000..580717d0 --- /dev/null +++ b/src/gcore/resources/cdn/logs/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .logs import ( + LogsResource, + AsyncLogsResource, + LogsResourceWithRawResponse, + AsyncLogsResourceWithRawResponse, + LogsResourceWithStreamingResponse, + AsyncLogsResourceWithStreamingResponse, +) +from .settings import ( + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, +) + +__all__ = [ + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", + "LogsResource", + "AsyncLogsResource", + "LogsResourceWithRawResponse", + "AsyncLogsResourceWithRawResponse", + "LogsResourceWithStreamingResponse", + "AsyncLogsResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cdn/logs/logs.py b/src/gcore/resources/cdn/logs/logs.py new file mode 100644 index 00000000..9466b36b --- /dev/null +++ b/src/gcore/resources/cdn/logs/logs.py @@ -0,0 +1,1424 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .settings import ( + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, +) +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, + AsyncStreamedBinaryAPIResponse, + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + to_custom_raw_response_wrapper, + async_to_streamed_response_wrapper, + to_custom_streamed_response_wrapper, + 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 + +__all__ = ["LogsResource", "AsyncLogsResource"] + + +class LogsResource(SyncAPIResource): + @cached_property + def settings(self) -> SettingsResource: + return SettingsResource(self._client) + + @cached_property + def with_raw_response(self) -> LogsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return LogsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LogsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return LogsResourceWithStreamingResponse(self) + + def list( + self, + *, + from_: str, + to: str, + cache_status_eq: str | Omit = omit, + cache_status_in: str | Omit = omit, + cache_status_ne: str | Omit = omit, + cache_status_not_in: str | Omit = omit, + client_ip_eq: str | Omit = omit, + client_ip_in: str | Omit = omit, + client_ip_ne: str | Omit = omit, + client_ip_not_in: str | Omit = omit, + cname_contains: str | Omit = omit, + cname_eq: str | Omit = omit, + cname_in: str | Omit = omit, + cname_ne: str | Omit = omit, + cname_not_in: str | Omit = omit, + datacenter_eq: str | Omit = omit, + datacenter_in: str | Omit = omit, + datacenter_ne: str | Omit = omit, + datacenter_not_in: str | Omit = omit, + fields: str | Omit = omit, + limit: int | Omit = omit, + method_eq: str | Omit = omit, + method_in: str | Omit = omit, + method_ne: str | Omit = omit, + method_not_in: str | Omit = omit, + offset: int | Omit = omit, + ordering: str | Omit = omit, + resource_id_eq: int | Omit = omit, + resource_id_gt: int | Omit = omit, + resource_id_gte: int | Omit = omit, + resource_id_in: str | Omit = omit, + resource_id_lt: int | Omit = omit, + resource_id_lte: int | Omit = omit, + resource_id_ne: int | Omit = omit, + resource_id_not_in: str | Omit = omit, + size_eq: int | Omit = omit, + size_gt: int | Omit = omit, + size_gte: int | Omit = omit, + size_in: str | Omit = omit, + size_lt: int | Omit = omit, + size_lte: int | Omit = omit, + size_ne: int | Omit = omit, + size_not_in: str | Omit = omit, + status_eq: int | Omit = omit, + status_gt: int | Omit = omit, + status_gte: int | Omit = omit, + status_in: str | Omit = omit, + status_lt: int | Omit = omit, + status_lte: int | Omit = omit, + status_ne: int | Omit = omit, + status_not_in: 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, + ) -> SyncOffsetPageCdnLogs[Data]: + """ + Get CDN logs for up to 3 days starting today. + + You can filter logs using query parameters by client IP, CDN resource, date, + path and etc. + + To filter the CDN logs by 2xx status codes, use: + + - &`status__gte`=200&`status__lt`=300 + + Args: + from_: Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &from=2021-06-14T00:00:00Z + - &from=2021-06-14T00:00:00.000Z + + to: End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &to=2021-06-15T00:00:00Z + - &to=2021-06-15T00:00:00.000Z + + cache_status_eq: Caching status. Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', + 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. + + cache_status_in: List of caching statuses. Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', + 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. Values should be separated by + a comma. + + cache_status_ne: Caching status not equal to the specified value. Possible values: 'MISS', + 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. + + cache_status_not_in: + List of caching statuses not equal to the specified values. Possible values: + 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', 'REVALIDATED', + 'HIT', '-'. Values should be separated by a comma. + + client_ip_eq: IP address of the client who sent the request. + + client_ip_in: List of IP addresses of the clients who sent the request. + + client_ip_ne: IP address of the client who did not send the request. + + client_ip_not_in: List of IP addresses of the clients who did not send the request. + + cname_contains: Part of the custom domain of the requested CDN resource. Minimum length is 3 + characters. + + cname_eq: Custom domain of the requested CDN resource. + + cname_in: List of custom domains of the requested CDN resource. Values should be separated + by a comma. + + cname_ne: Custom domain of the requested CDN resource not equal to the specified value. + + cname_not_in: List of custom domains of the requested CDN resource not equal to the specified + values. Values should be separated by a comma. + + datacenter_eq: Data center where request was processed. + + datacenter_in: List of data centers where request was processed. Values should be separated by + a comma. + + datacenter_ne: Data center where request was not processed. + + datacenter_not_in: List of data centers where request was not processed. Values should be separated + by a comma. + + fields: A comma-separated list of returned fields. + + Supported fields are presented in the responses section. + + Example: + + - &fields=timestamp,path,status + + limit: Maximum number of log records in the response. + + method_eq: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. + + method_in: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be separated by a + comma. + + method_ne: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. + + method_not_in: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be separated by a + comma. + + offset: Number of log records to skip starting from the beginning of the requested + period. + + ordering: Sorting rules. + + Possible values: + + - **method** - Request HTTP method. + - **`client_ip`** - IP address of the client who sent the request. + - **status** - Status code in the response. + - **size** - Response size in bytes. + - **cname** - Custom domain of the requested resource. + - **`resource_id`** - ID of the requested CDN resource. + - **`cache_status`** - Caching status. + - **datacenter** - Data center where request was processed. + - **timestamp** - Date and time when the request was made. + + Parameter may have multiple values separated by a comma. + + By default, ascending sorting is applied. To sort in descending order, add '-' + prefix. + + Example: + + - &ordering=-timestamp,status + + resource_id_eq: ID of the requested CDN resource equal to the specified value. + + resource_id_gt: ID of the requested CDN resource greater than the specified value. + + resource_id_gte: ID of the requested CDN resource greater than or equal to the specified value. + + resource_id_in: List of IDs of the requested CDN resource. Values should be separated by a + comma. + + resource_id_lt: ID of the requested CDN resource less than the specified value. + + resource_id_lte: ID of the requested CDN resource less than or equal to the specified value. + + resource_id_ne: ID of the requested CDN resource not equal to the specified value. + + resource_id_not_in: List of IDs of the requested CDN resource not equal to the specified values. + Values should be separated by a comma. + + size_eq: Response size in bytes equal to the specified value. + + size_gt: Response size in bytes greater than the specified value. + + size_gte: Response size in bytes greater than or equal to the specified value. + + size_in: List of response sizes in bytes. Values should be separated by a comma. + + size_lt: Response size in bytes less than the specified value. + + size_lte: Response size in bytes less than or equal to the specified value. + + size_ne: Response size in bytes not equal to the specified value. + + size_not_in: List of response sizes in bytes not equal to the specified values. Values should + be separated by + + status_eq: Status code in the response equal to the specified value. + + status_gt: Status code in the response greater than the specified value. + + status_gte: Status code in the response greater than or equal to the specified value. + + status_in: List of status codes in the response. Values should be separated by a comma. + + status_lt: Status code in the response less than the specified value. + + status_lte: Status code in the response less than or equal to the specified value. + + status_ne: Status code in the response not equal to the specified value. + + status_not_in: List of status codes not in the response. Values should be separated by a comma. + + 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 + """ + return self._get_api_list( + "/cdn/advanced/v1/logs" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/advanced/v1/logs", + page=SyncOffsetPageCdnLogs[Data], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "cache_status_eq": cache_status_eq, + "cache_status_in": cache_status_in, + "cache_status_ne": cache_status_ne, + "cache_status_not_in": cache_status_not_in, + "client_ip_eq": client_ip_eq, + "client_ip_in": client_ip_in, + "client_ip_ne": client_ip_ne, + "client_ip_not_in": client_ip_not_in, + "cname_contains": cname_contains, + "cname_eq": cname_eq, + "cname_in": cname_in, + "cname_ne": cname_ne, + "cname_not_in": cname_not_in, + "datacenter_eq": datacenter_eq, + "datacenter_in": datacenter_in, + "datacenter_ne": datacenter_ne, + "datacenter_not_in": datacenter_not_in, + "fields": fields, + "limit": limit, + "method_eq": method_eq, + "method_in": method_in, + "method_ne": method_ne, + "method_not_in": method_not_in, + "offset": offset, + "ordering": ordering, + "resource_id_eq": resource_id_eq, + "resource_id_gt": resource_id_gt, + "resource_id_gte": resource_id_gte, + "resource_id_in": resource_id_in, + "resource_id_lt": resource_id_lt, + "resource_id_lte": resource_id_lte, + "resource_id_ne": resource_id_ne, + "resource_id_not_in": resource_id_not_in, + "size_eq": size_eq, + "size_gt": size_gt, + "size_gte": size_gte, + "size_in": size_in, + "size_lt": size_lt, + "size_lte": size_lte, + "size_ne": size_ne, + "size_not_in": size_not_in, + "status_eq": status_eq, + "status_gt": status_gt, + "status_gte": status_gte, + "status_in": status_in, + "status_lt": status_lt, + "status_lte": status_lte, + "status_ne": status_ne, + "status_not_in": status_not_in, + }, + log_list_params.LogListParams, + ), + ), + model=Data, + ) + + def download( + self, + *, + format: str, + from_: str, + to: str, + cache_status_eq: str | Omit = omit, + cache_status_in: str | Omit = omit, + cache_status_ne: str | Omit = omit, + cache_status_not_in: str | Omit = omit, + client_ip_eq: str | Omit = omit, + client_ip_in: str | Omit = omit, + client_ip_ne: str | Omit = omit, + client_ip_not_in: str | Omit = omit, + cname_contains: str | Omit = omit, + cname_eq: str | Omit = omit, + cname_in: str | Omit = omit, + cname_ne: str | Omit = omit, + cname_not_in: str | Omit = omit, + datacenter_eq: str | Omit = omit, + datacenter_in: str | Omit = omit, + datacenter_ne: str | Omit = omit, + datacenter_not_in: str | Omit = omit, + fields: str | Omit = omit, + limit: int | Omit = omit, + method_eq: str | Omit = omit, + method_in: str | Omit = omit, + method_ne: str | Omit = omit, + method_not_in: str | Omit = omit, + offset: int | Omit = omit, + resource_id_eq: int | Omit = omit, + resource_id_gt: int | Omit = omit, + resource_id_gte: int | Omit = omit, + resource_id_in: str | Omit = omit, + resource_id_lt: int | Omit = omit, + resource_id_lte: int | Omit = omit, + resource_id_ne: int | Omit = omit, + resource_id_not_in: str | Omit = omit, + size_eq: int | Omit = omit, + size_gt: int | Omit = omit, + size_gte: int | Omit = omit, + size_in: str | Omit = omit, + size_lt: int | Omit = omit, + size_lte: int | Omit = omit, + size_ne: int | Omit = omit, + size_not_in: str | Omit = omit, + sort: str | Omit = omit, + status_eq: int | Omit = omit, + status_gt: int | Omit = omit, + status_gte: int | Omit = omit, + status_in: str | Omit = omit, + status_lt: int | Omit = omit, + status_lte: int | Omit = omit, + status_ne: int | Omit = omit, + status_not_in: 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, + ) -> BinaryAPIResponse: + """ + Download CDN logs for up to 3 days starting today. + + You can filter logs using query params by client IP, CDN resource, date, path + and etc. + + Args: + format: Output format. + + Possible values: + + - csv + - tsv + + from_: Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &from=2021-06-14T00:00:00Z + - &from=2021-06-14T00:00:00.000Z + + to: End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &to=2021-06-15T00:00:00Z + - &to=2021-06-15T00:00:00.000Z + + cache_status_eq: Caching status. Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', + 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. + + cache_status_in: List of caching statuses. Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', + 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. Values should be separated by + a comma. + + cache_status_ne: Caching status not equal to the specified value. Possible values: 'MISS', + 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. + + cache_status_not_in: + List of caching statuses not equal to the specified values. Possible values: + 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', 'REVALIDATED', + 'HIT', '-'. Values should be separated by a comma. + + client_ip_eq: IP address of the client who sent the request. + + client_ip_in: List of IP addresses of the clients who sent the request. + + client_ip_ne: IP address of the client who did not send the request. + + client_ip_not_in: List of IP addresses of the clients who did not send the request. + + cname_contains: Part of the custom domain of the requested CDN resource. Minimum length is 3 + characters. + + cname_eq: Custom domain of the requested CDN resource. + + cname_in: List of custom domains of the requested CDN resource. Values should be separated + by a comma. + + cname_ne: Custom domain of the requested CDN resource not equal to the specified value. + + cname_not_in: List of custom domains of the requested CDN resource not equal to the specified + values. Values should be separated by a comma. + + datacenter_eq: Data center where request was processed. + + datacenter_in: List of data centers where request was processed. Values should be separated by + a comma. + + datacenter_ne: Data center where request was not processed. + + datacenter_not_in: List of data centers where request was not processed. Values should be separated + by a comma. + + fields: A comma-separated list of returned fields. + + Supported fields are presented in the responses section. + + Example: + + - &fields=timestamp,path,status + + limit: Maximum number of log records in the response. + + method_eq: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. + + method_in: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be separated by a + comma. + + method_ne: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. + + method_not_in: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be separated by a + comma. + + offset: Number of log records to skip starting from the beginning of the requested + period. + + resource_id_eq: ID of the requested CDN resource equal to the specified value. + + resource_id_gt: ID of the requested CDN resource greater than the specified value. + + resource_id_gte: ID of the requested CDN resource greater than or equal to the specified value. + + resource_id_in: List of IDs of the requested CDN resource. Values should be separated by a + comma. + + resource_id_lt: ID of the requested CDN resource less than the specified value. + + resource_id_lte: ID of the requested CDN resource less than or equal to the specified value. + + resource_id_ne: ID of the requested CDN resource not equal to the specified value. + + resource_id_not_in: List of IDs of the requested CDN resource not equal to the specified values. + Values should be separated by a comma. + + size_eq: Response size in bytes equal to the specified value. + + size_gt: Response size in bytes greater than the specified value. + + size_gte: Response size in bytes greater than or equal to the specified value. + + size_in: List of response sizes in bytes. Values should be separated by a comma. + + size_lt: Response size in bytes less than the specified value. + + size_lte: Response size in bytes less than or equal to the specified value. + + size_ne: Response size in bytes not equal to the specified value. + + size_not_in: List of response sizes in bytes not equal to the specified values. Values should + be separated by + + sort: Sorting rules. + + Possible values: + + - **method** - Request HTTP method. + - **`client_ip`** - IP address of the client who sent the request. + - **status** - Status code in the response. + - **size** - Response size in bytes. + - **cname** - Custom domain of the requested resource. + - **`resource_id`** - ID of the requested CDN resource. + - **`cache_status`** - Caching status. + - **datacenter** - Data center where request was processed. + - **timestamp** - Date and time when the request was made. + + May include multiple values separated by a comma. + + Example: + + - &sort=-timestamp,status + + status_eq: Status code in the response equal to the specified value. + + status_gt: Status code in the response greater than the specified value. + + status_gte: Status code in the response greater than or equal to the specified value. + + status_in: List of status codes in the response. Values should be separated by a comma. + + status_lt: Status code in the response less than the specified value. + + status_lte: Status code in the response less than or equal to the specified value. + + status_ne: Status code in the response not equal to the specified value. + + status_not_in: List of status codes not in the response. Values should be separated by a comma. + + 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 + """ + extra_headers = {"Accept": "application/zip", **(extra_headers or {})} + return self._get( + "/cdn/advanced/v1/logs/download" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/advanced/v1/logs/download", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "format": format, + "from_": from_, + "to": to, + "cache_status_eq": cache_status_eq, + "cache_status_in": cache_status_in, + "cache_status_ne": cache_status_ne, + "cache_status_not_in": cache_status_not_in, + "client_ip_eq": client_ip_eq, + "client_ip_in": client_ip_in, + "client_ip_ne": client_ip_ne, + "client_ip_not_in": client_ip_not_in, + "cname_contains": cname_contains, + "cname_eq": cname_eq, + "cname_in": cname_in, + "cname_ne": cname_ne, + "cname_not_in": cname_not_in, + "datacenter_eq": datacenter_eq, + "datacenter_in": datacenter_in, + "datacenter_ne": datacenter_ne, + "datacenter_not_in": datacenter_not_in, + "fields": fields, + "limit": limit, + "method_eq": method_eq, + "method_in": method_in, + "method_ne": method_ne, + "method_not_in": method_not_in, + "offset": offset, + "resource_id_eq": resource_id_eq, + "resource_id_gt": resource_id_gt, + "resource_id_gte": resource_id_gte, + "resource_id_in": resource_id_in, + "resource_id_lt": resource_id_lt, + "resource_id_lte": resource_id_lte, + "resource_id_ne": resource_id_ne, + "resource_id_not_in": resource_id_not_in, + "size_eq": size_eq, + "size_gt": size_gt, + "size_gte": size_gte, + "size_in": size_in, + "size_lt": size_lt, + "size_lte": size_lte, + "size_ne": size_ne, + "size_not_in": size_not_in, + "sort": sort, + "status_eq": status_eq, + "status_gt": status_gt, + "status_gte": status_gte, + "status_in": status_in, + "status_lt": status_lt, + "status_lte": status_lte, + "status_ne": status_ne, + "status_not_in": status_not_in, + }, + log_download_params.LogDownloadParams, + ), + ), + cast_to=BinaryAPIResponse, + ) + + +class AsyncLogsResource(AsyncAPIResource): + @cached_property + def settings(self) -> AsyncSettingsResource: + return AsyncSettingsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncLogsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncLogsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLogsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncLogsResourceWithStreamingResponse(self) + + def list( + self, + *, + from_: str, + to: str, + cache_status_eq: str | Omit = omit, + cache_status_in: str | Omit = omit, + cache_status_ne: str | Omit = omit, + cache_status_not_in: str | Omit = omit, + client_ip_eq: str | Omit = omit, + client_ip_in: str | Omit = omit, + client_ip_ne: str | Omit = omit, + client_ip_not_in: str | Omit = omit, + cname_contains: str | Omit = omit, + cname_eq: str | Omit = omit, + cname_in: str | Omit = omit, + cname_ne: str | Omit = omit, + cname_not_in: str | Omit = omit, + datacenter_eq: str | Omit = omit, + datacenter_in: str | Omit = omit, + datacenter_ne: str | Omit = omit, + datacenter_not_in: str | Omit = omit, + fields: str | Omit = omit, + limit: int | Omit = omit, + method_eq: str | Omit = omit, + method_in: str | Omit = omit, + method_ne: str | Omit = omit, + method_not_in: str | Omit = omit, + offset: int | Omit = omit, + ordering: str | Omit = omit, + resource_id_eq: int | Omit = omit, + resource_id_gt: int | Omit = omit, + resource_id_gte: int | Omit = omit, + resource_id_in: str | Omit = omit, + resource_id_lt: int | Omit = omit, + resource_id_lte: int | Omit = omit, + resource_id_ne: int | Omit = omit, + resource_id_not_in: str | Omit = omit, + size_eq: int | Omit = omit, + size_gt: int | Omit = omit, + size_gte: int | Omit = omit, + size_in: str | Omit = omit, + size_lt: int | Omit = omit, + size_lte: int | Omit = omit, + size_ne: int | Omit = omit, + size_not_in: str | Omit = omit, + status_eq: int | Omit = omit, + status_gt: int | Omit = omit, + status_gte: int | Omit = omit, + status_in: str | Omit = omit, + status_lt: int | Omit = omit, + status_lte: int | Omit = omit, + status_ne: int | Omit = omit, + status_not_in: 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, + ) -> AsyncPaginator[Data, AsyncOffsetPageCdnLogs[Data]]: + """ + Get CDN logs for up to 3 days starting today. + + You can filter logs using query parameters by client IP, CDN resource, date, + path and etc. + + To filter the CDN logs by 2xx status codes, use: + + - &`status__gte`=200&`status__lt`=300 + + Args: + from_: Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &from=2021-06-14T00:00:00Z + - &from=2021-06-14T00:00:00.000Z + + to: End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &to=2021-06-15T00:00:00Z + - &to=2021-06-15T00:00:00.000Z + + cache_status_eq: Caching status. Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', + 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. + + cache_status_in: List of caching statuses. Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', + 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. Values should be separated by + a comma. + + cache_status_ne: Caching status not equal to the specified value. Possible values: 'MISS', + 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. + + cache_status_not_in: + List of caching statuses not equal to the specified values. Possible values: + 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', 'REVALIDATED', + 'HIT', '-'. Values should be separated by a comma. + + client_ip_eq: IP address of the client who sent the request. + + client_ip_in: List of IP addresses of the clients who sent the request. + + client_ip_ne: IP address of the client who did not send the request. + + client_ip_not_in: List of IP addresses of the clients who did not send the request. + + cname_contains: Part of the custom domain of the requested CDN resource. Minimum length is 3 + characters. + + cname_eq: Custom domain of the requested CDN resource. + + cname_in: List of custom domains of the requested CDN resource. Values should be separated + by a comma. + + cname_ne: Custom domain of the requested CDN resource not equal to the specified value. + + cname_not_in: List of custom domains of the requested CDN resource not equal to the specified + values. Values should be separated by a comma. + + datacenter_eq: Data center where request was processed. + + datacenter_in: List of data centers where request was processed. Values should be separated by + a comma. + + datacenter_ne: Data center where request was not processed. + + datacenter_not_in: List of data centers where request was not processed. Values should be separated + by a comma. + + fields: A comma-separated list of returned fields. + + Supported fields are presented in the responses section. + + Example: + + - &fields=timestamp,path,status + + limit: Maximum number of log records in the response. + + method_eq: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. + + method_in: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be separated by a + comma. + + method_ne: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. + + method_not_in: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be separated by a + comma. + + offset: Number of log records to skip starting from the beginning of the requested + period. + + ordering: Sorting rules. + + Possible values: + + - **method** - Request HTTP method. + - **`client_ip`** - IP address of the client who sent the request. + - **status** - Status code in the response. + - **size** - Response size in bytes. + - **cname** - Custom domain of the requested resource. + - **`resource_id`** - ID of the requested CDN resource. + - **`cache_status`** - Caching status. + - **datacenter** - Data center where request was processed. + - **timestamp** - Date and time when the request was made. + + Parameter may have multiple values separated by a comma. + + By default, ascending sorting is applied. To sort in descending order, add '-' + prefix. + + Example: + + - &ordering=-timestamp,status + + resource_id_eq: ID of the requested CDN resource equal to the specified value. + + resource_id_gt: ID of the requested CDN resource greater than the specified value. + + resource_id_gte: ID of the requested CDN resource greater than or equal to the specified value. + + resource_id_in: List of IDs of the requested CDN resource. Values should be separated by a + comma. + + resource_id_lt: ID of the requested CDN resource less than the specified value. + + resource_id_lte: ID of the requested CDN resource less than or equal to the specified value. + + resource_id_ne: ID of the requested CDN resource not equal to the specified value. + + resource_id_not_in: List of IDs of the requested CDN resource not equal to the specified values. + Values should be separated by a comma. + + size_eq: Response size in bytes equal to the specified value. + + size_gt: Response size in bytes greater than the specified value. + + size_gte: Response size in bytes greater than or equal to the specified value. + + size_in: List of response sizes in bytes. Values should be separated by a comma. + + size_lt: Response size in bytes less than the specified value. + + size_lte: Response size in bytes less than or equal to the specified value. + + size_ne: Response size in bytes not equal to the specified value. + + size_not_in: List of response sizes in bytes not equal to the specified values. Values should + be separated by + + status_eq: Status code in the response equal to the specified value. + + status_gt: Status code in the response greater than the specified value. + + status_gte: Status code in the response greater than or equal to the specified value. + + status_in: List of status codes in the response. Values should be separated by a comma. + + status_lt: Status code in the response less than the specified value. + + status_lte: Status code in the response less than or equal to the specified value. + + status_ne: Status code in the response not equal to the specified value. + + status_not_in: List of status codes not in the response. Values should be separated by a comma. + + 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 + """ + return self._get_api_list( + "/cdn/advanced/v1/logs" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/advanced/v1/logs", + page=AsyncOffsetPageCdnLogs[Data], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "cache_status_eq": cache_status_eq, + "cache_status_in": cache_status_in, + "cache_status_ne": cache_status_ne, + "cache_status_not_in": cache_status_not_in, + "client_ip_eq": client_ip_eq, + "client_ip_in": client_ip_in, + "client_ip_ne": client_ip_ne, + "client_ip_not_in": client_ip_not_in, + "cname_contains": cname_contains, + "cname_eq": cname_eq, + "cname_in": cname_in, + "cname_ne": cname_ne, + "cname_not_in": cname_not_in, + "datacenter_eq": datacenter_eq, + "datacenter_in": datacenter_in, + "datacenter_ne": datacenter_ne, + "datacenter_not_in": datacenter_not_in, + "fields": fields, + "limit": limit, + "method_eq": method_eq, + "method_in": method_in, + "method_ne": method_ne, + "method_not_in": method_not_in, + "offset": offset, + "ordering": ordering, + "resource_id_eq": resource_id_eq, + "resource_id_gt": resource_id_gt, + "resource_id_gte": resource_id_gte, + "resource_id_in": resource_id_in, + "resource_id_lt": resource_id_lt, + "resource_id_lte": resource_id_lte, + "resource_id_ne": resource_id_ne, + "resource_id_not_in": resource_id_not_in, + "size_eq": size_eq, + "size_gt": size_gt, + "size_gte": size_gte, + "size_in": size_in, + "size_lt": size_lt, + "size_lte": size_lte, + "size_ne": size_ne, + "size_not_in": size_not_in, + "status_eq": status_eq, + "status_gt": status_gt, + "status_gte": status_gte, + "status_in": status_in, + "status_lt": status_lt, + "status_lte": status_lte, + "status_ne": status_ne, + "status_not_in": status_not_in, + }, + log_list_params.LogListParams, + ), + ), + model=Data, + ) + + async def download( + self, + *, + format: str, + from_: str, + to: str, + cache_status_eq: str | Omit = omit, + cache_status_in: str | Omit = omit, + cache_status_ne: str | Omit = omit, + cache_status_not_in: str | Omit = omit, + client_ip_eq: str | Omit = omit, + client_ip_in: str | Omit = omit, + client_ip_ne: str | Omit = omit, + client_ip_not_in: str | Omit = omit, + cname_contains: str | Omit = omit, + cname_eq: str | Omit = omit, + cname_in: str | Omit = omit, + cname_ne: str | Omit = omit, + cname_not_in: str | Omit = omit, + datacenter_eq: str | Omit = omit, + datacenter_in: str | Omit = omit, + datacenter_ne: str | Omit = omit, + datacenter_not_in: str | Omit = omit, + fields: str | Omit = omit, + limit: int | Omit = omit, + method_eq: str | Omit = omit, + method_in: str | Omit = omit, + method_ne: str | Omit = omit, + method_not_in: str | Omit = omit, + offset: int | Omit = omit, + resource_id_eq: int | Omit = omit, + resource_id_gt: int | Omit = omit, + resource_id_gte: int | Omit = omit, + resource_id_in: str | Omit = omit, + resource_id_lt: int | Omit = omit, + resource_id_lte: int | Omit = omit, + resource_id_ne: int | Omit = omit, + resource_id_not_in: str | Omit = omit, + size_eq: int | Omit = omit, + size_gt: int | Omit = omit, + size_gte: int | Omit = omit, + size_in: str | Omit = omit, + size_lt: int | Omit = omit, + size_lte: int | Omit = omit, + size_ne: int | Omit = omit, + size_not_in: str | Omit = omit, + sort: str | Omit = omit, + status_eq: int | Omit = omit, + status_gt: int | Omit = omit, + status_gte: int | Omit = omit, + status_in: str | Omit = omit, + status_lt: int | Omit = omit, + status_lte: int | Omit = omit, + status_ne: int | Omit = omit, + status_not_in: 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, + ) -> AsyncBinaryAPIResponse: + """ + Download CDN logs for up to 3 days starting today. + + You can filter logs using query params by client IP, CDN resource, date, path + and etc. + + Args: + format: Output format. + + Possible values: + + - csv + - tsv + + from_: Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &from=2021-06-14T00:00:00Z + - &from=2021-06-14T00:00:00.000Z + + to: End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &to=2021-06-15T00:00:00Z + - &to=2021-06-15T00:00:00.000Z + + cache_status_eq: Caching status. Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', + 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. + + cache_status_in: List of caching statuses. Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', + 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. Values should be separated by + a comma. + + cache_status_ne: Caching status not equal to the specified value. Possible values: 'MISS', + 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', 'REVALIDATED', 'HIT', '-'. + + cache_status_not_in: + List of caching statuses not equal to the specified values. Possible values: + 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', 'REVALIDATED', + 'HIT', '-'. Values should be separated by a comma. + + client_ip_eq: IP address of the client who sent the request. + + client_ip_in: List of IP addresses of the clients who sent the request. + + client_ip_ne: IP address of the client who did not send the request. + + client_ip_not_in: List of IP addresses of the clients who did not send the request. + + cname_contains: Part of the custom domain of the requested CDN resource. Minimum length is 3 + characters. + + cname_eq: Custom domain of the requested CDN resource. + + cname_in: List of custom domains of the requested CDN resource. Values should be separated + by a comma. + + cname_ne: Custom domain of the requested CDN resource not equal to the specified value. + + cname_not_in: List of custom domains of the requested CDN resource not equal to the specified + values. Values should be separated by a comma. + + datacenter_eq: Data center where request was processed. + + datacenter_in: List of data centers where request was processed. Values should be separated by + a comma. + + datacenter_ne: Data center where request was not processed. + + datacenter_not_in: List of data centers where request was not processed. Values should be separated + by a comma. + + fields: A comma-separated list of returned fields. + + Supported fields are presented in the responses section. + + Example: + + - &fields=timestamp,path,status + + limit: Maximum number of log records in the response. + + method_eq: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. + + method_in: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be separated by a + comma. + + method_ne: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. + + method_not_in: Request HTTP method. Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', + 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'. Values should be separated by a + comma. + + offset: Number of log records to skip starting from the beginning of the requested + period. + + resource_id_eq: ID of the requested CDN resource equal to the specified value. + + resource_id_gt: ID of the requested CDN resource greater than the specified value. + + resource_id_gte: ID of the requested CDN resource greater than or equal to the specified value. + + resource_id_in: List of IDs of the requested CDN resource. Values should be separated by a + comma. + + resource_id_lt: ID of the requested CDN resource less than the specified value. + + resource_id_lte: ID of the requested CDN resource less than or equal to the specified value. + + resource_id_ne: ID of the requested CDN resource not equal to the specified value. + + resource_id_not_in: List of IDs of the requested CDN resource not equal to the specified values. + Values should be separated by a comma. + + size_eq: Response size in bytes equal to the specified value. + + size_gt: Response size in bytes greater than the specified value. + + size_gte: Response size in bytes greater than or equal to the specified value. + + size_in: List of response sizes in bytes. Values should be separated by a comma. + + size_lt: Response size in bytes less than the specified value. + + size_lte: Response size in bytes less than or equal to the specified value. + + size_ne: Response size in bytes not equal to the specified value. + + size_not_in: List of response sizes in bytes not equal to the specified values. Values should + be separated by + + sort: Sorting rules. + + Possible values: + + - **method** - Request HTTP method. + - **`client_ip`** - IP address of the client who sent the request. + - **status** - Status code in the response. + - **size** - Response size in bytes. + - **cname** - Custom domain of the requested resource. + - **`resource_id`** - ID of the requested CDN resource. + - **`cache_status`** - Caching status. + - **datacenter** - Data center where request was processed. + - **timestamp** - Date and time when the request was made. + + May include multiple values separated by a comma. + + Example: + + - &sort=-timestamp,status + + status_eq: Status code in the response equal to the specified value. + + status_gt: Status code in the response greater than the specified value. + + status_gte: Status code in the response greater than or equal to the specified value. + + status_in: List of status codes in the response. Values should be separated by a comma. + + status_lt: Status code in the response less than the specified value. + + status_lte: Status code in the response less than or equal to the specified value. + + status_ne: Status code in the response not equal to the specified value. + + status_not_in: List of status codes not in the response. Values should be separated by a comma. + + 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 + """ + extra_headers = {"Accept": "application/zip", **(extra_headers or {})} + return await self._get( + "/cdn/advanced/v1/logs/download" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/advanced/v1/logs/download", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "format": format, + "from_": from_, + "to": to, + "cache_status_eq": cache_status_eq, + "cache_status_in": cache_status_in, + "cache_status_ne": cache_status_ne, + "cache_status_not_in": cache_status_not_in, + "client_ip_eq": client_ip_eq, + "client_ip_in": client_ip_in, + "client_ip_ne": client_ip_ne, + "client_ip_not_in": client_ip_not_in, + "cname_contains": cname_contains, + "cname_eq": cname_eq, + "cname_in": cname_in, + "cname_ne": cname_ne, + "cname_not_in": cname_not_in, + "datacenter_eq": datacenter_eq, + "datacenter_in": datacenter_in, + "datacenter_ne": datacenter_ne, + "datacenter_not_in": datacenter_not_in, + "fields": fields, + "limit": limit, + "method_eq": method_eq, + "method_in": method_in, + "method_ne": method_ne, + "method_not_in": method_not_in, + "offset": offset, + "resource_id_eq": resource_id_eq, + "resource_id_gt": resource_id_gt, + "resource_id_gte": resource_id_gte, + "resource_id_in": resource_id_in, + "resource_id_lt": resource_id_lt, + "resource_id_lte": resource_id_lte, + "resource_id_ne": resource_id_ne, + "resource_id_not_in": resource_id_not_in, + "size_eq": size_eq, + "size_gt": size_gt, + "size_gte": size_gte, + "size_in": size_in, + "size_lt": size_lt, + "size_lte": size_lte, + "size_ne": size_ne, + "size_not_in": size_not_in, + "sort": sort, + "status_eq": status_eq, + "status_gt": status_gt, + "status_gte": status_gte, + "status_in": status_in, + "status_lt": status_lt, + "status_lte": status_lte, + "status_ne": status_ne, + "status_not_in": status_not_in, + }, + log_download_params.LogDownloadParams, + ), + ), + cast_to=AsyncBinaryAPIResponse, + ) + + +class LogsResourceWithRawResponse: + def __init__(self, logs: LogsResource) -> None: + self._logs = logs + + self.list = to_raw_response_wrapper( + logs.list, + ) + self.download = to_custom_raw_response_wrapper( + logs.download, + BinaryAPIResponse, + ) + + @cached_property + def settings(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self._logs.settings) + + +class AsyncLogsResourceWithRawResponse: + def __init__(self, logs: AsyncLogsResource) -> None: + self._logs = logs + + self.list = async_to_raw_response_wrapper( + logs.list, + ) + self.download = async_to_custom_raw_response_wrapper( + logs.download, + AsyncBinaryAPIResponse, + ) + + @cached_property + def settings(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self._logs.settings) + + +class LogsResourceWithStreamingResponse: + def __init__(self, logs: LogsResource) -> None: + self._logs = logs + + self.list = to_streamed_response_wrapper( + logs.list, + ) + self.download = to_custom_streamed_response_wrapper( + logs.download, + StreamedBinaryAPIResponse, + ) + + @cached_property + def settings(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self._logs.settings) + + +class AsyncLogsResourceWithStreamingResponse: + def __init__(self, logs: AsyncLogsResource) -> None: + self._logs = logs + + self.list = async_to_streamed_response_wrapper( + logs.list, + ) + self.download = async_to_custom_streamed_response_wrapper( + logs.download, + AsyncStreamedBinaryAPIResponse, + ) + + @cached_property + def settings(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self._logs.settings) diff --git a/src/gcore/resources/cdn/logs/settings.py b/src/gcore/resources/cdn/logs/settings.py new file mode 100644 index 00000000..81624fb2 --- /dev/null +++ b/src/gcore/resources/cdn/logs/settings.py @@ -0,0 +1,1081 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional + +import httpx + +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cdn.logs import setting_create_params, setting_update_params +from ....types.cdn.logs.log_settings import LogSettings + +__all__ = ["SettingsResource", "AsyncSettingsResource"] + + +class SettingsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SettingsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return SettingsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return SettingsResourceWithStreamingResponse(self) + + def create( + self, + *, + all_resources_bucket: str, + all_resources_folder: str, + folders: Iterable[setting_create_params.Folder], + for_all_resources: bool, + ftp_hostname: str, + ftp_login: str, + ftp_password: str, + s3_access_key_id: str, + s3_hostname: str, + s3_secret_key: str, + s3_type: str, + sftp_hostname: str, + sftp_login: str, + sftp_password: str, + storage_type: str, + archive_size_mb: Optional[int] | Omit = omit, + enabled: bool | Omit = omit, + ftp_prepend_folder: str | Omit = omit, + ignore_empty_logs: bool | Omit = omit, + s3_aws_region: int | Omit = omit, + s3_bucket_location: str | Omit = omit, + s3_host_bucket: str | Omit = omit, + sftp_key_passphrase: str | Omit = omit, + sftp_prepend_folder: str | Omit = omit, + sftp_private_key: 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, + ) -> None: + """ + Setup raw logs settings + + Args: + all_resources_bucket: Name of the S3 bucket to which logs for all CDN resources are delivered. + + all_resources_folder: + Parameter meaning depends on the value of the "`storage_type`" value: + + - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for + all CDN resources are delivered. + - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for + all CDN resources are delivered. + + folders: List of folders/buckets for receiving CDN resources logs. + + for_all_resources: Defines whether logs of all CDN resources are delivered to one folder/bucket or + to separate ones. + + Possible values: + + - **true** - Logs of all CDN resources are delivered to one folder/bucket. + - **false** - Logs of different CDN resources are delivered to separate + folders/buckets. + + ftp_hostname: FTP storage hostname. + + ftp_login: FTP storage login. + + ftp_password: FTP storage password. + + s3_access_key_id: Access key ID for the S3 account. + + Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 + + s3_hostname: S3 storage hostname. + + It is required if "`s3_type`": other. + + s3_secret_key: Secret access key for the S3 account. + + Secret Access Key is 20-50 alpha-numeric-slash-plus characters like + kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct + + s3_type: Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + + sftp_hostname: SFTP storage hostname. + + sftp_login: SFTP storage login. + + sftp_password: SFTP storage password. + + It should be empty if "`sftp_private_key`" is set. + + storage_type: Storage type. + + Possible values: + + - **ftp** + - **sftp** + - **s3** + + archive_size_mb: The size of a single piece of the archive in MB. In case of **null** value logs + are delivered without slicing. + + enabled: Enables or disables a log forwarding feature. + + Possible values: + + - **true** - log forwarding feature is active. + - **false** - log forwarding feature is deactivated. + + ftp_prepend_folder: Name of the FTP prepend folder for log delivery. + + **Null** is allowed. + + ignore_empty_logs: Enables or disables the forwarding of empty logs. + + Possible values: + + - **true** - Empty logs are not sent. + - **false** - Empty logs are sent. + + s3_aws_region: Amazon AWS region. + + s3_bucket_location: Location of S3 storage. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores + (.:\\__-). + + s3_host_bucket: S3 bucket hostname. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. + - Required if "`s3_type`": other. + + sftp_key_passphrase: Passphrase for SFTP private key. + + Restrictions: + + - Should be set if private key encoded with passphrase. + - Should be empty if "`sftp_password`" is set. + + sftp_prepend_folder: Name of the SFTP prepend folder for log delivery. + + **Null** is allowed. + + sftp_private_key: Private key for SFTP authorization. + + Possible values: + + - **RSA** + - **ED25519** + + It should be empty if "`sftp_password`" is set. + + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + "/cdn/raw_log_settings" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/raw_log_settings", + body=maybe_transform( + { + "all_resources_bucket": all_resources_bucket, + "all_resources_folder": all_resources_folder, + "folders": folders, + "for_all_resources": for_all_resources, + "ftp_hostname": ftp_hostname, + "ftp_login": ftp_login, + "ftp_password": ftp_password, + "s3_access_key_id": s3_access_key_id, + "s3_hostname": s3_hostname, + "s3_secret_key": s3_secret_key, + "s3_type": s3_type, + "sftp_hostname": sftp_hostname, + "sftp_login": sftp_login, + "sftp_password": sftp_password, + "storage_type": storage_type, + "archive_size_mb": archive_size_mb, + "enabled": enabled, + "ftp_prepend_folder": ftp_prepend_folder, + "ignore_empty_logs": ignore_empty_logs, + "s3_aws_region": s3_aws_region, + "s3_bucket_location": s3_bucket_location, + "s3_host_bucket": s3_host_bucket, + "sftp_key_passphrase": sftp_key_passphrase, + "sftp_prepend_folder": sftp_prepend_folder, + "sftp_private_key": sftp_private_key, + }, + setting_create_params.SettingCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def update( + self, + *, + all_resources_bucket: str, + all_resources_folder: str, + folders: Iterable[setting_update_params.Folder], + for_all_resources: bool, + ftp_hostname: str, + ftp_login: str, + ftp_password: str, + s3_access_key_id: str, + s3_hostname: str, + s3_secret_key: str, + s3_type: str, + sftp_hostname: str, + sftp_login: str, + sftp_password: str, + storage_type: str, + archive_size_mb: Optional[int] | Omit = omit, + enabled: bool | Omit = omit, + ftp_prepend_folder: str | Omit = omit, + ignore_empty_logs: bool | Omit = omit, + s3_aws_region: int | Omit = omit, + s3_bucket_location: str | Omit = omit, + s3_host_bucket: str | Omit = omit, + sftp_key_passphrase: str | Omit = omit, + sftp_prepend_folder: str | Omit = omit, + sftp_private_key: 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, + ) -> None: + """ + PATCH method is not allowed. + + Args: + all_resources_bucket: Name of the S3 bucket to which logs for all CDN resources are delivered. + + all_resources_folder: + Parameter meaning depends on the value of the "`storage_type`" value: + + - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for + all CDN resources are delivered. + - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for + all CDN resources are delivered. + + folders: List of folders/buckets for receiving CDN resources logs. + + for_all_resources: Defines whether logs of all CDN resources are delivered to one folder/bucket or + to separate ones. + + Possible values: + + - **true** - Logs of all CDN resources are delivered to one folder/bucket. + - **false** - Logs of different CDN resources are delivered to separate + folders/buckets. + + ftp_hostname: FTP storage hostname. + + ftp_login: FTP storage login. + + ftp_password: FTP storage password. + + s3_access_key_id: Access key ID for the S3 account. + + Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 + + s3_hostname: S3 storage hostname. + + It is required if "`s3_type`": other. + + s3_secret_key: Secret access key for the S3 account. + + Secret Access Key is 20-50 alpha-numeric-slash-plus characters like + kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct + + s3_type: Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + + sftp_hostname: SFTP storage hostname. + + sftp_login: SFTP storage login. + + sftp_password: SFTP storage password. + + It should be empty if "`sftp_private_key`" is set. + + storage_type: Storage type. + + Possible values: + + - **ftp** + - **sftp** + - **s3** + + archive_size_mb: The size of a single piece of the archive in MB. In case of **null** value logs + are delivered without slicing. + + enabled: Enables or disables a log forwarding feature. + + Possible values: + + - **true** - log forwarding feature is active. + - **false** - log forwarding feature is deactivated. + + ftp_prepend_folder: Name of the FTP prepend folder for log delivery. + + **Null** is allowed. + + ignore_empty_logs: Enables or disables the forwarding of empty logs. + + Possible values: + + - **true** - Empty logs are not sent. + - **false** - Empty logs are sent. + + s3_aws_region: Amazon AWS region. + + s3_bucket_location: Location of S3 storage. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores + (.:\\__-). + + s3_host_bucket: S3 bucket hostname. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. + - Required if "`s3_type`": other. + + sftp_key_passphrase: Passphrase for SFTP private key. + + Restrictions: + + - Should be set if private key encoded with passphrase. + - Should be empty if "`sftp_password`" is set. + + sftp_prepend_folder: Name of the SFTP prepend folder for log delivery. + + **Null** is allowed. + + sftp_private_key: Private key for SFTP authorization. + + Possible values: + + - **RSA** + - **ED25519** + + It should be empty if "`sftp_password`" is set. + + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._put( + "/cdn/raw_log_settings" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/raw_log_settings", + body=maybe_transform( + { + "all_resources_bucket": all_resources_bucket, + "all_resources_folder": all_resources_folder, + "folders": folders, + "for_all_resources": for_all_resources, + "ftp_hostname": ftp_hostname, + "ftp_login": ftp_login, + "ftp_password": ftp_password, + "s3_access_key_id": s3_access_key_id, + "s3_hostname": s3_hostname, + "s3_secret_key": s3_secret_key, + "s3_type": s3_type, + "sftp_hostname": sftp_hostname, + "sftp_login": sftp_login, + "sftp_password": sftp_password, + "storage_type": storage_type, + "archive_size_mb": archive_size_mb, + "enabled": enabled, + "ftp_prepend_folder": ftp_prepend_folder, + "ignore_empty_logs": ignore_empty_logs, + "s3_aws_region": s3_aws_region, + "s3_bucket_location": s3_bucket_location, + "s3_host_bucket": s3_host_bucket, + "sftp_key_passphrase": sftp_key_passphrase, + "sftp_prepend_folder": sftp_prepend_folder, + "sftp_private_key": sftp_private_key, + }, + setting_update_params.SettingUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def delete( + 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, + ) -> None: + """ + Delete the raw logs delivery configuration from the system permanently. + + Notes: + + - **Deactivation Requirement**: Set the `enabled` attribute to `false` before + deletion. + - **Irreversibility**: This action is irreversible. Once deleted, the raw logs + delivery configuration cannot be recovered. + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + "/cdn/raw_log_settings" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/raw_log_settings", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + 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, + ) -> LogSettings: + """Get information about raw logs feature settings.""" + return self._get( + "/cdn/raw_log_settings" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/raw_log_settings", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogSettings, + ) + + +class AsyncSettingsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncSettingsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncSettingsResourceWithStreamingResponse(self) + + async def create( + self, + *, + all_resources_bucket: str, + all_resources_folder: str, + folders: Iterable[setting_create_params.Folder], + for_all_resources: bool, + ftp_hostname: str, + ftp_login: str, + ftp_password: str, + s3_access_key_id: str, + s3_hostname: str, + s3_secret_key: str, + s3_type: str, + sftp_hostname: str, + sftp_login: str, + sftp_password: str, + storage_type: str, + archive_size_mb: Optional[int] | Omit = omit, + enabled: bool | Omit = omit, + ftp_prepend_folder: str | Omit = omit, + ignore_empty_logs: bool | Omit = omit, + s3_aws_region: int | Omit = omit, + s3_bucket_location: str | Omit = omit, + s3_host_bucket: str | Omit = omit, + sftp_key_passphrase: str | Omit = omit, + sftp_prepend_folder: str | Omit = omit, + sftp_private_key: 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, + ) -> None: + """ + Setup raw logs settings + + Args: + all_resources_bucket: Name of the S3 bucket to which logs for all CDN resources are delivered. + + all_resources_folder: + Parameter meaning depends on the value of the "`storage_type`" value: + + - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for + all CDN resources are delivered. + - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for + all CDN resources are delivered. + + folders: List of folders/buckets for receiving CDN resources logs. + + for_all_resources: Defines whether logs of all CDN resources are delivered to one folder/bucket or + to separate ones. + + Possible values: + + - **true** - Logs of all CDN resources are delivered to one folder/bucket. + - **false** - Logs of different CDN resources are delivered to separate + folders/buckets. + + ftp_hostname: FTP storage hostname. + + ftp_login: FTP storage login. + + ftp_password: FTP storage password. + + s3_access_key_id: Access key ID for the S3 account. + + Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 + + s3_hostname: S3 storage hostname. + + It is required if "`s3_type`": other. + + s3_secret_key: Secret access key for the S3 account. + + Secret Access Key is 20-50 alpha-numeric-slash-plus characters like + kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct + + s3_type: Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + + sftp_hostname: SFTP storage hostname. + + sftp_login: SFTP storage login. + + sftp_password: SFTP storage password. + + It should be empty if "`sftp_private_key`" is set. + + storage_type: Storage type. + + Possible values: + + - **ftp** + - **sftp** + - **s3** + + archive_size_mb: The size of a single piece of the archive in MB. In case of **null** value logs + are delivered without slicing. + + enabled: Enables or disables a log forwarding feature. + + Possible values: + + - **true** - log forwarding feature is active. + - **false** - log forwarding feature is deactivated. + + ftp_prepend_folder: Name of the FTP prepend folder for log delivery. + + **Null** is allowed. + + ignore_empty_logs: Enables or disables the forwarding of empty logs. + + Possible values: + + - **true** - Empty logs are not sent. + - **false** - Empty logs are sent. + + s3_aws_region: Amazon AWS region. + + s3_bucket_location: Location of S3 storage. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores + (.:\\__-). + + s3_host_bucket: S3 bucket hostname. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. + - Required if "`s3_type`": other. + + sftp_key_passphrase: Passphrase for SFTP private key. + + Restrictions: + + - Should be set if private key encoded with passphrase. + - Should be empty if "`sftp_password`" is set. + + sftp_prepend_folder: Name of the SFTP prepend folder for log delivery. + + **Null** is allowed. + + sftp_private_key: Private key for SFTP authorization. + + Possible values: + + - **RSA** + - **ED25519** + + It should be empty if "`sftp_password`" is set. + + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + "/cdn/raw_log_settings" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/raw_log_settings", + body=await async_maybe_transform( + { + "all_resources_bucket": all_resources_bucket, + "all_resources_folder": all_resources_folder, + "folders": folders, + "for_all_resources": for_all_resources, + "ftp_hostname": ftp_hostname, + "ftp_login": ftp_login, + "ftp_password": ftp_password, + "s3_access_key_id": s3_access_key_id, + "s3_hostname": s3_hostname, + "s3_secret_key": s3_secret_key, + "s3_type": s3_type, + "sftp_hostname": sftp_hostname, + "sftp_login": sftp_login, + "sftp_password": sftp_password, + "storage_type": storage_type, + "archive_size_mb": archive_size_mb, + "enabled": enabled, + "ftp_prepend_folder": ftp_prepend_folder, + "ignore_empty_logs": ignore_empty_logs, + "s3_aws_region": s3_aws_region, + "s3_bucket_location": s3_bucket_location, + "s3_host_bucket": s3_host_bucket, + "sftp_key_passphrase": sftp_key_passphrase, + "sftp_prepend_folder": sftp_prepend_folder, + "sftp_private_key": sftp_private_key, + }, + setting_create_params.SettingCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def update( + self, + *, + all_resources_bucket: str, + all_resources_folder: str, + folders: Iterable[setting_update_params.Folder], + for_all_resources: bool, + ftp_hostname: str, + ftp_login: str, + ftp_password: str, + s3_access_key_id: str, + s3_hostname: str, + s3_secret_key: str, + s3_type: str, + sftp_hostname: str, + sftp_login: str, + sftp_password: str, + storage_type: str, + archive_size_mb: Optional[int] | Omit = omit, + enabled: bool | Omit = omit, + ftp_prepend_folder: str | Omit = omit, + ignore_empty_logs: bool | Omit = omit, + s3_aws_region: int | Omit = omit, + s3_bucket_location: str | Omit = omit, + s3_host_bucket: str | Omit = omit, + sftp_key_passphrase: str | Omit = omit, + sftp_prepend_folder: str | Omit = omit, + sftp_private_key: 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, + ) -> None: + """ + PATCH method is not allowed. + + Args: + all_resources_bucket: Name of the S3 bucket to which logs for all CDN resources are delivered. + + all_resources_folder: + Parameter meaning depends on the value of the "`storage_type`" value: + + - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for + all CDN resources are delivered. + - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for + all CDN resources are delivered. + + folders: List of folders/buckets for receiving CDN resources logs. + + for_all_resources: Defines whether logs of all CDN resources are delivered to one folder/bucket or + to separate ones. + + Possible values: + + - **true** - Logs of all CDN resources are delivered to one folder/bucket. + - **false** - Logs of different CDN resources are delivered to separate + folders/buckets. + + ftp_hostname: FTP storage hostname. + + ftp_login: FTP storage login. + + ftp_password: FTP storage password. + + s3_access_key_id: Access key ID for the S3 account. + + Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 + + s3_hostname: S3 storage hostname. + + It is required if "`s3_type`": other. + + s3_secret_key: Secret access key for the S3 account. + + Secret Access Key is 20-50 alpha-numeric-slash-plus characters like + kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct + + s3_type: Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + + sftp_hostname: SFTP storage hostname. + + sftp_login: SFTP storage login. + + sftp_password: SFTP storage password. + + It should be empty if "`sftp_private_key`" is set. + + storage_type: Storage type. + + Possible values: + + - **ftp** + - **sftp** + - **s3** + + archive_size_mb: The size of a single piece of the archive in MB. In case of **null** value logs + are delivered without slicing. + + enabled: Enables or disables a log forwarding feature. + + Possible values: + + - **true** - log forwarding feature is active. + - **false** - log forwarding feature is deactivated. + + ftp_prepend_folder: Name of the FTP prepend folder for log delivery. + + **Null** is allowed. + + ignore_empty_logs: Enables or disables the forwarding of empty logs. + + Possible values: + + - **true** - Empty logs are not sent. + - **false** - Empty logs are sent. + + s3_aws_region: Amazon AWS region. + + s3_bucket_location: Location of S3 storage. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores + (.:\\__-). + + s3_host_bucket: S3 bucket hostname. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. + - Required if "`s3_type`": other. + + sftp_key_passphrase: Passphrase for SFTP private key. + + Restrictions: + + - Should be set if private key encoded with passphrase. + - Should be empty if "`sftp_password`" is set. + + sftp_prepend_folder: Name of the SFTP prepend folder for log delivery. + + **Null** is allowed. + + sftp_private_key: Private key for SFTP authorization. + + Possible values: + + - **RSA** + - **ED25519** + + It should be empty if "`sftp_password`" is set. + + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._put( + "/cdn/raw_log_settings" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/raw_log_settings", + body=await async_maybe_transform( + { + "all_resources_bucket": all_resources_bucket, + "all_resources_folder": all_resources_folder, + "folders": folders, + "for_all_resources": for_all_resources, + "ftp_hostname": ftp_hostname, + "ftp_login": ftp_login, + "ftp_password": ftp_password, + "s3_access_key_id": s3_access_key_id, + "s3_hostname": s3_hostname, + "s3_secret_key": s3_secret_key, + "s3_type": s3_type, + "sftp_hostname": sftp_hostname, + "sftp_login": sftp_login, + "sftp_password": sftp_password, + "storage_type": storage_type, + "archive_size_mb": archive_size_mb, + "enabled": enabled, + "ftp_prepend_folder": ftp_prepend_folder, + "ignore_empty_logs": ignore_empty_logs, + "s3_aws_region": s3_aws_region, + "s3_bucket_location": s3_bucket_location, + "s3_host_bucket": s3_host_bucket, + "sftp_key_passphrase": sftp_key_passphrase, + "sftp_prepend_folder": sftp_prepend_folder, + "sftp_private_key": sftp_private_key, + }, + setting_update_params.SettingUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def delete( + 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, + ) -> None: + """ + Delete the raw logs delivery configuration from the system permanently. + + Notes: + + - **Deactivation Requirement**: Set the `enabled` attribute to `false` before + deletion. + - **Irreversibility**: This action is irreversible. Once deleted, the raw logs + delivery configuration cannot be recovered. + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + "/cdn/raw_log_settings" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/raw_log_settings", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + 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, + ) -> LogSettings: + """Get information about raw logs feature settings.""" + return await self._get( + "/cdn/raw_log_settings" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/raw_log_settings", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogSettings, + ) + + +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: + self._settings = settings + + self.create = to_raw_response_wrapper( + settings.create, + ) + self.update = to_raw_response_wrapper( + settings.update, + ) + self.delete = to_raw_response_wrapper( + settings.delete, + ) + self.get = to_raw_response_wrapper( + settings.get, + ) + + +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: + self._settings = settings + + self.create = async_to_raw_response_wrapper( + settings.create, + ) + self.update = async_to_raw_response_wrapper( + settings.update, + ) + self.delete = async_to_raw_response_wrapper( + settings.delete, + ) + self.get = async_to_raw_response_wrapper( + settings.get, + ) + + +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: + self._settings = settings + + self.create = to_streamed_response_wrapper( + settings.create, + ) + self.update = to_streamed_response_wrapper( + settings.update, + ) + self.delete = to_streamed_response_wrapper( + settings.delete, + ) + self.get = to_streamed_response_wrapper( + settings.get, + ) + + +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: + self._settings = settings + + self.create = async_to_streamed_response_wrapper( + settings.create, + ) + self.update = async_to_streamed_response_wrapper( + settings.update, + ) + self.delete = async_to_streamed_response_wrapper( + settings.delete, + ) + self.get = async_to_streamed_response_wrapper( + settings.get, + ) diff --git a/src/gcore/resources/cdn/logs_uploader/__init__.py b/src/gcore/resources/cdn/logs_uploader/__init__.py new file mode 100644 index 00000000..d5c0911f --- /dev/null +++ b/src/gcore/resources/cdn/logs_uploader/__init__.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .configs import ( + ConfigsResource, + AsyncConfigsResource, + ConfigsResourceWithRawResponse, + AsyncConfigsResourceWithRawResponse, + ConfigsResourceWithStreamingResponse, + AsyncConfigsResourceWithStreamingResponse, +) +from .targets import ( + TargetsResource, + AsyncTargetsResource, + TargetsResourceWithRawResponse, + AsyncTargetsResourceWithRawResponse, + TargetsResourceWithStreamingResponse, + AsyncTargetsResourceWithStreamingResponse, +) +from .policies import ( + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, +) +from .logs_uploader import ( + LogsUploaderResource, + AsyncLogsUploaderResource, + LogsUploaderResourceWithRawResponse, + AsyncLogsUploaderResourceWithRawResponse, + LogsUploaderResourceWithStreamingResponse, + AsyncLogsUploaderResourceWithStreamingResponse, +) + +__all__ = [ + "PoliciesResource", + "AsyncPoliciesResource", + "PoliciesResourceWithRawResponse", + "AsyncPoliciesResourceWithRawResponse", + "PoliciesResourceWithStreamingResponse", + "AsyncPoliciesResourceWithStreamingResponse", + "TargetsResource", + "AsyncTargetsResource", + "TargetsResourceWithRawResponse", + "AsyncTargetsResourceWithRawResponse", + "TargetsResourceWithStreamingResponse", + "AsyncTargetsResourceWithStreamingResponse", + "ConfigsResource", + "AsyncConfigsResource", + "ConfigsResourceWithRawResponse", + "AsyncConfigsResourceWithRawResponse", + "ConfigsResourceWithStreamingResponse", + "AsyncConfigsResourceWithStreamingResponse", + "LogsUploaderResource", + "AsyncLogsUploaderResource", + "LogsUploaderResourceWithRawResponse", + "AsyncLogsUploaderResourceWithRawResponse", + "LogsUploaderResourceWithStreamingResponse", + "AsyncLogsUploaderResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cdn/logs_uploader/configs.py b/src/gcore/resources/cdn/logs_uploader/configs.py new file mode 100644 index 00000000..34dfc89b --- /dev/null +++ b/src/gcore/resources/cdn/logs_uploader/configs.py @@ -0,0 +1,868 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable + +import httpx + +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cdn.logs_uploader import ( + config_list_params, + config_create_params, + config_update_params, + config_replace_params, +) +from ....types.cdn.logs_uploader_validation import LogsUploaderValidation +from ....types.cdn.logs_uploader.logs_uploader_config import LogsUploaderConfig +from ....types.cdn.logs_uploader.logs_uploader_config_list import LogsUploaderConfigList + +__all__ = ["ConfigsResource", "AsyncConfigsResource"] + + +class ConfigsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ConfigsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return ConfigsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ConfigsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return ConfigsResourceWithStreamingResponse(self) + + def create( + self, + *, + name: str, + policy: int, + target: int, + enabled: bool | Omit = omit, + for_all_resources: bool | Omit = omit, + resources: Iterable[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, + ) -> LogsUploaderConfig: + """ + Create logs uploader config. + + Args: + name: Name of the config. + + policy: ID of the policy that should be assigned to given config. + + target: ID of the target to which logs should be uploaded. + + enabled: Enables or disables the config. + + for_all_resources: If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + + resources: List of resource IDs to which the config should be applied. + + 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 + """ + return self._post( + "/cdn/logs_uploader/configs" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/configs", + body=maybe_transform( + { + "name": name, + "policy": policy, + "target": target, + "enabled": enabled, + "for_all_resources": for_all_resources, + "resources": resources, + }, + config_create_params.ConfigCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderConfig, + ) + + def update( + self, + id: int, + *, + enabled: bool | Omit = omit, + for_all_resources: bool | Omit = omit, + name: str | Omit = omit, + policy: int | Omit = omit, + resources: Iterable[int] | Omit = omit, + target: 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, + ) -> LogsUploaderConfig: + """ + Change logs uploader config partially. + + Args: + enabled: Enables or disables the config. + + for_all_resources: If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + + name: Name of the config. + + policy: ID of the policy that should be assigned to given config. + + resources: List of resource IDs to which the config should be applied. + + target: ID of the target to which logs should be uploaded. + + 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 + """ + return self._patch( + f"/cdn/logs_uploader/configs/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + body=maybe_transform( + { + "enabled": enabled, + "for_all_resources": for_all_resources, + "name": name, + "policy": policy, + "resources": resources, + "target": target, + }, + config_update_params.ConfigUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderConfig, + ) + + def list( + self, + *, + resource_ids: Iterable[int] | Omit = omit, + search: 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, + ) -> LogsUploaderConfigList: + """ + Get list of logs uploader configs. + + Args: + resource_ids: Filter by ids of CDN resources that are assigned to given config. + + search: Search by config name or id. + + 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 + """ + return self._get( + "/cdn/logs_uploader/configs" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/configs", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "resource_ids": resource_ids, + "search": search, + }, + config_list_params.ConfigListParams, + ), + ), + cast_to=LogsUploaderConfigList, + ) + + def delete( + self, + id: int, + *, + # 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, + ) -> None: + """ + Delete the logs uploader config from the system permanently. + + Notes: + + - **Irreversibility**: This action is irreversible. Once deleted, the logs + uploader config cannot be recovered. + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/logs_uploader/configs/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + id: int, + *, + # 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, + ) -> LogsUploaderConfig: + """ + Get information about logs uploader config. + + Args: + 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 + """ + return self._get( + f"/cdn/logs_uploader/configs/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderConfig, + ) + + def replace( + self, + id: int, + *, + name: str, + policy: int, + target: int, + enabled: bool | Omit = omit, + for_all_resources: bool | Omit = omit, + resources: Iterable[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, + ) -> LogsUploaderConfig: + """ + Change logs uploader config. + + Args: + name: Name of the config. + + policy: ID of the policy that should be assigned to given config. + + target: ID of the target to which logs should be uploaded. + + enabled: Enables or disables the config. + + for_all_resources: If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + + resources: List of resource IDs to which the config should be applied. + + 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 + """ + return self._put( + f"/cdn/logs_uploader/configs/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + body=maybe_transform( + { + "name": name, + "policy": policy, + "target": target, + "enabled": enabled, + "for_all_resources": for_all_resources, + "resources": resources, + }, + config_replace_params.ConfigReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderConfig, + ) + + def validate( + self, + id: int, + *, + # 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, + ) -> LogsUploaderValidation: + """ + Validate logs uploader config. + + Args: + 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 + """ + return self._post( + f"/cdn/logs_uploader/configs/{id}/validate" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}/validate", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderValidation, + ) + + +class AsyncConfigsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncConfigsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncConfigsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncConfigsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncConfigsResourceWithStreamingResponse(self) + + async def create( + self, + *, + name: str, + policy: int, + target: int, + enabled: bool | Omit = omit, + for_all_resources: bool | Omit = omit, + resources: Iterable[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, + ) -> LogsUploaderConfig: + """ + Create logs uploader config. + + Args: + name: Name of the config. + + policy: ID of the policy that should be assigned to given config. + + target: ID of the target to which logs should be uploaded. + + enabled: Enables or disables the config. + + for_all_resources: If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + + resources: List of resource IDs to which the config should be applied. + + 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 + """ + return await self._post( + "/cdn/logs_uploader/configs" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/configs", + body=await async_maybe_transform( + { + "name": name, + "policy": policy, + "target": target, + "enabled": enabled, + "for_all_resources": for_all_resources, + "resources": resources, + }, + config_create_params.ConfigCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderConfig, + ) + + async def update( + self, + id: int, + *, + enabled: bool | Omit = omit, + for_all_resources: bool | Omit = omit, + name: str | Omit = omit, + policy: int | Omit = omit, + resources: Iterable[int] | Omit = omit, + target: 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, + ) -> LogsUploaderConfig: + """ + Change logs uploader config partially. + + Args: + enabled: Enables or disables the config. + + for_all_resources: If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + + name: Name of the config. + + policy: ID of the policy that should be assigned to given config. + + resources: List of resource IDs to which the config should be applied. + + target: ID of the target to which logs should be uploaded. + + 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 + """ + return await self._patch( + f"/cdn/logs_uploader/configs/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + body=await async_maybe_transform( + { + "enabled": enabled, + "for_all_resources": for_all_resources, + "name": name, + "policy": policy, + "resources": resources, + "target": target, + }, + config_update_params.ConfigUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderConfig, + ) + + async def list( + self, + *, + resource_ids: Iterable[int] | Omit = omit, + search: 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, + ) -> LogsUploaderConfigList: + """ + Get list of logs uploader configs. + + Args: + resource_ids: Filter by ids of CDN resources that are assigned to given config. + + search: Search by config name or id. + + 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 + """ + return await self._get( + "/cdn/logs_uploader/configs" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/configs", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "resource_ids": resource_ids, + "search": search, + }, + config_list_params.ConfigListParams, + ), + ), + cast_to=LogsUploaderConfigList, + ) + + async def delete( + self, + id: int, + *, + # 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, + ) -> None: + """ + Delete the logs uploader config from the system permanently. + + Notes: + + - **Irreversibility**: This action is irreversible. Once deleted, the logs + uploader config cannot be recovered. + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/logs_uploader/configs/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + id: int, + *, + # 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, + ) -> LogsUploaderConfig: + """ + Get information about logs uploader config. + + Args: + 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 + """ + return await self._get( + f"/cdn/logs_uploader/configs/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderConfig, + ) + + async def replace( + self, + id: int, + *, + name: str, + policy: int, + target: int, + enabled: bool | Omit = omit, + for_all_resources: bool | Omit = omit, + resources: Iterable[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, + ) -> LogsUploaderConfig: + """ + Change logs uploader config. + + Args: + name: Name of the config. + + policy: ID of the policy that should be assigned to given config. + + target: ID of the target to which logs should be uploaded. + + enabled: Enables or disables the config. + + for_all_resources: If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + + resources: List of resource IDs to which the config should be applied. + + 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 + """ + return await self._put( + f"/cdn/logs_uploader/configs/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}", + body=await async_maybe_transform( + { + "name": name, + "policy": policy, + "target": target, + "enabled": enabled, + "for_all_resources": for_all_resources, + "resources": resources, + }, + config_replace_params.ConfigReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderConfig, + ) + + async def validate( + self, + id: int, + *, + # 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, + ) -> LogsUploaderValidation: + """ + Validate logs uploader config. + + Args: + 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 + """ + return await self._post( + f"/cdn/logs_uploader/configs/{id}/validate" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/configs/{id}/validate", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderValidation, + ) + + +class ConfigsResourceWithRawResponse: + def __init__(self, configs: ConfigsResource) -> None: + self._configs = configs + + self.create = to_raw_response_wrapper( + configs.create, + ) + self.update = to_raw_response_wrapper( + configs.update, + ) + self.list = to_raw_response_wrapper( + configs.list, + ) + self.delete = to_raw_response_wrapper( + configs.delete, + ) + self.get = to_raw_response_wrapper( + configs.get, + ) + self.replace = to_raw_response_wrapper( + configs.replace, + ) + self.validate = to_raw_response_wrapper( + configs.validate, + ) + + +class AsyncConfigsResourceWithRawResponse: + def __init__(self, configs: AsyncConfigsResource) -> None: + self._configs = configs + + self.create = async_to_raw_response_wrapper( + configs.create, + ) + self.update = async_to_raw_response_wrapper( + configs.update, + ) + self.list = async_to_raw_response_wrapper( + configs.list, + ) + self.delete = async_to_raw_response_wrapper( + configs.delete, + ) + self.get = async_to_raw_response_wrapper( + configs.get, + ) + self.replace = async_to_raw_response_wrapper( + configs.replace, + ) + self.validate = async_to_raw_response_wrapper( + configs.validate, + ) + + +class ConfigsResourceWithStreamingResponse: + def __init__(self, configs: ConfigsResource) -> None: + self._configs = configs + + self.create = to_streamed_response_wrapper( + configs.create, + ) + self.update = to_streamed_response_wrapper( + configs.update, + ) + self.list = to_streamed_response_wrapper( + configs.list, + ) + self.delete = to_streamed_response_wrapper( + configs.delete, + ) + self.get = to_streamed_response_wrapper( + configs.get, + ) + self.replace = to_streamed_response_wrapper( + configs.replace, + ) + self.validate = to_streamed_response_wrapper( + configs.validate, + ) + + +class AsyncConfigsResourceWithStreamingResponse: + def __init__(self, configs: AsyncConfigsResource) -> None: + self._configs = configs + + self.create = async_to_streamed_response_wrapper( + configs.create, + ) + self.update = async_to_streamed_response_wrapper( + configs.update, + ) + self.list = async_to_streamed_response_wrapper( + configs.list, + ) + self.delete = async_to_streamed_response_wrapper( + configs.delete, + ) + self.get = async_to_streamed_response_wrapper( + configs.get, + ) + self.replace = async_to_streamed_response_wrapper( + configs.replace, + ) + self.validate = async_to_streamed_response_wrapper( + configs.validate, + ) diff --git a/src/gcore/resources/cdn/logs_uploader/logs_uploader.py b/src/gcore/resources/cdn/logs_uploader/logs_uploader.py new file mode 100644 index 00000000..9d7c3aeb --- /dev/null +++ b/src/gcore/resources/cdn/logs_uploader/logs_uploader.py @@ -0,0 +1,166 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .configs import ( + ConfigsResource, + AsyncConfigsResource, + ConfigsResourceWithRawResponse, + AsyncConfigsResourceWithRawResponse, + ConfigsResourceWithStreamingResponse, + AsyncConfigsResourceWithStreamingResponse, +) +from .targets import ( + TargetsResource, + AsyncTargetsResource, + TargetsResourceWithRawResponse, + AsyncTargetsResourceWithRawResponse, + TargetsResourceWithStreamingResponse, + AsyncTargetsResourceWithStreamingResponse, +) +from .policies import ( + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["LogsUploaderResource", "AsyncLogsUploaderResource"] + + +class LogsUploaderResource(SyncAPIResource): + @cached_property + def policies(self) -> PoliciesResource: + return PoliciesResource(self._client) + + @cached_property + def targets(self) -> TargetsResource: + return TargetsResource(self._client) + + @cached_property + def configs(self) -> ConfigsResource: + return ConfigsResource(self._client) + + @cached_property + def with_raw_response(self) -> LogsUploaderResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return LogsUploaderResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LogsUploaderResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return LogsUploaderResourceWithStreamingResponse(self) + + +class AsyncLogsUploaderResource(AsyncAPIResource): + @cached_property + def policies(self) -> AsyncPoliciesResource: + return AsyncPoliciesResource(self._client) + + @cached_property + def targets(self) -> AsyncTargetsResource: + return AsyncTargetsResource(self._client) + + @cached_property + def configs(self) -> AsyncConfigsResource: + return AsyncConfigsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncLogsUploaderResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncLogsUploaderResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLogsUploaderResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncLogsUploaderResourceWithStreamingResponse(self) + + +class LogsUploaderResourceWithRawResponse: + def __init__(self, logs_uploader: LogsUploaderResource) -> None: + self._logs_uploader = logs_uploader + + @cached_property + def policies(self) -> PoliciesResourceWithRawResponse: + return PoliciesResourceWithRawResponse(self._logs_uploader.policies) + + @cached_property + def targets(self) -> TargetsResourceWithRawResponse: + return TargetsResourceWithRawResponse(self._logs_uploader.targets) + + @cached_property + def configs(self) -> ConfigsResourceWithRawResponse: + return ConfigsResourceWithRawResponse(self._logs_uploader.configs) + + +class AsyncLogsUploaderResourceWithRawResponse: + def __init__(self, logs_uploader: AsyncLogsUploaderResource) -> None: + self._logs_uploader = logs_uploader + + @cached_property + def policies(self) -> AsyncPoliciesResourceWithRawResponse: + return AsyncPoliciesResourceWithRawResponse(self._logs_uploader.policies) + + @cached_property + def targets(self) -> AsyncTargetsResourceWithRawResponse: + return AsyncTargetsResourceWithRawResponse(self._logs_uploader.targets) + + @cached_property + def configs(self) -> AsyncConfigsResourceWithRawResponse: + return AsyncConfigsResourceWithRawResponse(self._logs_uploader.configs) + + +class LogsUploaderResourceWithStreamingResponse: + def __init__(self, logs_uploader: LogsUploaderResource) -> None: + self._logs_uploader = logs_uploader + + @cached_property + def policies(self) -> PoliciesResourceWithStreamingResponse: + return PoliciesResourceWithStreamingResponse(self._logs_uploader.policies) + + @cached_property + def targets(self) -> TargetsResourceWithStreamingResponse: + return TargetsResourceWithStreamingResponse(self._logs_uploader.targets) + + @cached_property + def configs(self) -> ConfigsResourceWithStreamingResponse: + return ConfigsResourceWithStreamingResponse(self._logs_uploader.configs) + + +class AsyncLogsUploaderResourceWithStreamingResponse: + def __init__(self, logs_uploader: AsyncLogsUploaderResource) -> None: + self._logs_uploader = logs_uploader + + @cached_property + def policies(self) -> AsyncPoliciesResourceWithStreamingResponse: + return AsyncPoliciesResourceWithStreamingResponse(self._logs_uploader.policies) + + @cached_property + def targets(self) -> AsyncTargetsResourceWithStreamingResponse: + return AsyncTargetsResourceWithStreamingResponse(self._logs_uploader.targets) + + @cached_property + def configs(self) -> AsyncConfigsResourceWithStreamingResponse: + return AsyncConfigsResourceWithStreamingResponse(self._logs_uploader.configs) diff --git a/src/gcore/resources/cdn/logs_uploader/policies.py b/src/gcore/resources/cdn/logs_uploader/policies.py new file mode 100644 index 00000000..141db85a --- /dev/null +++ b/src/gcore/resources/cdn/logs_uploader/policies.py @@ -0,0 +1,1060 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Iterable, Optional + +import httpx + +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cdn.logs_uploader import ( + policy_list_params, + policy_create_params, + policy_update_params, + policy_replace_params, +) +from ....types.cdn.logs_uploader.logs_uploader_policy import LogsUploaderPolicy +from ....types.cdn.logs_uploader.logs_uploader_policy_list import LogsUploaderPolicyList +from ....types.cdn.logs_uploader.policy_list_fields_response import PolicyListFieldsResponse + +__all__ = ["PoliciesResource", "AsyncPoliciesResource"] + + +class PoliciesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> PoliciesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return PoliciesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PoliciesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return PoliciesResourceWithStreamingResponse(self) + + def create( + self, + *, + date_format: str | Omit = omit, + description: str | Omit = omit, + field_delimiter: str | Omit = omit, + field_separator: str | Omit = omit, + fields: SequenceNotStr[str] | Omit = omit, + file_name_template: str | Omit = omit, + format_type: str | Omit = omit, + include_empty_logs: bool | Omit = omit, + include_shield_logs: bool | Omit = omit, + name: str | Omit = omit, + retry_interval_minutes: int | Omit = omit, + rotate_interval_minutes: int | Omit = omit, + rotate_threshold_lines: int | Omit = omit, + rotate_threshold_mb: Optional[int] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderPolicy: + """ + Create logs uploader policy. + + Args: + date_format: Date format for logs. + + description: Description of the policy. + + field_delimiter: Field delimiter for logs. + + field_separator: Field separator for logs. + + fields: List of fields to include in logs. + + file_name_template: Template for log file name. + + format_type: Format type for logs. + + include_empty_logs: Include empty logs in the upload. + + include_shield_logs: Include logs from origin shielding in the upload. + + name: Name of the policy. + + retry_interval_minutes: Interval in minutes to retry failed uploads. + + rotate_interval_minutes: Interval in minutes to rotate logs. + + rotate_threshold_lines: Threshold in lines to rotate logs. + + rotate_threshold_mb: Threshold in MB to rotate logs. + + tags: Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + + 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 + """ + return self._post( + "/cdn/logs_uploader/policies" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/policies", + body=maybe_transform( + { + "date_format": date_format, + "description": description, + "field_delimiter": field_delimiter, + "field_separator": field_separator, + "fields": fields, + "file_name_template": file_name_template, + "format_type": format_type, + "include_empty_logs": include_empty_logs, + "include_shield_logs": include_shield_logs, + "name": name, + "retry_interval_minutes": retry_interval_minutes, + "rotate_interval_minutes": rotate_interval_minutes, + "rotate_threshold_lines": rotate_threshold_lines, + "rotate_threshold_mb": rotate_threshold_mb, + "tags": tags, + }, + policy_create_params.PolicyCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderPolicy, + ) + + def update( + self, + id: int, + *, + date_format: str | Omit = omit, + description: str | Omit = omit, + field_delimiter: str | Omit = omit, + field_separator: str | Omit = omit, + fields: SequenceNotStr[str] | Omit = omit, + file_name_template: str | Omit = omit, + format_type: str | Omit = omit, + include_empty_logs: bool | Omit = omit, + include_shield_logs: bool | Omit = omit, + name: str | Omit = omit, + retry_interval_minutes: int | Omit = omit, + rotate_interval_minutes: int | Omit = omit, + rotate_threshold_lines: int | Omit = omit, + rotate_threshold_mb: Optional[int] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderPolicy: + """ + Change logs uploader policy partially. + + Args: + date_format: Date format for logs. + + description: Description of the policy. + + field_delimiter: Field delimiter for logs. + + field_separator: Field separator for logs. + + fields: List of fields to include in logs. + + file_name_template: Template for log file name. + + format_type: Format type for logs. + + include_empty_logs: Include empty logs in the upload. + + include_shield_logs: Include logs from origin shielding in the upload. + + name: Name of the policy. + + retry_interval_minutes: Interval in minutes to retry failed uploads. + + rotate_interval_minutes: Interval in minutes to rotate logs. + + rotate_threshold_lines: Threshold in lines to rotate logs. + + rotate_threshold_mb: Threshold in MB to rotate logs. + + tags: Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + + 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 + """ + return self._patch( + f"/cdn/logs_uploader/policies/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + body=maybe_transform( + { + "date_format": date_format, + "description": description, + "field_delimiter": field_delimiter, + "field_separator": field_separator, + "fields": fields, + "file_name_template": file_name_template, + "format_type": format_type, + "include_empty_logs": include_empty_logs, + "include_shield_logs": include_shield_logs, + "name": name, + "retry_interval_minutes": retry_interval_minutes, + "rotate_interval_minutes": rotate_interval_minutes, + "rotate_threshold_lines": rotate_threshold_lines, + "rotate_threshold_mb": rotate_threshold_mb, + "tags": tags, + }, + policy_update_params.PolicyUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderPolicy, + ) + + def list( + self, + *, + config_ids: Iterable[int] | Omit = omit, + search: 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, + ) -> LogsUploaderPolicyList: + """ + Get list of logs uploader policies. + + Args: + config_ids: Filter by ids of related logs uploader configs that use given policy. + + search: Search by policy name or id. + + 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 + """ + return self._get( + "/cdn/logs_uploader/policies" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/policies", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "config_ids": config_ids, + "search": search, + }, + policy_list_params.PolicyListParams, + ), + ), + cast_to=LogsUploaderPolicyList, + ) + + def delete( + self, + id: int, + *, + # 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, + ) -> None: + """ + Delete the logs uploader policy from the system permanently. + + Notes: + + - **Irreversibility**: This action is irreversible. Once deleted, the logs + uploader policy cannot be recovered. + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/logs_uploader/policies/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + id: int, + *, + # 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, + ) -> LogsUploaderPolicy: + """ + Get information about logs uploader policy. + + Args: + 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 + """ + return self._get( + f"/cdn/logs_uploader/policies/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderPolicy, + ) + + def list_fields( + 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, + ) -> PolicyListFieldsResponse: + """Get list of available fields for logs uploader policy.""" + return self._get( + "/cdn/logs_uploader/policies/fields" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/policies/fields", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PolicyListFieldsResponse, + ) + + def replace( + self, + id: int, + *, + date_format: str | Omit = omit, + description: str | Omit = omit, + field_delimiter: str | Omit = omit, + field_separator: str | Omit = omit, + fields: SequenceNotStr[str] | Omit = omit, + file_name_template: str | Omit = omit, + format_type: str | Omit = omit, + include_empty_logs: bool | Omit = omit, + include_shield_logs: bool | Omit = omit, + name: str | Omit = omit, + retry_interval_minutes: int | Omit = omit, + rotate_interval_minutes: int | Omit = omit, + rotate_threshold_lines: int | Omit = omit, + rotate_threshold_mb: Optional[int] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderPolicy: + """ + Change logs uploader policy. + + Args: + date_format: Date format for logs. + + description: Description of the policy. + + field_delimiter: Field delimiter for logs. + + field_separator: Field separator for logs. + + fields: List of fields to include in logs. + + file_name_template: Template for log file name. + + format_type: Format type for logs. + + include_empty_logs: Include empty logs in the upload. + + include_shield_logs: Include logs from origin shielding in the upload. + + name: Name of the policy. + + retry_interval_minutes: Interval in minutes to retry failed uploads. + + rotate_interval_minutes: Interval in minutes to rotate logs. + + rotate_threshold_lines: Threshold in lines to rotate logs. + + rotate_threshold_mb: Threshold in MB to rotate logs. + + tags: Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + + 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 + """ + return self._put( + f"/cdn/logs_uploader/policies/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + body=maybe_transform( + { + "date_format": date_format, + "description": description, + "field_delimiter": field_delimiter, + "field_separator": field_separator, + "fields": fields, + "file_name_template": file_name_template, + "format_type": format_type, + "include_empty_logs": include_empty_logs, + "include_shield_logs": include_shield_logs, + "name": name, + "retry_interval_minutes": retry_interval_minutes, + "rotate_interval_minutes": rotate_interval_minutes, + "rotate_threshold_lines": rotate_threshold_lines, + "rotate_threshold_mb": rotate_threshold_mb, + "tags": tags, + }, + policy_replace_params.PolicyReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderPolicy, + ) + + +class AsyncPoliciesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncPoliciesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncPoliciesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPoliciesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncPoliciesResourceWithStreamingResponse(self) + + async def create( + self, + *, + date_format: str | Omit = omit, + description: str | Omit = omit, + field_delimiter: str | Omit = omit, + field_separator: str | Omit = omit, + fields: SequenceNotStr[str] | Omit = omit, + file_name_template: str | Omit = omit, + format_type: str | Omit = omit, + include_empty_logs: bool | Omit = omit, + include_shield_logs: bool | Omit = omit, + name: str | Omit = omit, + retry_interval_minutes: int | Omit = omit, + rotate_interval_minutes: int | Omit = omit, + rotate_threshold_lines: int | Omit = omit, + rotate_threshold_mb: Optional[int] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderPolicy: + """ + Create logs uploader policy. + + Args: + date_format: Date format for logs. + + description: Description of the policy. + + field_delimiter: Field delimiter for logs. + + field_separator: Field separator for logs. + + fields: List of fields to include in logs. + + file_name_template: Template for log file name. + + format_type: Format type for logs. + + include_empty_logs: Include empty logs in the upload. + + include_shield_logs: Include logs from origin shielding in the upload. + + name: Name of the policy. + + retry_interval_minutes: Interval in minutes to retry failed uploads. + + rotate_interval_minutes: Interval in minutes to rotate logs. + + rotate_threshold_lines: Threshold in lines to rotate logs. + + rotate_threshold_mb: Threshold in MB to rotate logs. + + tags: Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + + 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 + """ + return await self._post( + "/cdn/logs_uploader/policies" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/policies", + body=await async_maybe_transform( + { + "date_format": date_format, + "description": description, + "field_delimiter": field_delimiter, + "field_separator": field_separator, + "fields": fields, + "file_name_template": file_name_template, + "format_type": format_type, + "include_empty_logs": include_empty_logs, + "include_shield_logs": include_shield_logs, + "name": name, + "retry_interval_minutes": retry_interval_minutes, + "rotate_interval_minutes": rotate_interval_minutes, + "rotate_threshold_lines": rotate_threshold_lines, + "rotate_threshold_mb": rotate_threshold_mb, + "tags": tags, + }, + policy_create_params.PolicyCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderPolicy, + ) + + async def update( + self, + id: int, + *, + date_format: str | Omit = omit, + description: str | Omit = omit, + field_delimiter: str | Omit = omit, + field_separator: str | Omit = omit, + fields: SequenceNotStr[str] | Omit = omit, + file_name_template: str | Omit = omit, + format_type: str | Omit = omit, + include_empty_logs: bool | Omit = omit, + include_shield_logs: bool | Omit = omit, + name: str | Omit = omit, + retry_interval_minutes: int | Omit = omit, + rotate_interval_minutes: int | Omit = omit, + rotate_threshold_lines: int | Omit = omit, + rotate_threshold_mb: Optional[int] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderPolicy: + """ + Change logs uploader policy partially. + + Args: + date_format: Date format for logs. + + description: Description of the policy. + + field_delimiter: Field delimiter for logs. + + field_separator: Field separator for logs. + + fields: List of fields to include in logs. + + file_name_template: Template for log file name. + + format_type: Format type for logs. + + include_empty_logs: Include empty logs in the upload. + + include_shield_logs: Include logs from origin shielding in the upload. + + name: Name of the policy. + + retry_interval_minutes: Interval in minutes to retry failed uploads. + + rotate_interval_minutes: Interval in minutes to rotate logs. + + rotate_threshold_lines: Threshold in lines to rotate logs. + + rotate_threshold_mb: Threshold in MB to rotate logs. + + tags: Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + + 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 + """ + return await self._patch( + f"/cdn/logs_uploader/policies/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + body=await async_maybe_transform( + { + "date_format": date_format, + "description": description, + "field_delimiter": field_delimiter, + "field_separator": field_separator, + "fields": fields, + "file_name_template": file_name_template, + "format_type": format_type, + "include_empty_logs": include_empty_logs, + "include_shield_logs": include_shield_logs, + "name": name, + "retry_interval_minutes": retry_interval_minutes, + "rotate_interval_minutes": rotate_interval_minutes, + "rotate_threshold_lines": rotate_threshold_lines, + "rotate_threshold_mb": rotate_threshold_mb, + "tags": tags, + }, + policy_update_params.PolicyUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderPolicy, + ) + + async def list( + self, + *, + config_ids: Iterable[int] | Omit = omit, + search: 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, + ) -> LogsUploaderPolicyList: + """ + Get list of logs uploader policies. + + Args: + config_ids: Filter by ids of related logs uploader configs that use given policy. + + search: Search by policy name or id. + + 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 + """ + return await self._get( + "/cdn/logs_uploader/policies" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/policies", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "config_ids": config_ids, + "search": search, + }, + policy_list_params.PolicyListParams, + ), + ), + cast_to=LogsUploaderPolicyList, + ) + + async def delete( + self, + id: int, + *, + # 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, + ) -> None: + """ + Delete the logs uploader policy from the system permanently. + + Notes: + + - **Irreversibility**: This action is irreversible. Once deleted, the logs + uploader policy cannot be recovered. + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/logs_uploader/policies/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + id: int, + *, + # 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, + ) -> LogsUploaderPolicy: + """ + Get information about logs uploader policy. + + Args: + 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 + """ + return await self._get( + f"/cdn/logs_uploader/policies/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderPolicy, + ) + + async def list_fields( + 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, + ) -> PolicyListFieldsResponse: + """Get list of available fields for logs uploader policy.""" + return await self._get( + "/cdn/logs_uploader/policies/fields" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/policies/fields", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PolicyListFieldsResponse, + ) + + async def replace( + self, + id: int, + *, + date_format: str | Omit = omit, + description: str | Omit = omit, + field_delimiter: str | Omit = omit, + field_separator: str | Omit = omit, + fields: SequenceNotStr[str] | Omit = omit, + file_name_template: str | Omit = omit, + format_type: str | Omit = omit, + include_empty_logs: bool | Omit = omit, + include_shield_logs: bool | Omit = omit, + name: str | Omit = omit, + retry_interval_minutes: int | Omit = omit, + rotate_interval_minutes: int | Omit = omit, + rotate_threshold_lines: int | Omit = omit, + rotate_threshold_mb: Optional[int] | Omit = omit, + tags: Dict[str, str] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> LogsUploaderPolicy: + """ + Change logs uploader policy. + + Args: + date_format: Date format for logs. + + description: Description of the policy. + + field_delimiter: Field delimiter for logs. + + field_separator: Field separator for logs. + + fields: List of fields to include in logs. + + file_name_template: Template for log file name. + + format_type: Format type for logs. + + include_empty_logs: Include empty logs in the upload. + + include_shield_logs: Include logs from origin shielding in the upload. + + name: Name of the policy. + + retry_interval_minutes: Interval in minutes to retry failed uploads. + + rotate_interval_minutes: Interval in minutes to rotate logs. + + rotate_threshold_lines: Threshold in lines to rotate logs. + + rotate_threshold_mb: Threshold in MB to rotate logs. + + tags: Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + + 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 + """ + return await self._put( + f"/cdn/logs_uploader/policies/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/policies/{id}", + body=await async_maybe_transform( + { + "date_format": date_format, + "description": description, + "field_delimiter": field_delimiter, + "field_separator": field_separator, + "fields": fields, + "file_name_template": file_name_template, + "format_type": format_type, + "include_empty_logs": include_empty_logs, + "include_shield_logs": include_shield_logs, + "name": name, + "retry_interval_minutes": retry_interval_minutes, + "rotate_interval_minutes": rotate_interval_minutes, + "rotate_threshold_lines": rotate_threshold_lines, + "rotate_threshold_mb": rotate_threshold_mb, + "tags": tags, + }, + policy_replace_params.PolicyReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderPolicy, + ) + + +class PoliciesResourceWithRawResponse: + def __init__(self, policies: PoliciesResource) -> None: + self._policies = policies + + self.create = to_raw_response_wrapper( + policies.create, + ) + self.update = to_raw_response_wrapper( + policies.update, + ) + self.list = to_raw_response_wrapper( + policies.list, + ) + self.delete = to_raw_response_wrapper( + policies.delete, + ) + self.get = to_raw_response_wrapper( + policies.get, + ) + self.list_fields = to_raw_response_wrapper( + policies.list_fields, + ) + self.replace = to_raw_response_wrapper( + policies.replace, + ) + + +class AsyncPoliciesResourceWithRawResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: + self._policies = policies + + self.create = async_to_raw_response_wrapper( + policies.create, + ) + self.update = async_to_raw_response_wrapper( + policies.update, + ) + self.list = async_to_raw_response_wrapper( + policies.list, + ) + self.delete = async_to_raw_response_wrapper( + policies.delete, + ) + self.get = async_to_raw_response_wrapper( + policies.get, + ) + self.list_fields = async_to_raw_response_wrapper( + policies.list_fields, + ) + self.replace = async_to_raw_response_wrapper( + policies.replace, + ) + + +class PoliciesResourceWithStreamingResponse: + def __init__(self, policies: PoliciesResource) -> None: + self._policies = policies + + self.create = to_streamed_response_wrapper( + policies.create, + ) + self.update = to_streamed_response_wrapper( + policies.update, + ) + self.list = to_streamed_response_wrapper( + policies.list, + ) + self.delete = to_streamed_response_wrapper( + policies.delete, + ) + self.get = to_streamed_response_wrapper( + policies.get, + ) + self.list_fields = to_streamed_response_wrapper( + policies.list_fields, + ) + self.replace = to_streamed_response_wrapper( + policies.replace, + ) + + +class AsyncPoliciesResourceWithStreamingResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: + self._policies = policies + + self.create = async_to_streamed_response_wrapper( + policies.create, + ) + self.update = async_to_streamed_response_wrapper( + policies.update, + ) + self.list = async_to_streamed_response_wrapper( + policies.list, + ) + self.delete = async_to_streamed_response_wrapper( + policies.delete, + ) + self.get = async_to_streamed_response_wrapper( + policies.get, + ) + self.list_fields = async_to_streamed_response_wrapper( + policies.list_fields, + ) + self.replace = async_to_streamed_response_wrapper( + policies.replace, + ) diff --git a/src/gcore/resources/cdn/logs_uploader/targets.py b/src/gcore/resources/cdn/logs_uploader/targets.py new file mode 100644 index 00000000..1b5b90fa --- /dev/null +++ b/src/gcore/resources/cdn/logs_uploader/targets.py @@ -0,0 +1,811 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Literal + +import httpx + +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cdn.logs_uploader import ( + target_list_params, + target_create_params, + target_update_params, + target_replace_params, +) +from ....types.cdn.logs_uploader_validation import LogsUploaderValidation +from ....types.cdn.logs_uploader.logs_uploader_target import LogsUploaderTarget +from ....types.cdn.logs_uploader.logs_uploader_target_list import LogsUploaderTargetList + +__all__ = ["TargetsResource", "AsyncTargetsResource"] + + +class TargetsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TargetsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return TargetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TargetsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return TargetsResourceWithStreamingResponse(self) + + def create( + self, + *, + config: target_create_params.Config, + storage_type: Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"], + description: str | Omit = omit, + name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # 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, + ) -> LogsUploaderTarget: + """ + Create logs uploader target. + + Args: + config: Config for specific storage type. + + storage_type: Type of storage for logs. + + description: Description of the target. + + name: Name of the target. + + 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 + """ + return self._post( + "/cdn/logs_uploader/targets" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/targets", + body=maybe_transform( + { + "config": config, + "storage_type": storage_type, + "description": description, + "name": name, + }, + target_create_params.TargetCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderTarget, + ) + + def update( + self, + id: int, + *, + config: target_update_params.Config | Omit = omit, + description: str | Omit = omit, + name: str | Omit = omit, + storage_type: Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"] + | 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, + ) -> LogsUploaderTarget: + """ + Change logs uploader target partially. + + Args: + config: Config for specific storage type. + + description: Description of the target. + + name: Name of the target. + + storage_type: Type of storage for logs. + + 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 + """ + return self._patch( + f"/cdn/logs_uploader/targets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + body=maybe_transform( + { + "config": config, + "description": description, + "name": name, + "storage_type": storage_type, + }, + target_update_params.TargetUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderTarget, + ) + + def list( + self, + *, + config_ids: Iterable[int] | Omit = omit, + search: 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, + ) -> LogsUploaderTargetList: + """ + Get list of logs uploader targets. + + Args: + config_ids: Filter by ids of related logs uploader configs that use given target. + + search: Search by target name or id. + + 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 + """ + return self._get( + "/cdn/logs_uploader/targets" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/targets", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "config_ids": config_ids, + "search": search, + }, + target_list_params.TargetListParams, + ), + ), + cast_to=LogsUploaderTargetList, + ) + + def delete( + self, + id: int, + *, + # 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, + ) -> None: + """ + Delete the logs uploader target from the system permanently. + + Notes: + + - **Irreversibility**: This action is irreversible. Once deleted, the logs + uploader target cannot be recovered. + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/logs_uploader/targets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + id: int, + *, + # 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, + ) -> LogsUploaderTarget: + """ + Get information about logs uploader target. + + Args: + 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 + """ + return self._get( + f"/cdn/logs_uploader/targets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderTarget, + ) + + def replace( + self, + id: int, + *, + config: target_replace_params.Config, + storage_type: Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"], + description: str | Omit = omit, + name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # 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, + ) -> LogsUploaderTarget: + """ + Change logs uploader target. + + Args: + config: Config for specific storage type. + + storage_type: Type of storage for logs. + + description: Description of the target. + + name: Name of the target. + + 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 + """ + return self._put( + f"/cdn/logs_uploader/targets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + body=maybe_transform( + { + "config": config, + "storage_type": storage_type, + "description": description, + "name": name, + }, + target_replace_params.TargetReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderTarget, + ) + + def validate( + self, + id: int, + *, + # 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, + ) -> LogsUploaderValidation: + """ + Validate logs uploader target. + + Args: + 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 + """ + return self._post( + f"/cdn/logs_uploader/targets/{id}/validate" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}/validate", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderValidation, + ) + + +class AsyncTargetsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTargetsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncTargetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTargetsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncTargetsResourceWithStreamingResponse(self) + + async def create( + self, + *, + config: target_create_params.Config, + storage_type: Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"], + description: str | Omit = omit, + name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # 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, + ) -> LogsUploaderTarget: + """ + Create logs uploader target. + + Args: + config: Config for specific storage type. + + storage_type: Type of storage for logs. + + description: Description of the target. + + name: Name of the target. + + 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 + """ + return await self._post( + "/cdn/logs_uploader/targets" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/targets", + body=await async_maybe_transform( + { + "config": config, + "storage_type": storage_type, + "description": description, + "name": name, + }, + target_create_params.TargetCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderTarget, + ) + + async def update( + self, + id: int, + *, + config: target_update_params.Config | Omit = omit, + description: str | Omit = omit, + name: str | Omit = omit, + storage_type: Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"] + | 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, + ) -> LogsUploaderTarget: + """ + Change logs uploader target partially. + + Args: + config: Config for specific storage type. + + description: Description of the target. + + name: Name of the target. + + storage_type: Type of storage for logs. + + 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 + """ + return await self._patch( + f"/cdn/logs_uploader/targets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + body=await async_maybe_transform( + { + "config": config, + "description": description, + "name": name, + "storage_type": storage_type, + }, + target_update_params.TargetUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderTarget, + ) + + async def list( + self, + *, + config_ids: Iterable[int] | Omit = omit, + search: 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, + ) -> LogsUploaderTargetList: + """ + Get list of logs uploader targets. + + Args: + config_ids: Filter by ids of related logs uploader configs that use given target. + + search: Search by target name or id. + + 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 + """ + return await self._get( + "/cdn/logs_uploader/targets" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/logs_uploader/targets", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "config_ids": config_ids, + "search": search, + }, + target_list_params.TargetListParams, + ), + ), + cast_to=LogsUploaderTargetList, + ) + + async def delete( + self, + id: int, + *, + # 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, + ) -> None: + """ + Delete the logs uploader target from the system permanently. + + Notes: + + - **Irreversibility**: This action is irreversible. Once deleted, the logs + uploader target cannot be recovered. + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/logs_uploader/targets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + id: int, + *, + # 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, + ) -> LogsUploaderTarget: + """ + Get information about logs uploader target. + + Args: + 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 + """ + return await self._get( + f"/cdn/logs_uploader/targets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderTarget, + ) + + async def replace( + self, + id: int, + *, + config: target_replace_params.Config, + storage_type: Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"], + description: str | Omit = omit, + name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # 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, + ) -> LogsUploaderTarget: + """ + Change logs uploader target. + + Args: + config: Config for specific storage type. + + storage_type: Type of storage for logs. + + description: Description of the target. + + name: Name of the target. + + 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 + """ + return await self._put( + f"/cdn/logs_uploader/targets/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}", + body=await async_maybe_transform( + { + "config": config, + "storage_type": storage_type, + "description": description, + "name": name, + }, + target_replace_params.TargetReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderTarget, + ) + + async def validate( + self, + id: int, + *, + # 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, + ) -> LogsUploaderValidation: + """ + Validate logs uploader target. + + Args: + 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 + """ + return await self._post( + f"/cdn/logs_uploader/targets/{id}/validate" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/logs_uploader/targets/{id}/validate", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=LogsUploaderValidation, + ) + + +class TargetsResourceWithRawResponse: + def __init__(self, targets: TargetsResource) -> None: + self._targets = targets + + self.create = to_raw_response_wrapper( + targets.create, + ) + self.update = to_raw_response_wrapper( + targets.update, + ) + self.list = to_raw_response_wrapper( + targets.list, + ) + self.delete = to_raw_response_wrapper( + targets.delete, + ) + self.get = to_raw_response_wrapper( + targets.get, + ) + self.replace = to_raw_response_wrapper( + targets.replace, + ) + self.validate = to_raw_response_wrapper( + targets.validate, + ) + + +class AsyncTargetsResourceWithRawResponse: + def __init__(self, targets: AsyncTargetsResource) -> None: + self._targets = targets + + self.create = async_to_raw_response_wrapper( + targets.create, + ) + self.update = async_to_raw_response_wrapper( + targets.update, + ) + self.list = async_to_raw_response_wrapper( + targets.list, + ) + self.delete = async_to_raw_response_wrapper( + targets.delete, + ) + self.get = async_to_raw_response_wrapper( + targets.get, + ) + self.replace = async_to_raw_response_wrapper( + targets.replace, + ) + self.validate = async_to_raw_response_wrapper( + targets.validate, + ) + + +class TargetsResourceWithStreamingResponse: + def __init__(self, targets: TargetsResource) -> None: + self._targets = targets + + self.create = to_streamed_response_wrapper( + targets.create, + ) + self.update = to_streamed_response_wrapper( + targets.update, + ) + self.list = to_streamed_response_wrapper( + targets.list, + ) + self.delete = to_streamed_response_wrapper( + targets.delete, + ) + self.get = to_streamed_response_wrapper( + targets.get, + ) + self.replace = to_streamed_response_wrapper( + targets.replace, + ) + self.validate = to_streamed_response_wrapper( + targets.validate, + ) + + +class AsyncTargetsResourceWithStreamingResponse: + def __init__(self, targets: AsyncTargetsResource) -> None: + self._targets = targets + + self.create = async_to_streamed_response_wrapper( + targets.create, + ) + self.update = async_to_streamed_response_wrapper( + targets.update, + ) + self.list = async_to_streamed_response_wrapper( + targets.list, + ) + self.delete = async_to_streamed_response_wrapper( + targets.delete, + ) + self.get = async_to_streamed_response_wrapper( + targets.get, + ) + self.replace = async_to_streamed_response_wrapper( + targets.replace, + ) + self.validate = async_to_streamed_response_wrapper( + targets.validate, + ) diff --git a/src/gcore/resources/cdn/metrics.py b/src/gcore/resources/cdn/metrics.py new file mode 100644 index 00000000..4d32d90a --- /dev/null +++ b/src/gcore/resources/cdn/metrics.py @@ -0,0 +1,419 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import metric_list_params +from ..._base_client import make_request_options +from ...types.cdn.cdn_metrics import CdnMetrics + +__all__ = ["MetricsResource", "AsyncMetricsResource"] + + +class MetricsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> MetricsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return MetricsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> MetricsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return MetricsResourceWithStreamingResponse(self) + + def list( + self, + *, + from_: str, + metrics: SequenceNotStr[str], + to: str, + filter_by: Iterable[metric_list_params.FilterBy] | Omit = omit, + granularity: str | Omit = omit, + group_by: SequenceNotStr[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, + ) -> CdnMetrics: + """ + Get CDN metrics + + Args: + from_: Beginning period to fetch metrics (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - 2021-06-14T00:00:00Z + - 2021-06-14T00:00:00.000Z + + The total number of points, which is determined as the difference between "from" + and "to" divided by "granularity", cannot exceed 1440. Exception: "speed" + metrics are limited to 72 points. + + metrics: + Possible values: + + - **`edge_bandwidth`** - Bandwidth from client to CDN (bit/s.) + - **`edge_requests`** - Number of requests per interval (requests/s.) + - **`edge_requests_total`** - Total number of requests per interval. + - **`edge_status_1xx`** - Number of 1xx status codes from edge. + - **`edge_status_200`** - Number of 200 status codes from edge. + - **`edge_status_204`** - Number of 204 status codes from edge. + - **`edge_status_206`** - Number of 206 status codes from edge. + - **`edge_status_2xx`** - Number of 2xx status codes from edge. + - **`edge_status_301`** - Number of 301 status codes from edge. + - **`edge_status_302`** - Number of 302 status codes from edge. + - **`edge_status_304`** - Number of 304 status codes from edge. + - **`edge_status_3xx`** - Number of 3xx status codes from edge. + - **`edge_status_400`** - Number of 400 status codes from edge. + - **`edge_status_401`** - Number of 401 status codes from edge. + - **`edge_status_403`** - Number of 403 status codes from edge. + - **`edge_status_404`** - Number of 404 status codes from edge. + - **`edge_status_416`** - Number of 416 status codes from edge. + - **`edge_status_429`** - Number of 429 status codes from edge. + - **`edge_status_4xx`** - Number of 4xx status codes from edge. + - **`edge_status_500`** - Number of 500 status codes from edge. + - **`edge_status_501`** - Number of 501 status codes from edge. + - **`edge_status_502`** - Number of 502 status codes from edge. + - **`edge_status_503`** - Number of 503 status codes from edge. + - **`edge_status_504`** - Number of 504 status codes from edge. + - **`edge_status_505`** - Number of 505 status codes from edge. + - **`edge_status_5xx`** - Number of 5xx status codes from edge. + - **`edge_hit_ratio`** - Percent of cache hits (0.0 - 1.0). + - **`edge_hit_bytes`** - Number of bytes sent back when cache hits. + - **`origin_bandwidth`** - Bandwidth from CDN to Origin (bit/s.) + - **`origin_requests`** - Number of requests per interval (requests/s.) + - **`origin_status_1xx`** - Number of 1xx status from origin. + - **`origin_status_200`** - Number of 200 status from origin. + - **`origin_status_204`** - Number of 204 status from origin. + - **`origin_status_206`** - Number of 206 status from origin. + - **`origin_status_2xx`** - Number of 2xx status from origin. + - **`origin_status_301`** - Number of 301 status from origin. + - **`origin_status_302`** - Number of 302 status from origin. + - **`origin_status_304`** - Number of 304 status from origin. + - **`origin_status_3xx`** - Number of 3xx status from origin. + - **`origin_status_400`** - Number of 400 status from origin. + - **`origin_status_401`** - Number of 401 status from origin. + - **`origin_status_403`** - Number of 403 status from origin. + - **`origin_status_404`** - Number of 404 status from origin. + - **`origin_status_416`** - Number of 416 status from origin. + - **`origin_status_429`** - Number of 426 status from origin. + - **`origin_status_4xx`** - Number of 4xx status from origin. + - **`origin_status_500`** - Number of 500 status from origin. + - **`origin_status_501`** - Number of 501 status from origin. + - **`origin_status_502`** - Number of 502 status from origin. + - **`origin_status_503`** - Number of 503 status from origin. + - **`origin_status_504`** - Number of 504 status from origin. + - **`origin_status_505`** - Number of 505 status from origin. + - **`origin_status_5xx`** - Number of 5xx status from origin. + - **`edge_download_speed`** - Download speed from edge in KB/s (includes only + requests that status was in the range [200, 300].) + - **`origin_download_speed`** - Download speed from origin in KB/s (includes + only requests that status was in the range [200, 300].) + + to: Specifies ending period to fetch metrics (ISO 8601/RFC 3339 format, UTC) + + Examples: + + - 2021-06-15T00:00:00Z + - 2021-06-15T00:00:00.000Z + + The total number of points, which is determined as the difference between "from" + and "to" divided by "granularity", cannot exceed 1440. Exception: "speed" + metrics are limited to 72 points. + + filter_by: Each item represents one filter statement. + + granularity: Duration of the time blocks into which the data is divided. The value must + correspond to the ISO 8601 period format. + + Examples: + + - P1D + - PT5M + + Notes: + + - The total number of points, which is determined as the difference between + "from" and "to" divided by "granularity", cannot exceed 1440. Exception: + "speed" metrics are limited to 72 points. + - For "speed" metrics the value must be a multiple of 5. + + group_by: Output data grouping. + + Possible values: + + - **resource** - Data is grouped by CDN resource. + - **cname** - Data is grouped by common names. + - **region** – Data is grouped by regions (continents.) Available for "speed" + metrics only. + - **isp** - Data is grouped by ISP names. Available for "speed" metrics only. + + 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 + """ + return self._post( + "/cdn/advanced/v1/metrics" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/advanced/v1/metrics", + body=maybe_transform( + { + "from_": from_, + "metrics": metrics, + "to": to, + "filter_by": filter_by, + "granularity": granularity, + "group_by": group_by, + }, + metric_list_params.MetricListParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnMetrics, + ) + + +class AsyncMetricsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncMetricsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncMetricsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncMetricsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncMetricsResourceWithStreamingResponse(self) + + async def list( + self, + *, + from_: str, + metrics: SequenceNotStr[str], + to: str, + filter_by: Iterable[metric_list_params.FilterBy] | Omit = omit, + granularity: str | Omit = omit, + group_by: SequenceNotStr[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, + ) -> CdnMetrics: + """ + Get CDN metrics + + Args: + from_: Beginning period to fetch metrics (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - 2021-06-14T00:00:00Z + - 2021-06-14T00:00:00.000Z + + The total number of points, which is determined as the difference between "from" + and "to" divided by "granularity", cannot exceed 1440. Exception: "speed" + metrics are limited to 72 points. + + metrics: + Possible values: + + - **`edge_bandwidth`** - Bandwidth from client to CDN (bit/s.) + - **`edge_requests`** - Number of requests per interval (requests/s.) + - **`edge_requests_total`** - Total number of requests per interval. + - **`edge_status_1xx`** - Number of 1xx status codes from edge. + - **`edge_status_200`** - Number of 200 status codes from edge. + - **`edge_status_204`** - Number of 204 status codes from edge. + - **`edge_status_206`** - Number of 206 status codes from edge. + - **`edge_status_2xx`** - Number of 2xx status codes from edge. + - **`edge_status_301`** - Number of 301 status codes from edge. + - **`edge_status_302`** - Number of 302 status codes from edge. + - **`edge_status_304`** - Number of 304 status codes from edge. + - **`edge_status_3xx`** - Number of 3xx status codes from edge. + - **`edge_status_400`** - Number of 400 status codes from edge. + - **`edge_status_401`** - Number of 401 status codes from edge. + - **`edge_status_403`** - Number of 403 status codes from edge. + - **`edge_status_404`** - Number of 404 status codes from edge. + - **`edge_status_416`** - Number of 416 status codes from edge. + - **`edge_status_429`** - Number of 429 status codes from edge. + - **`edge_status_4xx`** - Number of 4xx status codes from edge. + - **`edge_status_500`** - Number of 500 status codes from edge. + - **`edge_status_501`** - Number of 501 status codes from edge. + - **`edge_status_502`** - Number of 502 status codes from edge. + - **`edge_status_503`** - Number of 503 status codes from edge. + - **`edge_status_504`** - Number of 504 status codes from edge. + - **`edge_status_505`** - Number of 505 status codes from edge. + - **`edge_status_5xx`** - Number of 5xx status codes from edge. + - **`edge_hit_ratio`** - Percent of cache hits (0.0 - 1.0). + - **`edge_hit_bytes`** - Number of bytes sent back when cache hits. + - **`origin_bandwidth`** - Bandwidth from CDN to Origin (bit/s.) + - **`origin_requests`** - Number of requests per interval (requests/s.) + - **`origin_status_1xx`** - Number of 1xx status from origin. + - **`origin_status_200`** - Number of 200 status from origin. + - **`origin_status_204`** - Number of 204 status from origin. + - **`origin_status_206`** - Number of 206 status from origin. + - **`origin_status_2xx`** - Number of 2xx status from origin. + - **`origin_status_301`** - Number of 301 status from origin. + - **`origin_status_302`** - Number of 302 status from origin. + - **`origin_status_304`** - Number of 304 status from origin. + - **`origin_status_3xx`** - Number of 3xx status from origin. + - **`origin_status_400`** - Number of 400 status from origin. + - **`origin_status_401`** - Number of 401 status from origin. + - **`origin_status_403`** - Number of 403 status from origin. + - **`origin_status_404`** - Number of 404 status from origin. + - **`origin_status_416`** - Number of 416 status from origin. + - **`origin_status_429`** - Number of 426 status from origin. + - **`origin_status_4xx`** - Number of 4xx status from origin. + - **`origin_status_500`** - Number of 500 status from origin. + - **`origin_status_501`** - Number of 501 status from origin. + - **`origin_status_502`** - Number of 502 status from origin. + - **`origin_status_503`** - Number of 503 status from origin. + - **`origin_status_504`** - Number of 504 status from origin. + - **`origin_status_505`** - Number of 505 status from origin. + - **`origin_status_5xx`** - Number of 5xx status from origin. + - **`edge_download_speed`** - Download speed from edge in KB/s (includes only + requests that status was in the range [200, 300].) + - **`origin_download_speed`** - Download speed from origin in KB/s (includes + only requests that status was in the range [200, 300].) + + to: Specifies ending period to fetch metrics (ISO 8601/RFC 3339 format, UTC) + + Examples: + + - 2021-06-15T00:00:00Z + - 2021-06-15T00:00:00.000Z + + The total number of points, which is determined as the difference between "from" + and "to" divided by "granularity", cannot exceed 1440. Exception: "speed" + metrics are limited to 72 points. + + filter_by: Each item represents one filter statement. + + granularity: Duration of the time blocks into which the data is divided. The value must + correspond to the ISO 8601 period format. + + Examples: + + - P1D + - PT5M + + Notes: + + - The total number of points, which is determined as the difference between + "from" and "to" divided by "granularity", cannot exceed 1440. Exception: + "speed" metrics are limited to 72 points. + - For "speed" metrics the value must be a multiple of 5. + + group_by: Output data grouping. + + Possible values: + + - **resource** - Data is grouped by CDN resource. + - **cname** - Data is grouped by common names. + - **region** – Data is grouped by regions (continents.) Available for "speed" + metrics only. + - **isp** - Data is grouped by ISP names. Available for "speed" metrics only. + + 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 + """ + return await self._post( + "/cdn/advanced/v1/metrics" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/advanced/v1/metrics", + body=await async_maybe_transform( + { + "from_": from_, + "metrics": metrics, + "to": to, + "filter_by": filter_by, + "granularity": granularity, + "group_by": group_by, + }, + metric_list_params.MetricListParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnMetrics, + ) + + +class MetricsResourceWithRawResponse: + def __init__(self, metrics: MetricsResource) -> None: + self._metrics = metrics + + self.list = to_raw_response_wrapper( + metrics.list, + ) + + +class AsyncMetricsResourceWithRawResponse: + def __init__(self, metrics: AsyncMetricsResource) -> None: + self._metrics = metrics + + self.list = async_to_raw_response_wrapper( + metrics.list, + ) + + +class MetricsResourceWithStreamingResponse: + def __init__(self, metrics: MetricsResource) -> None: + self._metrics = metrics + + self.list = to_streamed_response_wrapper( + metrics.list, + ) + + +class AsyncMetricsResourceWithStreamingResponse: + def __init__(self, metrics: AsyncMetricsResource) -> None: + self._metrics = metrics + + self.list = async_to_streamed_response_wrapper( + metrics.list, + ) diff --git a/src/gcore/resources/cdn/network_capacity.py b/src/gcore/resources/cdn/network_capacity.py new file mode 100644 index 00000000..30acd2bb --- /dev/null +++ b/src/gcore/resources/cdn/network_capacity.py @@ -0,0 +1,139 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.cdn.network_capacity import NetworkCapacity + +__all__ = ["NetworkCapacityResource", "AsyncNetworkCapacityResource"] + + +class NetworkCapacityResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> NetworkCapacityResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return NetworkCapacityResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> NetworkCapacityResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return NetworkCapacityResourceWithStreamingResponse(self) + + def list( + 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, + ) -> NetworkCapacity: + """Get network capacity per country.""" + return self._get( + "/cdn/advanced/v1/capacity" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/advanced/v1/capacity", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NetworkCapacity, + ) + + +class AsyncNetworkCapacityResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncNetworkCapacityResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncNetworkCapacityResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncNetworkCapacityResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncNetworkCapacityResourceWithStreamingResponse(self) + + async def list( + 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, + ) -> NetworkCapacity: + """Get network capacity per country.""" + return await self._get( + "/cdn/advanced/v1/capacity" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/advanced/v1/capacity", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NetworkCapacity, + ) + + +class NetworkCapacityResourceWithRawResponse: + def __init__(self, network_capacity: NetworkCapacityResource) -> None: + self._network_capacity = network_capacity + + self.list = to_raw_response_wrapper( + network_capacity.list, + ) + + +class AsyncNetworkCapacityResourceWithRawResponse: + def __init__(self, network_capacity: AsyncNetworkCapacityResource) -> None: + self._network_capacity = network_capacity + + self.list = async_to_raw_response_wrapper( + network_capacity.list, + ) + + +class NetworkCapacityResourceWithStreamingResponse: + def __init__(self, network_capacity: NetworkCapacityResource) -> None: + self._network_capacity = network_capacity + + self.list = to_streamed_response_wrapper( + network_capacity.list, + ) + + +class AsyncNetworkCapacityResourceWithStreamingResponse: + def __init__(self, network_capacity: AsyncNetworkCapacityResource) -> None: + self._network_capacity = network_capacity + + self.list = async_to_streamed_response_wrapper( + network_capacity.list, + ) diff --git a/src/gcore/resources/cdn/origin_groups.py b/src/gcore/resources/cdn/origin_groups.py new file mode 100644 index 00000000..aa98a961 --- /dev/null +++ b/src/gcore/resources/cdn/origin_groups.py @@ -0,0 +1,1496 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Any, Iterable, cast +from typing_extensions import overload + +import httpx + +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given +from ..._utils import required_args, maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import ( + origin_group_list_params, + origin_group_create_params, + origin_group_update_params, + origin_group_replace_params, +) +from ..._base_client import make_request_options +from ...types.cdn.origin_groups import OriginGroups +from ...types.cdn.origin_groups_list import OriginGroupsList + +__all__ = ["OriginGroupsResource", "AsyncOriginGroupsResource"] + + +class OriginGroupsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> OriginGroupsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return OriginGroupsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> OriginGroupsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return OriginGroupsResourceWithStreamingResponse(self) + + @overload + def create( + self, + *, + name: str, + sources: Iterable[origin_group_create_params.NoneAuthSource], + auth_type: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + use_next: bool | 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, + ) -> OriginGroups: + """ + Create an origin group with one or more origin sources. + + Args: + name: Origin group name. + + sources: List of origin sources in the origin group. + + auth_type: Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def create( + self, + *, + auth: origin_group_create_params.AwsSignatureV4Auth, + auth_type: str, + name: str, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + use_next: bool | 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, + ) -> OriginGroups: + """ + Create an origin group with one or more origin sources. + + Args: + auth: Credentials to access the private bucket. + + auth_type: Authentication type. + + **awsSignatureV4** value is used for S3 storage. + + name: Origin group name. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + 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 + """ + ... + + @required_args(["name", "sources"], ["auth", "auth_type", "name"]) + def create( + self, + *, + name: str, + sources: Iterable[origin_group_create_params.NoneAuthSource] | Omit = omit, + auth_type: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + use_next: bool | Omit = omit, + auth: origin_group_create_params.AwsSignatureV4Auth | 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, + ) -> OriginGroups: + return cast( + OriginGroups, + self._post( + "/cdn/origin_groups" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/origin_groups", + body=maybe_transform( + { + "name": name, + "sources": sources, + "auth_type": auth_type, + "proxy_next_upstream": proxy_next_upstream, + "use_next": use_next, + "auth": auth, + }, + origin_group_create_params.OriginGroupCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginGroups), # Union types cannot be passed in as arguments in the type system + ), + ) + + @overload + def update( + self, + origin_group_id: int, + *, + name: str, + auth_type: str | Omit = omit, + path: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + sources: Iterable[origin_group_update_params.NoneAuthSource] | Omit = omit, + use_next: bool | 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, + ) -> OriginGroups: + """ + Change origin group + + Args: + name: Origin group name. + + auth_type: Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + + path: Parameter is **deprecated**. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + sources: List of origin sources in the origin group. + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def update( + self, + origin_group_id: int, + *, + auth: origin_group_update_params.AwsSignatureV4Auth | Omit = omit, + auth_type: str | Omit = omit, + name: str | Omit = omit, + path: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + use_next: bool | 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, + ) -> OriginGroups: + """ + Change origin group + + Args: + auth: Credentials to access the private bucket. + + auth_type: Authentication type. + + **awsSignatureV4** value is used for S3 storage. + + name: Origin group name. + + path: Parameter is **deprecated**. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + def update( + self, + origin_group_id: int, + *, + name: str | Omit = omit, + auth_type: str | Omit = omit, + path: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + sources: Iterable[origin_group_update_params.NoneAuthSource] | Omit = omit, + use_next: bool | Omit = omit, + auth: origin_group_update_params.AwsSignatureV4Auth | 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, + ) -> OriginGroups: + return cast( + OriginGroups, + self._patch( + f"/cdn/origin_groups/{origin_group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + body=maybe_transform( + { + "name": name, + "auth_type": auth_type, + "path": path, + "proxy_next_upstream": proxy_next_upstream, + "sources": sources, + "use_next": use_next, + "auth": auth, + }, + origin_group_update_params.OriginGroupUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginGroups), # Union types cannot be passed in as arguments in the type system + ), + ) + + def list( + self, + *, + has_related_resources: bool | Omit = omit, + name: str | Omit = omit, + sources: 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, + ) -> OriginGroupsList: + """ + Get all origin groups and related origin sources. + + Args: + has_related_resources: Defines whether the origin group has related CDN resources. + + Possible values: + + - **true** – Origin group has related CDN resources. + - **false** – Origin group does not have related CDN resources. + + name: Origin group name. + + sources: Origin sources (IP addresses or domains) in the origin group. + + 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 + """ + return self._get( + "/cdn/origin_groups" if self._client._base_url_overridden else "https://api.gcore.com//cdn/origin_groups", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "has_related_resources": has_related_resources, + "name": name, + "sources": sources, + }, + origin_group_list_params.OriginGroupListParams, + ), + ), + cast_to=OriginGroupsList, + ) + + def delete( + self, + origin_group_id: int, + *, + # 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, + ) -> None: + """ + Delete origin group + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/origin_groups/{origin_group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + origin_group_id: int, + *, + # 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, + ) -> OriginGroups: + """ + Get origin group details + + Args: + 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 + """ + return cast( + OriginGroups, + self._get( + f"/cdn/origin_groups/{origin_group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginGroups), # Union types cannot be passed in as arguments in the type system + ), + ) + + @overload + def replace( + self, + origin_group_id: int, + *, + auth_type: str, + name: str, + path: str, + sources: Iterable[origin_group_replace_params.NoneAuthSource], + use_next: bool, + proxy_next_upstream: SequenceNotStr[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, + ) -> OriginGroups: + """ + Change origin group + + Args: + auth_type: Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + + name: Origin group name. + + path: Parameter is **deprecated**. + + sources: List of origin sources in the origin group. + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def replace( + self, + origin_group_id: int, + *, + auth: origin_group_replace_params.AwsSignatureV4Auth, + auth_type: str, + name: str, + path: str, + use_next: bool, + proxy_next_upstream: SequenceNotStr[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, + ) -> OriginGroups: + """ + Change origin group + + Args: + auth: Credentials to access the private bucket. + + auth_type: Authentication type. + + **awsSignatureV4** value is used for S3 storage. + + name: Origin group name. + + path: Parameter is **deprecated**. + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + 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 + """ + ... + + @required_args( + ["auth_type", "name", "path", "sources", "use_next"], ["auth", "auth_type", "name", "path", "use_next"] + ) + def replace( + self, + origin_group_id: int, + *, + auth_type: str, + name: str, + path: str, + sources: Iterable[origin_group_replace_params.NoneAuthSource] | Omit = omit, + use_next: bool, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + auth: origin_group_replace_params.AwsSignatureV4Auth | 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, + ) -> OriginGroups: + return cast( + OriginGroups, + self._put( + f"/cdn/origin_groups/{origin_group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + body=maybe_transform( + { + "auth_type": auth_type, + "name": name, + "path": path, + "sources": sources, + "use_next": use_next, + "proxy_next_upstream": proxy_next_upstream, + "auth": auth, + }, + origin_group_replace_params.OriginGroupReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginGroups), # Union types cannot be passed in as arguments in the type system + ), + ) + + +class AsyncOriginGroupsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncOriginGroupsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncOriginGroupsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncOriginGroupsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncOriginGroupsResourceWithStreamingResponse(self) + + @overload + async def create( + self, + *, + name: str, + sources: Iterable[origin_group_create_params.NoneAuthSource], + auth_type: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + use_next: bool | 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, + ) -> OriginGroups: + """ + Create an origin group with one or more origin sources. + + Args: + name: Origin group name. + + sources: List of origin sources in the origin group. + + auth_type: Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def create( + self, + *, + auth: origin_group_create_params.AwsSignatureV4Auth, + auth_type: str, + name: str, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + use_next: bool | 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, + ) -> OriginGroups: + """ + Create an origin group with one or more origin sources. + + Args: + auth: Credentials to access the private bucket. + + auth_type: Authentication type. + + **awsSignatureV4** value is used for S3 storage. + + name: Origin group name. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + 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 + """ + ... + + @required_args(["name", "sources"], ["auth", "auth_type", "name"]) + async def create( + self, + *, + name: str, + sources: Iterable[origin_group_create_params.NoneAuthSource] | Omit = omit, + auth_type: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + use_next: bool | Omit = omit, + auth: origin_group_create_params.AwsSignatureV4Auth | 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, + ) -> OriginGroups: + return cast( + OriginGroups, + await self._post( + "/cdn/origin_groups" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/origin_groups", + body=await async_maybe_transform( + { + "name": name, + "sources": sources, + "auth_type": auth_type, + "proxy_next_upstream": proxy_next_upstream, + "use_next": use_next, + "auth": auth, + }, + origin_group_create_params.OriginGroupCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginGroups), # Union types cannot be passed in as arguments in the type system + ), + ) + + @overload + async def update( + self, + origin_group_id: int, + *, + name: str, + auth_type: str | Omit = omit, + path: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + sources: Iterable[origin_group_update_params.NoneAuthSource] | Omit = omit, + use_next: bool | 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, + ) -> OriginGroups: + """ + Change origin group + + Args: + name: Origin group name. + + auth_type: Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + + path: Parameter is **deprecated**. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + sources: List of origin sources in the origin group. + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def update( + self, + origin_group_id: int, + *, + auth: origin_group_update_params.AwsSignatureV4Auth | Omit = omit, + auth_type: str | Omit = omit, + name: str | Omit = omit, + path: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + use_next: bool | 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, + ) -> OriginGroups: + """ + Change origin group + + Args: + auth: Credentials to access the private bucket. + + auth_type: Authentication type. + + **awsSignatureV4** value is used for S3 storage. + + name: Origin group name. + + path: Parameter is **deprecated**. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + async def update( + self, + origin_group_id: int, + *, + name: str | Omit = omit, + auth_type: str | Omit = omit, + path: str | Omit = omit, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + sources: Iterable[origin_group_update_params.NoneAuthSource] | Omit = omit, + use_next: bool | Omit = omit, + auth: origin_group_update_params.AwsSignatureV4Auth | 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, + ) -> OriginGroups: + return cast( + OriginGroups, + await self._patch( + f"/cdn/origin_groups/{origin_group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + body=await async_maybe_transform( + { + "name": name, + "auth_type": auth_type, + "path": path, + "proxy_next_upstream": proxy_next_upstream, + "sources": sources, + "use_next": use_next, + "auth": auth, + }, + origin_group_update_params.OriginGroupUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginGroups), # Union types cannot be passed in as arguments in the type system + ), + ) + + async def list( + self, + *, + has_related_resources: bool | Omit = omit, + name: str | Omit = omit, + sources: 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, + ) -> OriginGroupsList: + """ + Get all origin groups and related origin sources. + + Args: + has_related_resources: Defines whether the origin group has related CDN resources. + + Possible values: + + - **true** – Origin group has related CDN resources. + - **false** – Origin group does not have related CDN resources. + + name: Origin group name. + + sources: Origin sources (IP addresses or domains) in the origin group. + + 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 + """ + return await self._get( + "/cdn/origin_groups" if self._client._base_url_overridden else "https://api.gcore.com//cdn/origin_groups", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "has_related_resources": has_related_resources, + "name": name, + "sources": sources, + }, + origin_group_list_params.OriginGroupListParams, + ), + ), + cast_to=OriginGroupsList, + ) + + async def delete( + self, + origin_group_id: int, + *, + # 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, + ) -> None: + """ + Delete origin group + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/origin_groups/{origin_group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + origin_group_id: int, + *, + # 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, + ) -> OriginGroups: + """ + Get origin group details + + Args: + 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 + """ + return cast( + OriginGroups, + await self._get( + f"/cdn/origin_groups/{origin_group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginGroups), # Union types cannot be passed in as arguments in the type system + ), + ) + + @overload + async def replace( + self, + origin_group_id: int, + *, + auth_type: str, + name: str, + path: str, + sources: Iterable[origin_group_replace_params.NoneAuthSource], + use_next: bool, + proxy_next_upstream: SequenceNotStr[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, + ) -> OriginGroups: + """ + Change origin group + + Args: + auth_type: Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + + name: Origin group name. + + path: Parameter is **deprecated**. + + sources: List of origin sources in the origin group. + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def replace( + self, + origin_group_id: int, + *, + auth: origin_group_replace_params.AwsSignatureV4Auth, + auth_type: str, + name: str, + path: str, + use_next: bool, + proxy_next_upstream: SequenceNotStr[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, + ) -> OriginGroups: + """ + Change origin group + + Args: + auth: Credentials to access the private bucket. + + auth_type: Authentication type. + + **awsSignatureV4** value is used for S3 storage. + + name: Origin group name. + + path: Parameter is **deprecated**. + + use_next: Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + + proxy_next_upstream: Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + + 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 + """ + ... + + @required_args( + ["auth_type", "name", "path", "sources", "use_next"], ["auth", "auth_type", "name", "path", "use_next"] + ) + async def replace( + self, + origin_group_id: int, + *, + auth_type: str, + name: str, + path: str, + sources: Iterable[origin_group_replace_params.NoneAuthSource] | Omit = omit, + use_next: bool, + proxy_next_upstream: SequenceNotStr[str] | Omit = omit, + auth: origin_group_replace_params.AwsSignatureV4Auth | 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, + ) -> OriginGroups: + return cast( + OriginGroups, + await self._put( + f"/cdn/origin_groups/{origin_group_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/origin_groups/{origin_group_id}", + body=await async_maybe_transform( + { + "auth_type": auth_type, + "name": name, + "path": path, + "sources": sources, + "use_next": use_next, + "proxy_next_upstream": proxy_next_upstream, + "auth": auth, + }, + origin_group_replace_params.OriginGroupReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginGroups), # Union types cannot be passed in as arguments in the type system + ), + ) + + +class OriginGroupsResourceWithRawResponse: + def __init__(self, origin_groups: OriginGroupsResource) -> None: + self._origin_groups = origin_groups + + self.create = to_raw_response_wrapper( + origin_groups.create, + ) + self.update = to_raw_response_wrapper( + origin_groups.update, + ) + self.list = to_raw_response_wrapper( + origin_groups.list, + ) + self.delete = to_raw_response_wrapper( + origin_groups.delete, + ) + self.get = to_raw_response_wrapper( + origin_groups.get, + ) + self.replace = to_raw_response_wrapper( + origin_groups.replace, + ) + + +class AsyncOriginGroupsResourceWithRawResponse: + def __init__(self, origin_groups: AsyncOriginGroupsResource) -> None: + self._origin_groups = origin_groups + + self.create = async_to_raw_response_wrapper( + origin_groups.create, + ) + self.update = async_to_raw_response_wrapper( + origin_groups.update, + ) + self.list = async_to_raw_response_wrapper( + origin_groups.list, + ) + self.delete = async_to_raw_response_wrapper( + origin_groups.delete, + ) + self.get = async_to_raw_response_wrapper( + origin_groups.get, + ) + self.replace = async_to_raw_response_wrapper( + origin_groups.replace, + ) + + +class OriginGroupsResourceWithStreamingResponse: + def __init__(self, origin_groups: OriginGroupsResource) -> None: + self._origin_groups = origin_groups + + self.create = to_streamed_response_wrapper( + origin_groups.create, + ) + self.update = to_streamed_response_wrapper( + origin_groups.update, + ) + self.list = to_streamed_response_wrapper( + origin_groups.list, + ) + self.delete = to_streamed_response_wrapper( + origin_groups.delete, + ) + self.get = to_streamed_response_wrapper( + origin_groups.get, + ) + self.replace = to_streamed_response_wrapper( + origin_groups.replace, + ) + + +class AsyncOriginGroupsResourceWithStreamingResponse: + def __init__(self, origin_groups: AsyncOriginGroupsResource) -> None: + self._origin_groups = origin_groups + + self.create = async_to_streamed_response_wrapper( + origin_groups.create, + ) + self.update = async_to_streamed_response_wrapper( + origin_groups.update, + ) + self.list = async_to_streamed_response_wrapper( + origin_groups.list, + ) + self.delete = async_to_streamed_response_wrapper( + origin_groups.delete, + ) + self.get = async_to_streamed_response_wrapper( + origin_groups.get, + ) + self.replace = async_to_streamed_response_wrapper( + origin_groups.replace, + ) diff --git a/src/gcore/resources/cdn/resources/__init__.py b/src/gcore/resources/cdn/resources/__init__.py new file mode 100644 index 00000000..e72105aa --- /dev/null +++ b/src/gcore/resources/cdn/resources/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .rules import ( + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, +) +from .shield import ( + ShieldResource, + AsyncShieldResource, + ShieldResourceWithRawResponse, + AsyncShieldResourceWithRawResponse, + ShieldResourceWithStreamingResponse, + AsyncShieldResourceWithStreamingResponse, +) +from .resources import ( + ResourcesResource, + AsyncResourcesResource, + ResourcesResourceWithRawResponse, + AsyncResourcesResourceWithRawResponse, + ResourcesResourceWithStreamingResponse, + AsyncResourcesResourceWithStreamingResponse, +) + +__all__ = [ + "ShieldResource", + "AsyncShieldResource", + "ShieldResourceWithRawResponse", + "AsyncShieldResourceWithRawResponse", + "ShieldResourceWithStreamingResponse", + "AsyncShieldResourceWithStreamingResponse", + "RulesResource", + "AsyncRulesResource", + "RulesResourceWithRawResponse", + "AsyncRulesResourceWithRawResponse", + "RulesResourceWithStreamingResponse", + "AsyncRulesResourceWithStreamingResponse", + "ResourcesResource", + "AsyncResourcesResource", + "ResourcesResourceWithRawResponse", + "AsyncResourcesResourceWithRawResponse", + "ResourcesResourceWithStreamingResponse", + "AsyncResourcesResourceWithStreamingResponse", +] diff --git a/src/gcore/resources/cdn/resources/resources.py b/src/gcore/resources/cdn/resources/resources.py new file mode 100644 index 00000000..02065307 --- /dev/null +++ b/src/gcore/resources/cdn/resources/resources.py @@ -0,0 +1,2060 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, overload + +import httpx + +from .rules import ( + RulesResource, + AsyncRulesResource, + RulesResourceWithRawResponse, + AsyncRulesResourceWithRawResponse, + RulesResourceWithStreamingResponse, + AsyncRulesResourceWithStreamingResponse, +) +from .shield import ( + ShieldResource, + AsyncShieldResource, + ShieldResourceWithRawResponse, + AsyncShieldResourceWithRawResponse, + ShieldResourceWithStreamingResponse, + AsyncShieldResourceWithStreamingResponse, +) +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....types.cdn import ( + resource_list_params, + resource_purge_params, + resource_create_params, + resource_update_params, + resource_replace_params, + resource_prefetch_params, +) +from ...._base_client import make_request_options +from ....types.cdn.cdn_resource import CdnResource +from ....types.cdn.cdn_resource_list import CdnResourceList + +__all__ = ["ResourcesResource", "AsyncResourcesResource"] + + +class ResourcesResource(SyncAPIResource): + @cached_property + def shield(self) -> ShieldResource: + return ShieldResource(self._client) + + @cached_property + def rules(self) -> RulesResource: + return RulesResource(self._client) + + @cached_property + def with_raw_response(self) -> ResourcesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return ResourcesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ResourcesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return ResourcesResourceWithStreamingResponse(self) + + def create( + self, + *, + cname: str, + origin: str, + origin_group: int, + active: bool | Omit = omit, + description: str | Omit = omit, + name: Optional[str] | Omit = omit, + options: resource_create_params.Options | Omit = omit, + origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, + primary_resource: Optional[int] | Omit = omit, + proxy_ssl_ca: Optional[int] | Omit = omit, + proxy_ssl_data: Optional[int] | Omit = omit, + proxy_ssl_enabled: bool | Omit = omit, + secondary_hostnames: SequenceNotStr[str] | Omit = omit, + ssl_data: Optional[int] | Omit = omit, + ssl_enabled: bool | Omit = omit, + waap_api_domain_enabled: bool | 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, + ) -> CdnResource: + """ + Create CDN resource + + Args: + cname: Delivery domains that will be used for content delivery through a CDN. + + Delivery domains should be added to your DNS settings. + + origin: IP address or domain name of the origin and the port, if custom port is used. + + You can use either the `origin` or `originGroup` parameter in the request. + + origin_group: Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + + active: Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + + description: Optional comment describing the CDN resource. + + name: CDN resource name. + + options: List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + + origin_protocol: Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + + primary_resource: ID of the main CDN resource which has a shared caching zone with a reserve CDN + resource. + + If the parameter is not empty, then the current CDN resource is the reserve. You + cannot change some options, create rules, set up origin shielding, or use the + reserve CDN resource for Streaming. + + proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_data: ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + + secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + + ssl_data: ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + + ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + + waap_api_domain_enabled: Defines whether the associated WAAP Domain is identified as an API Domain. + + Possible values: + + - **true** - The associated WAAP Domain is designated as an API Domain. + - **false** - The associated WAAP Domain is not designated as an API Domain. + + 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 + """ + return self._post( + "/cdn/resources" if self._client._base_url_overridden else "https://api.gcore.com//cdn/resources", + body=maybe_transform( + { + "cname": cname, + "origin": origin, + "origin_group": origin_group, + "active": active, + "description": description, + "name": name, + "options": options, + "origin_protocol": origin_protocol, + "primary_resource": primary_resource, + "proxy_ssl_ca": proxy_ssl_ca, + "proxy_ssl_data": proxy_ssl_data, + "proxy_ssl_enabled": proxy_ssl_enabled, + "secondary_hostnames": secondary_hostnames, + "ssl_data": ssl_data, + "ssl_enabled": ssl_enabled, + "waap_api_domain_enabled": waap_api_domain_enabled, + }, + resource_create_params.ResourceCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResource, + ) + + def update( + self, + resource_id: int, + *, + active: bool | Omit = omit, + description: str | Omit = omit, + name: Optional[str] | Omit = omit, + options: resource_update_params.Options | Omit = omit, + origin_group: int | Omit = omit, + origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, + proxy_ssl_ca: Optional[int] | Omit = omit, + proxy_ssl_data: Optional[int] | Omit = omit, + proxy_ssl_enabled: bool | Omit = omit, + secondary_hostnames: SequenceNotStr[str] | Omit = omit, + ssl_data: Optional[int] | Omit = omit, + ssl_enabled: bool | 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, + ) -> CdnResource: + """ + Change CDN resource + + Args: + active: Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + + description: Optional comment describing the CDN resource. + + name: CDN resource name. + + options: List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + + origin_group: Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + + origin_protocol: Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + + proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_data: ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + + secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + + ssl_data: ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + + ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + + 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 + """ + return self._patch( + f"/cdn/resources/{resource_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}", + body=maybe_transform( + { + "active": active, + "description": description, + "name": name, + "options": options, + "origin_group": origin_group, + "origin_protocol": origin_protocol, + "proxy_ssl_ca": proxy_ssl_ca, + "proxy_ssl_data": proxy_ssl_data, + "proxy_ssl_enabled": proxy_ssl_enabled, + "secondary_hostnames": secondary_hostnames, + "ssl_data": ssl_data, + "ssl_enabled": ssl_enabled, + }, + resource_update_params.ResourceUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResource, + ) + + def list( + self, + *, + cname: str | Omit = omit, + deleted: bool | Omit = omit, + enabled: bool | Omit = omit, + max_created: str | Omit = omit, + min_created: str | Omit = omit, + origin_group: int | Omit = omit, + rules: str | Omit = omit, + secondary_hostnames: str | Omit = omit, + shield_dc: str | Omit = omit, + shielded: bool | Omit = omit, + ssl_data: int | Omit = omit, + ssl_data_in: int | Omit = omit, + ssl_enabled: bool | Omit = omit, + status: Literal["active", "processed", "suspended", "deleted"] | Omit = omit, + suspend: bool | Omit = omit, + vp_enabled: bool | 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, + ) -> CdnResourceList: + """ + Get information about all CDN resources in your account. + + Args: + cname: Delivery domain (CNAME) of the CDN resource. + + deleted: Defines whether a CDN resource has been deleted. + + Possible values: + + - **true** - CDN resource has been deleted. + - **false** - CDN resource has not been deleted. + + enabled: Enables or disables a CDN resource change by a user. + + Possible values: + + - **true** - CDN resource is enabled. + - **false** - CDN resource is disabled. + + max_created: Most recent date of CDN resource creation for which CDN resources should be + returned (ISO 8601/RFC 3339 format, UTC.) + + min_created: Earliest date of CDN resource creation for which CDN resources should be + returned (ISO 8601/RFC 3339 format, UTC.) + + origin_group: Origin group ID. + + rules: Rule name or pattern. + + secondary_hostnames: Additional delivery domains (CNAMEs) of the CDN resource. + + shield_dc: Name of the origin shielding data center location. + + shielded: Defines whether origin shielding is enabled for the CDN resource. + + Possible values: + + - **true** - Origin shielding is enabled for the CDN resource. + - **false** - Origin shielding is disabled for the CDN resource. + + ssl_data: SSL certificate ID. + + ssl_data_in: SSL certificates IDs. + + Example: + + - ?`sslData_in`=1643,1644,1652 + + ssl_enabled: Defines whether the HTTPS protocol is enabled for content delivery. + + Possible values: + + - **true** - HTTPS protocol is enabled for CDN resource. + - **false** - HTTPS protocol is disabled for CDN resource. + + status: CDN resource status. + + suspend: Defines whether the CDN resource was automatically suspended by the system. + + Possible values: + + - **true** - CDN resource is selected for automatic suspension in the next 7 + days. + - **false** - CDN resource is not selected for automatic suspension. + + vp_enabled: Defines whether the CDN resource is integrated with the Streaming platform. + + Possible values: + + - **true** - CDN resource is used for Streaming platform. + - **false** - CDN resource is not used for Streaming platform. + + 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 + """ + return self._get( + "/cdn/resources" if self._client._base_url_overridden else "https://api.gcore.com//cdn/resources", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "cname": cname, + "deleted": deleted, + "enabled": enabled, + "max_created": max_created, + "min_created": min_created, + "origin_group": origin_group, + "rules": rules, + "secondary_hostnames": secondary_hostnames, + "shield_dc": shield_dc, + "shielded": shielded, + "ssl_data": ssl_data, + "ssl_data_in": ssl_data_in, + "ssl_enabled": ssl_enabled, + "status": status, + "suspend": suspend, + "vp_enabled": vp_enabled, + }, + resource_list_params.ResourceListParams, + ), + ), + cast_to=CdnResourceList, + ) + + def delete( + self, + resource_id: int, + *, + # 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, + ) -> None: + """ + Delete the CDN resource from the system permanently. + + Notes: + + - **Deactivation Requirement**: Set the `active` attribute to `false` before + deletion. + - **Statistics Availability**: Statistics will be available for **365 days** + after deletion through the + [statistics endpoints](/docs/api-reference/cdn/cdn-statistics/cdn-resource-statistics). + - **Irreversibility**: This action is irreversible. Once deleted, the CDN + resource cannot be recovered. + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/resources/{resource_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + resource_id: int, + *, + # 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, + ) -> CdnResource: + """ + Get CDN resource details + + Args: + 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 + """ + return self._get( + f"/cdn/resources/{resource_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResource, + ) + + def prefetch( + self, + resource_id: int, + *, + paths: SequenceNotStr[str], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """Pre-populate files to a CDN cache before users requests. + + Prefetch is recommended + only for files that **more than 200 MB** and **less than 5 GB**. + + You can make one prefetch request for a CDN resource per minute. One request for + prefetch may content only up to 100 paths to files. + + The time of procedure depends on the number and size of the files. + + If you need to update files stored in the CDN, first purge these files and then + prefetch. + + Args: + paths: Paths to files that should be pre-populated to the CDN. + + Paths to the files should be specified without a domain name. + + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/cdn/resources/{resource_id}/prefetch" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/prefetch", + body=maybe_transform({"paths": paths}, resource_prefetch_params.ResourcePrefetchParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def prevalidate_ssl_le_certificate( + self, + resource_id: int, + *, + # 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, + ) -> None: + """ + Check whether a Let's Encrypt certificate can be issued for the CDN resource. + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/cdn/resources/{resource_id}/ssl/le/pre-validate" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/ssl/le/pre-validate", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + @overload + def purge( + self, + resource_id: int, + *, + urls: SequenceNotStr[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, + ) -> None: + """Delete cache from CDN servers. + + This is necessary to update CDN content. + + We have different limits for different purge types: + + - **Purge all cache** - One purge request for a CDN resource per minute. + - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge + request is limited to 100 URLs. + - **Purge by pattern** - One purge request for a CDN resource per minute. One + purge request is limited to 10 patterns. + + Args: + urls: **Purge by URL** clears the cache of a specific files. This purge type is + recommended. + + Specify file URLs including query strings. URLs should start with / without a + domain name. + + Purge by URL depends on the following CDN options: + + 1. "vary response header" is used. If your origin serves variants of the same + content depending on the Vary HTTP response header, purge by URL will delete + only one version of the file. + 2. "slice" is used. If you update several files in the origin without clearing + the CDN cache, purge by URL will delete only the first slice (with bytes=0… + .) + 3. "ignoreQueryString" is used. Don’t specify parameters in the purge request. + 4. "`query_params_blacklist`" is used. Only files with the listed in the option + parameters will be cached as different objects. Files with other parameters + will be cached as one object. In this case, specify the listed parameters in + the Purge request. Don't specify other parameters. + 5. "`query_params_whitelist`" is used. Files with listed in the option + parameters will be cached as one object. Files with other parameters will be + cached as different objects. In this case, specify other parameters (if any) + besides the ones listed in the purge request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def purge( + self, + resource_id: int, + *, + paths: SequenceNotStr[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, + ) -> None: + """Delete cache from CDN servers. + + This is necessary to update CDN content. + + We have different limits for different purge types: + + - **Purge all cache** - One purge request for a CDN resource per minute. + - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge + request is limited to 100 URLs. + - **Purge by pattern** - One purge request for a CDN resource per minute. One + purge request is limited to 10 patterns. + + Args: + paths: **Purge by pattern** clears the cache that matches the pattern. + + Use \\** operator, which replaces any number of symbols in your path. It's + important to note that wildcard usage (\\**) is permitted only at the end of a + pattern. + + Query string added to any patterns will be ignored, and purge request will be + processed as if there weren't any parameters. + + Purge by pattern is recursive. Both /path and /path\\** will result in recursive + purging, meaning all content under the specified path will be affected. As such, + using the pattern /path\\** is functionally equivalent to simply using /path. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def purge( + self, + resource_id: int, + *, + paths: SequenceNotStr[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, + ) -> None: + """Delete cache from CDN servers. + + This is necessary to update CDN content. + + We have different limits for different purge types: + + - **Purge all cache** - One purge request for a CDN resource per minute. + - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge + request is limited to 100 URLs. + - **Purge by pattern** - One purge request for a CDN resource per minute. One + purge request is limited to 10 patterns. + + Args: + paths: **Purge all cache** clears the entire cache for the CDN resource. + + Specify an empty array to purge all content for the resource. + + When you purge all assets, CDN servers request content from your origin server + and cause a high load. Therefore, we recommend to use purge by URL for large + content quantities. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + def purge( + self, + resource_id: int, + *, + urls: SequenceNotStr[str] | Omit = omit, + paths: SequenceNotStr[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, + ) -> None: + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/cdn/resources/{resource_id}/purge" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/purge", + body=maybe_transform( + { + "urls": urls, + "paths": paths, + }, + resource_purge_params.ResourcePurgeParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def replace( + self, + resource_id: int, + *, + origin_group: int, + active: bool | Omit = omit, + description: str | Omit = omit, + name: Optional[str] | Omit = omit, + options: resource_replace_params.Options | Omit = omit, + origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, + proxy_ssl_ca: Optional[int] | Omit = omit, + proxy_ssl_data: Optional[int] | Omit = omit, + proxy_ssl_enabled: bool | Omit = omit, + secondary_hostnames: SequenceNotStr[str] | Omit = omit, + ssl_data: Optional[int] | Omit = omit, + ssl_enabled: bool | Omit = omit, + waap_api_domain_enabled: bool | 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, + ) -> CdnResource: + """ + Change CDN resource + + Args: + origin_group: Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + + active: Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + + description: Optional comment describing the CDN resource. + + name: CDN resource name. + + options: List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + + origin_protocol: Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + + proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_data: ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + + secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + + ssl_data: ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + + ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + + waap_api_domain_enabled: Defines whether the associated WAAP Domain is identified as an API Domain. + + Possible values: + + - **true** - The associated WAAP Domain is designated as an API Domain. + - **false** - The associated WAAP Domain is not designated as an API Domain. + + 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 + """ + return self._put( + f"/cdn/resources/{resource_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}", + body=maybe_transform( + { + "origin_group": origin_group, + "active": active, + "description": description, + "name": name, + "options": options, + "origin_protocol": origin_protocol, + "proxy_ssl_ca": proxy_ssl_ca, + "proxy_ssl_data": proxy_ssl_data, + "proxy_ssl_enabled": proxy_ssl_enabled, + "secondary_hostnames": secondary_hostnames, + "ssl_data": ssl_data, + "ssl_enabled": ssl_enabled, + "waap_api_domain_enabled": waap_api_domain_enabled, + }, + resource_replace_params.ResourceReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResource, + ) + + +class AsyncResourcesResource(AsyncAPIResource): + @cached_property + def shield(self) -> AsyncShieldResource: + return AsyncShieldResource(self._client) + + @cached_property + def rules(self) -> AsyncRulesResource: + return AsyncRulesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncResourcesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncResourcesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncResourcesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncResourcesResourceWithStreamingResponse(self) + + async def create( + self, + *, + cname: str, + origin: str, + origin_group: int, + active: bool | Omit = omit, + description: str | Omit = omit, + name: Optional[str] | Omit = omit, + options: resource_create_params.Options | Omit = omit, + origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, + primary_resource: Optional[int] | Omit = omit, + proxy_ssl_ca: Optional[int] | Omit = omit, + proxy_ssl_data: Optional[int] | Omit = omit, + proxy_ssl_enabled: bool | Omit = omit, + secondary_hostnames: SequenceNotStr[str] | Omit = omit, + ssl_data: Optional[int] | Omit = omit, + ssl_enabled: bool | Omit = omit, + waap_api_domain_enabled: bool | 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, + ) -> CdnResource: + """ + Create CDN resource + + Args: + cname: Delivery domains that will be used for content delivery through a CDN. + + Delivery domains should be added to your DNS settings. + + origin: IP address or domain name of the origin and the port, if custom port is used. + + You can use either the `origin` or `originGroup` parameter in the request. + + origin_group: Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + + active: Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + + description: Optional comment describing the CDN resource. + + name: CDN resource name. + + options: List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + + origin_protocol: Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + + primary_resource: ID of the main CDN resource which has a shared caching zone with a reserve CDN + resource. + + If the parameter is not empty, then the current CDN resource is the reserve. You + cannot change some options, create rules, set up origin shielding, or use the + reserve CDN resource for Streaming. + + proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_data: ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + + secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + + ssl_data: ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + + ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + + waap_api_domain_enabled: Defines whether the associated WAAP Domain is identified as an API Domain. + + Possible values: + + - **true** - The associated WAAP Domain is designated as an API Domain. + - **false** - The associated WAAP Domain is not designated as an API Domain. + + 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 + """ + return await self._post( + "/cdn/resources" if self._client._base_url_overridden else "https://api.gcore.com//cdn/resources", + body=await async_maybe_transform( + { + "cname": cname, + "origin": origin, + "origin_group": origin_group, + "active": active, + "description": description, + "name": name, + "options": options, + "origin_protocol": origin_protocol, + "primary_resource": primary_resource, + "proxy_ssl_ca": proxy_ssl_ca, + "proxy_ssl_data": proxy_ssl_data, + "proxy_ssl_enabled": proxy_ssl_enabled, + "secondary_hostnames": secondary_hostnames, + "ssl_data": ssl_data, + "ssl_enabled": ssl_enabled, + "waap_api_domain_enabled": waap_api_domain_enabled, + }, + resource_create_params.ResourceCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResource, + ) + + async def update( + self, + resource_id: int, + *, + active: bool | Omit = omit, + description: str | Omit = omit, + name: Optional[str] | Omit = omit, + options: resource_update_params.Options | Omit = omit, + origin_group: int | Omit = omit, + origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, + proxy_ssl_ca: Optional[int] | Omit = omit, + proxy_ssl_data: Optional[int] | Omit = omit, + proxy_ssl_enabled: bool | Omit = omit, + secondary_hostnames: SequenceNotStr[str] | Omit = omit, + ssl_data: Optional[int] | Omit = omit, + ssl_enabled: bool | 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, + ) -> CdnResource: + """ + Change CDN resource + + Args: + active: Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + + description: Optional comment describing the CDN resource. + + name: CDN resource name. + + options: List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + + origin_group: Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + + origin_protocol: Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + + proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_data: ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + + secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + + ssl_data: ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + + ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + + 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 + """ + return await self._patch( + f"/cdn/resources/{resource_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}", + body=await async_maybe_transform( + { + "active": active, + "description": description, + "name": name, + "options": options, + "origin_group": origin_group, + "origin_protocol": origin_protocol, + "proxy_ssl_ca": proxy_ssl_ca, + "proxy_ssl_data": proxy_ssl_data, + "proxy_ssl_enabled": proxy_ssl_enabled, + "secondary_hostnames": secondary_hostnames, + "ssl_data": ssl_data, + "ssl_enabled": ssl_enabled, + }, + resource_update_params.ResourceUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResource, + ) + + async def list( + self, + *, + cname: str | Omit = omit, + deleted: bool | Omit = omit, + enabled: bool | Omit = omit, + max_created: str | Omit = omit, + min_created: str | Omit = omit, + origin_group: int | Omit = omit, + rules: str | Omit = omit, + secondary_hostnames: str | Omit = omit, + shield_dc: str | Omit = omit, + shielded: bool | Omit = omit, + ssl_data: int | Omit = omit, + ssl_data_in: int | Omit = omit, + ssl_enabled: bool | Omit = omit, + status: Literal["active", "processed", "suspended", "deleted"] | Omit = omit, + suspend: bool | Omit = omit, + vp_enabled: bool | 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, + ) -> CdnResourceList: + """ + Get information about all CDN resources in your account. + + Args: + cname: Delivery domain (CNAME) of the CDN resource. + + deleted: Defines whether a CDN resource has been deleted. + + Possible values: + + - **true** - CDN resource has been deleted. + - **false** - CDN resource has not been deleted. + + enabled: Enables or disables a CDN resource change by a user. + + Possible values: + + - **true** - CDN resource is enabled. + - **false** - CDN resource is disabled. + + max_created: Most recent date of CDN resource creation for which CDN resources should be + returned (ISO 8601/RFC 3339 format, UTC.) + + min_created: Earliest date of CDN resource creation for which CDN resources should be + returned (ISO 8601/RFC 3339 format, UTC.) + + origin_group: Origin group ID. + + rules: Rule name or pattern. + + secondary_hostnames: Additional delivery domains (CNAMEs) of the CDN resource. + + shield_dc: Name of the origin shielding data center location. + + shielded: Defines whether origin shielding is enabled for the CDN resource. + + Possible values: + + - **true** - Origin shielding is enabled for the CDN resource. + - **false** - Origin shielding is disabled for the CDN resource. + + ssl_data: SSL certificate ID. + + ssl_data_in: SSL certificates IDs. + + Example: + + - ?`sslData_in`=1643,1644,1652 + + ssl_enabled: Defines whether the HTTPS protocol is enabled for content delivery. + + Possible values: + + - **true** - HTTPS protocol is enabled for CDN resource. + - **false** - HTTPS protocol is disabled for CDN resource. + + status: CDN resource status. + + suspend: Defines whether the CDN resource was automatically suspended by the system. + + Possible values: + + - **true** - CDN resource is selected for automatic suspension in the next 7 + days. + - **false** - CDN resource is not selected for automatic suspension. + + vp_enabled: Defines whether the CDN resource is integrated with the Streaming platform. + + Possible values: + + - **true** - CDN resource is used for Streaming platform. + - **false** - CDN resource is not used for Streaming platform. + + 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 + """ + return await self._get( + "/cdn/resources" if self._client._base_url_overridden else "https://api.gcore.com//cdn/resources", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "cname": cname, + "deleted": deleted, + "enabled": enabled, + "max_created": max_created, + "min_created": min_created, + "origin_group": origin_group, + "rules": rules, + "secondary_hostnames": secondary_hostnames, + "shield_dc": shield_dc, + "shielded": shielded, + "ssl_data": ssl_data, + "ssl_data_in": ssl_data_in, + "ssl_enabled": ssl_enabled, + "status": status, + "suspend": suspend, + "vp_enabled": vp_enabled, + }, + resource_list_params.ResourceListParams, + ), + ), + cast_to=CdnResourceList, + ) + + async def delete( + self, + resource_id: int, + *, + # 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, + ) -> None: + """ + Delete the CDN resource from the system permanently. + + Notes: + + - **Deactivation Requirement**: Set the `active` attribute to `false` before + deletion. + - **Statistics Availability**: Statistics will be available for **365 days** + after deletion through the + [statistics endpoints](/docs/api-reference/cdn/cdn-statistics/cdn-resource-statistics). + - **Irreversibility**: This action is irreversible. Once deleted, the CDN + resource cannot be recovered. + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/resources/{resource_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + resource_id: int, + *, + # 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, + ) -> CdnResource: + """ + Get CDN resource details + + Args: + 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 + """ + return await self._get( + f"/cdn/resources/{resource_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResource, + ) + + async def prefetch( + self, + resource_id: int, + *, + paths: SequenceNotStr[str], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> None: + """Pre-populate files to a CDN cache before users requests. + + Prefetch is recommended + only for files that **more than 200 MB** and **less than 5 GB**. + + You can make one prefetch request for a CDN resource per minute. One request for + prefetch may content only up to 100 paths to files. + + The time of procedure depends on the number and size of the files. + + If you need to update files stored in the CDN, first purge these files and then + prefetch. + + Args: + paths: Paths to files that should be pre-populated to the CDN. + + Paths to the files should be specified without a domain name. + + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/cdn/resources/{resource_id}/prefetch" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/prefetch", + body=await async_maybe_transform({"paths": paths}, resource_prefetch_params.ResourcePrefetchParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def prevalidate_ssl_le_certificate( + self, + resource_id: int, + *, + # 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, + ) -> None: + """ + Check whether a Let's Encrypt certificate can be issued for the CDN resource. + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/cdn/resources/{resource_id}/ssl/le/pre-validate" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/ssl/le/pre-validate", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + @overload + async def purge( + self, + resource_id: int, + *, + urls: SequenceNotStr[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, + ) -> None: + """Delete cache from CDN servers. + + This is necessary to update CDN content. + + We have different limits for different purge types: + + - **Purge all cache** - One purge request for a CDN resource per minute. + - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge + request is limited to 100 URLs. + - **Purge by pattern** - One purge request for a CDN resource per minute. One + purge request is limited to 10 patterns. + + Args: + urls: **Purge by URL** clears the cache of a specific files. This purge type is + recommended. + + Specify file URLs including query strings. URLs should start with / without a + domain name. + + Purge by URL depends on the following CDN options: + + 1. "vary response header" is used. If your origin serves variants of the same + content depending on the Vary HTTP response header, purge by URL will delete + only one version of the file. + 2. "slice" is used. If you update several files in the origin without clearing + the CDN cache, purge by URL will delete only the first slice (with bytes=0… + .) + 3. "ignoreQueryString" is used. Don’t specify parameters in the purge request. + 4. "`query_params_blacklist`" is used. Only files with the listed in the option + parameters will be cached as different objects. Files with other parameters + will be cached as one object. In this case, specify the listed parameters in + the Purge request. Don't specify other parameters. + 5. "`query_params_whitelist`" is used. Files with listed in the option + parameters will be cached as one object. Files with other parameters will be + cached as different objects. In this case, specify other parameters (if any) + besides the ones listed in the purge request. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def purge( + self, + resource_id: int, + *, + paths: SequenceNotStr[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, + ) -> None: + """Delete cache from CDN servers. + + This is necessary to update CDN content. + + We have different limits for different purge types: + + - **Purge all cache** - One purge request for a CDN resource per minute. + - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge + request is limited to 100 URLs. + - **Purge by pattern** - One purge request for a CDN resource per minute. One + purge request is limited to 10 patterns. + + Args: + paths: **Purge by pattern** clears the cache that matches the pattern. + + Use \\** operator, which replaces any number of symbols in your path. It's + important to note that wildcard usage (\\**) is permitted only at the end of a + pattern. + + Query string added to any patterns will be ignored, and purge request will be + processed as if there weren't any parameters. + + Purge by pattern is recursive. Both /path and /path\\** will result in recursive + purging, meaning all content under the specified path will be affected. As such, + using the pattern /path\\** is functionally equivalent to simply using /path. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def purge( + self, + resource_id: int, + *, + paths: SequenceNotStr[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, + ) -> None: + """Delete cache from CDN servers. + + This is necessary to update CDN content. + + We have different limits for different purge types: + + - **Purge all cache** - One purge request for a CDN resource per minute. + - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge + request is limited to 100 URLs. + - **Purge by pattern** - One purge request for a CDN resource per minute. One + purge request is limited to 10 patterns. + + Args: + paths: **Purge all cache** clears the entire cache for the CDN resource. + + Specify an empty array to purge all content for the resource. + + When you purge all assets, CDN servers request content from your origin server + and cause a high load. Therefore, we recommend to use purge by URL for large + content quantities. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + async def purge( + self, + resource_id: int, + *, + urls: SequenceNotStr[str] | Omit = omit, + paths: SequenceNotStr[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, + ) -> None: + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/cdn/resources/{resource_id}/purge" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/purge", + body=await async_maybe_transform( + { + "urls": urls, + "paths": paths, + }, + resource_purge_params.ResourcePurgeParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def replace( + self, + resource_id: int, + *, + origin_group: int, + active: bool | Omit = omit, + description: str | Omit = omit, + name: Optional[str] | Omit = omit, + options: resource_replace_params.Options | Omit = omit, + origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit, + proxy_ssl_ca: Optional[int] | Omit = omit, + proxy_ssl_data: Optional[int] | Omit = omit, + proxy_ssl_enabled: bool | Omit = omit, + secondary_hostnames: SequenceNotStr[str] | Omit = omit, + ssl_data: Optional[int] | Omit = omit, + ssl_enabled: bool | Omit = omit, + waap_api_domain_enabled: bool | 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, + ) -> CdnResource: + """ + Change CDN resource + + Args: + origin_group: Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + + active: Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + + description: Optional comment describing the CDN resource. + + name: CDN resource name. + + options: List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + + origin_protocol: Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + + proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_data: ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + + proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + + secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + + ssl_data: ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + + ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + + waap_api_domain_enabled: Defines whether the associated WAAP Domain is identified as an API Domain. + + Possible values: + + - **true** - The associated WAAP Domain is designated as an API Domain. + - **false** - The associated WAAP Domain is not designated as an API Domain. + + 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 + """ + return await self._put( + f"/cdn/resources/{resource_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}", + body=await async_maybe_transform( + { + "origin_group": origin_group, + "active": active, + "description": description, + "name": name, + "options": options, + "origin_protocol": origin_protocol, + "proxy_ssl_ca": proxy_ssl_ca, + "proxy_ssl_data": proxy_ssl_data, + "proxy_ssl_enabled": proxy_ssl_enabled, + "secondary_hostnames": secondary_hostnames, + "ssl_data": ssl_data, + "ssl_enabled": ssl_enabled, + "waap_api_domain_enabled": waap_api_domain_enabled, + }, + resource_replace_params.ResourceReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResource, + ) + + +class ResourcesResourceWithRawResponse: + def __init__(self, resources: ResourcesResource) -> None: + self._resources = resources + + self.create = to_raw_response_wrapper( + resources.create, + ) + self.update = to_raw_response_wrapper( + resources.update, + ) + self.list = to_raw_response_wrapper( + resources.list, + ) + self.delete = to_raw_response_wrapper( + resources.delete, + ) + self.get = to_raw_response_wrapper( + resources.get, + ) + self.prefetch = to_raw_response_wrapper( + resources.prefetch, + ) + self.prevalidate_ssl_le_certificate = to_raw_response_wrapper( + resources.prevalidate_ssl_le_certificate, + ) + self.purge = to_raw_response_wrapper( + resources.purge, + ) + self.replace = to_raw_response_wrapper( + resources.replace, + ) + + @cached_property + def shield(self) -> ShieldResourceWithRawResponse: + return ShieldResourceWithRawResponse(self._resources.shield) + + @cached_property + def rules(self) -> RulesResourceWithRawResponse: + return RulesResourceWithRawResponse(self._resources.rules) + + +class AsyncResourcesResourceWithRawResponse: + def __init__(self, resources: AsyncResourcesResource) -> None: + self._resources = resources + + self.create = async_to_raw_response_wrapper( + resources.create, + ) + self.update = async_to_raw_response_wrapper( + resources.update, + ) + self.list = async_to_raw_response_wrapper( + resources.list, + ) + self.delete = async_to_raw_response_wrapper( + resources.delete, + ) + self.get = async_to_raw_response_wrapper( + resources.get, + ) + self.prefetch = async_to_raw_response_wrapper( + resources.prefetch, + ) + self.prevalidate_ssl_le_certificate = async_to_raw_response_wrapper( + resources.prevalidate_ssl_le_certificate, + ) + self.purge = async_to_raw_response_wrapper( + resources.purge, + ) + self.replace = async_to_raw_response_wrapper( + resources.replace, + ) + + @cached_property + def shield(self) -> AsyncShieldResourceWithRawResponse: + return AsyncShieldResourceWithRawResponse(self._resources.shield) + + @cached_property + def rules(self) -> AsyncRulesResourceWithRawResponse: + return AsyncRulesResourceWithRawResponse(self._resources.rules) + + +class ResourcesResourceWithStreamingResponse: + def __init__(self, resources: ResourcesResource) -> None: + self._resources = resources + + self.create = to_streamed_response_wrapper( + resources.create, + ) + self.update = to_streamed_response_wrapper( + resources.update, + ) + self.list = to_streamed_response_wrapper( + resources.list, + ) + self.delete = to_streamed_response_wrapper( + resources.delete, + ) + self.get = to_streamed_response_wrapper( + resources.get, + ) + self.prefetch = to_streamed_response_wrapper( + resources.prefetch, + ) + self.prevalidate_ssl_le_certificate = to_streamed_response_wrapper( + resources.prevalidate_ssl_le_certificate, + ) + self.purge = to_streamed_response_wrapper( + resources.purge, + ) + self.replace = to_streamed_response_wrapper( + resources.replace, + ) + + @cached_property + def shield(self) -> ShieldResourceWithStreamingResponse: + return ShieldResourceWithStreamingResponse(self._resources.shield) + + @cached_property + def rules(self) -> RulesResourceWithStreamingResponse: + return RulesResourceWithStreamingResponse(self._resources.rules) + + +class AsyncResourcesResourceWithStreamingResponse: + def __init__(self, resources: AsyncResourcesResource) -> None: + self._resources = resources + + self.create = async_to_streamed_response_wrapper( + resources.create, + ) + self.update = async_to_streamed_response_wrapper( + resources.update, + ) + self.list = async_to_streamed_response_wrapper( + resources.list, + ) + self.delete = async_to_streamed_response_wrapper( + resources.delete, + ) + self.get = async_to_streamed_response_wrapper( + resources.get, + ) + self.prefetch = async_to_streamed_response_wrapper( + resources.prefetch, + ) + self.prevalidate_ssl_le_certificate = async_to_streamed_response_wrapper( + resources.prevalidate_ssl_le_certificate, + ) + self.purge = async_to_streamed_response_wrapper( + resources.purge, + ) + self.replace = async_to_streamed_response_wrapper( + resources.replace, + ) + + @cached_property + def shield(self) -> AsyncShieldResourceWithStreamingResponse: + return AsyncShieldResourceWithStreamingResponse(self._resources.shield) + + @cached_property + def rules(self) -> AsyncRulesResourceWithStreamingResponse: + return AsyncRulesResourceWithStreamingResponse(self._resources.rules) diff --git a/src/gcore/resources/cdn/resources/rules.py b/src/gcore/resources/cdn/resources/rules.py new file mode 100644 index 00000000..11dd3eda --- /dev/null +++ b/src/gcore/resources/cdn/resources/rules.py @@ -0,0 +1,1027 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal + +import httpx + +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cdn.resources import rule_create_params, rule_update_params, rule_replace_params +from ....types.cdn.resources.cdn_resource_rule import CdnResourceRule +from ....types.cdn.resources.rule_list_response import RuleListResponse + +__all__ = ["RulesResource", "AsyncRulesResource"] + + +class RulesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RulesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return RulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RulesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return RulesResourceWithStreamingResponse(self) + + def create( + self, + resource_id: int, + *, + name: str, + rule: str, + rule_type: int, + active: bool | Omit = omit, + options: rule_create_params.Options | Omit = omit, + origin_group: Optional[int] | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + weight: 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, + ) -> CdnResourceRule: + """ + Create rule + + Args: + name: Rule name. + + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + active: Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + origin_group: ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + 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 + """ + return self._post( + f"/cdn/resources/{resource_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules", + body=maybe_transform( + { + "name": name, + "rule": rule, + "rule_type": rule_type, + "active": active, + "options": options, + "origin_group": origin_group, + "override_origin_protocol": override_origin_protocol, + "weight": weight, + }, + rule_create_params.RuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResourceRule, + ) + + def update( + self, + rule_id: int, + *, + resource_id: int, + active: bool | Omit = omit, + name: str | Omit = omit, + options: rule_update_params.Options | Omit = omit, + origin_group: Optional[int] | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + rule: str | Omit = omit, + rule_type: int | Omit = omit, + weight: 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, + ) -> CdnResourceRule: + """ + Change rule + + Args: + active: Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + + name: Rule name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + origin_group: ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + 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 + """ + return self._patch( + f"/cdn/resources/{resource_id}/rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + body=maybe_transform( + { + "active": active, + "name": name, + "options": options, + "origin_group": origin_group, + "override_origin_protocol": override_origin_protocol, + "rule": rule, + "rule_type": rule_type, + "weight": weight, + }, + rule_update_params.RuleUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResourceRule, + ) + + def list( + self, + resource_id: int, + *, + # 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, + ) -> RuleListResponse: + """ + Get rules list + + Args: + 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 + """ + return self._get( + f"/cdn/resources/{resource_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleListResponse, + ) + + def delete( + self, + rule_id: int, + *, + resource_id: int, + # 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, + ) -> None: + """ + Delete the rule from the system permanently. + + Notes: + + - **Deactivation Requirement**: Set the `active` attribute to `false` before + deletion. + - **Irreversibility**: This action is irreversible. Once deleted, the rule + cannot be recovered. + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/resources/{resource_id}/rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + rule_id: int, + *, + resource_id: int, + # 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, + ) -> CdnResourceRule: + """ + Get rule details + + Args: + 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 + """ + return self._get( + f"/cdn/resources/{resource_id}/rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResourceRule, + ) + + def replace( + self, + rule_id: int, + *, + resource_id: int, + rule: str, + rule_type: int, + active: bool | Omit = omit, + name: str | Omit = omit, + options: rule_replace_params.Options | Omit = omit, + origin_group: Optional[int] | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + weight: 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, + ) -> CdnResourceRule: + """ + Change rule + + Args: + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + active: Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + + name: Rule name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + origin_group: ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + 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 + """ + return self._put( + f"/cdn/resources/{resource_id}/rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + body=maybe_transform( + { + "rule": rule, + "rule_type": rule_type, + "active": active, + "name": name, + "options": options, + "origin_group": origin_group, + "override_origin_protocol": override_origin_protocol, + "weight": weight, + }, + rule_replace_params.RuleReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResourceRule, + ) + + +class AsyncRulesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncRulesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncRulesResourceWithStreamingResponse(self) + + async def create( + self, + resource_id: int, + *, + name: str, + rule: str, + rule_type: int, + active: bool | Omit = omit, + options: rule_create_params.Options | Omit = omit, + origin_group: Optional[int] | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + weight: 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, + ) -> CdnResourceRule: + """ + Create rule + + Args: + name: Rule name. + + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + active: Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + origin_group: ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + 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 + """ + return await self._post( + f"/cdn/resources/{resource_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules", + body=await async_maybe_transform( + { + "name": name, + "rule": rule, + "rule_type": rule_type, + "active": active, + "options": options, + "origin_group": origin_group, + "override_origin_protocol": override_origin_protocol, + "weight": weight, + }, + rule_create_params.RuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResourceRule, + ) + + async def update( + self, + rule_id: int, + *, + resource_id: int, + active: bool | Omit = omit, + name: str | Omit = omit, + options: rule_update_params.Options | Omit = omit, + origin_group: Optional[int] | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + rule: str | Omit = omit, + rule_type: int | Omit = omit, + weight: 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, + ) -> CdnResourceRule: + """ + Change rule + + Args: + active: Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + + name: Rule name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + origin_group: ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + 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 + """ + return await self._patch( + f"/cdn/resources/{resource_id}/rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + body=await async_maybe_transform( + { + "active": active, + "name": name, + "options": options, + "origin_group": origin_group, + "override_origin_protocol": override_origin_protocol, + "rule": rule, + "rule_type": rule_type, + "weight": weight, + }, + rule_update_params.RuleUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResourceRule, + ) + + async def list( + self, + resource_id: int, + *, + # 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, + ) -> RuleListResponse: + """ + Get rules list + + Args: + 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 + """ + return await self._get( + f"/cdn/resources/{resource_id}/rules" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleListResponse, + ) + + async def delete( + self, + rule_id: int, + *, + resource_id: int, + # 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, + ) -> None: + """ + Delete the rule from the system permanently. + + Notes: + + - **Deactivation Requirement**: Set the `active` attribute to `false` before + deletion. + - **Irreversibility**: This action is irreversible. Once deleted, the rule + cannot be recovered. + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/resources/{resource_id}/rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + rule_id: int, + *, + resource_id: int, + # 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, + ) -> CdnResourceRule: + """ + Get rule details + + Args: + 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 + """ + return await self._get( + f"/cdn/resources/{resource_id}/rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResourceRule, + ) + + async def replace( + self, + rule_id: int, + *, + resource_id: int, + rule: str, + rule_type: int, + active: bool | Omit = omit, + name: str | Omit = omit, + options: rule_replace_params.Options | Omit = omit, + origin_group: Optional[int] | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + weight: 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, + ) -> CdnResourceRule: + """ + Change rule + + Args: + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + active: Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + + name: Rule name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + origin_group: ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + 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 + """ + return await self._put( + f"/cdn/resources/{resource_id}/rules/{rule_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/rules/{rule_id}", + body=await async_maybe_transform( + { + "rule": rule, + "rule_type": rule_type, + "active": active, + "name": name, + "options": options, + "origin_group": origin_group, + "override_origin_protocol": override_origin_protocol, + "weight": weight, + }, + rule_replace_params.RuleReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CdnResourceRule, + ) + + +class RulesResourceWithRawResponse: + def __init__(self, rules: RulesResource) -> None: + self._rules = rules + + self.create = to_raw_response_wrapper( + rules.create, + ) + self.update = to_raw_response_wrapper( + rules.update, + ) + self.list = to_raw_response_wrapper( + rules.list, + ) + self.delete = to_raw_response_wrapper( + rules.delete, + ) + self.get = to_raw_response_wrapper( + rules.get, + ) + self.replace = to_raw_response_wrapper( + rules.replace, + ) + + +class AsyncRulesResourceWithRawResponse: + def __init__(self, rules: AsyncRulesResource) -> None: + self._rules = rules + + self.create = async_to_raw_response_wrapper( + rules.create, + ) + self.update = async_to_raw_response_wrapper( + rules.update, + ) + self.list = async_to_raw_response_wrapper( + rules.list, + ) + self.delete = async_to_raw_response_wrapper( + rules.delete, + ) + self.get = async_to_raw_response_wrapper( + rules.get, + ) + self.replace = async_to_raw_response_wrapper( + rules.replace, + ) + + +class RulesResourceWithStreamingResponse: + def __init__(self, rules: RulesResource) -> None: + self._rules = rules + + self.create = to_streamed_response_wrapper( + rules.create, + ) + self.update = to_streamed_response_wrapper( + rules.update, + ) + self.list = to_streamed_response_wrapper( + rules.list, + ) + self.delete = to_streamed_response_wrapper( + rules.delete, + ) + self.get = to_streamed_response_wrapper( + rules.get, + ) + self.replace = to_streamed_response_wrapper( + rules.replace, + ) + + +class AsyncRulesResourceWithStreamingResponse: + def __init__(self, rules: AsyncRulesResource) -> None: + self._rules = rules + + self.create = async_to_streamed_response_wrapper( + rules.create, + ) + self.update = async_to_streamed_response_wrapper( + rules.update, + ) + self.list = async_to_streamed_response_wrapper( + rules.list, + ) + self.delete = async_to_streamed_response_wrapper( + rules.delete, + ) + self.get = async_to_streamed_response_wrapper( + rules.get, + ) + self.replace = async_to_streamed_response_wrapper( + rules.replace, + ) diff --git a/src/gcore/resources/cdn/resources/shield.py b/src/gcore/resources/cdn/resources/shield.py new file mode 100644 index 00000000..1d7d3bc9 --- /dev/null +++ b/src/gcore/resources/cdn/resources/shield.py @@ -0,0 +1,259 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional + +import httpx + +from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ...._utils import maybe_transform, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.cdn.resources import shield_replace_params +from ....types.cdn.resources.origin_shielding import OriginShielding + +__all__ = ["ShieldResource", "AsyncShieldResource"] + + +class ShieldResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ShieldResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return ShieldResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ShieldResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return ShieldResourceWithStreamingResponse(self) + + def get( + self, + resource_id: int, + *, + # 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, + ) -> OriginShielding: + """ + Get information about origin shielding. + + Args: + 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 + """ + return self._get( + f"/cdn/resources/{resource_id}/shielding_v2" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/shielding_v2", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=OriginShielding, + ) + + def replace( + self, + resource_id: int, + *, + shielding_pop: Optional[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, + ) -> object: + """ + Change origin shielding settings or disabled origin shielding. + + Args: + shielding_pop: Shielding location ID. + + If origin shielding is disabled, the parameter value is **null**. + + 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 + """ + return self._put( + f"/cdn/resources/{resource_id}/shielding_v2" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/shielding_v2", + body=maybe_transform({"shielding_pop": shielding_pop}, shield_replace_params.ShieldReplaceParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + +class AsyncShieldResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncShieldResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncShieldResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncShieldResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncShieldResourceWithStreamingResponse(self) + + async def get( + self, + resource_id: int, + *, + # 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, + ) -> OriginShielding: + """ + Get information about origin shielding. + + Args: + 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 + """ + return await self._get( + f"/cdn/resources/{resource_id}/shielding_v2" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/shielding_v2", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=OriginShielding, + ) + + async def replace( + self, + resource_id: int, + *, + shielding_pop: Optional[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, + ) -> object: + """ + Change origin shielding settings or disabled origin shielding. + + Args: + shielding_pop: Shielding location ID. + + If origin shielding is disabled, the parameter value is **null**. + + 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 + """ + return await self._put( + f"/cdn/resources/{resource_id}/shielding_v2" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/{resource_id}/shielding_v2", + body=await async_maybe_transform( + {"shielding_pop": shielding_pop}, shield_replace_params.ShieldReplaceParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + +class ShieldResourceWithRawResponse: + def __init__(self, shield: ShieldResource) -> None: + self._shield = shield + + self.get = to_raw_response_wrapper( + shield.get, + ) + self.replace = to_raw_response_wrapper( + shield.replace, + ) + + +class AsyncShieldResourceWithRawResponse: + def __init__(self, shield: AsyncShieldResource) -> None: + self._shield = shield + + self.get = async_to_raw_response_wrapper( + shield.get, + ) + self.replace = async_to_raw_response_wrapper( + shield.replace, + ) + + +class ShieldResourceWithStreamingResponse: + def __init__(self, shield: ShieldResource) -> None: + self._shield = shield + + self.get = to_streamed_response_wrapper( + shield.get, + ) + self.replace = to_streamed_response_wrapper( + shield.replace, + ) + + +class AsyncShieldResourceWithStreamingResponse: + def __init__(self, shield: AsyncShieldResource) -> None: + self._shield = shield + + self.get = async_to_streamed_response_wrapper( + shield.get, + ) + self.replace = async_to_streamed_response_wrapper( + shield.replace, + ) diff --git a/src/gcore/resources/cdn/rule_templates.py b/src/gcore/resources/cdn/rule_templates.py new file mode 100644 index 00000000..a48777d2 --- /dev/null +++ b/src/gcore/resources/cdn/rule_templates.py @@ -0,0 +1,883 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal + +import httpx + +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import rule_template_create_params, rule_template_update_params, rule_template_replace_params +from ..._base_client import make_request_options +from ...types.cdn.rule_template import RuleTemplate +from ...types.cdn.rule_template_list import RuleTemplateList + +__all__ = ["RuleTemplatesResource", "AsyncRuleTemplatesResource"] + + +class RuleTemplatesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RuleTemplatesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return RuleTemplatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RuleTemplatesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return RuleTemplatesResourceWithStreamingResponse(self) + + def create( + self, + *, + rule: str, + rule_type: int, + name: str | Omit = omit, + options: rule_template_create_params.Options | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + weight: 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, + ) -> RuleTemplate: + """ + Create rule template + + Args: + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + name: Rule template name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + 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 + """ + return self._post( + "/cdn/resources/rule_templates" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/resources/rule_templates", + body=maybe_transform( + { + "rule": rule, + "rule_type": rule_type, + "name": name, + "options": options, + "override_origin_protocol": override_origin_protocol, + "weight": weight, + }, + rule_template_create_params.RuleTemplateCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplate, + ) + + def update( + self, + rule_template_id: int, + *, + name: str | Omit = omit, + options: rule_template_update_params.Options | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + rule: str | Omit = omit, + rule_type: int | Omit = omit, + weight: 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, + ) -> RuleTemplate: + """ + Change rule template + + Args: + name: Rule template name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + 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 + """ + return self._patch( + f"/cdn/resources/rule_templates/{rule_template_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + body=maybe_transform( + { + "name": name, + "options": options, + "override_origin_protocol": override_origin_protocol, + "rule": rule, + "rule_type": rule_type, + "weight": weight, + }, + rule_template_update_params.RuleTemplateUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplate, + ) + + def list( + 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, + ) -> RuleTemplateList: + """Get rule templates list""" + return self._get( + "/cdn/resources/rule_templates" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/resources/rule_templates", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplateList, + ) + + def delete( + self, + rule_template_id: int, + *, + # 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, + ) -> None: + """ + Delete rule template + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/resources/rule_templates/{rule_template_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + rule_template_id: int, + *, + # 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, + ) -> RuleTemplate: + """ + Get rule template details + + Args: + 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 + """ + return self._get( + f"/cdn/resources/rule_templates/{rule_template_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplate, + ) + + def replace( + self, + rule_template_id: int, + *, + rule: str, + rule_type: int, + name: str | Omit = omit, + options: rule_template_replace_params.Options | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + weight: 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, + ) -> RuleTemplate: + """ + Change rule template + + Args: + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + name: Rule template name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + 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 + """ + return self._put( + f"/cdn/resources/rule_templates/{rule_template_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + body=maybe_transform( + { + "rule": rule, + "rule_type": rule_type, + "name": name, + "options": options, + "override_origin_protocol": override_origin_protocol, + "weight": weight, + }, + rule_template_replace_params.RuleTemplateReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplate, + ) + + +class AsyncRuleTemplatesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRuleTemplatesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncRuleTemplatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRuleTemplatesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncRuleTemplatesResourceWithStreamingResponse(self) + + async def create( + self, + *, + rule: str, + rule_type: int, + name: str | Omit = omit, + options: rule_template_create_params.Options | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + weight: 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, + ) -> RuleTemplate: + """ + Create rule template + + Args: + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + name: Rule template name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + 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 + """ + return await self._post( + "/cdn/resources/rule_templates" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/resources/rule_templates", + body=await async_maybe_transform( + { + "rule": rule, + "rule_type": rule_type, + "name": name, + "options": options, + "override_origin_protocol": override_origin_protocol, + "weight": weight, + }, + rule_template_create_params.RuleTemplateCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplate, + ) + + async def update( + self, + rule_template_id: int, + *, + name: str | Omit = omit, + options: rule_template_update_params.Options | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + rule: str | Omit = omit, + rule_type: int | Omit = omit, + weight: 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, + ) -> RuleTemplate: + """ + Change rule template + + Args: + name: Rule template name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + 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 + """ + return await self._patch( + f"/cdn/resources/rule_templates/{rule_template_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + body=await async_maybe_transform( + { + "name": name, + "options": options, + "override_origin_protocol": override_origin_protocol, + "rule": rule, + "rule_type": rule_type, + "weight": weight, + }, + rule_template_update_params.RuleTemplateUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplate, + ) + + async def list( + 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, + ) -> RuleTemplateList: + """Get rule templates list""" + return await self._get( + "/cdn/resources/rule_templates" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/resources/rule_templates", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplateList, + ) + + async def delete( + self, + rule_template_id: int, + *, + # 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, + ) -> None: + """ + Delete rule template + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/resources/rule_templates/{rule_template_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + rule_template_id: int, + *, + # 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, + ) -> RuleTemplate: + """ + Get rule template details + + Args: + 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 + """ + return await self._get( + f"/cdn/resources/rule_templates/{rule_template_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplate, + ) + + async def replace( + self, + rule_template_id: int, + *, + rule: str, + rule_type: int, + name: str | Omit = omit, + options: rule_template_replace_params.Options | Omit = omit, + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] | Omit = omit, + weight: 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, + ) -> RuleTemplate: + """ + Change rule template + + Args: + rule: Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + + rule_type: Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + + name: Rule template name. + + options: List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + + override_origin_protocol: Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + + weight: Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + + 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 + """ + return await self._put( + f"/cdn/resources/rule_templates/{rule_template_id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/resources/rule_templates/{rule_template_id}", + body=await async_maybe_transform( + { + "rule": rule, + "rule_type": rule_type, + "name": name, + "options": options, + "override_origin_protocol": override_origin_protocol, + "weight": weight, + }, + rule_template_replace_params.RuleTemplateReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleTemplate, + ) + + +class RuleTemplatesResourceWithRawResponse: + def __init__(self, rule_templates: RuleTemplatesResource) -> None: + self._rule_templates = rule_templates + + self.create = to_raw_response_wrapper( + rule_templates.create, + ) + self.update = to_raw_response_wrapper( + rule_templates.update, + ) + self.list = to_raw_response_wrapper( + rule_templates.list, + ) + self.delete = to_raw_response_wrapper( + rule_templates.delete, + ) + self.get = to_raw_response_wrapper( + rule_templates.get, + ) + self.replace = to_raw_response_wrapper( + rule_templates.replace, + ) + + +class AsyncRuleTemplatesResourceWithRawResponse: + def __init__(self, rule_templates: AsyncRuleTemplatesResource) -> None: + self._rule_templates = rule_templates + + self.create = async_to_raw_response_wrapper( + rule_templates.create, + ) + self.update = async_to_raw_response_wrapper( + rule_templates.update, + ) + self.list = async_to_raw_response_wrapper( + rule_templates.list, + ) + self.delete = async_to_raw_response_wrapper( + rule_templates.delete, + ) + self.get = async_to_raw_response_wrapper( + rule_templates.get, + ) + self.replace = async_to_raw_response_wrapper( + rule_templates.replace, + ) + + +class RuleTemplatesResourceWithStreamingResponse: + def __init__(self, rule_templates: RuleTemplatesResource) -> None: + self._rule_templates = rule_templates + + self.create = to_streamed_response_wrapper( + rule_templates.create, + ) + self.update = to_streamed_response_wrapper( + rule_templates.update, + ) + self.list = to_streamed_response_wrapper( + rule_templates.list, + ) + self.delete = to_streamed_response_wrapper( + rule_templates.delete, + ) + self.get = to_streamed_response_wrapper( + rule_templates.get, + ) + self.replace = to_streamed_response_wrapper( + rule_templates.replace, + ) + + +class AsyncRuleTemplatesResourceWithStreamingResponse: + def __init__(self, rule_templates: AsyncRuleTemplatesResource) -> None: + self._rule_templates = rule_templates + + self.create = async_to_streamed_response_wrapper( + rule_templates.create, + ) + self.update = async_to_streamed_response_wrapper( + rule_templates.update, + ) + self.list = async_to_streamed_response_wrapper( + rule_templates.list, + ) + self.delete = async_to_streamed_response_wrapper( + rule_templates.delete, + ) + self.get = async_to_streamed_response_wrapper( + rule_templates.get, + ) + self.replace = async_to_streamed_response_wrapper( + rule_templates.replace, + ) diff --git a/src/gcore/resources/cdn/shields.py b/src/gcore/resources/cdn/shields.py new file mode 100644 index 00000000..cc6d7c38 --- /dev/null +++ b/src/gcore/resources/cdn/shields.py @@ -0,0 +1,139 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.cdn.shield_list_response import ShieldListResponse + +__all__ = ["ShieldsResource", "AsyncShieldsResource"] + + +class ShieldsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ShieldsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return ShieldsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ShieldsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return ShieldsResourceWithStreamingResponse(self) + + def list( + 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, + ) -> ShieldListResponse: + """Get information about all origin shielding locations available in the account.""" + return self._get( + "/cdn/shieldingpop_v2" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/shieldingpop_v2", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ShieldListResponse, + ) + + +class AsyncShieldsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncShieldsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncShieldsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncShieldsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncShieldsResourceWithStreamingResponse(self) + + async def list( + 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, + ) -> ShieldListResponse: + """Get information about all origin shielding locations available in the account.""" + return await self._get( + "/cdn/shieldingpop_v2" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/shieldingpop_v2", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ShieldListResponse, + ) + + +class ShieldsResourceWithRawResponse: + def __init__(self, shields: ShieldsResource) -> None: + self._shields = shields + + self.list = to_raw_response_wrapper( + shields.list, + ) + + +class AsyncShieldsResourceWithRawResponse: + def __init__(self, shields: AsyncShieldsResource) -> None: + self._shields = shields + + self.list = async_to_raw_response_wrapper( + shields.list, + ) + + +class ShieldsResourceWithStreamingResponse: + def __init__(self, shields: ShieldsResource) -> None: + self._shields = shields + + self.list = to_streamed_response_wrapper( + shields.list, + ) + + +class AsyncShieldsResourceWithStreamingResponse: + def __init__(self, shields: AsyncShieldsResource) -> None: + self._shields = shields + + self.list = async_to_streamed_response_wrapper( + shields.list, + ) diff --git a/src/gcore/resources/cdn/statistics.py b/src/gcore/resources/cdn/statistics.py new file mode 100644 index 00000000..113ffff9 --- /dev/null +++ b/src/gcore/resources/cdn/statistics.py @@ -0,0 +1,1408 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import ( + statistic_get_logs_usage_series_params, + statistic_get_shield_usage_series_params, + statistic_get_logs_usage_aggregated_params, + statistic_get_resource_usage_series_params, + statistic_get_shield_usage_aggregated_params, + statistic_get_resource_usage_aggregated_params, +) +from ..._base_client import make_request_options +from ...types.cdn.usage_series_stats import UsageSeriesStats +from ...types.cdn.resource_usage_stats import ResourceUsageStats +from ...types.cdn.logs_aggregated_stats import LogsAggregatedStats +from ...types.cdn.shield_aggregated_stats import ShieldAggregatedStats +from ...types.cdn.resource_aggregated_stats import ResourceAggregatedStats + +__all__ = ["StatisticsResource", "AsyncStatisticsResource"] + + +class StatisticsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> StatisticsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return StatisticsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> StatisticsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return StatisticsResourceWithStreamingResponse(self) + + def get_logs_usage_aggregated( + self, + *, + from_: str, + to: str, + flat: bool | Omit = omit, + group_by: str | Omit = omit, + resource: 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, + ) -> LogsAggregatedStats: + """ + Get the number of CDN resources that used raw logs. + + Request URL parameters should be added as a query string after the endpoint. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + flat: The waу parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + + group_by: Output data grouping. + + Possible value: + + - **resource** - Data is grouped by CDN resources. + + resource: CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + 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 + """ + return self._get( + "/cdn/statistics/raw_logs_usage/aggregated" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/raw_logs_usage/aggregated", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "flat": flat, + "group_by": group_by, + "resource": resource, + }, + statistic_get_logs_usage_aggregated_params.StatisticGetLogsUsageAggregatedParams, + ), + ), + cast_to=LogsAggregatedStats, + ) + + def get_logs_usage_series( + self, + *, + from_: str, + to: str, + resource: 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, + ) -> UsageSeriesStats: + """ + Get raw logs usage statistics for up to 90 days starting today. + + Request URL parameters should be added as a query string after the endpoint. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Example: + + - &from=2020-01-01T00:00:00.000 + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Example: + + - &from=2020-01-01T00:00:00.000 + + resource: CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + 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 + """ + return self._get( + "/cdn/statistics/raw_logs_usage/series" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/raw_logs_usage/series", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "resource": resource, + }, + statistic_get_logs_usage_series_params.StatisticGetLogsUsageSeriesParams, + ), + ), + cast_to=UsageSeriesStats, + ) + + def get_resource_usage_aggregated( + self, + *, + from_: str, + metrics: str, + service: str, + to: str, + countries: str | Omit = omit, + flat: bool | Omit = omit, + group_by: str | Omit = omit, + regions: str | Omit = omit, + resource: 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, + ) -> ResourceAggregatedStats: + """ + Get aggregated CDN resources statistics. + + Request URL parameters should be added as a query string after the endpoint. + + Aggregated data does not include data for the last two hours. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &from=2018-11-01T00:00:00.000 + - &from=2018-11-01 + + metrics: Types of statistics data. + + Possible values: + + - **`upstream_bytes`** – Traffic in bytes from an origin server to CDN servers + or to origin shielding when used. + - **`sent_bytes`** – Traffic in bytes from CDN servers to clients. + - **`shield_bytes`** – Traffic in bytes from origin shielding to CDN servers. + - **`backblaze_bytes`** - Traffic in bytes from Backblaze origin. + - **`total_bytes`** – `shield_bytes`, `upstream_bytes` and `sent_bytes` + combined. + - **`cdn_bytes`** – `sent_bytes` and `shield_bytes` combined. + - **requests** – Number of requests to edge servers. + - **`responses_2xx`** – Number of 2xx response codes. + - **`responses_3xx`** – Number of 3xx response codes. + - **`responses_4xx`** – Number of 4xx response codes. + - **`responses_5xx`** – Number of 5xx response codes. + - **`responses_hit`** – Number of responses with the header Cache: HIT. + - **`responses_miss`** – Number of responses with the header Cache: MISS. + - **`response_types`** – Statistics by content type. It returns a number of + responses for content with different MIME types. + - **`cache_hit_traffic_ratio`** – Formula: 1 - `upstream_bytes` / `sent_bytes`. + We deduct the non-cached traffic from the total traffic amount. + - **`cache_hit_requests_ratio`** – Formula: `responses_hit` / requests. The + share of sending cached content. + - **`shield_traffic_ratio`** – Formula: (`shield_bytes` - `upstream_bytes`) / + `shield_bytes`. The efficiency of the Origin Shielding: how much more traffic + is sent from the Origin Shielding than from the origin. + - **`image_processed`** - Number of images transformed on the Image optimization + service. + - **`request_time`** - Time elapsed between the first bytes of a request were + processed and logging after the last bytes were sent to a user. + - **`upstream_response_time`** - Number of milliseconds it took to receive a + response from an origin. If upstream `response_time_` contains several + indications for one request (in case of more than 1 origin), we summarize + them. In case of aggregating several queries, the average of this amount is + calculated. + - **`95_percentile`** - Represents the 95th percentile of network bandwidth + usage in bytes per second. This means that 95% of the time, the network + resource usage was below this value. + - **`max_bandwidth`** - The maximum network bandwidth that was used during the + selected time represented in bytes per second. + - **`min_bandwidth`** - The minimum network bandwidth that was used during the + selected time represented in bytes per second. + + Metrics **`upstream_response_time`** and **`request_time`** should be requested + separately from other metrics + + service: Service name. + + Possible value: + + - CDN + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &to=2018-11-01T00:00:00.000 + - &to=2018-11-01 + + countries: Names of countries for which data is displayed. + + English short name from [ISO 3166 standard][1] without the definite article + "the" should be used. + + [1]: https://www.iso.org/obp/ui/#search/code/ + + To request multiple values, use: + + - &countries=france&countries=denmark + + flat: The waу the parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + + group_by: Output data grouping. + + Possible values: + + - **resource** – Data is grouped by CDN resources IDs. + - **region** – Data is grouped by regions of CDN edge servers. + - **country** – Data is grouped by countries of CDN edge servers. + - **vhost** – Data is grouped by resources CNAME. + + To request multiple values, use: + + - &`group_by`=region&`group_by`=resource + + regions: Regions for which data is displayed. + + Possible values: + + - **na** – North America + - **eu** – Europe + - **cis** – Commonwealth of Independent States + - **asia** – Asia + - **au** – Australia + - **latam** – Latin America + - **me** – Middle East + - **africa** - Africa + - **sa** - South America + + resource: CDN resources IDs by which statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + If CDN resource ID is not specified, data related to all CDN resources is + returned. + + 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 + """ + return self._get( + "/cdn/statistics/aggregate/stats" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/aggregate/stats", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "metrics": metrics, + "service": service, + "to": to, + "countries": countries, + "flat": flat, + "group_by": group_by, + "regions": regions, + "resource": resource, + }, + statistic_get_resource_usage_aggregated_params.StatisticGetResourceUsageAggregatedParams, + ), + ), + cast_to=ResourceAggregatedStats, + ) + + def get_resource_usage_series( + self, + *, + from_: str, + granularity: str, + metrics: str, + service: str, + to: str, + countries: str | Omit = omit, + group_by: str | Omit = omit, + regions: str | Omit = omit, + resource: 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, + ) -> ResourceUsageStats: + """ + Get CDN resources statistics for up to 365 days starting today. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + granularity: Duration of the time blocks into which the data will be divided. + + Possible values: + + - **1m** - available only for up to 1 month in the past. + - **5m** + - **15m** + - **1h** + - **1d** + + metrics: Types of statistics data. + + Possible values: + + - **`upstream_bytes`** – Traffic in bytes from an origin server to CDN servers + or to origin shielding when used. + - **`sent_bytes`** – Traffic in bytes from CDN servers to clients. + - **`shield_bytes`** – Traffic in bytes from origin shielding to CDN servers. + - **`backblaze_bytes`** - Traffic in bytes from Backblaze origin. + - **`total_bytes`** – `shield_bytes`, `upstream_bytes` and `sent_bytes` + combined. + - **`cdn_bytes`** – `sent_bytes` and `shield_bytes` combined. + - **requests** – Number of requests to edge servers. + - **`responses_2xx`** – Number of 2xx response codes. + - **`responses_3xx`** – Number of 3xx response codes. + - **`responses_4xx`** – Number of 4xx response codes. + - **`responses_5xx`** – Number of 5xx response codes. + - **`responses_hit`** – Number of responses with the header Cache: HIT. + - **`responses_miss`** – Number of responses with the header Cache: MISS. + - **`response_types`** – Statistics by content type. It returns a number of + responses for content with different MIME types. + - **`cache_hit_traffic_ratio`** – Formula: 1 - `upstream_bytes` / `sent_bytes`. + We deduct the non-cached traffic from the total traffic amount. + - **`cache_hit_requests_ratio`** – Formula: `responses_hit` / requests. The + share of sending cached content. + - **`shield_traffic_ratio`** – Formula: (`shield_bytes` - `upstream_bytes`) / + `shield_bytes`. The efficiency of the Origin Shielding: how much more traffic + is sent from the Origin Shielding than from the origin. + - **`image_processed`** - Number of images transformed on the Image optimization + service. + - **`request_time`** - Time elapsed between the first bytes of a request were + processed and logging after the last bytes were sent to a user. + - **`upstream_response_time`** - Number of milliseconds it took to receive a + response from an origin. If upstream `response_time_` contains several + indications for one request (in case of more than 1 origin), we summarize + them. In case of aggregating several queries, the average of this amount is + calculated. + + Metrics **`upstream_response_time`** and **`request_time`** should be requested + separately from other metrics + + service: Service name. + + Possible value: + + - CDN + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + countries: Names of countries for which data should be displayed. English short name from + [ISO 3166 standard][1] without the definite article ("the") should be used. + + [1]: https://www.iso.org/obp/ui/#search/code/ + + To request multiple values, use: + + - &countries=france&countries=denmark + + group_by: Output data grouping. + + Possible values: + + - **resource** – Data is grouped by CDN resources IDs. + - **region** – Data is grouped by regions of CDN edge servers. + - **country** – Data is grouped by countries of CDN edge servers. + - **vhost** – Data is grouped by resources CNAMEs. + + To request multiple values, use: + + - &`group_by`=region&`group_by`=resource + + regions: Regions for which data is displayed. + + Possible values: + + - **na** – North America + - **eu** – Europe + - **cis** – Commonwealth of Independent States + - **asia** – Asia + - **au** – Australia + - **latam** – Latin America + - **me** – Middle East + - **africa** - Africa + - **sa** - South America + + resource: CDN resource IDs. + + To request multiple values, use: + + - &resource=1&resource=2 + + 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 + """ + return self._get( + "/cdn/statistics/series" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/series", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "granularity": granularity, + "metrics": metrics, + "service": service, + "to": to, + "countries": countries, + "group_by": group_by, + "regions": regions, + "resource": resource, + }, + statistic_get_resource_usage_series_params.StatisticGetResourceUsageSeriesParams, + ), + ), + cast_to=ResourceUsageStats, + ) + + def get_shield_usage_aggregated( + self, + *, + from_: str, + to: str, + flat: bool | Omit = omit, + group_by: str | Omit = omit, + resource: 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, + ) -> ShieldAggregatedStats: + """ + The number of CDN resources that use origin shielding. + + Request URL parameters should be added as a query string after the endpoint. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + flat: The waу parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + + group_by: Output data grouping. + + Possible value: + + - **resource** - Data is grouped by CDN resource. + + resource: CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + 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 + """ + return self._get( + "/cdn/statistics/shield_usage/aggregated" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/shield_usage/aggregated", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "flat": flat, + "group_by": group_by, + "resource": resource, + }, + statistic_get_shield_usage_aggregated_params.StatisticGetShieldUsageAggregatedParams, + ), + ), + cast_to=ShieldAggregatedStats, + ) + + def get_shield_usage_series( + self, + *, + from_: str, + to: str, + resource: 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, + ) -> UsageSeriesStats: + """ + Get origin shielding usage statistics for up to 365 days starting from today. + + Request URL parameters should be added as a query string after the endpoint. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + resource: CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + 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 + """ + return self._get( + "/cdn/statistics/shield_usage/series" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/shield_usage/series", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "to": to, + "resource": resource, + }, + statistic_get_shield_usage_series_params.StatisticGetShieldUsageSeriesParams, + ), + ), + cast_to=UsageSeriesStats, + ) + + +class AsyncStatisticsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncStatisticsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncStatisticsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncStatisticsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncStatisticsResourceWithStreamingResponse(self) + + async def get_logs_usage_aggregated( + self, + *, + from_: str, + to: str, + flat: bool | Omit = omit, + group_by: str | Omit = omit, + resource: 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, + ) -> LogsAggregatedStats: + """ + Get the number of CDN resources that used raw logs. + + Request URL parameters should be added as a query string after the endpoint. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + flat: The waу parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + + group_by: Output data grouping. + + Possible value: + + - **resource** - Data is grouped by CDN resources. + + resource: CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + 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 + """ + return await self._get( + "/cdn/statistics/raw_logs_usage/aggregated" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/raw_logs_usage/aggregated", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "to": to, + "flat": flat, + "group_by": group_by, + "resource": resource, + }, + statistic_get_logs_usage_aggregated_params.StatisticGetLogsUsageAggregatedParams, + ), + ), + cast_to=LogsAggregatedStats, + ) + + async def get_logs_usage_series( + self, + *, + from_: str, + to: str, + resource: 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, + ) -> UsageSeriesStats: + """ + Get raw logs usage statistics for up to 90 days starting today. + + Request URL parameters should be added as a query string after the endpoint. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Example: + + - &from=2020-01-01T00:00:00.000 + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Example: + + - &from=2020-01-01T00:00:00.000 + + resource: CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + 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 + """ + return await self._get( + "/cdn/statistics/raw_logs_usage/series" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/raw_logs_usage/series", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "to": to, + "resource": resource, + }, + statistic_get_logs_usage_series_params.StatisticGetLogsUsageSeriesParams, + ), + ), + cast_to=UsageSeriesStats, + ) + + async def get_resource_usage_aggregated( + self, + *, + from_: str, + metrics: str, + service: str, + to: str, + countries: str | Omit = omit, + flat: bool | Omit = omit, + group_by: str | Omit = omit, + regions: str | Omit = omit, + resource: 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, + ) -> ResourceAggregatedStats: + """ + Get aggregated CDN resources statistics. + + Request URL parameters should be added as a query string after the endpoint. + + Aggregated data does not include data for the last two hours. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &from=2018-11-01T00:00:00.000 + - &from=2018-11-01 + + metrics: Types of statistics data. + + Possible values: + + - **`upstream_bytes`** – Traffic in bytes from an origin server to CDN servers + or to origin shielding when used. + - **`sent_bytes`** – Traffic in bytes from CDN servers to clients. + - **`shield_bytes`** – Traffic in bytes from origin shielding to CDN servers. + - **`backblaze_bytes`** - Traffic in bytes from Backblaze origin. + - **`total_bytes`** – `shield_bytes`, `upstream_bytes` and `sent_bytes` + combined. + - **`cdn_bytes`** – `sent_bytes` and `shield_bytes` combined. + - **requests** – Number of requests to edge servers. + - **`responses_2xx`** – Number of 2xx response codes. + - **`responses_3xx`** – Number of 3xx response codes. + - **`responses_4xx`** – Number of 4xx response codes. + - **`responses_5xx`** – Number of 5xx response codes. + - **`responses_hit`** – Number of responses with the header Cache: HIT. + - **`responses_miss`** – Number of responses with the header Cache: MISS. + - **`response_types`** – Statistics by content type. It returns a number of + responses for content with different MIME types. + - **`cache_hit_traffic_ratio`** – Formula: 1 - `upstream_bytes` / `sent_bytes`. + We deduct the non-cached traffic from the total traffic amount. + - **`cache_hit_requests_ratio`** – Formula: `responses_hit` / requests. The + share of sending cached content. + - **`shield_traffic_ratio`** – Formula: (`shield_bytes` - `upstream_bytes`) / + `shield_bytes`. The efficiency of the Origin Shielding: how much more traffic + is sent from the Origin Shielding than from the origin. + - **`image_processed`** - Number of images transformed on the Image optimization + service. + - **`request_time`** - Time elapsed between the first bytes of a request were + processed and logging after the last bytes were sent to a user. + - **`upstream_response_time`** - Number of milliseconds it took to receive a + response from an origin. If upstream `response_time_` contains several + indications for one request (in case of more than 1 origin), we summarize + them. In case of aggregating several queries, the average of this amount is + calculated. + - **`95_percentile`** - Represents the 95th percentile of network bandwidth + usage in bytes per second. This means that 95% of the time, the network + resource usage was below this value. + - **`max_bandwidth`** - The maximum network bandwidth that was used during the + selected time represented in bytes per second. + - **`min_bandwidth`** - The minimum network bandwidth that was used during the + selected time represented in bytes per second. + + Metrics **`upstream_response_time`** and **`request_time`** should be requested + separately from other metrics + + service: Service name. + + Possible value: + + - CDN + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &to=2018-11-01T00:00:00.000 + - &to=2018-11-01 + + countries: Names of countries for which data is displayed. + + English short name from [ISO 3166 standard][1] without the definite article + "the" should be used. + + [1]: https://www.iso.org/obp/ui/#search/code/ + + To request multiple values, use: + + - &countries=france&countries=denmark + + flat: The waу the parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + + group_by: Output data grouping. + + Possible values: + + - **resource** – Data is grouped by CDN resources IDs. + - **region** – Data is grouped by regions of CDN edge servers. + - **country** – Data is grouped by countries of CDN edge servers. + - **vhost** – Data is grouped by resources CNAME. + + To request multiple values, use: + + - &`group_by`=region&`group_by`=resource + + regions: Regions for which data is displayed. + + Possible values: + + - **na** – North America + - **eu** – Europe + - **cis** – Commonwealth of Independent States + - **asia** – Asia + - **au** – Australia + - **latam** – Latin America + - **me** – Middle East + - **africa** - Africa + - **sa** - South America + + resource: CDN resources IDs by which statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + If CDN resource ID is not specified, data related to all CDN resources is + returned. + + 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 + """ + return await self._get( + "/cdn/statistics/aggregate/stats" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/aggregate/stats", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "metrics": metrics, + "service": service, + "to": to, + "countries": countries, + "flat": flat, + "group_by": group_by, + "regions": regions, + "resource": resource, + }, + statistic_get_resource_usage_aggregated_params.StatisticGetResourceUsageAggregatedParams, + ), + ), + cast_to=ResourceAggregatedStats, + ) + + async def get_resource_usage_series( + self, + *, + from_: str, + granularity: str, + metrics: str, + service: str, + to: str, + countries: str | Omit = omit, + group_by: str | Omit = omit, + regions: str | Omit = omit, + resource: 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, + ) -> ResourceUsageStats: + """ + Get CDN resources statistics for up to 365 days starting today. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + granularity: Duration of the time blocks into which the data will be divided. + + Possible values: + + - **1m** - available only for up to 1 month in the past. + - **5m** + - **15m** + - **1h** + - **1d** + + metrics: Types of statistics data. + + Possible values: + + - **`upstream_bytes`** – Traffic in bytes from an origin server to CDN servers + or to origin shielding when used. + - **`sent_bytes`** – Traffic in bytes from CDN servers to clients. + - **`shield_bytes`** – Traffic in bytes from origin shielding to CDN servers. + - **`backblaze_bytes`** - Traffic in bytes from Backblaze origin. + - **`total_bytes`** – `shield_bytes`, `upstream_bytes` and `sent_bytes` + combined. + - **`cdn_bytes`** – `sent_bytes` and `shield_bytes` combined. + - **requests** – Number of requests to edge servers. + - **`responses_2xx`** – Number of 2xx response codes. + - **`responses_3xx`** – Number of 3xx response codes. + - **`responses_4xx`** – Number of 4xx response codes. + - **`responses_5xx`** – Number of 5xx response codes. + - **`responses_hit`** – Number of responses with the header Cache: HIT. + - **`responses_miss`** – Number of responses with the header Cache: MISS. + - **`response_types`** – Statistics by content type. It returns a number of + responses for content with different MIME types. + - **`cache_hit_traffic_ratio`** – Formula: 1 - `upstream_bytes` / `sent_bytes`. + We deduct the non-cached traffic from the total traffic amount. + - **`cache_hit_requests_ratio`** – Formula: `responses_hit` / requests. The + share of sending cached content. + - **`shield_traffic_ratio`** – Formula: (`shield_bytes` - `upstream_bytes`) / + `shield_bytes`. The efficiency of the Origin Shielding: how much more traffic + is sent from the Origin Shielding than from the origin. + - **`image_processed`** - Number of images transformed on the Image optimization + service. + - **`request_time`** - Time elapsed between the first bytes of a request were + processed and logging after the last bytes were sent to a user. + - **`upstream_response_time`** - Number of milliseconds it took to receive a + response from an origin. If upstream `response_time_` contains several + indications for one request (in case of more than 1 origin), we summarize + them. In case of aggregating several queries, the average of this amount is + calculated. + + Metrics **`upstream_response_time`** and **`request_time`** should be requested + separately from other metrics + + service: Service name. + + Possible value: + + - CDN + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + countries: Names of countries for which data should be displayed. English short name from + [ISO 3166 standard][1] without the definite article ("the") should be used. + + [1]: https://www.iso.org/obp/ui/#search/code/ + + To request multiple values, use: + + - &countries=france&countries=denmark + + group_by: Output data grouping. + + Possible values: + + - **resource** – Data is grouped by CDN resources IDs. + - **region** – Data is grouped by regions of CDN edge servers. + - **country** – Data is grouped by countries of CDN edge servers. + - **vhost** – Data is grouped by resources CNAMEs. + + To request multiple values, use: + + - &`group_by`=region&`group_by`=resource + + regions: Regions for which data is displayed. + + Possible values: + + - **na** – North America + - **eu** – Europe + - **cis** – Commonwealth of Independent States + - **asia** – Asia + - **au** – Australia + - **latam** – Latin America + - **me** – Middle East + - **africa** - Africa + - **sa** - South America + + resource: CDN resource IDs. + + To request multiple values, use: + + - &resource=1&resource=2 + + 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 + """ + return await self._get( + "/cdn/statistics/series" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/series", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "granularity": granularity, + "metrics": metrics, + "service": service, + "to": to, + "countries": countries, + "group_by": group_by, + "regions": regions, + "resource": resource, + }, + statistic_get_resource_usage_series_params.StatisticGetResourceUsageSeriesParams, + ), + ), + cast_to=ResourceUsageStats, + ) + + async def get_shield_usage_aggregated( + self, + *, + from_: str, + to: str, + flat: bool | Omit = omit, + group_by: str | Omit = omit, + resource: 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, + ) -> ShieldAggregatedStats: + """ + The number of CDN resources that use origin shielding. + + Request URL parameters should be added as a query string after the endpoint. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + flat: The waу parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + + group_by: Output data grouping. + + Possible value: + + - **resource** - Data is grouped by CDN resource. + + resource: CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + 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 + """ + return await self._get( + "/cdn/statistics/shield_usage/aggregated" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/shield_usage/aggregated", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "to": to, + "flat": flat, + "group_by": group_by, + "resource": resource, + }, + statistic_get_shield_usage_aggregated_params.StatisticGetShieldUsageAggregatedParams, + ), + ), + cast_to=ShieldAggregatedStats, + ) + + async def get_shield_usage_series( + self, + *, + from_: str, + to: str, + resource: 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, + ) -> UsageSeriesStats: + """ + Get origin shielding usage statistics for up to 365 days starting from today. + + Request URL parameters should be added as a query string after the endpoint. + + Args: + from_: Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + to: End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + resource: CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + 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 + """ + return await self._get( + "/cdn/statistics/shield_usage/series" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/statistics/shield_usage/series", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "to": to, + "resource": resource, + }, + statistic_get_shield_usage_series_params.StatisticGetShieldUsageSeriesParams, + ), + ), + cast_to=UsageSeriesStats, + ) + + +class StatisticsResourceWithRawResponse: + def __init__(self, statistics: StatisticsResource) -> None: + self._statistics = statistics + + self.get_logs_usage_aggregated = to_raw_response_wrapper( + statistics.get_logs_usage_aggregated, + ) + self.get_logs_usage_series = to_raw_response_wrapper( + statistics.get_logs_usage_series, + ) + self.get_resource_usage_aggregated = to_raw_response_wrapper( + statistics.get_resource_usage_aggregated, + ) + self.get_resource_usage_series = to_raw_response_wrapper( + statistics.get_resource_usage_series, + ) + self.get_shield_usage_aggregated = to_raw_response_wrapper( + statistics.get_shield_usage_aggregated, + ) + self.get_shield_usage_series = to_raw_response_wrapper( + statistics.get_shield_usage_series, + ) + + +class AsyncStatisticsResourceWithRawResponse: + def __init__(self, statistics: AsyncStatisticsResource) -> None: + self._statistics = statistics + + self.get_logs_usage_aggregated = async_to_raw_response_wrapper( + statistics.get_logs_usage_aggregated, + ) + self.get_logs_usage_series = async_to_raw_response_wrapper( + statistics.get_logs_usage_series, + ) + self.get_resource_usage_aggregated = async_to_raw_response_wrapper( + statistics.get_resource_usage_aggregated, + ) + self.get_resource_usage_series = async_to_raw_response_wrapper( + statistics.get_resource_usage_series, + ) + self.get_shield_usage_aggregated = async_to_raw_response_wrapper( + statistics.get_shield_usage_aggregated, + ) + self.get_shield_usage_series = async_to_raw_response_wrapper( + statistics.get_shield_usage_series, + ) + + +class StatisticsResourceWithStreamingResponse: + def __init__(self, statistics: StatisticsResource) -> None: + self._statistics = statistics + + self.get_logs_usage_aggregated = to_streamed_response_wrapper( + statistics.get_logs_usage_aggregated, + ) + self.get_logs_usage_series = to_streamed_response_wrapper( + statistics.get_logs_usage_series, + ) + self.get_resource_usage_aggregated = to_streamed_response_wrapper( + statistics.get_resource_usage_aggregated, + ) + self.get_resource_usage_series = to_streamed_response_wrapper( + statistics.get_resource_usage_series, + ) + self.get_shield_usage_aggregated = to_streamed_response_wrapper( + statistics.get_shield_usage_aggregated, + ) + self.get_shield_usage_series = to_streamed_response_wrapper( + statistics.get_shield_usage_series, + ) + + +class AsyncStatisticsResourceWithStreamingResponse: + def __init__(self, statistics: AsyncStatisticsResource) -> None: + self._statistics = statistics + + self.get_logs_usage_aggregated = async_to_streamed_response_wrapper( + statistics.get_logs_usage_aggregated, + ) + self.get_logs_usage_series = async_to_streamed_response_wrapper( + statistics.get_logs_usage_series, + ) + self.get_resource_usage_aggregated = async_to_streamed_response_wrapper( + statistics.get_resource_usage_aggregated, + ) + self.get_resource_usage_series = async_to_streamed_response_wrapper( + statistics.get_resource_usage_series, + ) + self.get_shield_usage_aggregated = async_to_streamed_response_wrapper( + statistics.get_shield_usage_aggregated, + ) + self.get_shield_usage_series = async_to_streamed_response_wrapper( + statistics.get_shield_usage_series, + ) diff --git a/src/gcore/resources/cdn/trusted_ca_certificates.py b/src/gcore/resources/cdn/trusted_ca_certificates.py new file mode 100644 index 00000000..b8f83ff3 --- /dev/null +++ b/src/gcore/resources/cdn/trusted_ca_certificates.py @@ -0,0 +1,592 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cdn import ( + trusted_ca_certificate_list_params, + trusted_ca_certificate_create_params, + trusted_ca_certificate_replace_params, +) +from ..._base_client import make_request_options +from ...types.cdn.ca_certificate import CaCertificate +from ...types.cdn.ca_certificate_list import CaCertificateList + +__all__ = ["TrustedCaCertificatesResource", "AsyncTrustedCaCertificatesResource"] + + +class TrustedCaCertificatesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TrustedCaCertificatesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return TrustedCaCertificatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TrustedCaCertificatesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return TrustedCaCertificatesResourceWithStreamingResponse(self) + + def create( + self, + *, + name: str, + ssl_certificate: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CaCertificate: + """ + Add a trusted CA certificate to verify an origin. + + Enter all strings of the certificate in one string parameter. Each string should + be separated by the "\n" symbol. + + Args: + name: CA certificate name. + + It must be unique. + + ssl_certificate: Public part of the CA certificate. + + It must be in the PEM format. + + 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 + """ + return self._post( + "/cdn/sslCertificates" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/sslCertificates", + body=maybe_transform( + { + "name": name, + "ssl_certificate": ssl_certificate, + }, + trusted_ca_certificate_create_params.TrustedCaCertificateCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CaCertificate, + ) + + def list( + self, + *, + automated: bool | Omit = omit, + resource_id: int | Omit = omit, + validity_not_after_lte: 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, + ) -> CaCertificateList: + """ + Get list of trusted CA certificates used to verify an origin. + + Args: + automated: How the certificate was issued. + + Possible values: + + - **true** – Certificate was issued automatically. + - **false** – Certificate was added by a user. + + resource_id: CDN resource ID for which the certificates are requested. + + validity_not_after_lte: Date and time when the certificate become untrusted (ISO 8601/RFC 3339 format, + UTC.) + + Response will contain certificates valid until the specified time. + + 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 + """ + return self._get( + "/cdn/sslCertificates" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/sslCertificates", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "automated": automated, + "resource_id": resource_id, + "validity_not_after_lte": validity_not_after_lte, + }, + trusted_ca_certificate_list_params.TrustedCaCertificateListParams, + ), + ), + cast_to=CaCertificateList, + ) + + def delete( + self, + id: int, + *, + # 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, + ) -> None: + """ + Delete trusted CA certificate + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/cdn/sslCertificates/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslCertificates/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + id: int, + *, + # 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, + ) -> CaCertificate: + """ + Get trusted CA certificate details + + Args: + 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 + """ + return self._get( + f"/cdn/sslCertificates/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslCertificates/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CaCertificate, + ) + + def replace( + self, + id: int, + *, + name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CaCertificate: + """ + Change trusted CA certificate + + Args: + name: CA certificate name. + + It must be unique. + + 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 + """ + return self._put( + f"/cdn/sslCertificates/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslCertificates/{id}", + body=maybe_transform( + {"name": name}, trusted_ca_certificate_replace_params.TrustedCaCertificateReplaceParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CaCertificate, + ) + + +class AsyncTrustedCaCertificatesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTrustedCaCertificatesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers + """ + return AsyncTrustedCaCertificatesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTrustedCaCertificatesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response + """ + return AsyncTrustedCaCertificatesResourceWithStreamingResponse(self) + + async def create( + self, + *, + name: str, + ssl_certificate: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CaCertificate: + """ + Add a trusted CA certificate to verify an origin. + + Enter all strings of the certificate in one string parameter. Each string should + be separated by the "\n" symbol. + + Args: + name: CA certificate name. + + It must be unique. + + ssl_certificate: Public part of the CA certificate. + + It must be in the PEM format. + + 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 + """ + return await self._post( + "/cdn/sslCertificates" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/sslCertificates", + body=await async_maybe_transform( + { + "name": name, + "ssl_certificate": ssl_certificate, + }, + trusted_ca_certificate_create_params.TrustedCaCertificateCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CaCertificate, + ) + + async def list( + self, + *, + automated: bool | Omit = omit, + resource_id: int | Omit = omit, + validity_not_after_lte: 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, + ) -> CaCertificateList: + """ + Get list of trusted CA certificates used to verify an origin. + + Args: + automated: How the certificate was issued. + + Possible values: + + - **true** – Certificate was issued automatically. + - **false** – Certificate was added by a user. + + resource_id: CDN resource ID for which the certificates are requested. + + validity_not_after_lte: Date and time when the certificate become untrusted (ISO 8601/RFC 3339 format, + UTC.) + + Response will contain certificates valid until the specified time. + + 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 + """ + return await self._get( + "/cdn/sslCertificates" + if self._client._base_url_overridden + else "https://api.gcore.com//cdn/sslCertificates", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "automated": automated, + "resource_id": resource_id, + "validity_not_after_lte": validity_not_after_lte, + }, + trusted_ca_certificate_list_params.TrustedCaCertificateListParams, + ), + ), + cast_to=CaCertificateList, + ) + + async def delete( + self, + id: int, + *, + # 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, + ) -> None: + """ + Delete trusted CA certificate + + Args: + 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 + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/cdn/sslCertificates/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslCertificates/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + id: int, + *, + # 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, + ) -> CaCertificate: + """ + Get trusted CA certificate details + + Args: + 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 + """ + return await self._get( + f"/cdn/sslCertificates/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslCertificates/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CaCertificate, + ) + + async def replace( + self, + id: int, + *, + name: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CaCertificate: + """ + Change trusted CA certificate + + Args: + name: CA certificate name. + + It must be unique. + + 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 + """ + return await self._put( + f"/cdn/sslCertificates/{id}" + if self._client._base_url_overridden + else f"https://api.gcore.com//cdn/sslCertificates/{id}", + body=await async_maybe_transform( + {"name": name}, trusted_ca_certificate_replace_params.TrustedCaCertificateReplaceParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CaCertificate, + ) + + +class TrustedCaCertificatesResourceWithRawResponse: + def __init__(self, trusted_ca_certificates: TrustedCaCertificatesResource) -> None: + self._trusted_ca_certificates = trusted_ca_certificates + + self.create = to_raw_response_wrapper( + trusted_ca_certificates.create, + ) + self.list = to_raw_response_wrapper( + trusted_ca_certificates.list, + ) + self.delete = to_raw_response_wrapper( + trusted_ca_certificates.delete, + ) + self.get = to_raw_response_wrapper( + trusted_ca_certificates.get, + ) + self.replace = to_raw_response_wrapper( + trusted_ca_certificates.replace, + ) + + +class AsyncTrustedCaCertificatesResourceWithRawResponse: + def __init__(self, trusted_ca_certificates: AsyncTrustedCaCertificatesResource) -> None: + self._trusted_ca_certificates = trusted_ca_certificates + + self.create = async_to_raw_response_wrapper( + trusted_ca_certificates.create, + ) + self.list = async_to_raw_response_wrapper( + trusted_ca_certificates.list, + ) + self.delete = async_to_raw_response_wrapper( + trusted_ca_certificates.delete, + ) + self.get = async_to_raw_response_wrapper( + trusted_ca_certificates.get, + ) + self.replace = async_to_raw_response_wrapper( + trusted_ca_certificates.replace, + ) + + +class TrustedCaCertificatesResourceWithStreamingResponse: + def __init__(self, trusted_ca_certificates: TrustedCaCertificatesResource) -> None: + self._trusted_ca_certificates = trusted_ca_certificates + + self.create = to_streamed_response_wrapper( + trusted_ca_certificates.create, + ) + self.list = to_streamed_response_wrapper( + trusted_ca_certificates.list, + ) + self.delete = to_streamed_response_wrapper( + trusted_ca_certificates.delete, + ) + self.get = to_streamed_response_wrapper( + trusted_ca_certificates.get, + ) + self.replace = to_streamed_response_wrapper( + trusted_ca_certificates.replace, + ) + + +class AsyncTrustedCaCertificatesResourceWithStreamingResponse: + def __init__(self, trusted_ca_certificates: AsyncTrustedCaCertificatesResource) -> None: + self._trusted_ca_certificates = trusted_ca_certificates + + self.create = async_to_streamed_response_wrapper( + trusted_ca_certificates.create, + ) + self.list = async_to_streamed_response_wrapper( + trusted_ca_certificates.list, + ) + self.delete = async_to_streamed_response_wrapper( + trusted_ca_certificates.delete, + ) + self.get = async_to_streamed_response_wrapper( + trusted_ca_certificates.get, + ) + self.replace = async_to_streamed_response_wrapper( + trusted_ca_certificates.replace, + ) diff --git a/src/gcore/types/cdn/__init__.py b/src/gcore/types/cdn/__init__.py new file mode 100644 index 00000000..66a8669b --- /dev/null +++ b/src/gcore/types/cdn/__init__.py @@ -0,0 +1,80 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .ssl_detail import SslDetail as SslDetail +from .cdn_account import CdnAccount as CdnAccount +from .cdn_metrics import CdnMetrics as CdnMetrics +from .cdn_resource import CdnResource as CdnResource +from .purge_status import PurgeStatus as PurgeStatus +from .cdn_log_entry import CdnLogEntry as CdnLogEntry +from .origin_groups import OriginGroups as OriginGroups +from .rule_template import RuleTemplate as RuleTemplate +from .ca_certificate import CaCertificate as CaCertificate +from .public_ip_list import PublicIPList as PublicIPList +from .log_list_params import LogListParams as LogListParams +from .ssl_detail_list import SslDetailList as SslDetailList +from .network_capacity import NetworkCapacity as NetworkCapacity +from .cdn_resource_list import CdnResourceList as CdnResourceList +from .cdn_account_limits import CdnAccountLimits as CdnAccountLimits +from .cdn_metrics_groups import CdnMetricsGroups as CdnMetricsGroups +from .cdn_metrics_values import CdnMetricsValues as CdnMetricsValues +from .metric_list_params import MetricListParams as MetricListParams +from .origin_groups_list import OriginGroupsList as OriginGroupsList +from .rule_template_list import RuleTemplateList as RuleTemplateList +from .ssl_request_status import SslRequestStatus as SslRequestStatus +from .usage_series_stats import UsageSeriesStats as UsageSeriesStats +from .ca_certificate_list import CaCertificateList as CaCertificateList +from .cdn_audit_log_entry import CdnAuditLogEntry as CdnAuditLogEntry +from .log_download_params import LogDownloadParams as LogDownloadParams +from .public_network_list import PublicNetworkList as PublicNetworkList +from .resource_list_params import ResourceListParams as ResourceListParams +from .resource_usage_stats import ResourceUsageStats as ResourceUsageStats +from .shield_list_response import ShieldListResponse as ShieldListResponse +from .audit_log_list_params import AuditLogListParams as AuditLogListParams +from .logs_aggregated_stats import LogsAggregatedStats as LogsAggregatedStats +from .resource_purge_params import ResourcePurgeParams as ResourcePurgeParams +from .cdn_available_features import CdnAvailableFeatures as CdnAvailableFeatures +from .resource_create_params import ResourceCreateParams as ResourceCreateParams +from .resource_update_params import ResourceUpdateParams as ResourceUpdateParams +from .certificate_list_params import CertificateListParams as CertificateListParams +from .resource_replace_params import ResourceReplaceParams as ResourceReplaceParams +from .shield_aggregated_stats import ShieldAggregatedStats as ShieldAggregatedStats +from .logs_uploader_validation import LogsUploaderValidation as LogsUploaderValidation +from .origin_group_list_params import OriginGroupListParams as OriginGroupListParams +from .resource_prefetch_params import ResourcePrefetchParams as ResourcePrefetchParams +from .cdn_update_account_params import CdnUpdateAccountParams as CdnUpdateAccountParams +from .certificate_create_params import CertificateCreateParams as CertificateCreateParams +from .resource_aggregated_stats import ResourceAggregatedStats as ResourceAggregatedStats +from .certificate_replace_params import CertificateReplaceParams as CertificateReplaceParams +from .origin_group_create_params import OriginGroupCreateParams as OriginGroupCreateParams +from .origin_group_update_params import OriginGroupUpdateParams as OriginGroupUpdateParams +from .origin_group_replace_params import OriginGroupReplaceParams as OriginGroupReplaceParams +from .rule_template_create_params import RuleTemplateCreateParams as RuleTemplateCreateParams +from .rule_template_update_params import RuleTemplateUpdateParams as RuleTemplateUpdateParams +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 .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 ( + TrustedCaCertificateReplaceParams as TrustedCaCertificateReplaceParams, +) +from .statistic_get_logs_usage_series_params import ( + StatisticGetLogsUsageSeriesParams as StatisticGetLogsUsageSeriesParams, +) +from .statistic_get_shield_usage_series_params import ( + StatisticGetShieldUsageSeriesParams as StatisticGetShieldUsageSeriesParams, +) +from .statistic_get_logs_usage_aggregated_params import ( + StatisticGetLogsUsageAggregatedParams as StatisticGetLogsUsageAggregatedParams, +) +from .statistic_get_resource_usage_series_params import ( + StatisticGetResourceUsageSeriesParams as StatisticGetResourceUsageSeriesParams, +) +from .statistic_get_shield_usage_aggregated_params import ( + StatisticGetShieldUsageAggregatedParams as StatisticGetShieldUsageAggregatedParams, +) +from .statistic_get_resource_usage_aggregated_params import ( + StatisticGetResourceUsageAggregatedParams as StatisticGetResourceUsageAggregatedParams, +) diff --git a/src/gcore/types/cdn/audit_log_list_params.py b/src/gcore/types/cdn/audit_log_list_params.py new file mode 100644 index 00000000..95024e59 --- /dev/null +++ b/src/gcore/types/cdn/audit_log_list_params.py @@ -0,0 +1,73 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["AuditLogListParams"] + + +class AuditLogListParams(TypedDict, total=False): + client_id: int + """Client ID.""" + + limit: int + """Maximum number of items in response.""" + + max_requested_at: str + """End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + You can specify a date with a time separated by a space, or just a date. + + Examples: + + - &`max_requested_at`=2021-05-05 12:00:00 + - &`max_requested_at`=2021-05-05 + """ + + method: str + """HTTP method type of requests. + + Use upper case only. + + Example: + + - ?method=DELETE + """ + + min_requested_at: str + """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + You can specify a date with a time separated by a space, or just a date. + + Examples: + + - &`min_requested_at`=2021-05-05 12:00:00 + - &`min_requested_at`=2021-05-05 + """ + + offset: int + """Offset relative to the beginning of activity logs.""" + + path: str + """Path that a requested URL should contain.""" + + remote_ip_address: str + """IP address or part of it from which requests are sent.""" + + status_code: int + """Status code returned in the response. + + Specify the first numbers of a status code to get requests for a group of status + codes. + + To filter the activity logs by 4xx codes, use: + + - &`status_code`=4 - + """ + + token_id: int + """Permanent API token ID. Requests made with this token should be displayed.""" + + user_id: int + """User ID.""" diff --git a/src/gcore/types/cdn/ca_certificate.py b/src/gcore/types/cdn/ca_certificate.py new file mode 100644 index 00000000..bc2cba57 --- /dev/null +++ b/src/gcore/types/cdn/ca_certificate.py @@ -0,0 +1,53 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["CaCertificate"] + + +class CaCertificate(BaseModel): + id: Optional[int] = None + """CA certificate ID.""" + + cert_issuer: Optional[str] = None + """Name of the certification center that issued the CA certificate.""" + + cert_subject_alt: Optional[str] = None + """Alternative domain names that the CA certificate secures.""" + + cert_subject_cn: Optional[str] = None + """Domain name that the CA certificate secures.""" + + deleted: Optional[bool] = None + """Defines whether the certificate has been deleted. Parameter is **deprecated**. + + Possible values: + + - **true** - Certificate has been deleted. + - **false** - Certificate has not been deleted. + """ + + has_related_resources: Optional[bool] = FieldInfo(alias="hasRelatedResources", default=None) + """Defines whether the CA certificate is used by a CDN resource. + + Possible values: + + - **true** - Certificate is used by a CDN resource. + - **false** - Certificate is not used by a CDN resource. + """ + + name: Optional[str] = None + """CA certificate name.""" + + ssl_certificate_chain: Optional[str] = FieldInfo(alias="sslCertificateChain", default=None) + """Parameter is **deprecated**.""" + + validity_not_after: Optional[str] = None + """Date when the CA certificate become untrusted (ISO 8601/RFC 3339 format, UTC.)""" + + validity_not_before: Optional[str] = None + """Date when the CA certificate become valid (ISO 8601/RFC 3339 format, UTC.)""" diff --git a/src/gcore/types/cdn/ca_certificate_list.py b/src/gcore/types/cdn/ca_certificate_list.py new file mode 100644 index 00000000..1f56b642 --- /dev/null +++ b/src/gcore/types/cdn/ca_certificate_list.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 .ca_certificate import CaCertificate + +__all__ = ["CaCertificateList"] + +CaCertificateList: TypeAlias = List[CaCertificate] diff --git a/src/gcore/types/cdn/cdn_account.py b/src/gcore/types/cdn/cdn_account.py new file mode 100644 index 00000000..44e8165e --- /dev/null +++ b/src/gcore/types/cdn/cdn_account.py @@ -0,0 +1,86 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["CdnAccount", "Service"] + + +class Service(BaseModel): + enabled: Optional[bool] = None + """Defines whether the CDN service is activated. + + Possible values: + + - **true** - Service is activated. + - **false** - Service is not activated. + """ + + status: Optional[str] = None + """CDN service status. + + Possible values: + + - **new** - CDN service is not activated. + - **trial** - Free trial is in progress. + - **trialend** - Free trial has ended and CDN service is stopped. All CDN + resources are suspended. + - **activating** - CDN service is being activated. It can take up to 15 minutes. + - **active** - CDN service is active. + - **paused** - CDN service is stopped. All CDN resources are suspended. + - **deleted** - CDN service is stopped. All CDN resources are deleted. + """ + + updated: Optional[str] = None + """Date of the last CDN service status update (ISO 8601/RFC 3339 format, UTC.)""" + + +class CdnAccount(BaseModel): + id: Optional[int] = None + """Account ID.""" + + auto_suspend_enabled: Optional[bool] = None + """Defines whether resources will be deactivated automatically by inactivity. + + Possible values: + + - **true** - Resources will be deactivated. + - **false** - Resources will not be deactivated. + """ + + cdn_resources_rules_max_count: Optional[int] = None + """Limit on the number of rules for each CDN resource.""" + + cname: Optional[str] = None + """Domain zone to which a CNAME record of your CDN resources should be pointed.""" + + created: Optional[str] = None + """ + Date of the first synchronization with the Platform (ISO 8601/RFC 3339 format, + UTC.) + """ + + service: Optional[Service] = None + """Information about the CDN service status.""" + + updated: Optional[str] = None + """ + Date of the last update of information about CDN service (ISO 8601/RFC 3339 + format, UTC.) + """ + + use_balancer: Optional[bool] = None + """Defines whether custom balancing is used for content delivery. + + Possible values: + + - **true** - Custom balancing is used for content delivery. + - **false** - Custom balancing is not used for content delivery. + """ + + utilization_level: Optional[int] = None + """CDN traffic usage limit in gigabytes. + + When the limit is reached, we will send an email notification. + """ diff --git a/src/gcore/types/cdn/cdn_account_limits.py b/src/gcore/types/cdn/cdn_account_limits.py new file mode 100644 index 00000000..efaf384d --- /dev/null +++ b/src/gcore/types/cdn/cdn_account_limits.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["CdnAccountLimits"] + + +class CdnAccountLimits(BaseModel): + id: Optional[int] = None + """Account ID.""" + + origins_in_group_limit: Optional[int] = None + """ + Maximum number of origins that can be added to the origin group on your tariff + plan. + """ + + resources_limit: Optional[int] = None + """Maximum number of CDN resources that can be created on your tariff plan.""" + + rules_limit: Optional[int] = None + """ + Maximum number of rules that can be created per CDN resource on your tariff + plan. + """ diff --git a/src/gcore/types/cdn/cdn_audit_log_entry.py b/src/gcore/types/cdn/cdn_audit_log_entry.py new file mode 100644 index 00000000..28064cb6 --- /dev/null +++ b/src/gcore/types/cdn/cdn_audit_log_entry.py @@ -0,0 +1,66 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["CdnAuditLogEntry", "Action"] + + +class Action(BaseModel): + action_type: Optional[str] = None + """Type of change. + + Possible values: + + - **D** - Object is deleted. + - **C** - Object is created. + - **U** - Object is updated. + """ + + state_after_request: Optional[object] = None + """JSON representation of object after the request.""" + + state_before_request: Optional[object] = None + """JSON representation of object before the request.""" + + +class CdnAuditLogEntry(BaseModel): + id: Optional[int] = None + """Activity logs record ID.""" + + actions: Optional[List[Action]] = None + """State of a requested object before and after the request.""" + + client_id: Optional[int] = None + """ID of the client who made the request.""" + + data: Optional[object] = None + """Request body.""" + + host: Optional[str] = None + """Host from which the request was made.""" + + method: Optional[str] = None + """Request HTTP method.""" + + path: Optional[str] = None + """Request URL.""" + + query_params: Optional[str] = None + """Request parameters.""" + + remote_ip_address: Optional[str] = None + """IP address from which the request was made.""" + + requested_at: Optional[str] = None + """Date and time when the request was made.""" + + status_code: Optional[int] = None + """Status code that is returned in the response.""" + + token_id: Optional[int] = None + """Permanent API token ID with which the request was made.""" + + user_id: Optional[int] = None + """ID of the user who made the request.""" diff --git a/src/gcore/types/cdn/cdn_available_features.py b/src/gcore/types/cdn/cdn_available_features.py new file mode 100644 index 00000000..dead1cdc --- /dev/null +++ b/src/gcore/types/cdn/cdn_available_features.py @@ -0,0 +1,46 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["CdnAvailableFeatures", "FreeFeature", "PaidFeature"] + + +class FreeFeature(BaseModel): + create_date: Optional[str] = None + """Date and time when the feature was activated (ISO 8601/RFC 3339 format, UTC.)""" + + feature_id: Optional[int] = None + """Feature ID.""" + + free_feature_id: Optional[int] = None + """Internal feature activation ID.""" + + name: Optional[str] = None + """Feature name.""" + + +class PaidFeature(BaseModel): + create_date: Optional[str] = None + """Date and time when the feature was activated (ISO 8601/RFC 3339 format, UTC.)""" + + feature_id: Optional[int] = None + """Feature ID.""" + + name: Optional[str] = None + """Feature name.""" + + paid_feature_id: Optional[int] = None + """Internal feature activation ID.""" + + +class CdnAvailableFeatures(BaseModel): + id: Optional[int] = None + """Account ID.""" + + free_features: Optional[List[FreeFeature]] = None + """Free features available for your account.""" + + paid_features: Optional[List[PaidFeature]] = None + """Paid features available for your account.""" diff --git a/src/gcore/types/cdn/cdn_list_purge_statuses_params.py b/src/gcore/types/cdn/cdn_list_purge_statuses_params.py new file mode 100644 index 00000000..3c725a88 --- /dev/null +++ b/src/gcore/types/cdn/cdn_list_purge_statuses_params.py @@ -0,0 +1,67 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["CdnListPurgeStatusesParams"] + + +class CdnListPurgeStatusesParams(TypedDict, total=False): + cname: str + """Purges associated with a specific resource CNAME. + + Example: + + - &cname=example.com + """ + + from_created: str + """ + Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Examples: + + - &`from_created`=2021-06-14T00:00:00Z + - &`from_created`=2021-06-14T00:00:00.000Z + """ + + limit: int + """Maximum number of purges in the response.""" + + offset: int + """ + Number of purge requests in the response to skip starting from the beginning of + the requested period. + """ + + purge_type: str + """Purge requests with a certain purge type. + + Possible values: + + - **`purge_by_pattern`** - Purge by Pattern. + - **`purge_by_url`** - Purge by URL. + - **`purge_all`** - Purge All. + """ + + status: str + """Purge with a certain status. + + Possible values: + + - **In progress** + - **Successful** + - **Failed** + - **Status report disabled** + """ + + to_created: str + """End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &`to_created`=2021-06-15T00:00:00Z + - &`to_created`=2021-06-15T00:00:00.000Z + """ diff --git a/src/gcore/types/cdn/cdn_log_entry.py b/src/gcore/types/cdn/cdn_log_entry.py new file mode 100644 index 00000000..5e13d3ac --- /dev/null +++ b/src/gcore/types/cdn/cdn_log_entry.py @@ -0,0 +1,70 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["CdnLogEntry", "Data", "Meta"] + + +class Data(BaseModel): + cache_status: Optional[str] = None + """Cache status: HIT, MISS, etc.""" + + client_ip: Optional[str] = None + """IP address from that the request was received.""" + + cname: Optional[str] = None + """CDN resource custom domain.""" + + datacenter: Optional[str] = None + """Data center where the request was processed.""" + + method: Optional[str] = None + """HTTP method used in the request.""" + + path: Optional[str] = None + """Path requested.""" + + referer: Optional[str] = None + """Value of 'Referer' header.""" + + resource_id: Optional[int] = None + """CDN resource ID.""" + + sent_http_content_type: Optional[str] = None + """ + Value of the Content-Type HTTP header, indicating the MIME type of the resource + being transmitted. + """ + + size: Optional[int] = None + """Response size in bytes.""" + + status: Optional[int] = None + """HTTP status code.""" + + tcpinfo_rtt: Optional[int] = None + """ + Time required to transmit a complete TCP segment: from the first bit to the + last. + """ + + timestamp: Optional[int] = None + """Log timestamp.""" + + user_agent: Optional[str] = None + """Value of 'User-Agent' header.""" + + +class Meta(BaseModel): + count: Optional[int] = None + """Total number of records which match given parameters.""" + + +class CdnLogEntry(BaseModel): + data: Optional[List[Data]] = None + """Contains requested logs.""" + + meta: Optional[Meta] = None + """Contains meta-information.""" diff --git a/src/gcore/types/cdn/cdn_metrics.py b/src/gcore/types/cdn/cdn_metrics.py new file mode 100644 index 00000000..1922d524 --- /dev/null +++ b/src/gcore/types/cdn/cdn_metrics.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from typing_extensions import TypeAlias + +from ..._models import BaseModel +from .cdn_metrics_groups import CdnMetricsGroups +from .cdn_metrics_values import CdnMetricsValues + +__all__ = ["CdnMetrics", "Data"] + +Data: TypeAlias = Union[CdnMetricsValues, CdnMetricsGroups] + + +class CdnMetrics(BaseModel): + data: Optional[Data] = None + """ + If no grouping was requested then "data" holds an array of metric values. If at + least one field is specified in "`group_by`" then "data" is an object whose + properties are groups, which may include other groups; the last group will hold + array of metrics values. + """ diff --git a/src/gcore/types/cdn/cdn_metrics_groups.py b/src/gcore/types/cdn/cdn_metrics_groups.py new file mode 100644 index 00000000..e808f0bd --- /dev/null +++ b/src/gcore/types/cdn/cdn_metrics_groups.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .cdn_metrics_values import CdnMetricsValues + +__all__ = ["CdnMetricsGroups"] + + +class CdnMetricsGroups(BaseModel): + group: Optional[CdnMetricsValues] = None + """List of requested metrics sorted by timestamp in ascending order.""" diff --git a/src/gcore/types/cdn/cdn_metrics_values.py b/src/gcore/types/cdn/cdn_metrics_values.py new file mode 100644 index 00000000..d436ae54 --- /dev/null +++ b/src/gcore/types/cdn/cdn_metrics_values.py @@ -0,0 +1,19 @@ +# 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__ = ["CdnMetricsValues", "CdnMetricsValueItem"] + + +class CdnMetricsValueItem(BaseModel): + metric: Optional[float] = None + """Metrics value.""" + + timestamp: Optional[int] = None + """Start timestamp of interval.""" + + +CdnMetricsValues: TypeAlias = List[CdnMetricsValueItem] diff --git a/src/gcore/types/cdn/cdn_resource.py b/src/gcore/types/cdn/cdn_resource.py new file mode 100644 index 00000000..978b7f64 --- /dev/null +++ b/src/gcore/types/cdn/cdn_resource.py @@ -0,0 +1,1977 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "CdnResource", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsHttp3Enabled", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsTlsVersions", + "OptionsUseDefaultLeChain", + "OptionsUseDns01LeChallenge", + "OptionsUseRsaLeCert", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class OptionsAllowedHTTPMethods(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]] + + +class OptionsBotProtectionBotChallenge(BaseModel): + enabled: Optional[bool] = None + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(BaseModel): + bot_challenge: OptionsBotProtectionBotChallenge + """Controls the bot challenge module state.""" + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + + +class OptionsCors(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: Optional[bool] = None + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Literal["allow", "deny"] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Optional[Dict[str, str]] = None + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: Optional[str] = None + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: Optional[str] = None + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: Optional[OptionsFastedgeOnRequestBody] = None + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: Optional[OptionsFastedgeOnRequestHeaders] = None + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: Optional[OptionsFastedgeOnResponseBody] = None + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: Optional[OptionsFastedgeOnResponseHeaders] = None + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(BaseModel): + codes: List[Literal[301, 302, 303, 307, 308]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(BaseModel): + end_time: str + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: str + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: Optional[str] = None + """Time zone used to calculate time.""" + + +class OptionsForceReturn(BaseModel): + body: str + """URL for redirection or text.""" + + code: int + """Status code value.""" + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] = None + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Host Header value.""" + + +class OptionsHttp3Enabled(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsIgnoreCookie(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: Optional[bool] = None + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: Optional[bool] = None + """Enables or disables compression without quality loss for PNG format.""" + + quality: Optional[int] = None + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: Optional[bool] = None + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Literal["allow", "deny"] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Literal["static", "dynamic"] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: Optional[int] = None + """Amount of downloaded data after which the user will be rate limited.""" + + speed: Optional[int] = None + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: List[str] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: List[str] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Literal["allow", "deny"] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: int + """Maximum request rate.""" + + burst: Optional[int] = None + + delay: Optional[int] = None + + rate_unit: Optional[Literal["r/s", "r/m"]] = None + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: List[str] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Literal["hide", "show"] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(BaseModel): + body: str + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Optional[Literal["break", "last", "redirect", "permanent"]] = None + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Optional[str] = None + """Key generated on your side that will be used for URL signing.""" + + type: Optional[Literal[0, 2]] = None + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(BaseModel): + custom_hostname: str + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Optional[Literal["dynamic", "custom"]] = None + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(BaseModel): + name: str + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: List[str] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: Optional[bool] = None + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[OptionsStaticResponseHeadersValue] + + +class OptionsStaticHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Dict[str, str] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Dict[str, str] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsTlsVersions(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[Literal["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"]] + """List of SSL/TLS protocol versions (case sensitive).""" + + +class OptionsUseDefaultLeChain(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Default Let's Encrypt certificate chain. This is a deprecated + version, use it only for compatibilities with Android devices 7.1.1 or lower. + - **false** - Alternative Let's Encrypt certificate chain. + """ + + +class OptionsUseDns01LeChallenge(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - DNS-01 challenge is used to issue Let's Encrypt certificate. + - **false** - HTTP-01 challenge is used to issue Let's Encrypt certificate. + """ + + +class OptionsUseRsaLeCert(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - RSA Let's Encrypt certificate. + - **false** - ECDSA Let's Encrypt certificate. + """ + + +class OptionsUserAgentACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Literal["allow", "deny"] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(BaseModel): + allowed_http_methods: Optional[OptionsAllowedHTTPMethods] = FieldInfo(alias="allowedHttpMethods", default=None) + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] = None + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] = None + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] = None + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] = None + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] = None + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] = None + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] = None + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] = None + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] = None + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] = None + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] = None + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] = None + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] = None + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] = None + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Optional[OptionsGzipOn] = FieldInfo(alias="gzipOn", default=None) + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Optional[OptionsHostHeader] = FieldInfo(alias="hostHeader", default=None) + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + http3_enabled: Optional[OptionsHttp3Enabled] = None + """Enables HTTP/3 protocol for content delivery. + + `http3_enabled` option works only with `"sslEnabled": true`. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] = None + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Optional[OptionsIgnoreQueryString] = FieldInfo(alias="ignoreQueryString", default=None) + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] = None + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] = None + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] = None + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] = None + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] = None + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] = None + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] = None + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] = None + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] = None + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] = None + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] = None + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] = None + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] = None + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] = None + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] = None + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] = None + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] = None + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] = None + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] = None + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] = None + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] = None + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Optional[OptionsStaticHeaders] = FieldInfo(alias="staticHeaders", default=None) + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Optional[OptionsStaticRequestHeaders] = FieldInfo( + alias="staticRequestHeaders", default=None + ) + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + tls_versions: Optional[OptionsTlsVersions] = None + """ + List of SSL/TLS protocol versions allowed for HTTPS connections from end users + to the domain. + + When the option is disabled, all protocols versions are allowed. + """ + + use_default_le_chain: Optional[OptionsUseDefaultLeChain] = None + """Let's Encrypt certificate chain. + + The specified chain will be used during the next Let's Encrypt certificate issue + or renewal. + """ + + use_dns01_le_challenge: Optional[OptionsUseDns01LeChallenge] = None + """DNS-01 challenge to issue a Let's Encrypt certificate for the resource. + + DNS service should be activated to enable this option. + """ + + use_rsa_le_cert: Optional[OptionsUseRsaLeCert] = None + """RSA Let's Encrypt certificate type for the CDN resource. + + The specified value will be used during the next Let's Encrypt certificate issue + or renewal. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] = None + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] = None + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] = None + """Enables or disables WebSockets connections to an origin server.""" + + +class CdnResource(BaseModel): + id: Optional[int] = None + """CDN resource ID.""" + + active: Optional[bool] = None + """Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + """ + + can_purge_by_urls: Optional[bool] = None + """Defines whether the CDN resource can be used for purge by URLs feature. + + It's available only in case the CDN resource has enabled `ignore_vary_header` + option. + """ + + client: Optional[int] = None + """ID of an account to which the CDN resource belongs.""" + + cname: Optional[str] = None + """Delivery domains that will be used for content delivery through a CDN. + + Delivery domains should be added to your DNS settings. + """ + + created: Optional[str] = None + """Date of CDN resource creation.""" + + deleted: Optional[bool] = None + """Defines whether CDN resource has been deleted. + + Possible values: + + - **true** - CDN resource is deleted. + - **false** - CDN resource is not deleted. + """ + + description: Optional[str] = None + """Optional comment describing the CDN resource.""" + + enabled: Optional[bool] = None + """Enables or disables a CDN resource change by a user. + + Possible values: + + - **true** - CDN resource is enabled and can be changed. Content can be + delivered. + - **false** - CDN resource is disabled and cannot be changed. Content can not be + delivered. + """ + + full_custom_enabled: Optional[bool] = None + """Defines whether the CDN resource has a custom configuration. + + Possible values: + + - **true** - CDN resource has a custom configuration. You cannot change resource + settings, except for the SSL certificate. To change other settings, contact + technical support. + - **false** - CDN resource has a regular configuration. You can change CDN + resource settings. + """ + + is_primary: Optional[bool] = None + """Defines whether a CDN resource has a cache zone shared with other CDN resources. + + Possible values: + + - **true** - CDN resource is main and has a shared caching zone with other CDN + resources, which are called reserve. + - **false** - CDN resource is reserve and it has a shared caching zone with the + main CDN resource. You cannot change some options, create rules, set up origin + shielding and use the reserve resource for Streaming. + - **null** - CDN resource does not have a shared cache zone. + + The main CDN resource is specified in the `primary_resource` field. It cannot be + suspended unless all related reserve CDN resources are suspended. + """ + + name: Optional[str] = None + """CDN resource name.""" + + options: Optional[Options] = None + """List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + """ + + origin_group: Optional[int] = FieldInfo(alias="originGroup", default=None) + """Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + """ + + origin_group_name: Optional[str] = FieldInfo(alias="originGroup_name", default=None) + """Origin group name.""" + + origin_protocol: Optional[Literal["HTTP", "HTTPS", "MATCH"]] = FieldInfo(alias="originProtocol", default=None) + """Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + """ + + preset_applied: Optional[bool] = None + """Defines whether the CDN resource has a preset applied. + + Possible values: + + - **true** - CDN resource has a preset applied. CDN resource options included in + the preset cannot be edited. + - **false** - CDN resource does not have a preset applied. + """ + + primary_resource: Optional[int] = None + """ + ID of the main CDN resource which has a shared caching zone with a reserve CDN + resource. + + If the parameter is not empty, then the current CDN resource is the reserve. You + cannot change some options, create rules, set up origin shielding, or use the + reserve CDN resource for Streaming. + """ + + proxy_ssl_ca: Optional[int] = None + """ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + """ + + proxy_ssl_data: Optional[int] = None + """ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + """ + + proxy_ssl_enabled: Optional[bool] = None + """ + Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + """ + + rules: Optional[List[object]] = None + """Rules configured for the CDN resource.""" + + secondary_hostnames: Optional[List[str]] = FieldInfo(alias="secondaryHostnames", default=None) + """ + Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + """ + + shield_dc: Optional[str] = None + """Name of the origin shielding location data center. + + Parameter returns **null** if origin shielding is disabled. + """ + + shield_enabled: Optional[bool] = None + """Defines whether origin shield is active and working for the CDN resource. + + Possible values: + + - **true** - Origin shield is active. + - **false** - Origin shield is not active. + """ + + shield_routing_map: Optional[int] = None + """ + Defines whether the origin shield with a dynamic location is enabled for the CDN + resource. + + To manage origin shielding, you must contact customer support. + """ + + shielded: Optional[bool] = None + """Defines whether origin shielding feature is enabled for the resource. + + Possible values: + + - **true** - Origin shielding is enabled. + - **false** - Origin shielding is disabled. + """ + + ssl_data: Optional[int] = FieldInfo(alias="sslData", default=None) + """ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + """ + + ssl_enabled: Optional[bool] = FieldInfo(alias="sslEnabled", default=None) + """Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + """ + + status: Optional[Literal["active", "suspended", "processed", "deleted"]] = None + """CDN resource status. + + Possible values: + + - **active** - CDN resource is active. Content is available to users. + - **suspended** - CDN resource is suspended. Content is not available to users. + - **processed** - CDN resource has recently been created and is currently being + processed. It will take about fifteen minutes to propagate it to all + locations. + - **deleted** - CDN resource is deleted. + """ + + suspend_date: Optional[str] = None + """ + Date when the CDN resource was suspended automatically if there is no traffic on + it for 90 days. + + Not specified if the resource was not stopped due to lack of traffic. + """ + + suspended: Optional[bool] = None + """ + Defines whether the CDN resource has been automatically suspended because there + was no traffic on it for 90 days. + + Possible values: + + - **true** - CDN resource is currently automatically suspended. + - **false** - CDN resource is not automatically suspended. + + You can enable CDN resource using the `active` field. If there is no traffic on + the CDN resource within seven days following activation, it will be suspended + again. + + To avoid CDN resource suspension due to no traffic, contact technical support. + """ + + updated: Optional[str] = None + """Date of the last CDN resource update.""" + + vp_enabled: Optional[bool] = None + """Defines whether the CDN resource is integrated with the Streaming Platform. + + Possible values: + + - **true** - CDN resource is configured for Streaming Platform. Changing + resource settings can affect its operation. + - **false** - CDN resource is not configured for Streaming Platform. + """ + + waap_domain_id: Optional[str] = None + """The ID of the associated WAAP domain.""" diff --git a/src/gcore/types/cdn/cdn_resource_list.py b/src/gcore/types/cdn/cdn_resource_list.py new file mode 100644 index 00000000..cfbed20c --- /dev/null +++ b/src/gcore/types/cdn/cdn_resource_list.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 .cdn_resource import CdnResource + +__all__ = ["CdnResourceList"] + +CdnResourceList: TypeAlias = List[CdnResource] diff --git a/src/gcore/types/cdn/cdn_update_account_params.py b/src/gcore/types/cdn/cdn_update_account_params.py new file mode 100644 index 00000000..cfeba9f7 --- /dev/null +++ b/src/gcore/types/cdn/cdn_update_account_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["CdnUpdateAccountParams"] + + +class CdnUpdateAccountParams(TypedDict, total=False): + utilization_level: int + """CDN traffic usage limit in gigabytes. + + When the limit is reached, we will send an email notification. + """ diff --git a/src/gcore/types/cdn/certificate_create_params.py b/src/gcore/types/cdn/certificate_create_params.py new file mode 100644 index 00000000..8c17c903 --- /dev/null +++ b/src/gcore/types/cdn/certificate_create_params.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import Required, Annotated, TypeAlias, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["CertificateCreateParams", "CreateSSlPayload", "LetSEncryptCertificate"] + + +class CreateSSlPayload(TypedDict, total=False): + name: Required[str] + """SSL certificate name. + + It must be unique. + """ + + ssl_certificate: Required[Annotated[str, PropertyInfo(alias="sslCertificate")]] + """Public part of the SSL certificate. + + All chain of the SSL certificate should be added. + """ + + ssl_private_key: Required[Annotated[str, PropertyInfo(alias="sslPrivateKey")]] + """Private key of the SSL certificate.""" + + validate_root_ca: bool + """ + Defines whether to check the SSL certificate for a signature from a trusted + certificate authority. + + Possible values: + + - **true** - SSL certificate must be verified to be signed by a trusted + certificate authority. + - **false** - SSL certificate will not be verified to be signed by a trusted + certificate authority. + """ + + +class LetSEncryptCertificate(TypedDict, total=False): + automated: Required[bool] + """Must be **true** to issue certificate automatically.""" + + name: Required[str] + """SSL certificate name. It must be unique.""" + + +CertificateCreateParams: TypeAlias = Union[CreateSSlPayload, LetSEncryptCertificate] diff --git a/src/gcore/types/cdn/certificate_get_status_params.py b/src/gcore/types/cdn/certificate_get_status_params.py new file mode 100644 index 00000000..ea923341 --- /dev/null +++ b/src/gcore/types/cdn/certificate_get_status_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["CertificateGetStatusParams"] + + +class CertificateGetStatusParams(TypedDict, total=False): + exclude: SequenceNotStr[str] + """Listed fields will be excluded from the response.""" diff --git a/src/gcore/types/cdn/certificate_list_params.py b/src/gcore/types/cdn/certificate_list_params.py new file mode 100644 index 00000000..7474922f --- /dev/null +++ b/src/gcore/types/cdn/certificate_list_params.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["CertificateListParams"] + + +class CertificateListParams(TypedDict, total=False): + automated: bool + """How the SSL certificate was issued. + + Possible values: + + - **true** – Certificate was issued automatically. + - **false** – Certificate was added by a user. + """ + + resource_id: int + """CDN resource ID for which certificates are requested.""" + + validity_not_after_lte: str + """ + Date and time when the certificate become untrusted (ISO 8601/RFC 3339 format, + UTC.) + + Response will contain only certificates valid until the specified time. + """ diff --git a/src/gcore/types/cdn/certificate_replace_params.py b/src/gcore/types/cdn/certificate_replace_params.py new file mode 100644 index 00000000..8d60c803 --- /dev/null +++ b/src/gcore/types/cdn/certificate_replace_params.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["CertificateReplaceParams"] + + +class CertificateReplaceParams(TypedDict, total=False): + name: Required[str] + """SSL certificate name. + + It must be unique. + """ + + ssl_certificate: Required[Annotated[str, PropertyInfo(alias="sslCertificate")]] + """Public part of the SSL certificate. + + All chain of the SSL certificate should be added. + """ + + ssl_private_key: Required[Annotated[str, PropertyInfo(alias="sslPrivateKey")]] + """Private key of the SSL certificate.""" + + validate_root_ca: bool + """ + Defines whether to check the SSL certificate for a signature from a trusted + certificate authority. + + Possible values: + + - **true** - SSL certificate must be verified to be signed by a trusted + certificate authority. + - **false** - SSL certificate will not be verified to be signed by a trusted + certificate authority. + """ diff --git a/src/gcore/types/cdn/log_download_params.py b/src/gcore/types/cdn/log_download_params.py new file mode 100644 index 00000000..2804b7bb --- /dev/null +++ b/src/gcore/types/cdn/log_download_params.py @@ -0,0 +1,279 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["LogDownloadParams"] + + +class LogDownloadParams(TypedDict, total=False): + format: Required[str] + """Output format. + + Possible values: + + - csv + - tsv + """ + + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """ + Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &from=2021-06-14T00:00:00Z + - &from=2021-06-14T00:00:00.000Z + """ + + to: Required[str] + """End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &to=2021-06-15T00:00:00Z + - &to=2021-06-15T00:00:00.000Z + """ + + cache_status_eq: Annotated[str, PropertyInfo(alias="cache_status__eq")] + """Caching status. + + Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', + 'REVALIDATED', 'HIT', '-'. + """ + + cache_status_in: Annotated[str, PropertyInfo(alias="cache_status__in")] + """List of caching statuses. + + Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', + 'REVALIDATED', 'HIT', '-'. Values should be separated by a comma. + """ + + cache_status_ne: Annotated[str, PropertyInfo(alias="cache_status__ne")] + """Caching status not equal to the specified value. + + Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', + 'REVALIDATED', 'HIT', '-'. + """ + + cache_status_not_in: Annotated[str, PropertyInfo(alias="cache_status__not_in")] + """List of caching statuses not equal to the specified values. + + Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', + 'REVALIDATED', 'HIT', '-'. Values should be separated by a comma. + """ + + client_ip_eq: Annotated[str, PropertyInfo(alias="client_ip__eq")] + """IP address of the client who sent the request.""" + + client_ip_in: Annotated[str, PropertyInfo(alias="client_ip__in")] + """List of IP addresses of the clients who sent the request.""" + + client_ip_ne: Annotated[str, PropertyInfo(alias="client_ip__ne")] + """IP address of the client who did not send the request.""" + + client_ip_not_in: Annotated[str, PropertyInfo(alias="client_ip__not_in")] + """List of IP addresses of the clients who did not send the request.""" + + cname_contains: Annotated[str, PropertyInfo(alias="cname__contains")] + """Part of the custom domain of the requested CDN resource. + + Minimum length is 3 characters. + """ + + cname_eq: Annotated[str, PropertyInfo(alias="cname__eq")] + """Custom domain of the requested CDN resource.""" + + cname_in: Annotated[str, PropertyInfo(alias="cname__in")] + """List of custom domains of the requested CDN resource. + + Values should be separated by a comma. + """ + + cname_ne: Annotated[str, PropertyInfo(alias="cname__ne")] + """Custom domain of the requested CDN resource not equal to the specified value.""" + + cname_not_in: Annotated[str, PropertyInfo(alias="cname__not_in")] + """ + List of custom domains of the requested CDN resource not equal to the specified + values. Values should be separated by a comma. + """ + + datacenter_eq: Annotated[str, PropertyInfo(alias="datacenter__eq")] + """Data center where request was processed.""" + + datacenter_in: Annotated[str, PropertyInfo(alias="datacenter__in")] + """List of data centers where request was processed. + + Values should be separated by a comma. + """ + + datacenter_ne: Annotated[str, PropertyInfo(alias="datacenter__ne")] + """Data center where request was not processed.""" + + datacenter_not_in: Annotated[str, PropertyInfo(alias="datacenter__not_in")] + """List of data centers where request was not processed. + + Values should be separated by a comma. + """ + + fields: str + """A comma-separated list of returned fields. + + Supported fields are presented in the responses section. + + Example: + + - &fields=timestamp,path,status + """ + + limit: int + """Maximum number of log records in the response.""" + + method_eq: Annotated[str, PropertyInfo(alias="method__eq")] + """Request HTTP method. + + Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', + 'PUT', 'TRACE'. + """ + + method_in: Annotated[str, PropertyInfo(alias="method__in")] + """Request HTTP method. + + Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', + 'PUT', 'TRACE'. Values should be separated by a comma. + """ + + method_ne: Annotated[str, PropertyInfo(alias="method__ne")] + """Request HTTP method. + + Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', + 'PUT', 'TRACE'. + """ + + method_not_in: Annotated[str, PropertyInfo(alias="method__not_in")] + """Request HTTP method. + + Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', + 'PUT', 'TRACE'. Values should be separated by a comma. + """ + + offset: int + """ + Number of log records to skip starting from the beginning of the requested + period. + """ + + resource_id_eq: Annotated[int, PropertyInfo(alias="resource_id__eq")] + """ID of the requested CDN resource equal to the specified value.""" + + resource_id_gt: Annotated[int, PropertyInfo(alias="resource_id__gt")] + """ID of the requested CDN resource greater than the specified value.""" + + resource_id_gte: Annotated[int, PropertyInfo(alias="resource_id__gte")] + """ID of the requested CDN resource greater than or equal to the specified value.""" + + resource_id_in: Annotated[str, PropertyInfo(alias="resource_id__in")] + """List of IDs of the requested CDN resource. + + Values should be separated by a comma. + """ + + resource_id_lt: Annotated[int, PropertyInfo(alias="resource_id__lt")] + """ID of the requested CDN resource less than the specified value.""" + + resource_id_lte: Annotated[int, PropertyInfo(alias="resource_id__lte")] + """ID of the requested CDN resource less than or equal to the specified value.""" + + resource_id_ne: Annotated[int, PropertyInfo(alias="resource_id__ne")] + """ID of the requested CDN resource not equal to the specified value.""" + + resource_id_not_in: Annotated[str, PropertyInfo(alias="resource_id__not_in")] + """List of IDs of the requested CDN resource not equal to the specified values. + + Values should be separated by a comma. + """ + + size_eq: Annotated[int, PropertyInfo(alias="size__eq")] + """Response size in bytes equal to the specified value.""" + + size_gt: Annotated[int, PropertyInfo(alias="size__gt")] + """Response size in bytes greater than the specified value.""" + + size_gte: Annotated[int, PropertyInfo(alias="size__gte")] + """Response size in bytes greater than or equal to the specified value.""" + + size_in: Annotated[str, PropertyInfo(alias="size__in")] + """List of response sizes in bytes. Values should be separated by a comma.""" + + size_lt: Annotated[int, PropertyInfo(alias="size__lt")] + """Response size in bytes less than the specified value.""" + + size_lte: Annotated[int, PropertyInfo(alias="size__lte")] + """Response size in bytes less than or equal to the specified value.""" + + size_ne: Annotated[int, PropertyInfo(alias="size__ne")] + """Response size in bytes not equal to the specified value.""" + + size_not_in: Annotated[str, PropertyInfo(alias="size__not_in")] + """List of response sizes in bytes not equal to the specified values. + + Values should be separated by + """ + + sort: str + """Sorting rules. + + Possible values: + + - **method** - Request HTTP method. + - **`client_ip`** - IP address of the client who sent the request. + - **status** - Status code in the response. + - **size** - Response size in bytes. + - **cname** - Custom domain of the requested resource. + - **`resource_id`** - ID of the requested CDN resource. + - **`cache_status`** - Caching status. + - **datacenter** - Data center where request was processed. + - **timestamp** - Date and time when the request was made. + + May include multiple values separated by a comma. + + Example: + + - &sort=-timestamp,status + """ + + status_eq: Annotated[int, PropertyInfo(alias="status__eq")] + """Status code in the response equal to the specified value.""" + + status_gt: Annotated[int, PropertyInfo(alias="status__gt")] + """Status code in the response greater than the specified value.""" + + status_gte: Annotated[int, PropertyInfo(alias="status__gte")] + """Status code in the response greater than or equal to the specified value.""" + + status_in: Annotated[str, PropertyInfo(alias="status__in")] + """List of status codes in the response. Values should be separated by a comma.""" + + status_lt: Annotated[int, PropertyInfo(alias="status__lt")] + """Status code in the response less than the specified value.""" + + status_lte: Annotated[int, PropertyInfo(alias="status__lte")] + """Status code in the response less than or equal to the specified value.""" + + status_ne: Annotated[int, PropertyInfo(alias="status__ne")] + """Status code in the response not equal to the specified value.""" + + status_not_in: Annotated[str, PropertyInfo(alias="status__not_in")] + """List of status codes not in the response. + + Values should be separated by a comma. + """ diff --git a/src/gcore/types/cdn/log_list_params.py b/src/gcore/types/cdn/log_list_params.py new file mode 100644 index 00000000..7a9b1aca --- /dev/null +++ b/src/gcore/types/cdn/log_list_params.py @@ -0,0 +1,273 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["LogListParams"] + + +class LogListParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """ + Start date and time of the requested time period (ISO 8601/RFC 3339 format, + UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &from=2021-06-14T00:00:00Z + - &from=2021-06-14T00:00:00.000Z + """ + + to: Required[str] + """End date and time of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Difference between "from" and "to" cannot exceed 6 hours. + + Examples: + + - &to=2021-06-15T00:00:00Z + - &to=2021-06-15T00:00:00.000Z + """ + + cache_status_eq: Annotated[str, PropertyInfo(alias="cache_status__eq")] + """Caching status. + + Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', + 'REVALIDATED', 'HIT', '-'. + """ + + cache_status_in: Annotated[str, PropertyInfo(alias="cache_status__in")] + """List of caching statuses. + + Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', + 'REVALIDATED', 'HIT', '-'. Values should be separated by a comma. + """ + + cache_status_ne: Annotated[str, PropertyInfo(alias="cache_status__ne")] + """Caching status not equal to the specified value. + + Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', + 'REVALIDATED', 'HIT', '-'. + """ + + cache_status_not_in: Annotated[str, PropertyInfo(alias="cache_status__not_in")] + """List of caching statuses not equal to the specified values. + + Possible values: 'MISS', 'BYPASS', 'EXPIRED', 'STALE', 'PENDING', 'UPDATING', + 'REVALIDATED', 'HIT', '-'. Values should be separated by a comma. + """ + + client_ip_eq: Annotated[str, PropertyInfo(alias="client_ip__eq")] + """IP address of the client who sent the request.""" + + client_ip_in: Annotated[str, PropertyInfo(alias="client_ip__in")] + """List of IP addresses of the clients who sent the request.""" + + client_ip_ne: Annotated[str, PropertyInfo(alias="client_ip__ne")] + """IP address of the client who did not send the request.""" + + client_ip_not_in: Annotated[str, PropertyInfo(alias="client_ip__not_in")] + """List of IP addresses of the clients who did not send the request.""" + + cname_contains: Annotated[str, PropertyInfo(alias="cname__contains")] + """Part of the custom domain of the requested CDN resource. + + Minimum length is 3 characters. + """ + + cname_eq: Annotated[str, PropertyInfo(alias="cname__eq")] + """Custom domain of the requested CDN resource.""" + + cname_in: Annotated[str, PropertyInfo(alias="cname__in")] + """List of custom domains of the requested CDN resource. + + Values should be separated by a comma. + """ + + cname_ne: Annotated[str, PropertyInfo(alias="cname__ne")] + """Custom domain of the requested CDN resource not equal to the specified value.""" + + cname_not_in: Annotated[str, PropertyInfo(alias="cname__not_in")] + """ + List of custom domains of the requested CDN resource not equal to the specified + values. Values should be separated by a comma. + """ + + datacenter_eq: Annotated[str, PropertyInfo(alias="datacenter__eq")] + """Data center where request was processed.""" + + datacenter_in: Annotated[str, PropertyInfo(alias="datacenter__in")] + """List of data centers where request was processed. + + Values should be separated by a comma. + """ + + datacenter_ne: Annotated[str, PropertyInfo(alias="datacenter__ne")] + """Data center where request was not processed.""" + + datacenter_not_in: Annotated[str, PropertyInfo(alias="datacenter__not_in")] + """List of data centers where request was not processed. + + Values should be separated by a comma. + """ + + fields: str + """A comma-separated list of returned fields. + + Supported fields are presented in the responses section. + + Example: + + - &fields=timestamp,path,status + """ + + limit: int + """Maximum number of log records in the response.""" + + method_eq: Annotated[str, PropertyInfo(alias="method__eq")] + """Request HTTP method. + + Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', + 'PUT', 'TRACE'. + """ + + method_in: Annotated[str, PropertyInfo(alias="method__in")] + """Request HTTP method. + + Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', + 'PUT', 'TRACE'. Values should be separated by a comma. + """ + + method_ne: Annotated[str, PropertyInfo(alias="method__ne")] + """Request HTTP method. + + Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', + 'PUT', 'TRACE'. + """ + + method_not_in: Annotated[str, PropertyInfo(alias="method__not_in")] + """Request HTTP method. + + Possible values: 'CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', + 'PUT', 'TRACE'. Values should be separated by a comma. + """ + + offset: int + """ + Number of log records to skip starting from the beginning of the requested + period. + """ + + ordering: str + """Sorting rules. + + Possible values: + + - **method** - Request HTTP method. + - **`client_ip`** - IP address of the client who sent the request. + - **status** - Status code in the response. + - **size** - Response size in bytes. + - **cname** - Custom domain of the requested resource. + - **`resource_id`** - ID of the requested CDN resource. + - **`cache_status`** - Caching status. + - **datacenter** - Data center where request was processed. + - **timestamp** - Date and time when the request was made. + + Parameter may have multiple values separated by a comma. + + By default, ascending sorting is applied. To sort in descending order, add '-' + prefix. + + Example: + + - &ordering=-timestamp,status + """ + + resource_id_eq: Annotated[int, PropertyInfo(alias="resource_id__eq")] + """ID of the requested CDN resource equal to the specified value.""" + + resource_id_gt: Annotated[int, PropertyInfo(alias="resource_id__gt")] + """ID of the requested CDN resource greater than the specified value.""" + + resource_id_gte: Annotated[int, PropertyInfo(alias="resource_id__gte")] + """ID of the requested CDN resource greater than or equal to the specified value.""" + + resource_id_in: Annotated[str, PropertyInfo(alias="resource_id__in")] + """List of IDs of the requested CDN resource. + + Values should be separated by a comma. + """ + + resource_id_lt: Annotated[int, PropertyInfo(alias="resource_id__lt")] + """ID of the requested CDN resource less than the specified value.""" + + resource_id_lte: Annotated[int, PropertyInfo(alias="resource_id__lte")] + """ID of the requested CDN resource less than or equal to the specified value.""" + + resource_id_ne: Annotated[int, PropertyInfo(alias="resource_id__ne")] + """ID of the requested CDN resource not equal to the specified value.""" + + resource_id_not_in: Annotated[str, PropertyInfo(alias="resource_id__not_in")] + """List of IDs of the requested CDN resource not equal to the specified values. + + Values should be separated by a comma. + """ + + size_eq: Annotated[int, PropertyInfo(alias="size__eq")] + """Response size in bytes equal to the specified value.""" + + size_gt: Annotated[int, PropertyInfo(alias="size__gt")] + """Response size in bytes greater than the specified value.""" + + size_gte: Annotated[int, PropertyInfo(alias="size__gte")] + """Response size in bytes greater than or equal to the specified value.""" + + size_in: Annotated[str, PropertyInfo(alias="size__in")] + """List of response sizes in bytes. Values should be separated by a comma.""" + + size_lt: Annotated[int, PropertyInfo(alias="size__lt")] + """Response size in bytes less than the specified value.""" + + size_lte: Annotated[int, PropertyInfo(alias="size__lte")] + """Response size in bytes less than or equal to the specified value.""" + + size_ne: Annotated[int, PropertyInfo(alias="size__ne")] + """Response size in bytes not equal to the specified value.""" + + size_not_in: Annotated[str, PropertyInfo(alias="size__not_in")] + """List of response sizes in bytes not equal to the specified values. + + Values should be separated by + """ + + status_eq: Annotated[int, PropertyInfo(alias="status__eq")] + """Status code in the response equal to the specified value.""" + + status_gt: Annotated[int, PropertyInfo(alias="status__gt")] + """Status code in the response greater than the specified value.""" + + status_gte: Annotated[int, PropertyInfo(alias="status__gte")] + """Status code in the response greater than or equal to the specified value.""" + + status_in: Annotated[str, PropertyInfo(alias="status__in")] + """List of status codes in the response. Values should be separated by a comma.""" + + status_lt: Annotated[int, PropertyInfo(alias="status__lt")] + """Status code in the response less than the specified value.""" + + status_lte: Annotated[int, PropertyInfo(alias="status__lte")] + """Status code in the response less than or equal to the specified value.""" + + status_ne: Annotated[int, PropertyInfo(alias="status__ne")] + """Status code in the response not equal to the specified value.""" + + status_not_in: Annotated[str, PropertyInfo(alias="status__not_in")] + """List of status codes not in the response. + + Values should be separated by a comma. + """ diff --git a/src/gcore/types/cdn/logs/__init__.py b/src/gcore/types/cdn/logs/__init__.py new file mode 100644 index 00000000..02f4dd5c --- /dev/null +++ b/src/gcore/types/cdn/logs/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .log_settings import LogSettings as LogSettings +from .setting_create_params import SettingCreateParams as SettingCreateParams +from .setting_update_params import SettingUpdateParams as SettingUpdateParams diff --git a/src/gcore/types/cdn/logs/log_settings.py b/src/gcore/types/cdn/logs/log_settings.py new file mode 100644 index 00000000..ab1adcc9 --- /dev/null +++ b/src/gcore/types/cdn/logs/log_settings.py @@ -0,0 +1,172 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ...._models import BaseModel + +__all__ = ["LogSettings", "Folder"] + + +class Folder(BaseModel): + id: Optional[int] = None + """Parameter meaning depends on the value of the "`storage_type`" value: + + - **s3** - S3 bucket ID. + - **ftp/sftp** - FTP/SFTP folder ID. + """ + + bucket: Optional[str] = None + """S3 bucket name. + + The field is required if "`storage_type`": **s3**. + """ + + cdn_resource: Optional[int] = None + """CDN resource ID.""" + + folder: Optional[str] = None + """Parameter meaning depends on the value of the "`storage_type`" value: + + - **s3** - S3 bucket sub-folder name (optional.) + - **ftp/sftp** - FTP/SFTP folder name (required.) + """ + + +class LogSettings(BaseModel): + all_resources_bucket: Optional[str] = None + """Name of the S3 bucket to which logs of all CDN resources are delivered. + + Applicable for "`storage_type`": S3. + """ + + all_resources_folder: Optional[str] = None + """Parameter meaning depends on the value of the "`storage_type`" value: + + - **s3** - Name of the S3 bucket sub-folder to which logs for all CDN resources + are delivered. + - **ftp/sftp** - Name of the folder (or path) to which logs for all CDN + resources are delivered. + """ + + archive_size_mb: Optional[int] = None + """ + The size of a single piece of the archive in MB. In case of **null** value logs + are delivered without slicing. + """ + + client: Optional[int] = None + """Client ID.""" + + comment: Optional[str] = None + """System comment on the status of settings, if they are suspended.""" + + enabled: Optional[bool] = None + """Enables or disables a log forwarding feature. + + Possible values: + + - **true** - log forwarding feature is active. + - **false** - log forwarding feature is deactivated. + """ + + folders: Optional[List[Folder]] = None + """List of folders/buckets for receiving CDN resources logs.""" + + for_all_resources: Optional[bool] = None + """ + Defines whether logs of all CDN resources are delivered to one folder/bucket or + to separate ones. + + Possible values: + + - **true** - Logs of all CDN resources are delivered to one folder/bucket. + - **false** - Logs of CDN resources are delivered to separate folders/buckets. + """ + + ftp_hostname: Optional[str] = None + """FTP storage hostname.""" + + ftp_login: Optional[str] = None + """FTP storage login.""" + + ftp_prepend_folder: Optional[str] = None + """Name of prepend FTP folder for log delivery.""" + + ignore_empty_logs: Optional[bool] = None + """Enables or disables the forwarding of empty logs. + + Possible values: + + - **true** - Empty logs are not sent. + - **false** - Empty logs are sent. + """ + + s3_access_key_id: Optional[str] = None + """Access key ID for the S3 account. + + Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 + """ + + s3_aws_region: Optional[str] = None + """Amazon AWS region.""" + + s3_bucket_location: Optional[str] = None + """S3 storage location. + + Restrictions: + + - Maximum 255 symbols. + - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores + (.:\\__-). + """ + + s3_host_bucket: Optional[str] = None + """S3 storage bucket hostname. + + Restrictions: + + - Maximum 255 symbols. + - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. + """ + + s3_hostname: Optional[str] = None + """S3 storage hostname.""" + + s3_type: Optional[str] = None + """Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + """ + + sftp_hostname: Optional[str] = None + """SFTP storage hostname.""" + + sftp_login: Optional[str] = None + """SFTP storage login.""" + + sftp_prepend_folder: Optional[str] = None + """Name of prepend SFTP folder for log delivery.""" + + status: Optional[str] = None + """Log delivery status. + + Possible values: + + - **ok** – All/part of attempts to deliver logs were successful. + - **failed** – All attempts to deliver logs failed. + - **pending** - No logs delivery attempts yet. + - **disabled** - Log delivery is disabled. + """ + + storage_type: Optional[str] = None + """Storage type. + + Possible values: + + - **ftp** + - **sftp** + - **s3** + """ diff --git a/src/gcore/types/cdn/logs/setting_create_params.py b/src/gcore/types/cdn/logs/setting_create_params.py new file mode 100644 index 00000000..20720e89 --- /dev/null +++ b/src/gcore/types/cdn/logs/setting_create_params.py @@ -0,0 +1,200 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["SettingCreateParams", "Folder"] + + +class SettingCreateParams(TypedDict, total=False): + all_resources_bucket: Required[str] + """Name of the S3 bucket to which logs for all CDN resources are delivered.""" + + all_resources_folder: Required[str] + """Parameter meaning depends on the value of the "`storage_type`" value: + + - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for + all CDN resources are delivered. + - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for + all CDN resources are delivered. + """ + + folders: Required[Iterable[Folder]] + """List of folders/buckets for receiving CDN resources logs.""" + + for_all_resources: Required[bool] + """ + Defines whether logs of all CDN resources are delivered to one folder/bucket or + to separate ones. + + Possible values: + + - **true** - Logs of all CDN resources are delivered to one folder/bucket. + - **false** - Logs of different CDN resources are delivered to separate + folders/buckets. + """ + + ftp_hostname: Required[str] + """FTP storage hostname.""" + + ftp_login: Required[str] + """FTP storage login.""" + + ftp_password: Required[str] + """FTP storage password.""" + + s3_access_key_id: Required[str] + """Access key ID for the S3 account. + + Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 + """ + + s3_hostname: Required[str] + """S3 storage hostname. + + It is required if "`s3_type`": other. + """ + + s3_secret_key: Required[str] + """Secret access key for the S3 account. + + Secret Access Key is 20-50 alpha-numeric-slash-plus characters like + kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct + """ + + s3_type: Required[str] + """Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + """ + + sftp_hostname: Required[str] + """SFTP storage hostname.""" + + sftp_login: Required[str] + """SFTP storage login.""" + + sftp_password: Required[str] + """SFTP storage password. + + It should be empty if "`sftp_private_key`" is set. + """ + + storage_type: Required[str] + """Storage type. + + Possible values: + + - **ftp** + - **sftp** + - **s3** + """ + + archive_size_mb: Optional[int] + """ + The size of a single piece of the archive in MB. In case of **null** value logs + are delivered without slicing. + """ + + enabled: bool + """Enables or disables a log forwarding feature. + + Possible values: + + - **true** - log forwarding feature is active. + - **false** - log forwarding feature is deactivated. + """ + + ftp_prepend_folder: str + """Name of the FTP prepend folder for log delivery. + + **Null** is allowed. + """ + + ignore_empty_logs: bool + """Enables or disables the forwarding of empty logs. + + Possible values: + + - **true** - Empty logs are not sent. + - **false** - Empty logs are sent. + """ + + s3_aws_region: int + """Amazon AWS region.""" + + s3_bucket_location: str + """Location of S3 storage. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores + (.:\\__-). + """ + + s3_host_bucket: str + """S3 bucket hostname. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. + - Required if "`s3_type`": other. + """ + + sftp_key_passphrase: str + """Passphrase for SFTP private key. + + Restrictions: + + - Should be set if private key encoded with passphrase. + - Should be empty if "`sftp_password`" is set. + """ + + sftp_prepend_folder: str + """Name of the SFTP prepend folder for log delivery. + + **Null** is allowed. + """ + + sftp_private_key: str + """Private key for SFTP authorization. + + Possible values: + + - **RSA** + - **ED25519** + + It should be empty if "`sftp_password`" is set. + """ + + +class Folder(TypedDict, total=False): + id: int + """Parameter meaning depends on the value of the "`storage_type`" value: + + - **s3** - S3 bucket ID. + - **ftp/sftp** - FTP/SFTP folder ID. + """ + + bucket: str + """S3 bucket name. + + The field is required if "`storage_type`": **s3**. + """ + + cdn_resource: int + """CDN resource ID.""" + + folder: str + """Parameter meaning depends on the value of the "`storage_type`" value: + + - **s3** - S3 bucket sub-folder name (optional.) + - **ftp/sftp** - FTP/SFTP folder name (required.) + """ diff --git a/src/gcore/types/cdn/logs/setting_update_params.py b/src/gcore/types/cdn/logs/setting_update_params.py new file mode 100644 index 00000000..b6736ad2 --- /dev/null +++ b/src/gcore/types/cdn/logs/setting_update_params.py @@ -0,0 +1,200 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["SettingUpdateParams", "Folder"] + + +class SettingUpdateParams(TypedDict, total=False): + all_resources_bucket: Required[str] + """Name of the S3 bucket to which logs for all CDN resources are delivered.""" + + all_resources_folder: Required[str] + """Parameter meaning depends on the value of the "`storage_type`" value: + + - If "`storage_type`": s3 - Name of the S3 bucket sub-folder to which logs for + all CDN resources are delivered. + - If "`storage_type`": ftp/sftp - Name of the folder (or path) to which logs for + all CDN resources are delivered. + """ + + folders: Required[Iterable[Folder]] + """List of folders/buckets for receiving CDN resources logs.""" + + for_all_resources: Required[bool] + """ + Defines whether logs of all CDN resources are delivered to one folder/bucket or + to separate ones. + + Possible values: + + - **true** - Logs of all CDN resources are delivered to one folder/bucket. + - **false** - Logs of different CDN resources are delivered to separate + folders/buckets. + """ + + ftp_hostname: Required[str] + """FTP storage hostname.""" + + ftp_login: Required[str] + """FTP storage login.""" + + ftp_password: Required[str] + """FTP storage password.""" + + s3_access_key_id: Required[str] + """Access key ID for the S3 account. + + Access Key ID is 20 alpha-numeric characters like 022QF06E7MXBSH9DHM02 + """ + + s3_hostname: Required[str] + """S3 storage hostname. + + It is required if "`s3_type`": other. + """ + + s3_secret_key: Required[str] + """Secret access key for the S3 account. + + Secret Access Key is 20-50 alpha-numeric-slash-plus characters like + kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct + """ + + s3_type: Required[str] + """Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + """ + + sftp_hostname: Required[str] + """SFTP storage hostname.""" + + sftp_login: Required[str] + """SFTP storage login.""" + + sftp_password: Required[str] + """SFTP storage password. + + It should be empty if "`sftp_private_key`" is set. + """ + + storage_type: Required[str] + """Storage type. + + Possible values: + + - **ftp** + - **sftp** + - **s3** + """ + + archive_size_mb: Optional[int] + """ + The size of a single piece of the archive in MB. In case of **null** value logs + are delivered without slicing. + """ + + enabled: bool + """Enables or disables a log forwarding feature. + + Possible values: + + - **true** - log forwarding feature is active. + - **false** - log forwarding feature is deactivated. + """ + + ftp_prepend_folder: str + """Name of the FTP prepend folder for log delivery. + + **Null** is allowed. + """ + + ignore_empty_logs: bool + """Enables or disables the forwarding of empty logs. + + Possible values: + + - **true** - Empty logs are not sent. + - **false** - Empty logs are sent. + """ + + s3_aws_region: int + """Amazon AWS region.""" + + s3_bucket_location: str + """Location of S3 storage. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z), digits (0-9), dots, colons, dashes, and underscores + (.:\\__-). + """ + + s3_host_bucket: str + """S3 bucket hostname. + + Restrictions: + + - Maximum of 255 symbols. + - Latin letters (A-Z, a-z,) digits (0-9,) dots, colons, dashes, and underscores. + - Required if "`s3_type`": other. + """ + + sftp_key_passphrase: str + """Passphrase for SFTP private key. + + Restrictions: + + - Should be set if private key encoded with passphrase. + - Should be empty if "`sftp_password`" is set. + """ + + sftp_prepend_folder: str + """Name of the SFTP prepend folder for log delivery. + + **Null** is allowed. + """ + + sftp_private_key: str + """Private key for SFTP authorization. + + Possible values: + + - **RSA** + - **ED25519** + + It should be empty if "`sftp_password`" is set. + """ + + +class Folder(TypedDict, total=False): + id: int + """Parameter meaning depends on the value of the "`storage_type`" value: + + - **s3** - S3 bucket ID. + - **ftp/sftp** - FTP/SFTP folder ID. + """ + + bucket: str + """S3 bucket name. + + The field is required if "`storage_type`": **s3**. + """ + + cdn_resource: int + """CDN resource ID.""" + + folder: str + """Parameter meaning depends on the value of the "`storage_type`" value: + + - **s3** - S3 bucket sub-folder name (optional.) + - **ftp/sftp** - FTP/SFTP folder name (required.) + """ diff --git a/src/gcore/types/cdn/logs_aggregated_stats.py b/src/gcore/types/cdn/logs_aggregated_stats.py new file mode 100644 index 00000000..30806dfc --- /dev/null +++ b/src/gcore/types/cdn/logs_aggregated_stats.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["LogsAggregatedStats"] + + +class LogsAggregatedStats(BaseModel): + api_1_example: Optional[object] = FieldInfo(alias="1 (example)", default=None) + """CDN resource ID for which statistics data is shown.""" + + metrics: Optional[object] = None + """Statistics parameters.""" + + raw_logs_usage: Optional[str] = None + """Number of resources that used raw logs.""" + + resource: Optional[object] = None + """Resources IDs by which statistics data is grouped..""" diff --git a/src/gcore/types/cdn/logs_uploader/__init__.py b/src/gcore/types/cdn/logs_uploader/__init__.py new file mode 100644 index 00000000..3bf54233 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/__init__.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .config_list_params import ConfigListParams as ConfigListParams +from .policy_list_params import PolicyListParams as PolicyListParams +from .target_list_params import TargetListParams as TargetListParams +from .config_create_params import ConfigCreateParams as ConfigCreateParams +from .config_update_params import ConfigUpdateParams as ConfigUpdateParams +from .logs_uploader_config import LogsUploaderConfig as LogsUploaderConfig +from .logs_uploader_policy import LogsUploaderPolicy as LogsUploaderPolicy +from .logs_uploader_target import LogsUploaderTarget as LogsUploaderTarget +from .policy_create_params import PolicyCreateParams as PolicyCreateParams +from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams +from .target_create_params import TargetCreateParams as TargetCreateParams +from .target_update_params import TargetUpdateParams as TargetUpdateParams +from .config_replace_params import ConfigReplaceParams as ConfigReplaceParams +from .policy_replace_params import PolicyReplaceParams as PolicyReplaceParams +from .target_replace_params import TargetReplaceParams as TargetReplaceParams +from .logs_uploader_config_list import LogsUploaderConfigList as LogsUploaderConfigList +from .logs_uploader_policy_list import LogsUploaderPolicyList as LogsUploaderPolicyList +from .logs_uploader_target_list import LogsUploaderTargetList as LogsUploaderTargetList +from .policy_list_fields_response import PolicyListFieldsResponse as PolicyListFieldsResponse diff --git a/src/gcore/types/cdn/logs_uploader/config_create_params.py b/src/gcore/types/cdn/logs_uploader/config_create_params.py new file mode 100644 index 00000000..40e51bdf --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/config_create_params.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["ConfigCreateParams"] + + +class ConfigCreateParams(TypedDict, total=False): + name: Required[str] + """Name of the config.""" + + policy: Required[int] + """ID of the policy that should be assigned to given config.""" + + target: Required[int] + """ID of the target to which logs should be uploaded.""" + + enabled: bool + """Enables or disables the config.""" + + for_all_resources: bool + """ + If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + """ + + resources: Iterable[int] + """List of resource IDs to which the config should be applied.""" diff --git a/src/gcore/types/cdn/logs_uploader/config_list_params.py b/src/gcore/types/cdn/logs_uploader/config_list_params.py new file mode 100644 index 00000000..8b2e42b2 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/config_list_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import TypedDict + +__all__ = ["ConfigListParams"] + + +class ConfigListParams(TypedDict, total=False): + resource_ids: Iterable[int] + """Filter by ids of CDN resources that are assigned to given config.""" + + search: str + """Search by config name or id.""" diff --git a/src/gcore/types/cdn/logs_uploader/config_replace_params.py b/src/gcore/types/cdn/logs_uploader/config_replace_params.py new file mode 100644 index 00000000..398da0ae --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/config_replace_params.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["ConfigReplaceParams"] + + +class ConfigReplaceParams(TypedDict, total=False): + name: Required[str] + """Name of the config.""" + + policy: Required[int] + """ID of the policy that should be assigned to given config.""" + + target: Required[int] + """ID of the target to which logs should be uploaded.""" + + enabled: bool + """Enables or disables the config.""" + + for_all_resources: bool + """ + If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + """ + + resources: Iterable[int] + """List of resource IDs to which the config should be applied.""" diff --git a/src/gcore/types/cdn/logs_uploader/config_update_params.py b/src/gcore/types/cdn/logs_uploader/config_update_params.py new file mode 100644 index 00000000..d0dcd2cb --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/config_update_params.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import TypedDict + +__all__ = ["ConfigUpdateParams"] + + +class ConfigUpdateParams(TypedDict, total=False): + enabled: bool + """Enables or disables the config.""" + + for_all_resources: bool + """ + If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + """ + + name: str + """Name of the config.""" + + policy: int + """ID of the policy that should be assigned to given config.""" + + resources: Iterable[int] + """List of resource IDs to which the config should be applied.""" + + target: int + """ID of the target to which logs should be uploaded.""" diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_config.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_config.py new file mode 100644 index 00000000..71914495 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_config.py @@ -0,0 +1,51 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ...._models import BaseModel +from ..logs_uploader_validation import LogsUploaderValidation + +__all__ = ["LogsUploaderConfig", "Status"] + + +class Status(LogsUploaderValidation): + pass + + +class LogsUploaderConfig(BaseModel): + id: Optional[int] = None + + client_id: Optional[int] = None + """Client that owns the config.""" + + created: Optional[datetime] = None + """Time when the config was created.""" + + enabled: Optional[bool] = None + """Enables or disables the config.""" + + for_all_resources: Optional[bool] = None + """ + If set to true, the config will be applied to all CDN resources. If set to + false, the config will be applied to the resources specified in the `resources` + field. + """ + + name: Optional[str] = None + """Name of the config.""" + + policy: Optional[int] = None + """ID of the policy that should be assigned to given config.""" + + resources: Optional[List[int]] = None + """List of resource IDs to which the config should be applied.""" + + status: Optional[Status] = None + """Validation status of the logs uploader config.""" + + target: Optional[int] = None + """ID of the target to which logs should be uploaded.""" + + updated: Optional[datetime] = None + """Time when the config was updated.""" diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_config_list.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_config_list.py new file mode 100644 index 00000000..477aaf6c --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_config_list.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 .logs_uploader_config import LogsUploaderConfig + +__all__ = ["LogsUploaderConfigList"] + +LogsUploaderConfigList: TypeAlias = List[LogsUploaderConfig] diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py new file mode 100644 index 00000000..241cb7d5 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_policy.py @@ -0,0 +1,73 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime + +from ...._models import BaseModel + +__all__ = ["LogsUploaderPolicy"] + + +class LogsUploaderPolicy(BaseModel): + id: Optional[int] = None + + client_id: Optional[int] = None + """Client that owns the policy.""" + + created: Optional[datetime] = None + """Time when logs uploader policy was created.""" + + date_format: Optional[str] = None + """Date format for logs.""" + + description: Optional[str] = None + """Description of the policy.""" + + field_delimiter: Optional[str] = None + """Field delimiter for logs.""" + + field_separator: Optional[str] = None + """Field separator for logs.""" + + fields: Optional[List[str]] = None + """List of fields to include in logs.""" + + file_name_template: Optional[str] = None + """Template for log file name.""" + + format_type: Optional[str] = None + """Format type for logs.""" + + include_empty_logs: Optional[bool] = None + """Include empty logs in the upload.""" + + include_shield_logs: Optional[bool] = None + """Include logs from origin shielding in the upload.""" + + name: Optional[str] = None + """Name of the policy.""" + + related_uploader_configs: Optional[List[int]] = None + """List of logs uploader configs that use this policy.""" + + retry_interval_minutes: Optional[int] = None + """Interval in minutes to retry failed uploads.""" + + rotate_interval_minutes: Optional[int] = None + """Interval in minutes to rotate logs.""" + + rotate_threshold_lines: Optional[int] = None + """Threshold in lines to rotate logs.""" + + rotate_threshold_mb: Optional[int] = None + """Threshold in MB to rotate logs.""" + + tags: Optional[Dict[str, str]] = None + """ + Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + """ + + updated: Optional[datetime] = None + """Time when logs uploader policy was updated.""" diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_policy_list.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_policy_list.py new file mode 100644 index 00000000..75f9a44e --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_policy_list.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 .logs_uploader_policy import LogsUploaderPolicy + +__all__ = ["LogsUploaderPolicyList"] + +LogsUploaderPolicyList: TypeAlias = List[LogsUploaderPolicy] diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_target.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_target.py new file mode 100644 index 00000000..05eb1f25 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_target.py @@ -0,0 +1,236 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Union, Optional +from datetime import datetime +from typing_extensions import Literal, TypeAlias + +from ...._models import BaseModel +from ..logs_uploader_validation import LogsUploaderValidation + +__all__ = [ + "LogsUploaderTarget", + "Config", + "ConfigS3GcoreConfigResponse", + "ConfigS3AmazonConfigResponse", + "ConfigUnionMember2", + "ConfigBaseFtpConfig", + "ConfigSftpConfigResponse", + "ConfigHTTPConfigResponse", + "ConfigHTTPConfigResponseAppend", + "ConfigHTTPConfigResponseAppendResponseAction", + "ConfigHTTPConfigResponseAuth", + "ConfigHTTPConfigResponseAuthConfig", + "ConfigHTTPConfigResponseRetry", + "ConfigHTTPConfigResponseRetryResponseAction", + "ConfigHTTPConfigResponseUpload", + "ConfigHTTPConfigResponseUploadResponseAction", + "Status", +] + + +class ConfigS3GcoreConfigResponse(BaseModel): + access_key_id: Optional[str] = None + + bucket_name: Optional[str] = None + + directory: Optional[str] = None + + endpoint: Optional[str] = None + + region: Optional[str] = None + + use_path_style: Optional[bool] = None + + +class ConfigS3AmazonConfigResponse(BaseModel): + access_key_id: Optional[str] = None + + bucket_name: Optional[str] = None + + directory: Optional[str] = None + + region: Optional[str] = None + + +class ConfigUnionMember2(BaseModel): + access_key_id: Optional[str] = None + + bucket_name: Optional[str] = None + + directory: Optional[str] = None + + region: Optional[str] = None + + +class ConfigBaseFtpConfig(BaseModel): + directory: Optional[str] = None + + hostname: Optional[str] = None + + timeout_seconds: Optional[int] = None + + user: Optional[str] = None + + +class ConfigSftpConfigResponse(BaseModel): + hostname: str + + user: str + + directory: Optional[str] = None + + key_passphrase: Optional[str] = None + + password: Optional[str] = None + + private_key: Optional[str] = None + + timeout_seconds: Optional[int] = None + + +class ConfigHTTPConfigResponseAppendResponseAction(BaseModel): + action: Optional[Literal["drop", "retry", "append"]] = None + + description: Optional[str] = None + + match_payload: Optional[str] = None + + match_status_code: Optional[int] = None + + +class ConfigHTTPConfigResponseAppend(BaseModel): + headers: Optional[Dict[str, str]] = None + + method: Optional[Literal["POST", "PUT"]] = None + + response_actions: Optional[List[ConfigHTTPConfigResponseAppendResponseAction]] = None + + timeout_seconds: Optional[int] = None + + url: Optional[str] = None + + use_compression: Optional[bool] = None + + +class ConfigHTTPConfigResponseAuthConfig(BaseModel): + token: Optional[str] = None + + header_name: Optional[str] = None + + +class ConfigHTTPConfigResponseAuth(BaseModel): + config: Optional[ConfigHTTPConfigResponseAuthConfig] = None + + type: Optional[Literal["token"]] = None + + +class ConfigHTTPConfigResponseRetryResponseAction(BaseModel): + action: Optional[Literal["drop", "retry", "append"]] = None + + description: Optional[str] = None + + match_payload: Optional[str] = None + + match_status_code: Optional[int] = None + + +class ConfigHTTPConfigResponseRetry(BaseModel): + headers: Optional[Dict[str, str]] = None + + method: Optional[Literal["POST", "PUT"]] = None + + response_actions: Optional[List[ConfigHTTPConfigResponseRetryResponseAction]] = None + + timeout_seconds: Optional[int] = None + + url: Optional[str] = None + + use_compression: Optional[bool] = None + + +class ConfigHTTPConfigResponseUploadResponseAction(BaseModel): + action: Optional[Literal["drop", "retry", "append"]] = None + + description: Optional[str] = None + + match_payload: Optional[str] = None + + match_status_code: Optional[int] = None + + +class ConfigHTTPConfigResponseUpload(BaseModel): + headers: Optional[Dict[str, str]] = None + + method: Optional[Literal["POST", "PUT"]] = None + + response_actions: Optional[List[ConfigHTTPConfigResponseUploadResponseAction]] = None + + timeout_seconds: Optional[int] = None + + url: Optional[str] = None + + use_compression: Optional[bool] = None + + +class ConfigHTTPConfigResponse(BaseModel): + append: Optional[ConfigHTTPConfigResponseAppend] = None + + auth: Optional[ConfigHTTPConfigResponseAuth] = None + + content_type: Optional[Literal["json", "text"]] = None + + retry: Optional[ConfigHTTPConfigResponseRetry] = None + + upload: Optional[ConfigHTTPConfigResponseUpload] = None + + +Config: TypeAlias = Union[ + ConfigS3GcoreConfigResponse, + ConfigS3AmazonConfigResponse, + ConfigUnionMember2, + ConfigS3GcoreConfigResponse, + ConfigS3GcoreConfigResponse, + ConfigBaseFtpConfig, + ConfigSftpConfigResponse, + ConfigHTTPConfigResponse, +] + + +class Status(LogsUploaderValidation): + pass + + +class LogsUploaderTarget(BaseModel): + id: Optional[int] = None + + client_id: Optional[int] = None + """Client that owns the target.""" + + config: Optional[Config] = None + """Config for specific storage type.""" + + created: Optional[datetime] = None + """Time when logs uploader target was created.""" + + description: Optional[str] = None + """Description of the target.""" + + name: Optional[str] = None + """Name of the target.""" + + related_uploader_configs: Optional[List[int]] = None + """List of logs uploader configs that use this target.""" + + status: Optional[Status] = None + """Validation status of the logs uploader target. + + Informs if the specified target is reachable. + """ + + storage_type: Optional[Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"]] = ( + None + ) + """Type of storage for logs.""" + + updated: Optional[datetime] = None + """Time when logs uploader target was updated.""" diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_target_list.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_target_list.py new file mode 100644 index 00000000..f3df6d6b --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_target_list.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 .logs_uploader_target import LogsUploaderTarget + +__all__ = ["LogsUploaderTargetList"] + +LogsUploaderTargetList: TypeAlias = List[LogsUploaderTarget] diff --git a/src/gcore/types/cdn/logs_uploader/policy_create_params.py b/src/gcore/types/cdn/logs_uploader/policy_create_params.py new file mode 100644 index 00000000..4d763619 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/policy_create_params.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import TypedDict + +from ...._types import SequenceNotStr + +__all__ = ["PolicyCreateParams"] + + +class PolicyCreateParams(TypedDict, total=False): + date_format: str + """Date format for logs.""" + + description: str + """Description of the policy.""" + + field_delimiter: str + """Field delimiter for logs.""" + + field_separator: str + """Field separator for logs.""" + + fields: SequenceNotStr[str] + """List of fields to include in logs.""" + + file_name_template: str + """Template for log file name.""" + + format_type: str + """Format type for logs.""" + + include_empty_logs: bool + """Include empty logs in the upload.""" + + include_shield_logs: bool + """Include logs from origin shielding in the upload.""" + + name: str + """Name of the policy.""" + + retry_interval_minutes: int + """Interval in minutes to retry failed uploads.""" + + rotate_interval_minutes: int + """Interval in minutes to rotate logs.""" + + rotate_threshold_lines: int + """Threshold in lines to rotate logs.""" + + rotate_threshold_mb: Optional[int] + """Threshold in MB to rotate logs.""" + + tags: Dict[str, str] + """ + Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + """ diff --git a/src/gcore/types/cdn/logs_uploader/policy_list_fields_response.py b/src/gcore/types/cdn/logs_uploader/policy_list_fields_response.py new file mode 100644 index 00000000..fcfbca93 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/policy_list_fields_response.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +__all__ = ["PolicyListFieldsResponse"] + +PolicyListFieldsResponse: TypeAlias = List[str] diff --git a/src/gcore/types/cdn/logs_uploader/policy_list_params.py b/src/gcore/types/cdn/logs_uploader/policy_list_params.py new file mode 100644 index 00000000..4b2a2b4a --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/policy_list_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import TypedDict + +__all__ = ["PolicyListParams"] + + +class PolicyListParams(TypedDict, total=False): + config_ids: Iterable[int] + """Filter by ids of related logs uploader configs that use given policy.""" + + search: str + """Search by policy name or id.""" diff --git a/src/gcore/types/cdn/logs_uploader/policy_replace_params.py b/src/gcore/types/cdn/logs_uploader/policy_replace_params.py new file mode 100644 index 00000000..7c62d955 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/policy_replace_params.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import TypedDict + +from ...._types import SequenceNotStr + +__all__ = ["PolicyReplaceParams"] + + +class PolicyReplaceParams(TypedDict, total=False): + date_format: str + """Date format for logs.""" + + description: str + """Description of the policy.""" + + field_delimiter: str + """Field delimiter for logs.""" + + field_separator: str + """Field separator for logs.""" + + fields: SequenceNotStr[str] + """List of fields to include in logs.""" + + file_name_template: str + """Template for log file name.""" + + format_type: str + """Format type for logs.""" + + include_empty_logs: bool + """Include empty logs in the upload.""" + + include_shield_logs: bool + """Include logs from origin shielding in the upload.""" + + name: str + """Name of the policy.""" + + retry_interval_minutes: int + """Interval in minutes to retry failed uploads.""" + + rotate_interval_minutes: int + """Interval in minutes to rotate logs.""" + + rotate_threshold_lines: int + """Threshold in lines to rotate logs.""" + + rotate_threshold_mb: Optional[int] + """Threshold in MB to rotate logs.""" + + tags: Dict[str, str] + """ + Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + """ diff --git a/src/gcore/types/cdn/logs_uploader/policy_update_params.py b/src/gcore/types/cdn/logs_uploader/policy_update_params.py new file mode 100644 index 00000000..c1bb5811 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/policy_update_params.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import TypedDict + +from ...._types import SequenceNotStr + +__all__ = ["PolicyUpdateParams"] + + +class PolicyUpdateParams(TypedDict, total=False): + date_format: str + """Date format for logs.""" + + description: str + """Description of the policy.""" + + field_delimiter: str + """Field delimiter for logs.""" + + field_separator: str + """Field separator for logs.""" + + fields: SequenceNotStr[str] + """List of fields to include in logs.""" + + file_name_template: str + """Template for log file name.""" + + format_type: str + """Format type for logs.""" + + include_empty_logs: bool + """Include empty logs in the upload.""" + + include_shield_logs: bool + """Include logs from origin shielding in the upload.""" + + name: str + """Name of the policy.""" + + retry_interval_minutes: int + """Interval in minutes to retry failed uploads.""" + + rotate_interval_minutes: int + """Interval in minutes to rotate logs.""" + + rotate_threshold_lines: int + """Threshold in lines to rotate logs.""" + + rotate_threshold_mb: Optional[int] + """Threshold in MB to rotate logs.""" + + tags: Dict[str, str] + """ + Tags allow for dynamic decoration of logs by adding predefined fields to the log + format. These tags serve as customizable key-value pairs that can be included in + log entries to enhance context and readability. + """ diff --git a/src/gcore/types/cdn/logs_uploader/target_create_params.py b/src/gcore/types/cdn/logs_uploader/target_create_params.py new file mode 100644 index 00000000..f8d8e8e9 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/target_create_params.py @@ -0,0 +1,249 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +__all__ = [ + "TargetCreateParams", + "Config", + "ConfigS3GcoreConfig", + "ConfigS3AmazonConfig", + "ConfigS3OssConfig", + "ConfigS3OtherConfig", + "ConfigS3V1Config", + "ConfigFtpConfig", + "ConfigSftpConfig", + "ConfigHTTPConfig", + "ConfigHTTPConfigUpload", + "ConfigHTTPConfigUploadResponseAction", + "ConfigHTTPConfigAppend", + "ConfigHTTPConfigAppendResponseAction", + "ConfigHTTPConfigAuth", + "ConfigHTTPConfigAuthConfig", + "ConfigHTTPConfigRetry", + "ConfigHTTPConfigRetryResponseAction", +] + + +class TargetCreateParams(TypedDict, total=False): + config: Required[Config] + """Config for specific storage type.""" + + storage_type: Required[Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"]] + """Type of storage for logs.""" + + description: str + """Description of the target.""" + + name: str + """Name of the target.""" + + +class ConfigS3GcoreConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigS3AmazonConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + +class ConfigS3OssConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + region: Optional[str] + + +class ConfigS3OtherConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigS3V1Config(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigFtpConfig(TypedDict, total=False): + hostname: Required[str] + + password: Required[str] + + user: Required[str] + + directory: Optional[str] + + timeout_seconds: int + + +class ConfigSftpConfig(TypedDict, total=False): + hostname: Required[str] + + user: Required[str] + + directory: Optional[str] + + key_passphrase: Optional[str] + + password: Optional[str] + + private_key: Optional[str] + + timeout_seconds: int + + +class ConfigHTTPConfigUploadResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigUpload(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigUploadResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfigAppendResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigAppend(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigAppendResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfigAuthConfig(TypedDict, total=False): + token: Required[str] + + header_name: Required[str] + + +class ConfigHTTPConfigAuth(TypedDict, total=False): + config: Required[ConfigHTTPConfigAuthConfig] + + type: Required[Literal["token"]] + + +class ConfigHTTPConfigRetryResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigRetry(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigRetryResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfig(TypedDict, total=False): + upload: Required[ConfigHTTPConfigUpload] + + append: ConfigHTTPConfigAppend + + auth: ConfigHTTPConfigAuth + + content_type: Literal["json", "text"] + + retry: ConfigHTTPConfigRetry + + +Config: TypeAlias = Union[ + ConfigS3GcoreConfig, + ConfigS3AmazonConfig, + ConfigS3OssConfig, + ConfigS3OtherConfig, + ConfigS3V1Config, + ConfigFtpConfig, + ConfigSftpConfig, + ConfigHTTPConfig, +] diff --git a/src/gcore/types/cdn/logs_uploader/target_list_params.py b/src/gcore/types/cdn/logs_uploader/target_list_params.py new file mode 100644 index 00000000..aed247de --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/target_list_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import TypedDict + +__all__ = ["TargetListParams"] + + +class TargetListParams(TypedDict, total=False): + config_ids: Iterable[int] + """Filter by ids of related logs uploader configs that use given target.""" + + search: str + """Search by target name or id.""" diff --git a/src/gcore/types/cdn/logs_uploader/target_replace_params.py b/src/gcore/types/cdn/logs_uploader/target_replace_params.py new file mode 100644 index 00000000..77281c94 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/target_replace_params.py @@ -0,0 +1,249 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +__all__ = [ + "TargetReplaceParams", + "Config", + "ConfigS3GcoreConfig", + "ConfigS3AmazonConfig", + "ConfigS3OssConfig", + "ConfigS3OtherConfig", + "ConfigS3V1Config", + "ConfigFtpConfig", + "ConfigSftpConfig", + "ConfigHTTPConfig", + "ConfigHTTPConfigUpload", + "ConfigHTTPConfigUploadResponseAction", + "ConfigHTTPConfigAppend", + "ConfigHTTPConfigAppendResponseAction", + "ConfigHTTPConfigAuth", + "ConfigHTTPConfigAuthConfig", + "ConfigHTTPConfigRetry", + "ConfigHTTPConfigRetryResponseAction", +] + + +class TargetReplaceParams(TypedDict, total=False): + config: Required[Config] + """Config for specific storage type.""" + + storage_type: Required[Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"]] + """Type of storage for logs.""" + + description: str + """Description of the target.""" + + name: str + """Name of the target.""" + + +class ConfigS3GcoreConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigS3AmazonConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + +class ConfigS3OssConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + region: Optional[str] + + +class ConfigS3OtherConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigS3V1Config(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigFtpConfig(TypedDict, total=False): + hostname: Required[str] + + password: Required[str] + + user: Required[str] + + directory: Optional[str] + + timeout_seconds: int + + +class ConfigSftpConfig(TypedDict, total=False): + hostname: Required[str] + + user: Required[str] + + directory: Optional[str] + + key_passphrase: Optional[str] + + password: Optional[str] + + private_key: Optional[str] + + timeout_seconds: int + + +class ConfigHTTPConfigUploadResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigUpload(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigUploadResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfigAppendResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigAppend(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigAppendResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfigAuthConfig(TypedDict, total=False): + token: Required[str] + + header_name: Required[str] + + +class ConfigHTTPConfigAuth(TypedDict, total=False): + config: Required[ConfigHTTPConfigAuthConfig] + + type: Required[Literal["token"]] + + +class ConfigHTTPConfigRetryResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigRetry(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigRetryResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfig(TypedDict, total=False): + upload: Required[ConfigHTTPConfigUpload] + + append: ConfigHTTPConfigAppend + + auth: ConfigHTTPConfigAuth + + content_type: Literal["json", "text"] + + retry: ConfigHTTPConfigRetry + + +Config: TypeAlias = Union[ + ConfigS3GcoreConfig, + ConfigS3AmazonConfig, + ConfigS3OssConfig, + ConfigS3OtherConfig, + ConfigS3V1Config, + ConfigFtpConfig, + ConfigSftpConfig, + ConfigHTTPConfig, +] diff --git a/src/gcore/types/cdn/logs_uploader/target_update_params.py b/src/gcore/types/cdn/logs_uploader/target_update_params.py new file mode 100644 index 00000000..e93ab4d9 --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader/target_update_params.py @@ -0,0 +1,249 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +__all__ = [ + "TargetUpdateParams", + "Config", + "ConfigS3GcoreConfig", + "ConfigS3AmazonConfig", + "ConfigS3OssConfig", + "ConfigS3OtherConfig", + "ConfigS3V1Config", + "ConfigFtpConfig", + "ConfigSftpConfig", + "ConfigHTTPConfig", + "ConfigHTTPConfigUpload", + "ConfigHTTPConfigUploadResponseAction", + "ConfigHTTPConfigAppend", + "ConfigHTTPConfigAppendResponseAction", + "ConfigHTTPConfigAuth", + "ConfigHTTPConfigAuthConfig", + "ConfigHTTPConfigRetry", + "ConfigHTTPConfigRetryResponseAction", +] + + +class TargetUpdateParams(TypedDict, total=False): + config: Config + """Config for specific storage type.""" + + description: str + """Description of the target.""" + + name: str + """Name of the target.""" + + storage_type: Literal["s3_gcore", "s3_amazon", "s3_oss", "s3_other", "s3_v1", "ftp", "sftp", "http"] + """Type of storage for logs.""" + + +class ConfigS3GcoreConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigS3AmazonConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + +class ConfigS3OssConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + region: Optional[str] + + +class ConfigS3OtherConfig(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigS3V1Config(TypedDict, total=False): + access_key_id: Required[str] + + bucket_name: Required[str] + + endpoint: Required[str] + + region: Required[str] + + secret_access_key: Required[str] + + directory: Optional[str] + + use_path_style: bool + + +class ConfigFtpConfig(TypedDict, total=False): + hostname: Required[str] + + password: Required[str] + + user: Required[str] + + directory: Optional[str] + + timeout_seconds: int + + +class ConfigSftpConfig(TypedDict, total=False): + hostname: Required[str] + + user: Required[str] + + directory: Optional[str] + + key_passphrase: Optional[str] + + password: Optional[str] + + private_key: Optional[str] + + timeout_seconds: int + + +class ConfigHTTPConfigUploadResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigUpload(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigUploadResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfigAppendResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigAppend(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigAppendResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfigAuthConfig(TypedDict, total=False): + token: Required[str] + + header_name: Required[str] + + +class ConfigHTTPConfigAuth(TypedDict, total=False): + config: Required[ConfigHTTPConfigAuthConfig] + + type: Required[Literal["token"]] + + +class ConfigHTTPConfigRetryResponseAction(TypedDict, total=False): + action: Required[Literal["drop", "retry", "append"]] + + description: str + + match_payload: str + + match_status_code: int + + +class ConfigHTTPConfigRetry(TypedDict, total=False): + url: Required[str] + + headers: Dict[str, str] + + method: Literal["POST", "PUT"] + + response_actions: Iterable[ConfigHTTPConfigRetryResponseAction] + + timeout_seconds: int + + use_compression: bool + + +class ConfigHTTPConfig(TypedDict, total=False): + upload: Required[ConfigHTTPConfigUpload] + + append: ConfigHTTPConfigAppend + + auth: ConfigHTTPConfigAuth + + content_type: Literal["json", "text"] + + retry: ConfigHTTPConfigRetry + + +Config: TypeAlias = Union[ + ConfigS3GcoreConfig, + ConfigS3AmazonConfig, + ConfigS3OssConfig, + ConfigS3OtherConfig, + ConfigS3V1Config, + ConfigFtpConfig, + ConfigSftpConfig, + ConfigHTTPConfig, +] diff --git a/src/gcore/types/cdn/logs_uploader_validation.py b/src/gcore/types/cdn/logs_uploader_validation.py new file mode 100644 index 00000000..6f24857d --- /dev/null +++ b/src/gcore/types/cdn/logs_uploader_validation.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["LogsUploaderValidation"] + + +class LogsUploaderValidation(BaseModel): + code: Optional[int] = None + """Error code indicating the type of validation error.""" + + details: Optional[str] = None + """Error message if the validation failed.""" + + status: Optional[Literal["in_progress", "successful", "failed"]] = None + """Status of the validation.""" + + updated: Optional[datetime] = None + """Time when the validation status was updated.""" diff --git a/src/gcore/types/cdn/metric_list_params.py b/src/gcore/types/cdn/metric_list_params.py new file mode 100644 index 00000000..42aa48e4 --- /dev/null +++ b/src/gcore/types/cdn/metric_list_params.py @@ -0,0 +1,168 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = ["MetricListParams", "FilterBy"] + + +class MetricListParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Beginning period to fetch metrics (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - 2021-06-14T00:00:00Z + - 2021-06-14T00:00:00.000Z + + The total number of points, which is determined as the difference between "from" + and "to" divided by "granularity", cannot exceed 1440. Exception: "speed" + metrics are limited to 72 points. + """ + + metrics: Required[SequenceNotStr[str]] + """Possible values: + + - **`edge_bandwidth`** - Bandwidth from client to CDN (bit/s.) + - **`edge_requests`** - Number of requests per interval (requests/s.) + - **`edge_requests_total`** - Total number of requests per interval. + - **`edge_status_1xx`** - Number of 1xx status codes from edge. + - **`edge_status_200`** - Number of 200 status codes from edge. + - **`edge_status_204`** - Number of 204 status codes from edge. + - **`edge_status_206`** - Number of 206 status codes from edge. + - **`edge_status_2xx`** - Number of 2xx status codes from edge. + - **`edge_status_301`** - Number of 301 status codes from edge. + - **`edge_status_302`** - Number of 302 status codes from edge. + - **`edge_status_304`** - Number of 304 status codes from edge. + - **`edge_status_3xx`** - Number of 3xx status codes from edge. + - **`edge_status_400`** - Number of 400 status codes from edge. + - **`edge_status_401`** - Number of 401 status codes from edge. + - **`edge_status_403`** - Number of 403 status codes from edge. + - **`edge_status_404`** - Number of 404 status codes from edge. + - **`edge_status_416`** - Number of 416 status codes from edge. + - **`edge_status_429`** - Number of 429 status codes from edge. + - **`edge_status_4xx`** - Number of 4xx status codes from edge. + - **`edge_status_500`** - Number of 500 status codes from edge. + - **`edge_status_501`** - Number of 501 status codes from edge. + - **`edge_status_502`** - Number of 502 status codes from edge. + - **`edge_status_503`** - Number of 503 status codes from edge. + - **`edge_status_504`** - Number of 504 status codes from edge. + - **`edge_status_505`** - Number of 505 status codes from edge. + - **`edge_status_5xx`** - Number of 5xx status codes from edge. + - **`edge_hit_ratio`** - Percent of cache hits (0.0 - 1.0). + - **`edge_hit_bytes`** - Number of bytes sent back when cache hits. + - **`origin_bandwidth`** - Bandwidth from CDN to Origin (bit/s.) + - **`origin_requests`** - Number of requests per interval (requests/s.) + - **`origin_status_1xx`** - Number of 1xx status from origin. + - **`origin_status_200`** - Number of 200 status from origin. + - **`origin_status_204`** - Number of 204 status from origin. + - **`origin_status_206`** - Number of 206 status from origin. + - **`origin_status_2xx`** - Number of 2xx status from origin. + - **`origin_status_301`** - Number of 301 status from origin. + - **`origin_status_302`** - Number of 302 status from origin. + - **`origin_status_304`** - Number of 304 status from origin. + - **`origin_status_3xx`** - Number of 3xx status from origin. + - **`origin_status_400`** - Number of 400 status from origin. + - **`origin_status_401`** - Number of 401 status from origin. + - **`origin_status_403`** - Number of 403 status from origin. + - **`origin_status_404`** - Number of 404 status from origin. + - **`origin_status_416`** - Number of 416 status from origin. + - **`origin_status_429`** - Number of 426 status from origin. + - **`origin_status_4xx`** - Number of 4xx status from origin. + - **`origin_status_500`** - Number of 500 status from origin. + - **`origin_status_501`** - Number of 501 status from origin. + - **`origin_status_502`** - Number of 502 status from origin. + - **`origin_status_503`** - Number of 503 status from origin. + - **`origin_status_504`** - Number of 504 status from origin. + - **`origin_status_505`** - Number of 505 status from origin. + - **`origin_status_5xx`** - Number of 5xx status from origin. + - **`edge_download_speed`** - Download speed from edge in KB/s (includes only + requests that status was in the range [200, 300].) + - **`origin_download_speed`** - Download speed from origin in KB/s (includes + only requests that status was in the range [200, 300].) + """ + + to: Required[str] + """Specifies ending period to fetch metrics (ISO 8601/RFC 3339 format, UTC) + + Examples: + + - 2021-06-15T00:00:00Z + - 2021-06-15T00:00:00.000Z + + The total number of points, which is determined as the difference between "from" + and "to" divided by "granularity", cannot exceed 1440. Exception: "speed" + metrics are limited to 72 points. + """ + + filter_by: Iterable[FilterBy] + """Each item represents one filter statement.""" + + granularity: str + """Duration of the time blocks into which the data is divided. + + The value must correspond to the ISO 8601 period format. + + Examples: + + - P1D + - PT5M + + Notes: + + - The total number of points, which is determined as the difference between + "from" and "to" divided by "granularity", cannot exceed 1440. Exception: + "speed" metrics are limited to 72 points. + - For "speed" metrics the value must be a multiple of 5. + """ + + group_by: SequenceNotStr[str] + """Output data grouping. + + Possible values: + + - **resource** - Data is grouped by CDN resource. + - **cname** - Data is grouped by common names. + - **region** – Data is grouped by regions (continents.) Available for "speed" + metrics only. + - **isp** - Data is grouped by ISP names. Available for "speed" metrics only. + """ + + +class FilterBy(TypedDict, total=False): + field: Required[str] + """Defines the parameters by that data can be filtered. + + Possible values: + + - **resource** - Data is filtered by CDN resource ID. + - **cname** - Data is filtered by common name. + - **region** - Data is filtered by region (continent.) Available for "speed" + metrics only. + - **isp** - Data is filtered by ISP name. Available for "speed" metrics only. + """ + + op: Required[str] + """Comparison operator to be applied. + + Possible values: + + - **in** - 'IN' operator. + - **`not_in`** - 'NOT IN' operator. + - **gt** - '>' operator. + - **gte** - '>=' operator. + - **lt** - '<' operator. + - **lte** - '<=' operator. + - **eq** - '==' operator. + - **ne** - '!=' operator. + - **like** - 'LIKE' operator. + - **`not_like`** - 'NOT LIKE' operator. + """ + + values: Required[SequenceNotStr[Union[float, str]]] + """Contains one or more values to be compared against.""" diff --git a/src/gcore/types/cdn/network_capacity.py b/src/gcore/types/cdn/network_capacity.py new file mode 100644 index 00000000..8d76c0c5 --- /dev/null +++ b/src/gcore/types/cdn/network_capacity.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__ = ["NetworkCapacity", "NetworkCapacityItem"] + + +class NetworkCapacityItem(BaseModel): + capacity: Optional[float] = None + """Network capacity in Gbit/s.""" + + country: Optional[str] = None + """Country name.""" + + country_code: Optional[str] = None + """ISO country code.""" + + +NetworkCapacity: TypeAlias = List[NetworkCapacityItem] diff --git a/src/gcore/types/cdn/origin_group_create_params.py b/src/gcore/types/cdn/origin_group_create_params.py new file mode 100644 index 00000000..74f3a60a --- /dev/null +++ b/src/gcore/types/cdn/origin_group_create_params.py @@ -0,0 +1,184 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Required, TypeAlias, TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["OriginGroupCreateParams", "NoneAuth", "NoneAuthSource", "AwsSignatureV4", "AwsSignatureV4Auth"] + + +class NoneAuth(TypedDict, total=False): + name: Required[str] + """Origin group name.""" + + sources: Required[Iterable[NoneAuthSource]] + """List of origin sources in the origin group.""" + + auth_type: str + """Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + """ + + proxy_next_upstream: SequenceNotStr[str] + """Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + """ + + use_next: bool + """ + Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class NoneAuthSource(TypedDict, total=False): + backup: bool + """ + Defines whether the origin is a backup, meaning that it will not be used until + one of active origins become unavailable. + + Possible values: + + - **true** - Origin is a backup. + - **false** - Origin is not a backup. + """ + + enabled: bool + """Enables or disables an origin source in the origin group. + + Possible values: + + - **true** - Origin is enabled and the CDN uses it to pull content. + - **false** - Origin is disabled and the CDN does not use it to pull content. + + Origin group must contain at least one enabled origin. + """ + + source: str + """IP address or domain name of the origin and the port, if custom port is used.""" + + +class AwsSignatureV4(TypedDict, total=False): + auth: Required[AwsSignatureV4Auth] + """Credentials to access the private bucket.""" + + auth_type: Required[str] + """Authentication type. + + **awsSignatureV4** value is used for S3 storage. + """ + + name: Required[str] + """Origin group name.""" + + proxy_next_upstream: SequenceNotStr[str] + """Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + """ + + use_next: bool + """ + Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class AwsSignatureV4Auth(TypedDict, total=False): + s3_access_key_id: Required[str] + """Access key ID for the S3 account. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), colon, dash, and underscore. + - From 3 to 512 characters. + """ + + s3_bucket_name: Required[str] + """S3 bucket name. + + Restrictions: + + - Maximum 128 characters. + """ + + s3_secret_access_key: Required[str] + """Secret access key for the S3 account. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), pluses, slashes, dashes, colons and + underscores. + - If "`s3_type`": amazon, length should be 40 characters. + - If "`s3_type`": other, length should be from 16 to 255 characters. + """ + + s3_type: Required[str] + """Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + """ + + s3_region: str + """S3 storage region. + + The parameter is required, if "`s3_type`": amazon. + """ + + s3_storage_hostname: str + """S3 storage hostname. + + The parameter is required, if "`s3_type`": other. + """ + + +OriginGroupCreateParams: TypeAlias = Union[NoneAuth, AwsSignatureV4] diff --git a/src/gcore/types/cdn/origin_group_list_params.py b/src/gcore/types/cdn/origin_group_list_params.py new file mode 100644 index 00000000..9a19eea1 --- /dev/null +++ b/src/gcore/types/cdn/origin_group_list_params.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["OriginGroupListParams"] + + +class OriginGroupListParams(TypedDict, total=False): + has_related_resources: bool + """Defines whether the origin group has related CDN resources. + + Possible values: + + - **true** – Origin group has related CDN resources. + - **false** – Origin group does not have related CDN resources. + """ + + name: str + """Origin group name.""" + + sources: str + """Origin sources (IP addresses or domains) in the origin group.""" diff --git a/src/gcore/types/cdn/origin_group_replace_params.py b/src/gcore/types/cdn/origin_group_replace_params.py new file mode 100644 index 00000000..4125cae7 --- /dev/null +++ b/src/gcore/types/cdn/origin_group_replace_params.py @@ -0,0 +1,190 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Required, TypeAlias, TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["OriginGroupReplaceParams", "NoneAuth", "NoneAuthSource", "AwsSignatureV4", "AwsSignatureV4Auth"] + + +class NoneAuth(TypedDict, total=False): + auth_type: Required[str] + """Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + """ + + name: Required[str] + """Origin group name.""" + + path: Required[str] + """Parameter is **deprecated**.""" + + sources: Required[Iterable[NoneAuthSource]] + """List of origin sources in the origin group.""" + + use_next: Required[bool] + """ + Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + proxy_next_upstream: SequenceNotStr[str] + """Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + """ + + +class NoneAuthSource(TypedDict, total=False): + backup: bool + """ + Defines whether the origin is a backup, meaning that it will not be used until + one of active origins become unavailable. + + Possible values: + + - **true** - Origin is a backup. + - **false** - Origin is not a backup. + """ + + enabled: bool + """Enables or disables an origin source in the origin group. + + Possible values: + + - **true** - Origin is enabled and the CDN uses it to pull content. + - **false** - Origin is disabled and the CDN does not use it to pull content. + + Origin group must contain at least one enabled origin. + """ + + source: str + """IP address or domain name of the origin and the port, if custom port is used.""" + + +class AwsSignatureV4(TypedDict, total=False): + auth: Required[AwsSignatureV4Auth] + """Credentials to access the private bucket.""" + + auth_type: Required[str] + """Authentication type. + + **awsSignatureV4** value is used for S3 storage. + """ + + name: Required[str] + """Origin group name.""" + + path: Required[str] + """Parameter is **deprecated**.""" + + use_next: Required[bool] + """ + Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + proxy_next_upstream: SequenceNotStr[str] + """Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + """ + + +class AwsSignatureV4Auth(TypedDict, total=False): + s3_access_key_id: Required[str] + """Access key ID for the S3 account. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), colon, dash, and underscore. + - From 3 to 512 characters. + """ + + s3_bucket_name: Required[str] + """S3 bucket name. + + Restrictions: + + - Maximum 128 characters. + """ + + s3_secret_access_key: Required[str] + """Secret access key for the S3 account. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), pluses, slashes, dashes, colons and + underscores. + - If "`s3_type`": amazon, length should be 40 characters. + - If "`s3_type`": other, length should be from 16 to 255 characters. + """ + + s3_type: Required[str] + """Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + """ + + s3_region: str + """S3 storage region. + + The parameter is required, if "`s3_type`": amazon. + """ + + s3_storage_hostname: str + """S3 storage hostname. + + The parameter is required, if "`s3_type`": other. + """ + + +OriginGroupReplaceParams: TypeAlias = Union[NoneAuth, AwsSignatureV4] diff --git a/src/gcore/types/cdn/origin_group_update_params.py b/src/gcore/types/cdn/origin_group_update_params.py new file mode 100644 index 00000000..47d5a0d7 --- /dev/null +++ b/src/gcore/types/cdn/origin_group_update_params.py @@ -0,0 +1,190 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Required, TypeAlias, TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["OriginGroupUpdateParams", "NoneAuth", "NoneAuthSource", "AwsSignatureV4", "AwsSignatureV4Auth"] + + +class NoneAuth(TypedDict, total=False): + name: Required[str] + """Origin group name.""" + + auth_type: str + """Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + """ + + path: str + """Parameter is **deprecated**.""" + + proxy_next_upstream: SequenceNotStr[str] + """Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + """ + + sources: Iterable[NoneAuthSource] + """List of origin sources in the origin group.""" + + use_next: bool + """ + Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class NoneAuthSource(TypedDict, total=False): + backup: bool + """ + Defines whether the origin is a backup, meaning that it will not be used until + one of active origins become unavailable. + + Possible values: + + - **true** - Origin is a backup. + - **false** - Origin is not a backup. + """ + + enabled: bool + """Enables or disables an origin source in the origin group. + + Possible values: + + - **true** - Origin is enabled and the CDN uses it to pull content. + - **false** - Origin is disabled and the CDN does not use it to pull content. + + Origin group must contain at least one enabled origin. + """ + + source: str + """IP address or domain name of the origin and the port, if custom port is used.""" + + +class AwsSignatureV4(TypedDict, total=False): + auth: AwsSignatureV4Auth + """Credentials to access the private bucket.""" + + auth_type: str + """Authentication type. + + **awsSignatureV4** value is used for S3 storage. + """ + + name: str + """Origin group name.""" + + path: str + """Parameter is **deprecated**.""" + + proxy_next_upstream: SequenceNotStr[str] + """Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + """ + + use_next: bool + """ + Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class AwsSignatureV4Auth(TypedDict, total=False): + s3_access_key_id: Required[str] + """Access key ID for the S3 account. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), colon, dash, and underscore. + - From 3 to 512 characters. + """ + + s3_bucket_name: Required[str] + """S3 bucket name. + + Restrictions: + + - Maximum 128 characters. + """ + + s3_secret_access_key: Required[str] + """Secret access key for the S3 account. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), pluses, slashes, dashes, colons and + underscores. + - If "`s3_type`": amazon, length should be 40 characters. + - If "`s3_type`": other, length should be from 16 to 255 characters. + """ + + s3_type: Required[str] + """Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + """ + + s3_region: str + """S3 storage region. + + The parameter is required, if "`s3_type`": amazon. + """ + + s3_storage_hostname: str + """S3 storage hostname. + + The parameter is required, if "`s3_type`": other. + """ + + +OriginGroupUpdateParams: TypeAlias = Union[NoneAuth, AwsSignatureV4] diff --git a/src/gcore/types/cdn/origin_groups.py b/src/gcore/types/cdn/origin_groups.py new file mode 100644 index 00000000..50c3eb01 --- /dev/null +++ b/src/gcore/types/cdn/origin_groups.py @@ -0,0 +1,212 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["OriginGroups", "NoneAuth", "NoneAuthSource", "AwsSignatureV4", "AwsSignatureV4Auth"] + + +class NoneAuthSource(BaseModel): + backup: Optional[bool] = None + """ + Defines whether the origin is a backup, meaning that it will not be used until + one of active origins become unavailable. + + Possible values: + + - **true** - Origin is a backup. + - **false** - Origin is not a backup. + """ + + enabled: Optional[bool] = None + """Enables or disables an origin source in the origin group. + + Possible values: + + - **true** - Origin is enabled and the CDN uses it to pull content. + - **false** - Origin is disabled and the CDN does not use it to pull content. + + Origin group must contain at least one enabled origin. + """ + + source: Optional[str] = None + """IP address or domain name of the origin and the port, if custom port is used.""" + + +class NoneAuth(BaseModel): + id: Optional[int] = None + """Origin group ID.""" + + auth_type: Optional[str] = None + """Origin authentication type. + + Possible values: + + - **none** - Used for public origins. + - **awsSignatureV4** - Used for S3 storage. + """ + + has_related_resources: Optional[bool] = None + """Defines whether the origin group has related CDN resources. + + Possible values: + + - **true** - Origin group has related CDN resources. + - **false** - Origin group does not have related CDN resources. + """ + + name: Optional[str] = None + """Origin group name.""" + + path: Optional[str] = None + """Parameter is **deprecated**.""" + + proxy_next_upstream: Optional[List[str]] = None + """Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + """ + + sources: Optional[List[NoneAuthSource]] = None + """List of origin sources in the origin group.""" + + use_next: Optional[bool] = None + """ + Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class AwsSignatureV4Auth(BaseModel): + s3_access_key_id: str + """Access key ID for the S3 account. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), colon, dash, and underscore. + - From 3 to 512 characters. + """ + + s3_bucket_name: str + """S3 bucket name. + + Restrictions: + + - Maximum 128 characters. + """ + + s3_secret_access_key: str + """Secret access key for the S3 account. + + Restrictions: + + - Latin letters (A-Z, a-z), numbers (0-9), pluses, slashes, dashes, colons and + underscores. + - If "`s3_type`": amazon, length should be 40 characters. + - If "`s3_type`": other, length should be from 16 to 255 characters. + """ + + s3_type: str + """Storage type compatible with S3. + + Possible values: + + - **amazon** – AWS S3 storage. + - **other** – Other (not AWS) S3 compatible storage. + """ + + s3_region: Optional[str] = None + """S3 storage region. + + The parameter is required, if "`s3_type`": amazon. + """ + + s3_storage_hostname: Optional[str] = None + """S3 storage hostname. + + The parameter is required, if "`s3_type`": other. + """ + + +class AwsSignatureV4(BaseModel): + id: Optional[int] = None + """Origin group ID.""" + + auth: Optional[AwsSignatureV4Auth] = None + """Credentials to access the private bucket.""" + + auth_type: Optional[str] = None + """Authentication type. + + **awsSignatureV4** value is used for S3 storage. + """ + + has_related_resources: Optional[bool] = None + """Defines whether the origin group has related CDN resources. + + Possible values: + + - **true** - Origin group has related CDN resources. + - **false** - Origin group does not have related CDN resources. + """ + + name: Optional[str] = None + """Origin group name.""" + + path: Optional[str] = None + """Parameter is **deprecated**.""" + + proxy_next_upstream: Optional[List[str]] = None + """Defines cases when the request should be passed on to the next origin. + + Possible values: + + - **error** - an error occurred while establishing a connection with the origin, + passing a request to it, or reading the response header + - **timeout** - a timeout has occurred while establishing a connection with the + origin, passing a request to it, or reading the response header + - **`invalid_header`** - a origin returned an empty or invalid response + - **`http_403`** - a origin returned a response with the code 403 + - **`http_404`** - a origin returned a response with the code 404 + - **`http_429`** - a origin returned a response with the code 429 + - **`http_500`** - a origin returned a response with the code 500 + - **`http_502`** - a origin returned a response with the code 502 + - **`http_503`** - a origin returned a response with the code 503 + - **`http_504`** - a origin returned a response with the code 504 + """ + + use_next: Optional[bool] = None + """ + Defines whether to use the next origin from the origin group if origin responds + with the cases specified in `proxy_next_upstream`. If you enable it, you must + specify cases in `proxy_next_upstream`. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +OriginGroups: TypeAlias = Union[NoneAuth, AwsSignatureV4] diff --git a/src/gcore/types/cdn/origin_groups_list.py b/src/gcore/types/cdn/origin_groups_list.py new file mode 100644 index 00000000..248241d2 --- /dev/null +++ b/src/gcore/types/cdn/origin_groups_list.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 .origin_groups import OriginGroups + +__all__ = ["OriginGroupsList"] + +OriginGroupsList: TypeAlias = List[OriginGroups] diff --git a/src/gcore/types/cdn/public_ip_list.py b/src/gcore/types/cdn/public_ip_list.py new file mode 100644 index 00000000..ce8272df --- /dev/null +++ b/src/gcore/types/cdn/public_ip_list.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["PublicIPList"] + + +class PublicIPList(BaseModel): + addresses: Optional[List[str]] = None + """List of IPv4 addresses.""" + + addresses_v6: Optional[List[str]] = None + """List of IPv6 addresses.""" diff --git a/src/gcore/types/cdn/public_network_list.py b/src/gcore/types/cdn/public_network_list.py new file mode 100644 index 00000000..2cc5570d --- /dev/null +++ b/src/gcore/types/cdn/public_network_list.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["PublicNetworkList"] + + +class PublicNetworkList(BaseModel): + addresses: Optional[List[str]] = None + """List of IPv4 networks.""" + + addresses_v6: Optional[List[str]] = None + """List of IPv6 networks.""" diff --git a/src/gcore/types/cdn/purge_status.py b/src/gcore/types/cdn/purge_status.py new file mode 100644 index 00000000..2ac5c9f3 --- /dev/null +++ b/src/gcore/types/cdn/purge_status.py @@ -0,0 +1,55 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["PurgeStatus", "Resource"] + + +class Resource(BaseModel): + id: Optional[int] = None + """Resource ID.""" + + cname: Optional[str] = None + """CNAME of the resource.""" + + +class PurgeStatus(BaseModel): + created: Optional[str] = None + """Date and time when the purge was created (ISO 8601/RFC 3339 format, UTC).""" + + payload: Optional[object] = None + """Purge payload depends on purge type. + + Possible values: + + - **urls** - Purge by URL. + - **paths** - Purge by Pattern and purge All. + """ + + purge_id: Optional[int] = None + """Purge ID.""" + + purge_type: Optional[str] = None + """Contains the name of the purge request type. + + Possible values: + + - **`purge_by_pattern`** - Purge by Pattern. + - **`purge_by_url`** - Purge by URL. + - **`purge_all`** - Purge All. + """ + + resource: Optional[Resource] = None + + status: Optional[Literal["In progress", "Successful", "Failed"]] = None + """Purge status. + + Possible values: + + - **In progress** - Purge is in progress. + - **Successful** - Purge was successful. + - **Failed** - Purge failed. + """ diff --git a/src/gcore/types/cdn/resource_aggregated_stats.py b/src/gcore/types/cdn/resource_aggregated_stats.py new file mode 100644 index 00000000..5d6453a2 --- /dev/null +++ b/src/gcore/types/cdn/resource_aggregated_stats.py @@ -0,0 +1,80 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["ResourceAggregatedStats"] + + +class ResourceAggregatedStats(BaseModel): + api_1_example: Optional[object] = FieldInfo(alias="1 (example)", default=None) + """CDN resource ID for which statistics data is shown.""" + + api_95_percentile: Optional[int] = FieldInfo(alias="95_percentile", default=None) + """95 percentile bandwidth value""" + + backblaze_bytes: Optional[int] = None + """Traffic in bytes from Backblaze origin.""" + + cache_hit_traffic_ratio: Optional[int] = None + """Formula: 1 - `upstream_bytes` / `sent_bytes`. + + We deduct the non-cached traffic from the total traffic amount + """ + + cis_example: Optional[object] = FieldInfo(alias="cis (example)", default=None) + """Region by which statistics data is grouped.""" + + max_bandwidth: Optional[int] = None + """Maximum bandwidth""" + + metrics: Optional[object] = None + """Statistics parameters.""" + + min_bandwidth: Optional[int] = None + """Minimum bandwidth""" + + region: Optional[object] = None + """Regions by which statistics data is grouped.""" + + requests: Optional[int] = None + """Number of requests to edge servers.""" + + resource: Optional[object] = None + """Resources IDs by which statistics data is grouped.""" + + response_types: Optional[object] = None + """Statistics by content type. + + It returns a number of responses for content with different MIME types. + """ + + responses_2xx: Optional[int] = None + """Number of 2xx response codes.""" + + responses_3xx: Optional[int] = None + """Number of 3xx response codes.""" + + responses_4xx: Optional[int] = None + """Number of 4xx response codes.""" + + responses_5xx: Optional[int] = None + """Number of 5xx response codes.""" + + responses_hit: Optional[int] = None + """Number of responses with the header Cache: HIT.""" + + responses_miss: Optional[int] = None + """Number of responses with the header Cache: MISS.""" + + sent_bytes: Optional[int] = None + """Traffic in bytes from CDN servers to clients.""" + + total_bytes: Optional[int] = None + """Upstream bytes and `sent_bytes` combined.""" + + upstream_bytes: Optional[int] = None + """Traffic in bytes from the upstream to CDN servers.""" diff --git a/src/gcore/types/cdn/resource_create_params.py b/src/gcore/types/cdn/resource_create_params.py new file mode 100644 index 00000000..fbde3142 --- /dev/null +++ b/src/gcore/types/cdn/resource_create_params.py @@ -0,0 +1,1825 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = [ + "ResourceCreateParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsHttp3Enabled", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsTlsVersions", + "OptionsUseDefaultLeChain", + "OptionsUseDns01LeChallenge", + "OptionsUseRsaLeCert", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class ResourceCreateParams(TypedDict, total=False): + cname: Required[str] + """Delivery domains that will be used for content delivery through a CDN. + + Delivery domains should be added to your DNS settings. + """ + + origin: Required[str] + """IP address or domain name of the origin and the port, if custom port is used. + + You can use either the `origin` or `originGroup` parameter in the request. + """ + + origin_group: Required[Annotated[int, PropertyInfo(alias="originGroup")]] + """Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + """ + + active: bool + """Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + """ + + description: str + """Optional comment describing the CDN resource.""" + + name: Optional[str] + """CDN resource name.""" + + options: Options + """List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + """ + + origin_protocol: Annotated[Literal["HTTP", "HTTPS", "MATCH"], PropertyInfo(alias="originProtocol")] + """Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + """ + + primary_resource: Optional[int] + """ + ID of the main CDN resource which has a shared caching zone with a reserve CDN + resource. + + If the parameter is not empty, then the current CDN resource is the reserve. You + cannot change some options, create rules, set up origin shielding, or use the + reserve CDN resource for Streaming. + """ + + proxy_ssl_ca: Optional[int] + """ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + """ + + proxy_ssl_data: Optional[int] + """ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + """ + + proxy_ssl_enabled: bool + """ + Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + """ + + secondary_hostnames: Annotated[SequenceNotStr[str], PropertyInfo(alias="secondaryHostnames")] + """ + Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + """ + + ssl_data: Annotated[Optional[int], PropertyInfo(alias="sslData")] + """ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + """ + + ssl_enabled: Annotated[bool, PropertyInfo(alias="sslEnabled")] + """Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + """ + + waap_api_domain_enabled: bool + """Defines whether the associated WAAP Domain is identified as an API Domain. + + Possible values: + + - **true** - The associated WAAP Domain is designated as an API Domain. + - **false** - The associated WAAP Domain is not designated as an API Domain. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsHttp3Enabled(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsTlsVersions(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"]]] + """List of SSL/TLS protocol versions (case sensitive).""" + + +class OptionsUseDefaultLeChain(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Default Let's Encrypt certificate chain. This is a deprecated + version, use it only for compatibilities with Android devices 7.1.1 or lower. + - **false** - Alternative Let's Encrypt certificate chain. + """ + + +class OptionsUseDns01LeChallenge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - DNS-01 challenge is used to issue Let's Encrypt certificate. + - **false** - HTTP-01 challenge is used to issue Let's Encrypt certificate. + """ + + +class OptionsUseRsaLeCert(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - RSA Let's Encrypt certificate. + - **false** - ECDSA Let's Encrypt certificate. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + http3_enabled: Optional[OptionsHttp3Enabled] + """Enables HTTP/3 protocol for content delivery. + + `http3_enabled` option works only with `"sslEnabled": true`. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + tls_versions: Optional[OptionsTlsVersions] + """ + List of SSL/TLS protocol versions allowed for HTTPS connections from end users + to the domain. + + When the option is disabled, all protocols versions are allowed. + """ + + use_default_le_chain: Optional[OptionsUseDefaultLeChain] + """Let's Encrypt certificate chain. + + The specified chain will be used during the next Let's Encrypt certificate issue + or renewal. + """ + + use_dns01_le_challenge: Optional[OptionsUseDns01LeChallenge] + """DNS-01 challenge to issue a Let's Encrypt certificate for the resource. + + DNS service should be activated to enable this option. + """ + + use_rsa_le_cert: Optional[OptionsUseRsaLeCert] + """RSA Let's Encrypt certificate type for the CDN resource. + + The specified value will be used during the next Let's Encrypt certificate issue + or renewal. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/resource_list_params.py b/src/gcore/types/cdn/resource_list_params.py new file mode 100644 index 00000000..24c26506 --- /dev/null +++ b/src/gcore/types/cdn/resource_list_params.py @@ -0,0 +1,107 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["ResourceListParams"] + + +class ResourceListParams(TypedDict, total=False): + cname: str + """Delivery domain (CNAME) of the CDN resource.""" + + deleted: bool + """Defines whether a CDN resource has been deleted. + + Possible values: + + - **true** - CDN resource has been deleted. + - **false** - CDN resource has not been deleted. + """ + + enabled: bool + """Enables or disables a CDN resource change by a user. + + Possible values: + + - **true** - CDN resource is enabled. + - **false** - CDN resource is disabled. + """ + + max_created: str + """ + Most recent date of CDN resource creation for which CDN resources should be + returned (ISO 8601/RFC 3339 format, UTC.) + """ + + min_created: str + """ + Earliest date of CDN resource creation for which CDN resources should be + returned (ISO 8601/RFC 3339 format, UTC.) + """ + + origin_group: Annotated[int, PropertyInfo(alias="originGroup")] + """Origin group ID.""" + + rules: str + """Rule name or pattern.""" + + secondary_hostnames: Annotated[str, PropertyInfo(alias="secondaryHostnames")] + """Additional delivery domains (CNAMEs) of the CDN resource.""" + + shield_dc: str + """Name of the origin shielding data center location.""" + + shielded: bool + """Defines whether origin shielding is enabled for the CDN resource. + + Possible values: + + - **true** - Origin shielding is enabled for the CDN resource. + - **false** - Origin shielding is disabled for the CDN resource. + """ + + ssl_data: Annotated[int, PropertyInfo(alias="sslData")] + """SSL certificate ID.""" + + ssl_data_in: Annotated[int, PropertyInfo(alias="sslData_in")] + """SSL certificates IDs. + + Example: + + - ?`sslData_in`=1643,1644,1652 + """ + + ssl_enabled: Annotated[bool, PropertyInfo(alias="sslEnabled")] + """Defines whether the HTTPS protocol is enabled for content delivery. + + Possible values: + + - **true** - HTTPS protocol is enabled for CDN resource. + - **false** - HTTPS protocol is disabled for CDN resource. + """ + + status: Literal["active", "processed", "suspended", "deleted"] + """CDN resource status.""" + + suspend: bool + """Defines whether the CDN resource was automatically suspended by the system. + + Possible values: + + - **true** - CDN resource is selected for automatic suspension in the next 7 + days. + - **false** - CDN resource is not selected for automatic suspension. + """ + + vp_enabled: bool + """Defines whether the CDN resource is integrated with the Streaming platform. + + Possible values: + + - **true** - CDN resource is used for Streaming platform. + - **false** - CDN resource is not used for Streaming platform. + """ diff --git a/src/gcore/types/cdn/resource_prefetch_params.py b/src/gcore/types/cdn/resource_prefetch_params.py new file mode 100644 index 00000000..1fc88a63 --- /dev/null +++ b/src/gcore/types/cdn/resource_prefetch_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["ResourcePrefetchParams"] + + +class ResourcePrefetchParams(TypedDict, total=False): + paths: Required[SequenceNotStr[str]] + """Paths to files that should be pre-populated to the CDN. + + Paths to the files should be specified without a domain name. + """ diff --git a/src/gcore/types/cdn/resource_purge_params.py b/src/gcore/types/cdn/resource_purge_params.py new file mode 100644 index 00000000..5342995f --- /dev/null +++ b/src/gcore/types/cdn/resource_purge_params.py @@ -0,0 +1,71 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import TypeAlias, TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["ResourcePurgeParams", "PurgeByURL", "PurgeByPattern", "PurgeAllCache"] + + +class PurgeByURL(TypedDict, total=False): + urls: SequenceNotStr[str] + """**Purge by URL** clears the cache of a specific files. + + This purge type is recommended. + + Specify file URLs including query strings. URLs should start with / without a + domain name. + + Purge by URL depends on the following CDN options: + + 1. "vary response header" is used. If your origin serves variants of the same + content depending on the Vary HTTP response header, purge by URL will delete + only one version of the file. + 2. "slice" is used. If you update several files in the origin without clearing + the CDN cache, purge by URL will delete only the first slice (with bytes=0… + .) + 3. "ignoreQueryString" is used. Don’t specify parameters in the purge request. + 4. "`query_params_blacklist`" is used. Only files with the listed in the option + parameters will be cached as different objects. Files with other parameters + will be cached as one object. In this case, specify the listed parameters in + the Purge request. Don't specify other parameters. + 5. "`query_params_whitelist`" is used. Files with listed in the option + parameters will be cached as one object. Files with other parameters will be + cached as different objects. In this case, specify other parameters (if any) + besides the ones listed in the purge request. + """ + + +class PurgeByPattern(TypedDict, total=False): + paths: SequenceNotStr[str] + """**Purge by pattern** clears the cache that matches the pattern. + + Use \\** operator, which replaces any number of symbols in your path. It's + important to note that wildcard usage (\\**) is permitted only at the end of a + pattern. + + Query string added to any patterns will be ignored, and purge request will be + processed as if there weren't any parameters. + + Purge by pattern is recursive. Both /path and /path\\** will result in recursive + purging, meaning all content under the specified path will be affected. As such, + using the pattern /path\\** is functionally equivalent to simply using /path. + """ + + +class PurgeAllCache(TypedDict, total=False): + paths: SequenceNotStr[str] + """**Purge all cache** clears the entire cache for the CDN resource. + + Specify an empty array to purge all content for the resource. + + When you purge all assets, CDN servers request content from your origin server + and cause a high load. Therefore, we recommend to use purge by URL for large + content quantities. + """ + + +ResourcePurgeParams: TypeAlias = Union[PurgeByURL, PurgeByPattern, PurgeAllCache] diff --git a/src/gcore/types/cdn/resource_replace_params.py b/src/gcore/types/cdn/resource_replace_params.py new file mode 100644 index 00000000..4128691f --- /dev/null +++ b/src/gcore/types/cdn/resource_replace_params.py @@ -0,0 +1,1803 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = [ + "ResourceReplaceParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsHttp3Enabled", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsTlsVersions", + "OptionsUseDefaultLeChain", + "OptionsUseDns01LeChallenge", + "OptionsUseRsaLeCert", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class ResourceReplaceParams(TypedDict, total=False): + origin_group: Required[Annotated[int, PropertyInfo(alias="originGroup")]] + """Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + """ + + active: bool + """Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + """ + + description: str + """Optional comment describing the CDN resource.""" + + name: Optional[str] + """CDN resource name.""" + + options: Options + """List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + """ + + origin_protocol: Annotated[Literal["HTTP", "HTTPS", "MATCH"], PropertyInfo(alias="originProtocol")] + """Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + """ + + proxy_ssl_ca: Optional[int] + """ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + """ + + proxy_ssl_data: Optional[int] + """ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + """ + + proxy_ssl_enabled: bool + """ + Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + """ + + secondary_hostnames: Annotated[SequenceNotStr[str], PropertyInfo(alias="secondaryHostnames")] + """ + Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + """ + + ssl_data: Annotated[Optional[int], PropertyInfo(alias="sslData")] + """ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + """ + + ssl_enabled: Annotated[bool, PropertyInfo(alias="sslEnabled")] + """Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + """ + + waap_api_domain_enabled: bool + """Defines whether the associated WAAP Domain is identified as an API Domain. + + Possible values: + + - **true** - The associated WAAP Domain is designated as an API Domain. + - **false** - The associated WAAP Domain is not designated as an API Domain. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsHttp3Enabled(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsTlsVersions(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"]]] + """List of SSL/TLS protocol versions (case sensitive).""" + + +class OptionsUseDefaultLeChain(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Default Let's Encrypt certificate chain. This is a deprecated + version, use it only for compatibilities with Android devices 7.1.1 or lower. + - **false** - Alternative Let's Encrypt certificate chain. + """ + + +class OptionsUseDns01LeChallenge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - DNS-01 challenge is used to issue Let's Encrypt certificate. + - **false** - HTTP-01 challenge is used to issue Let's Encrypt certificate. + """ + + +class OptionsUseRsaLeCert(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - RSA Let's Encrypt certificate. + - **false** - ECDSA Let's Encrypt certificate. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + http3_enabled: Optional[OptionsHttp3Enabled] + """Enables HTTP/3 protocol for content delivery. + + `http3_enabled` option works only with `"sslEnabled": true`. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + tls_versions: Optional[OptionsTlsVersions] + """ + List of SSL/TLS protocol versions allowed for HTTPS connections from end users + to the domain. + + When the option is disabled, all protocols versions are allowed. + """ + + use_default_le_chain: Optional[OptionsUseDefaultLeChain] + """Let's Encrypt certificate chain. + + The specified chain will be used during the next Let's Encrypt certificate issue + or renewal. + """ + + use_dns01_le_challenge: Optional[OptionsUseDns01LeChallenge] + """DNS-01 challenge to issue a Let's Encrypt certificate for the resource. + + DNS service should be activated to enable this option. + """ + + use_rsa_le_cert: Optional[OptionsUseRsaLeCert] + """RSA Let's Encrypt certificate type for the CDN resource. + + The specified value will be used during the next Let's Encrypt certificate issue + or renewal. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/resource_update_params.py b/src/gcore/types/cdn/resource_update_params.py new file mode 100644 index 00000000..dad17ba7 --- /dev/null +++ b/src/gcore/types/cdn/resource_update_params.py @@ -0,0 +1,1794 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = [ + "ResourceUpdateParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsHttp3Enabled", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsTlsVersions", + "OptionsUseDefaultLeChain", + "OptionsUseDns01LeChallenge", + "OptionsUseRsaLeCert", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class ResourceUpdateParams(TypedDict, total=False): + active: bool + """Enables or disables a CDN resource. + + Possible values: + + - **true** - CDN resource is active. Content is being delivered. + - **false** - CDN resource is deactivated. Content is not being delivered. + """ + + description: str + """Optional comment describing the CDN resource.""" + + name: Optional[str] + """CDN resource name.""" + + options: Options + """List of options that can be configured for the CDN resource. + + In case of `null` value the option is not added to the CDN resource. Option may + inherit its value from the global account settings. + """ + + origin_group: Annotated[int, PropertyInfo(alias="originGroup")] + """Origin group ID with which the CDN resource is associated. + + You can use either the `origin` or `originGroup` parameter in the request. + """ + + origin_protocol: Annotated[Literal["HTTP", "HTTPS", "MATCH"], PropertyInfo(alias="originProtocol")] + """Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers will connect to the origin via HTTPS. + - **HTTP** - CDN servers will connect to the origin via HTTP. + - **MATCH** - connection protocol will be chosen automatically (content on the + origin source should be available for the CDN both through HTTP and HTTPS). + + If protocol is not specified, HTTP is used to connect to an origin server. + """ + + proxy_ssl_ca: Optional[int] + """ID of the trusted CA certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + """ + + proxy_ssl_data: Optional[int] + """ID of the SSL certificate used to verify an origin. + + It can be used only with `"`proxy_ssl_enabled`": true`. + """ + + proxy_ssl_enabled: bool + """ + Enables or disables SSL certificate validation of the origin server before + completing any connection. + + Possible values: + + - **true** - Origin SSL certificate validation is enabled. + - **false** - Origin SSL certificate validation is disabled. + """ + + secondary_hostnames: Annotated[SequenceNotStr[str], PropertyInfo(alias="secondaryHostnames")] + """ + Additional delivery domains (CNAMEs) that will be used to deliver content via + the CDN. + + Up to ten additional CNAMEs are possible. + """ + + ssl_data: Annotated[Optional[int], PropertyInfo(alias="sslData")] + """ID of the SSL certificate linked to the CDN resource. + + Can be used only with `"sslEnabled": true`. + """ + + ssl_enabled: Annotated[bool, PropertyInfo(alias="sslEnabled")] + """Defines whether the HTTPS protocol enabled for content delivery. + + Possible values: + + - **true** - HTTPS is enabled. + - **false** - HTTPS is disabled. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsHttp3Enabled(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsTlsVersions(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"]]] + """List of SSL/TLS protocol versions (case sensitive).""" + + +class OptionsUseDefaultLeChain(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Default Let's Encrypt certificate chain. This is a deprecated + version, use it only for compatibilities with Android devices 7.1.1 or lower. + - **false** - Alternative Let's Encrypt certificate chain. + """ + + +class OptionsUseDns01LeChallenge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - DNS-01 challenge is used to issue Let's Encrypt certificate. + - **false** - HTTP-01 challenge is used to issue Let's Encrypt certificate. + """ + + +class OptionsUseRsaLeCert(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - RSA Let's Encrypt certificate. + - **false** - ECDSA Let's Encrypt certificate. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + http3_enabled: Optional[OptionsHttp3Enabled] + """Enables HTTP/3 protocol for content delivery. + + `http3_enabled` option works only with `"sslEnabled": true`. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + tls_versions: Optional[OptionsTlsVersions] + """ + List of SSL/TLS protocol versions allowed for HTTPS connections from end users + to the domain. + + When the option is disabled, all protocols versions are allowed. + """ + + use_default_le_chain: Optional[OptionsUseDefaultLeChain] + """Let's Encrypt certificate chain. + + The specified chain will be used during the next Let's Encrypt certificate issue + or renewal. + """ + + use_dns01_le_challenge: Optional[OptionsUseDns01LeChallenge] + """DNS-01 challenge to issue a Let's Encrypt certificate for the resource. + + DNS service should be activated to enable this option. + """ + + use_rsa_le_cert: Optional[OptionsUseRsaLeCert] + """RSA Let's Encrypt certificate type for the CDN resource. + + The specified value will be used during the next Let's Encrypt certificate issue + or renewal. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/resource_usage_stats.py b/src/gcore/types/cdn/resource_usage_stats.py new file mode 100644 index 00000000..7a6f6255 --- /dev/null +++ b/src/gcore/types/cdn/resource_usage_stats.py @@ -0,0 +1,111 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["ResourceUsageStats"] + + +class ResourceUsageStats(BaseModel): + api_1_example: Optional[object] = FieldInfo(alias="1 (example)", default=None) + """ID of CDN resource for which statistics data is shown.""" + + backblaze_bytes: Optional[List[int]] = None + """BackBlaze bytes from Backblaze origin. + + Represented by two values: + + - 1543622400 — Time in the UNIX timestamp when statistics were received. + - 17329220573 — Bytes. + """ + + metrics: Optional[object] = None + """Types of statistics data. + + Possible values: + + - **`upstream_bytes`** – Traffic in bytes from an origin server to CDN servers + or to origin shielding, if used. + - **`sent_bytes`** – Traffic in bytes from CDN servers to clients. + - **`shield_bytes`** – Traffic in bytes from origin shielding to CDN servers. + - **`backblaze_bytes`** - Traffic in bytes from Backblaze origin. + - **`total_bytes`** – `shield_bytes`, `upstream_bytes` and `sent_bytes` + combined. + - **`cdn_bytes`** – `sent_bytes` and `shield_bytes` combined. + - **requests** – Number of requests to edge servers. + - **`responses_2xx`** – Number of 2xx response codes. + - **`responses_3xx`** – Number of 3xx response codes. + - **`responses_4xx`** – Number of 4xx response codes. + - **`responses_5xx`** – Number of 5xx response codes. + - **`responses_hit`** – Number of responses with the header Cache: HIT. + - **`responses_miss`** – Number of responses with the header Cache: MISS. + - **`response_types`** – Statistics by content type. It returns a number of + responses for content with different MIME types. + - **`cache_hit_traffic_ratio`** – Formula: 1 - `upstream_bytes` / `sent_bytes`. + We deduct the non-cached traffic from the total traffic value. + - **`cache_hit_requests_ratio`** – Share of sending cached content. Formula: + `responses_hit` / requests. + - **`shield_traffic_ratio`** – Origin shielding efficiency: how much more + traffic is sent from the origin shielding than from the origin. Formula: + (`shield_bytes` - `upstream_bytes`) / `shield_bytes`. + - **`image_processed`** - Number of images transformed on the Image optimization + service. + - **`request_time`** - Time elapsed between the first bytes of a request were + processed and logging after the last bytes were sent to a user. + - **`upstream_response_time`** - Number of milliseconds it took to receive a + response from an origin. If upstream `response_time_` contains several + indications for one request (when there is more than one origin,) we summarize + them. When aggregating several queries, the average is calculated. + + Metrics **`upstream_response_time`** and **`request_time`** should be requested + separately from other metrics + """ + + region: Optional[object] = None + """Locations (regions) by which the data is grouped. + + Possible values: + + - **asia** – Asia + - **au** – Australia + - **cis** – CIS (Commonwealth of Independent States) + - **eu** – Europe + - **latam** – Latin America + - **me** – Middle East + - **na** – North America + - **africa** – Africa + - **sa** – South America + """ + + resource: Optional[object] = None + """Resources IDs by which statistics data is grouped.""" + + sent_bytes: Optional[List[int]] = None + """Bytes from CDN servers to the end-users. + + Represented by two values: + + - 1543622400 — Time in the UNIX timestamp when statistics were received. + - 17329220573 — Bytes. + """ + + total_bytes: Optional[List[int]] = None + """Upstream bytes and `sent_bytes` combined. + + Represented by two values: + + - 1543622400 — Time in the UNIX timestamp when statistics were received. + - 17329220573 — Bytes. + """ + + upstream_bytes: Optional[List[int]] = None + """Bytes from the upstream to the CDN servers. + + Represented by two values: + + - 1543622400 — Time in the UNIX timestamp when statistics were received. + - 17329220573 — Bytes. + """ diff --git a/src/gcore/types/cdn/resources/__init__.py b/src/gcore/types/cdn/resources/__init__.py new file mode 100644 index 00000000..f5876a8a --- /dev/null +++ b/src/gcore/types/cdn/resources/__init__.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .origin_shielding import OriginShielding as OriginShielding +from .cdn_resource_rule import CdnResourceRule as CdnResourceRule +from .rule_create_params import RuleCreateParams as RuleCreateParams +from .rule_list_response import RuleListResponse as RuleListResponse +from .rule_update_params import RuleUpdateParams as RuleUpdateParams +from .rule_replace_params import RuleReplaceParams as RuleReplaceParams +from .shield_replace_params import ShieldReplaceParams as ShieldReplaceParams diff --git a/src/gcore/types/cdn/resources/cdn_resource_rule.py b/src/gcore/types/cdn/resources/cdn_resource_rule.py new file mode 100644 index 00000000..8bf93a9e --- /dev/null +++ b/src/gcore/types/cdn/resources/cdn_resource_rule.py @@ -0,0 +1,1695 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel + +__all__ = [ + "CdnResourceRule", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class OptionsAllowedHTTPMethods(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]] + + +class OptionsBotProtectionBotChallenge(BaseModel): + enabled: Optional[bool] = None + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(BaseModel): + bot_challenge: OptionsBotProtectionBotChallenge + """Controls the bot challenge module state.""" + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + + +class OptionsCors(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: Optional[bool] = None + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Literal["allow", "deny"] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Optional[Dict[str, str]] = None + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: Optional[str] = None + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: Optional[str] = None + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: Optional[OptionsFastedgeOnRequestBody] = None + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: Optional[OptionsFastedgeOnRequestHeaders] = None + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: Optional[OptionsFastedgeOnResponseBody] = None + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: Optional[OptionsFastedgeOnResponseHeaders] = None + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(BaseModel): + codes: List[Literal[301, 302, 303, 307, 308]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(BaseModel): + end_time: str + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: str + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: Optional[str] = None + """Time zone used to calculate time.""" + + +class OptionsForceReturn(BaseModel): + body: str + """URL for redirection or text.""" + + code: int + """Status code value.""" + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] = None + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Host Header value.""" + + +class OptionsIgnoreCookie(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: Optional[bool] = None + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: Optional[bool] = None + """Enables or disables compression without quality loss for PNG format.""" + + quality: Optional[int] = None + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: Optional[bool] = None + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Literal["allow", "deny"] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Literal["static", "dynamic"] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: Optional[int] = None + """Amount of downloaded data after which the user will be rate limited.""" + + speed: Optional[int] = None + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: List[str] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: List[str] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Literal["allow", "deny"] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: int + """Maximum request rate.""" + + burst: Optional[int] = None + + delay: Optional[int] = None + + rate_unit: Optional[Literal["r/s", "r/m"]] = None + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: List[str] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Literal["hide", "show"] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(BaseModel): + body: str + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Optional[Literal["break", "last", "redirect", "permanent"]] = None + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Optional[str] = None + """Key generated on your side that will be used for URL signing.""" + + type: Optional[Literal[0, 2]] = None + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(BaseModel): + custom_hostname: str + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Optional[Literal["dynamic", "custom"]] = None + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(BaseModel): + name: str + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: List[str] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: Optional[bool] = None + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[OptionsStaticResponseHeadersValue] + + +class OptionsStaticHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Dict[str, str] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Dict[str, str] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsUserAgentACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Literal["allow", "deny"] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(BaseModel): + allowed_http_methods: Optional[OptionsAllowedHTTPMethods] = FieldInfo(alias="allowedHttpMethods", default=None) + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] = None + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] = None + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] = None + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] = None + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] = None + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] = None + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] = None + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] = None + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] = None + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] = None + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] = None + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] = None + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] = None + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] = None + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Optional[OptionsGzipOn] = FieldInfo(alias="gzipOn", default=None) + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Optional[OptionsHostHeader] = FieldInfo(alias="hostHeader", default=None) + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] = None + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Optional[OptionsIgnoreQueryString] = FieldInfo(alias="ignoreQueryString", default=None) + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] = None + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] = None + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] = None + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] = None + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] = None + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] = None + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] = None + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] = None + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] = None + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] = None + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] = None + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] = None + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] = None + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] = None + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] = None + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] = None + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] = None + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] = None + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] = None + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] = None + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] = None + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Optional[OptionsStaticHeaders] = FieldInfo(alias="staticHeaders", default=None) + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Optional[OptionsStaticRequestHeaders] = FieldInfo( + alias="staticRequestHeaders", default=None + ) + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] = None + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] = None + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] = None + """Enables or disables WebSockets connections to an origin server.""" + + +class CdnResourceRule(BaseModel): + id: Optional[int] = None + """Rule ID.""" + + active: Optional[bool] = None + """Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + """ + + deleted: Optional[bool] = None + """Defines whether the rule has been deleted. + + Possible values: + + - **true** - Rule has been deleted. + - **false** - Rule has not been deleted. + """ + + name: Optional[str] = None + """Rule name.""" + + options: Optional[Options] = None + """List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + """ + + origin_group: Optional[int] = FieldInfo(alias="originGroup", default=None) + """ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + """ + + origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] = FieldInfo(alias="originProtocol", default=None) + """Protocol used by CDN servers to request content from an origin source. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + """ + + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] = FieldInfo( + alias="overrideOriginProtocol", default=None + ) + """ + Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + """ + + preset_applied: Optional[bool] = None + """Defines whether the rule has an applied preset. + + Possible values: + + - **true** - Rule has a preset applied. + - **false** - Rule does not have a preset applied. + + If a preset is applied to the rule, the options included in the preset cannot be + edited for the rule. + """ + + primary_rule: Optional[int] = None + """ + ID of the rule with which the current rule is synchronized within the CDN + resource shared cache zone feature. + """ + + rule: Optional[str] = None + """Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + """ + + rule_type: Optional[int] = FieldInfo(alias="ruleType", default=None) + """Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + """ + + weight: Optional[int] = None + """Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + """ diff --git a/src/gcore/types/cdn/resources/origin_shielding.py b/src/gcore/types/cdn/resources/origin_shielding.py new file mode 100644 index 00000000..f188e7ac --- /dev/null +++ b/src/gcore/types/cdn/resources/origin_shielding.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["OriginShielding"] + + +class OriginShielding(BaseModel): + shielding_pop: Optional[int] = None + """Shielding location ID. + + If origin shielding is disabled, the parameter value is **null**. + """ diff --git a/src/gcore/types/cdn/resources/rule_create_params.py b/src/gcore/types/cdn/resources/rule_create_params.py new file mode 100644 index 00000000..b9c282ce --- /dev/null +++ b/src/gcore/types/cdn/resources/rule_create_params.py @@ -0,0 +1,1652 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ...._types import SequenceNotStr +from ...._utils import PropertyInfo + +__all__ = [ + "RuleCreateParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class RuleCreateParams(TypedDict, total=False): + name: Required[str] + """Rule name.""" + + rule: Required[str] + """Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + """ + + rule_type: Required[Annotated[int, PropertyInfo(alias="ruleType")]] + """Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + """ + + active: bool + """Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + """ + + options: Options + """List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + """ + + origin_group: Annotated[Optional[int], PropertyInfo(alias="originGroup")] + """ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + """ + + override_origin_protocol: Annotated[ + Optional[Literal["HTTPS", "HTTP", "MATCH"]], PropertyInfo(alias="overrideOriginProtocol") + ] + """ + Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + """ + + weight: int + """Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/resources/rule_list_response.py b/src/gcore/types/cdn/resources/rule_list_response.py new file mode 100644 index 00000000..06cbe617 --- /dev/null +++ b/src/gcore/types/cdn/resources/rule_list_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 .cdn_resource_rule import CdnResourceRule + +__all__ = ["RuleListResponse"] + +RuleListResponse: TypeAlias = List[CdnResourceRule] diff --git a/src/gcore/types/cdn/resources/rule_replace_params.py b/src/gcore/types/cdn/resources/rule_replace_params.py new file mode 100644 index 00000000..6e9dfca4 --- /dev/null +++ b/src/gcore/types/cdn/resources/rule_replace_params.py @@ -0,0 +1,1654 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ...._types import SequenceNotStr +from ...._utils import PropertyInfo + +__all__ = [ + "RuleReplaceParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class RuleReplaceParams(TypedDict, total=False): + resource_id: Required[int] + + rule: Required[str] + """Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + """ + + rule_type: Required[Annotated[int, PropertyInfo(alias="ruleType")]] + """Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + """ + + active: bool + """Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + """ + + name: str + """Rule name.""" + + options: Options + """List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + """ + + origin_group: Annotated[Optional[int], PropertyInfo(alias="originGroup")] + """ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + """ + + override_origin_protocol: Annotated[ + Optional[Literal["HTTPS", "HTTP", "MATCH"]], PropertyInfo(alias="overrideOriginProtocol") + ] + """ + Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + """ + + weight: int + """Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/resources/rule_update_params.py b/src/gcore/types/cdn/resources/rule_update_params.py new file mode 100644 index 00000000..959e82a8 --- /dev/null +++ b/src/gcore/types/cdn/resources/rule_update_params.py @@ -0,0 +1,1654 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ...._types import SequenceNotStr +from ...._utils import PropertyInfo + +__all__ = [ + "RuleUpdateParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class RuleUpdateParams(TypedDict, total=False): + resource_id: Required[int] + + active: bool + """Enables or disables a rule. + + Possible values: + + - **true** - Rule is active, rule settings are applied. + - **false** - Rule is inactive, rule settings are not applied. + """ + + name: str + """Rule name.""" + + options: Options + """List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + """ + + origin_group: Annotated[Optional[int], PropertyInfo(alias="originGroup")] + """ID of the origin group to which the rule is applied. + + If the origin group is not specified, the rule is applied to the origin group + that the CDN resource is associated with. + """ + + override_origin_protocol: Annotated[ + Optional[Literal["HTTPS", "HTTP", "MATCH"]], PropertyInfo(alias="overrideOriginProtocol") + ] + """ + Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + """ + + rule: str + """Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + """ + + rule_type: Annotated[int, PropertyInfo(alias="ruleType")] + """Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + """ + + weight: int + """Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/resources/shield_replace_params.py b/src/gcore/types/cdn/resources/shield_replace_params.py new file mode 100644 index 00000000..3cc4e963 --- /dev/null +++ b/src/gcore/types/cdn/resources/shield_replace_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +__all__ = ["ShieldReplaceParams"] + + +class ShieldReplaceParams(TypedDict, total=False): + shielding_pop: Optional[int] + """Shielding location ID. + + If origin shielding is disabled, the parameter value is **null**. + """ diff --git a/src/gcore/types/cdn/rule_template.py b/src/gcore/types/cdn/rule_template.py new file mode 100644 index 00000000..000e8ebd --- /dev/null +++ b/src/gcore/types/cdn/rule_template.py @@ -0,0 +1,1666 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "RuleTemplate", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class OptionsAllowedHTTPMethods(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]] + + +class OptionsBotProtectionBotChallenge(BaseModel): + enabled: Optional[bool] = None + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(BaseModel): + bot_challenge: OptionsBotProtectionBotChallenge + """Controls the bot challenge module state.""" + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + + +class OptionsCors(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: Optional[bool] = None + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Literal["allow", "deny"] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Optional[Dict[str, str]] = None + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: Optional[str] = None + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: Optional[str] = None + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(BaseModel): + app_id: str + """The ID of the application in FastEdge.""" + + enabled: Optional[bool] = None + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: Optional[bool] = None + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: Optional[bool] = None + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: Optional[bool] = None + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: Optional[OptionsFastedgeOnRequestBody] = None + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: Optional[OptionsFastedgeOnRequestHeaders] = None + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: Optional[OptionsFastedgeOnResponseBody] = None + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: Optional[OptionsFastedgeOnResponseHeaders] = None + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(BaseModel): + codes: List[Literal[301, 302, 303, 307, 308]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(BaseModel): + end_time: str + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: str + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: Optional[str] = None + """Time zone used to calculate time.""" + + +class OptionsForceReturn(BaseModel): + body: str + """URL for redirection or text.""" + + code: int + """Status code value.""" + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] = None + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Host Header value.""" + + +class OptionsIgnoreCookie(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: Optional[bool] = None + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: Optional[bool] = None + """Enables or disables compression without quality loss for PNG format.""" + + quality: Optional[int] = None + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: Optional[bool] = None + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Literal["allow", "deny"] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Literal["static", "dynamic"] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: Optional[int] = None + """Amount of downloaded data after which the user will be rate limited.""" + + speed: Optional[int] = None + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: str + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[str] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: List[str] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: List[str] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Literal["allow", "deny"] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: int + """Maximum request rate.""" + + burst: Optional[int] = None + + delay: Optional[int] = None + + rate_unit: Optional[Literal["r/s", "r/m"]] = None + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: List[str] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Literal["hide", "show"] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(BaseModel): + body: str + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Optional[Literal["break", "last", "redirect", "permanent"]] = None + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Optional[str] = None + """Key generated on your side that will be used for URL signing.""" + + type: Optional[Literal[0, 2]] = None + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(BaseModel): + custom_hostname: str + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Optional[Literal["dynamic", "custom"]] = None + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(BaseModel): + name: str + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: List[str] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: Optional[bool] = None + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: List[OptionsStaticResponseHeadersValue] + + +class OptionsStaticHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Dict[str, str] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Dict[str, str] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsUserAgentACL(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: List[str] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Literal["allow", "deny"] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(BaseModel): + enabled: bool + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: bool + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(BaseModel): + allowed_http_methods: Optional[OptionsAllowedHTTPMethods] = FieldInfo(alias="allowedHttpMethods", default=None) + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] = None + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] = None + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] = None + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] = None + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] = None + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] = None + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] = None + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] = None + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] = None + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] = None + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] = None + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] = None + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] = None + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] = None + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Optional[OptionsGzipOn] = FieldInfo(alias="gzipOn", default=None) + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Optional[OptionsHostHeader] = FieldInfo(alias="hostHeader", default=None) + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] = None + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Optional[OptionsIgnoreQueryString] = FieldInfo(alias="ignoreQueryString", default=None) + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] = None + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] = None + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] = None + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] = None + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] = None + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] = None + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] = None + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] = None + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] = None + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] = None + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] = None + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] = None + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] = None + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] = None + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] = None + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] = None + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] = None + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] = None + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] = None + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] = None + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] = None + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Optional[OptionsStaticHeaders] = FieldInfo(alias="staticHeaders", default=None) + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Optional[OptionsStaticRequestHeaders] = FieldInfo( + alias="staticRequestHeaders", default=None + ) + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] = None + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] = None + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] = None + """Enables or disables WebSockets connections to an origin server.""" + + +class RuleTemplate(BaseModel): + id: Optional[int] = None + """Rule template ID.""" + + client: Optional[int] = None + """Client ID""" + + default: Optional[bool] = None + """Defines whether the template is a system template developed for common cases. + + System templates are available to all customers. + + Possible values: + + - **true** - Template is a system template and cannot be changed by a user. + - **false** - Template is a custom template and can be changed by a user. + """ + + deleted: Optional[bool] = None + """Defines whether the template has been deleted. + + Possible values: + + - **true** - Template has been deleted. + - **false** - Template has not been deleted. + """ + + name: Optional[str] = None + """Rule template name.""" + + options: Optional[Options] = None + """List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + """ + + override_origin_protocol: Optional[Literal["HTTPS", "HTTP", "MATCH"]] = FieldInfo( + alias="overrideOriginProtocol", default=None + ) + """ + Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + """ + + rule: Optional[str] = None + """Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + """ + + rule_type: Optional[int] = FieldInfo(alias="ruleType", default=None) + """Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + """ + + template: Optional[bool] = None + """Determines whether the rule is a template.""" + + weight: Optional[int] = None + """Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + """ diff --git a/src/gcore/types/cdn/rule_template_create_params.py b/src/gcore/types/cdn/rule_template_create_params.py new file mode 100644 index 00000000..bea0ca5a --- /dev/null +++ b/src/gcore/types/cdn/rule_template_create_params.py @@ -0,0 +1,1636 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = [ + "RuleTemplateCreateParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class RuleTemplateCreateParams(TypedDict, total=False): + rule: Required[str] + """Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + """ + + rule_type: Required[Annotated[int, PropertyInfo(alias="ruleType")]] + """Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + """ + + name: str + """Rule template name.""" + + options: Options + """List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + """ + + override_origin_protocol: Annotated[ + Optional[Literal["HTTPS", "HTTP", "MATCH"]], PropertyInfo(alias="overrideOriginProtocol") + ] + """ + Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + """ + + weight: int + """Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/rule_template_list.py b/src/gcore/types/cdn/rule_template_list.py new file mode 100644 index 00000000..7d194b4f --- /dev/null +++ b/src/gcore/types/cdn/rule_template_list.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 .rule_template import RuleTemplate + +__all__ = ["RuleTemplateList"] + +RuleTemplateList: TypeAlias = List[RuleTemplate] diff --git a/src/gcore/types/cdn/rule_template_replace_params.py b/src/gcore/types/cdn/rule_template_replace_params.py new file mode 100644 index 00000000..61956314 --- /dev/null +++ b/src/gcore/types/cdn/rule_template_replace_params.py @@ -0,0 +1,1636 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = [ + "RuleTemplateReplaceParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class RuleTemplateReplaceParams(TypedDict, total=False): + rule: Required[str] + """Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + """ + + rule_type: Required[Annotated[int, PropertyInfo(alias="ruleType")]] + """Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + """ + + name: str + """Rule template name.""" + + options: Options + """List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + """ + + override_origin_protocol: Annotated[ + Optional[Literal["HTTPS", "HTTP", "MATCH"]], PropertyInfo(alias="overrideOriginProtocol") + ] + """ + Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + """ + + weight: int + """Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/rule_template_update_params.py b/src/gcore/types/cdn/rule_template_update_params.py new file mode 100644 index 00000000..927ca2e9 --- /dev/null +++ b/src/gcore/types/cdn/rule_template_update_params.py @@ -0,0 +1,1636 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = [ + "RuleTemplateUpdateParams", + "Options", + "OptionsAllowedHTTPMethods", + "OptionsBotProtection", + "OptionsBotProtectionBotChallenge", + "OptionsBrotliCompression", + "OptionsBrowserCacheSettings", + "OptionsCacheHTTPHeaders", + "OptionsCors", + "OptionsCountryACL", + "OptionsDisableCache", + "OptionsDisableProxyForceRanges", + "OptionsEdgeCacheSettings", + "OptionsFastedge", + "OptionsFastedgeOnRequestBody", + "OptionsFastedgeOnRequestHeaders", + "OptionsFastedgeOnResponseBody", + "OptionsFastedgeOnResponseHeaders", + "OptionsFetchCompressed", + "OptionsFollowOriginRedirect", + "OptionsForceReturn", + "OptionsForceReturnTimeInterval", + "OptionsForwardHostHeader", + "OptionsGzipOn", + "OptionsHostHeader", + "OptionsIgnoreCookie", + "OptionsIgnoreQueryString", + "OptionsImageStack", + "OptionsIPAddressACL", + "OptionsLimitBandwidth", + "OptionsProxyCacheKey", + "OptionsProxyCacheMethodsSet", + "OptionsProxyConnectTimeout", + "OptionsProxyReadTimeout", + "OptionsQueryParamsBlacklist", + "OptionsQueryParamsWhitelist", + "OptionsQueryStringForwarding", + "OptionsRedirectHTTPToHTTPS", + "OptionsRedirectHTTPSToHTTP", + "OptionsReferrerACL", + "OptionsRequestLimiter", + "OptionsResponseHeadersHidingPolicy", + "OptionsRewrite", + "OptionsSecureKey", + "OptionsSlice", + "OptionsSni", + "OptionsStale", + "OptionsStaticResponseHeaders", + "OptionsStaticResponseHeadersValue", + "OptionsStaticHeaders", + "OptionsStaticRequestHeaders", + "OptionsUserAgentACL", + "OptionsWaap", + "OptionsWebsockets", +] + + +class RuleTemplateUpdateParams(TypedDict, total=False): + name: str + """Rule template name.""" + + options: Options + """List of options that can be configured for the rule. + + In case of `null` value the option is not added to the rule. Option inherits its + value from the CDN resource settings. + """ + + override_origin_protocol: Annotated[ + Optional[Literal["HTTPS", "HTTP", "MATCH"]], PropertyInfo(alias="overrideOriginProtocol") + ] + """ + Sets a protocol other than the one specified in the CDN resource settings to + connect to the origin. + + Possible values: + + - **HTTPS** - CDN servers connect to origin via HTTPS protocol. + - **HTTP** - CDN servers connect to origin via HTTP protocol. + - **MATCH** - Connection protocol is chosen automatically; in this case, content + on origin source should be available for the CDN both through HTTP and HTTPS + protocols. + - **null** - `originProtocol` setting is inherited from the CDN resource + settings. + """ + + rule: str + """Path to the file or folder for which the rule will be applied. + + The rule is applied if the requested URI matches the rule path. + + We add a leading forward slash to any rule path. Specify a path without a + forward slash. + """ + + rule_type: Annotated[int, PropertyInfo(alias="ruleType")] + """Rule type. + + Possible values: + + - **Type 0** - Regular expression. Must start with '^/' or '/'. + - **Type 1** - Regular expression. Note that for this rule type we automatically + add / to each rule pattern before your regular expression. This type is + **legacy**, please use Type 0. + """ + + weight: int + """Rule execution order: from lowest (1) to highest. + + If requested URI matches multiple rules, the one higher in the order of the + rules will be applied. + """ + + +class OptionsAllowedHTTPMethods(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[List[Literal["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]]] + + +class OptionsBotProtectionBotChallenge(TypedDict, total=False): + enabled: bool + """Possible values: + + - **true** - Bot challenge is enabled. + - **false** - Bot challenge is disabled. + """ + + +class OptionsBotProtection(TypedDict, total=False): + bot_challenge: Required[OptionsBotProtectionBotChallenge] + """Controls the bot challenge module state.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsBrotliCompression(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "application/javascript", + "application/json", + "application/vnd.ms-fontobject", + "application/wasm", + "application/x-font-ttf", + "application/x-javascript", + "application/xml", + "application/xml+rss", + "image/svg+xml", + "image/x-icon", + "text/css", + "text/html", + "text/javascript", + "text/plain", + "text/xml", + ] + ] + ] + """Allows to select the content types you want to compress. + + `text/html` is a mandatory content type. + """ + + +class OptionsBrowserCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Set the cache expiration time to '0s' to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsCacheHTTPHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + + +class OptionsCors(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """Value of the Access-Control-Allow-Origin header. + + Possible values: + + - **Adds \\** as the Access-Control-Allow-Origin header value** - Content will be + uploaded for requests from any domain. `"value": ["\\**"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value if the + origin matches one of the listed domains** - Content will be uploaded only for + requests from the domains specified in the field. + `"value": ["domain.com", "second.dom.com"]` + - **Adds "$`http_origin`" as the Access-Control-Allow-Origin header value** - + Content will be uploaded for requests from any domain, and the domain from + which the request was sent will be added to the "Access-Control-Allow-Origin" + header in the response. `"value": ["$`http_origin`"]` + """ + + always: bool + """ + Defines whether the Access-Control-Allow-Origin header should be added to a + response from CDN regardless of response code. + + Possible values: + + - **true** - Header will be added to a response regardless of response code. + - **false** - Header will only be added to responses with codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsCountryACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of countries according to ISO-3166-1. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of countries for which access is prohibited. + - **deny** - List of countries for which access is allowed. + """ + + policy_type: Required[Literal["allow", "deny"]] + """Defines the type of CDN resource access policy. + + Possible values: + + - **allow** - Access is allowed for all the countries except for those specified + in `excepted_values` field. + - **deny** - Access is denied for all the countries except for those specified + in `excepted_values` field. + """ + + +class OptionsDisableCache(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - content caching is disabled. + - **false** - content caching is enabled. + """ + + +class OptionsDisableProxyForceRanges(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsEdgeCacheSettings(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + custom_values: Dict[str, str] + """ + A MAP object representing the caching time in seconds for a response with a + specific response code. + + These settings have a higher priority than the `value` field. + + - Use `any` key to specify caching time for all response codes. + - Use `0s` value to disable caching for a specific response code. + """ + + default: str + """Enables content caching according to the origin cache settings. + + The value is applied to the following response codes 200, 201, 204, 206, 301, + 302, 303, 304, 307, 308, if an origin server does not have caching HTTP headers. + + Responses with other codes will not be cached. + + The maximum duration is any equivalent to `1y`. + """ + + value: str + """Caching time. + + The value is applied to the following response codes: 200, 206, 301, 302. + Responses with codes 4xx, 5xx will not be cached. + + Use `0s` to disable caching. + + The maximum duration is any equivalent to `1y`. + """ + + +class OptionsFastedgeOnRequestBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseBody(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + app_id: Required[str] + """The ID of the application in FastEdge.""" + + enabled: bool + """ + Determines if the FastEdge application should be called whenever HTTP request + headers are received. + """ + + execute_on_edge: bool + """Determines if the request should be executed at the edge nodes.""" + + execute_on_shield: bool + """Determines if the request should be executed at the shield nodes.""" + + interrupt_on_error: bool + """Determines if the request execution should be interrupted when an error occurs.""" + + +class OptionsFastedge(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + on_request_body: OptionsFastedgeOnRequestBody + """ + Allows to configure FastEdge application that will be called to handle request + body as soon as CDN receives incoming HTTP request. + """ + + on_request_headers: OptionsFastedgeOnRequestHeaders + """ + Allows to configure FastEdge application that will be called to handle request + headers as soon as CDN receives incoming HTTP request. + """ + + on_response_body: OptionsFastedgeOnResponseBody + """ + Allows to configure FastEdge application that will be called to handle response + body before CDN sends the HTTP response. + """ + + on_response_headers: OptionsFastedgeOnResponseHeaders + """ + Allows to configure FastEdge application that will be called to handle response + headers before CDN sends the HTTP response. + """ + + +class OptionsFetchCompressed(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsFollowOriginRedirect(TypedDict, total=False): + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] + """Redirect status code that the origin server returns. + + To serve up to date content to end users, you will need to purge the cache after + managing the option. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsForceReturnTimeInterval(TypedDict, total=False): + end_time: Required[str] + """Time until which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + start_time: Required[str] + """Time from which a custom HTTP response code should be applied. + + Indicated in 24-hour format. + """ + + time_zone: str + """Time zone used to calculate time.""" + + +class OptionsForceReturn(TypedDict, total=False): + body: Required[str] + """URL for redirection or text.""" + + code: Required[int] + """Status code value.""" + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + time_interval: Optional[OptionsForceReturnTimeInterval] + """Controls the time at which a custom HTTP response code should be applied. + + By default, a custom HTTP response code is applied at any time. + """ + + +class OptionsForwardHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsGzipOn(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsHostHeader(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Host Header value.""" + + +class OptionsIgnoreCookie(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled, files with cookies are cached as one file. + - **false** - Option is disabled, files with cookies are cached as different + files. + """ + + +class OptionsIgnoreQueryString(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsImageStack(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + avif_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to AVI format.""" + + png_lossless: bool + """Enables or disables compression without quality loss for PNG format.""" + + quality: int + """Defines quality settings for JPG and PNG images. + + The higher the value, the better the image quality, and the larger the file size + after conversion. + """ + + webp_enabled: bool + """Enables or disables automatic conversion of JPEG and PNG images to WebP format.""" + + +class OptionsIPAddressACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of IP addresses with a subnet mask. + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of IP addresses for which access is prohibited. + - **deny** - List of IP addresses for which access is allowed. + + Examples: + + - `192.168.3.2/32` + - `2a03:d000:2980:7::8/128` + """ + + policy_type: Required[Literal["allow", "deny"]] + """IP access policy type. + + Possible values: + + - **allow** - Allow access to all IPs except IPs specified in + "`excepted_values`" field. + - **deny** - Deny access to all IPs except IPs specified in "`excepted_values`" + field. + """ + + +class OptionsLimitBandwidth(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + limit_type: Required[Literal["static", "dynamic"]] + """Method of controlling the download speed per connection. + + Possible values: + + - **static** - Use speed and buffer fields to set the download speed limit. + - **dynamic** - Use query strings **speed** and **buffer** to set the download + speed limit. + + For example, when requesting content at the link + + ``` + http://cdn.example.com/video.mp4?speed=50k&buffer=500k + ``` + + the download speed will be limited to 50kB/s after 500 kB. + """ + + buffer: int + """Amount of downloaded data after which the user will be rate limited.""" + + speed: int + """Maximum download speed per connection.""" + + +class OptionsProxyCacheKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Key for caching.""" + + +class OptionsProxyCacheMethodsSet(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsProxyConnectTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsProxyReadTimeout(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[str] + """Timeout value in seconds.""" + + +class OptionsQueryParamsBlacklist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryParamsWhitelist(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[SequenceNotStr[str]] + """List of query parameters.""" + + +class OptionsQueryStringForwarding(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + forward_from_file_types: Required[SequenceNotStr[str]] + """ + The `forward_from_files_types` field specifies the types of playlist files from + which parameters will be extracted and forwarded. This typically includes + formats that list multiple media chunk references, such as HLS and DASH + playlists. Parameters associated with these playlist files (like query strings + or headers) will be propagated to the chunks they reference. + """ + + forward_to_file_types: Required[SequenceNotStr[str]] + """ + The field specifies the types of media chunk files to which parameters, + extracted from playlist files, will be forwarded. These refer to the actual + segments of media content that are delivered to viewers. Ensuring the correct + parameters are forwarded to these files is crucial for maintaining the integrity + of the streaming session. + """ + + +class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsReferrerACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """ + List of domain names or wildcard domains (without protocol: `http://` or + `https://`.) + + The meaning of the parameter depends on `policy_type` value: + + - **allow** - List of domain names for which access is prohibited. + - **deny** - List of IP domain names for which access is allowed. + + Examples: + + - `example.com` + - `\\**.example.com` + """ + + policy_type: Required[Literal["allow", "deny"]] + """Policy type. + + Possible values: + + - **allow** - Allow access to all domain names except the domain names specified + in `excepted_values` field. + - **deny** - Deny access to all domain names except the domain names specified + in `excepted_values` field. + """ + + +class OptionsRequestLimiter(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + rate: Required[int] + """Maximum request rate.""" + + rate_unit: Literal["r/s", "r/m"] + """Units of measurement for the `rate` field. + + Possible values: + + - **r/s** - Requests per second. + - **r/m** - Requests per minute. + + If the rate is less than one request per second, it is specified in request per + minute (r/m.) + """ + + +class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted: Required[SequenceNotStr[str]] + """List of HTTP headers. + + Parameter meaning depends on the value of the `mode` field: + + - **show** - List of HTTP headers to hide from response. + - **hide** - List of HTTP headers to include in response. Other HTTP headers + will be hidden. + + The following headers are required and cannot be hidden from response: + + - `Connection` + - `Content-Length` + - `Content-Type` + - `Date` + - `Server` + """ + + mode: Required[Literal["hide", "show"]] + """How HTTP headers are hidden from the response. + + Possible values: + + - **show** - Hide only HTTP headers listed in the `excepted` field. + - **hide** - Hide all HTTP headers except headers listed in the "excepted" + field. + """ + + +class OptionsRewrite(TypedDict, total=False): + body: Required[str] + """Path for the Rewrite option. + + Example: + + - `/(.\\**) /media/$1` + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + flag: Literal["break", "last", "redirect", "permanent"] + """Flag for the Rewrite option. + + Possible values: + + - **last** - Stop processing the current set of `ngx_http_rewrite_module` + directives and start a search for a new location matching changed URI. + - **break** - Stop processing the current set of the Rewrite option. + - **redirect** - Return a temporary redirect with the 302 code; used when a + replacement string does not start with `http://`, `https://`, or `$scheme`. + - **permanent** - Return a permanent redirect with the 301 code. + """ + + +class OptionsSecureKey(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + key: Required[Optional[str]] + """Key generated on your side that will be used for URL signing.""" + + type: Literal[0, 2] + """Type of URL signing. + + Possible types: + + - **Type 0** - Includes end user IP to secure token generation. + - **Type 2** - Excludes end user IP from secure token generation. + """ + + +class OptionsSlice(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsSni(TypedDict, total=False): + custom_hostname: Required[str] + """Custom SNI hostname. + + It is required if `sni_type` is set to custom. + """ + + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + sni_type: Literal["dynamic", "custom"] + """SNI (Server Name Indication) type. + + Possible values: + + - **dynamic** - SNI hostname depends on `hostHeader` and `forward_host_header` + options. It has several possible combinations: + - If the `hostHeader` option is enabled and specified, SNI hostname matches the + Host header. + - If the `forward_host_header` option is enabled and has true value, SNI + hostname matches the Host header used in the request made to a CDN. + - If the `hostHeader` and `forward_host_header` options are disabled, SNI + hostname matches the primary CNAME. + - **custom** - custom SNI hostname is in use. + """ + + +class OptionsStale(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[ + List[ + Literal[ + "error", + "http_403", + "http_404", + "http_429", + "http_500", + "http_502", + "http_503", + "http_504", + "invalid_header", + "timeout", + "updating", + ] + ] + ] + """Defines list of errors for which "Always online" option is applied.""" + + +class OptionsStaticResponseHeadersValue(TypedDict, total=False): + name: Required[str] + """HTTP Header name. + + Restrictions: + + - Maximum 128 symbols. + - Latin letters (A-Z, a-z,) numbers (0-9,) dashes, and underscores only. + """ + + value: Required[SequenceNotStr[str]] + """Header value. + + Restrictions: + + - Maximum 512 symbols. + - Letters (a-z), numbers (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ + /|\";:?.,><{}[]). + - Must start with a letter, number, asterisk or {. + - Multiple values can be added. + """ + + always: bool + """ + Defines whether the header will be added to a response from CDN regardless of + response code. + + Possible values: + + - **true** - Header will be added to a response from CDN regardless of response + code. + - **false** - Header will be added only to the following response codes: 200, + 201, 204, 206, 301, 302, 303, 304, 307, 308. + """ + + +class OptionsStaticResponseHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Iterable[OptionsStaticResponseHeadersValue]] + + +class OptionsStaticHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 128 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsStaticRequestHeaders(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[Dict[str, str]] + """A MAP for static headers in a format of `header_name: header_value`. + + Restrictions: + + - **Header name** - Maximum 255 symbols, may contain Latin letters (A-Z, a-z), + numbers (0-9), dashes, and underscores. + - **Header value** - Maximum 512 symbols, may contain letters (a-z), numbers + (0-9), spaces, and symbols (`~!@#%%^&\\**()-\\__=+ /|\";:?.,><{}[]). Must start + with a letter, number, asterisk or {. + """ + + +class OptionsUserAgentACL(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + excepted_values: Required[SequenceNotStr[str]] + """List of User-Agents that will be allowed/denied. + + The meaning of the parameter depends on `policy_type`: + + - **allow** - List of User-Agents for which access is prohibited. + - **deny** - List of User-Agents for which access is allowed. + + Use an empty string `""` to allow/deny access when the User-Agent header is + empty. + """ + + policy_type: Required[Literal["allow", "deny"]] + """User-Agents policy type. + + Possible values: + + - **allow** - Allow access for all User-Agents except specified in + `excepted_values` field. + - **deny** - Deny access for all User-Agents except specified in + `excepted_values` field. + """ + + +class OptionsWaap(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class OptionsWebsockets(TypedDict, total=False): + enabled: Required[bool] + """Controls the option state. + + Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + value: Required[bool] + """Possible values: + + - **true** - Option is enabled. + - **false** - Option is disabled. + """ + + +class Options(TypedDict, total=False): + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] + """HTTP methods allowed for content requests from the CDN.""" + + bot_protection: Optional[OptionsBotProtection] + """ + Allows to prevent online services from overloading and ensure your business + workflow running smoothly. + """ + + brotli_compression: Optional[OptionsBrotliCompression] + """Compresses content with Brotli on the CDN side. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. CDN only supports "Brotli compression" when the "origin shielding" feature is + activated. + 2. If a precache server is not active for a CDN resource, no compression occurs, + even if the option is enabled. + 3. `brotli_compression` is not supported with `fetch_compressed` or `slice` + options enabled. + 4. `fetch_compressed` option in CDN resource settings overrides + `brotli_compression` in rules. If you enabled `fetch_compressed` in CDN + resource and want to enable `brotli_compression` in a rule, you must specify + `fetch_compressed:false` in the rule. + """ + + browser_cache_settings: Optional[OptionsBrowserCacheSettings] + """Cache expiration time for users browsers in seconds. + + Cache expiration time is applied to the following response codes: 200, 201, 204, + 206, 301, 302, 303, 304, 307, 308. + + Responses with other codes will not be cached. + """ + + cache_http_headers: Optional[OptionsCacheHTTPHeaders] + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + + cors: Optional[OptionsCors] + """Enables or disables CORS (Cross-Origin Resource Sharing) header support. + + CORS header support allows the CDN to add the Access-Control-Allow-Origin header + to a response to a browser. + """ + + country_acl: Optional[OptionsCountryACL] + """Enables control access to content for specified countries.""" + + disable_cache: Optional[OptionsDisableCache] + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + + disable_proxy_force_ranges: Optional[OptionsDisableProxyForceRanges] + """Allows 206 responses regardless of the settings of an origin source.""" + + edge_cache_settings: Optional[OptionsEdgeCacheSettings] + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + + fastedge: Optional[OptionsFastedge] + """ + Allows to configure FastEdge app to be called on different request/response + phases. + + Note: At least one of `on_request_headers`, `on_request_body`, + `on_response_headers`, or `on_response_body` must be specified. + """ + + fetch_compressed: Optional[OptionsFetchCompressed] + """Makes the CDN request compressed content from the origin. + + The origin server should support compression. CDN servers will not decompress + your content even if a user browser does not accept compression. + + Notes: + + 1. `fetch_compressed` is not supported with `gzipON` or `brotli_compression` or + `slice` options enabled. + 2. `fetch_compressed` overrides `gzipON` and `brotli_compression` in rule. If + you enable it in CDN resource and want to use `gzipON` and + `brotli_compression` in a rule, you have to specify + `"`fetch_compressed`": false` in the rule. + """ + + follow_origin_redirect: Optional[OptionsFollowOriginRedirect] + """ + Enables redirection from origin. If the origin server returns a redirect, the + option allows the CDN to pull the requested content from the origin server that + was returned in the redirect. + """ + + force_return: Optional[OptionsForceReturn] + """Applies custom HTTP response codes for CDN content. + + The following codes are reserved by our system and cannot be specified in this + option: 408, 444, 477, 494, 495, 496, 497, 499. + """ + + forward_host_header: Optional[OptionsForwardHostHeader] + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + gzip_on: Annotated[Optional[OptionsGzipOn], PropertyInfo(alias="gzipOn")] + """Compresses content with gzip on the CDN end. + + CDN servers will request only uncompressed content from the origin. + + Notes: + + 1. Compression with gzip is not supported with `fetch_compressed` or `slice` + options enabled. + 2. `fetch_compressed` option in CDN resource settings overrides `gzipON` in + rules. If you enable `fetch_compressed` in CDN resource and want to enable + `gzipON` in rules, you need to specify `"`fetch_compressed`":false` for + rules. + """ + + host_header: Annotated[Optional[OptionsHostHeader], PropertyInfo(alias="hostHeader")] + """ + Sets the Host header that CDN servers use when request content from an origin + server. Your server must be able to process requests with the chosen header. + + If the option is `null`, the Host Header value is equal to first CNAME. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + + ignore_cookie: Optional[OptionsIgnoreCookie] + """ + Defines whether the files with the Set-Cookies header are cached as one file or + as different ones. + """ + + ignore_query_string: Annotated[Optional[OptionsIgnoreQueryString], PropertyInfo(alias="ignoreQueryString")] + """ + How a file with different query strings is cached: either as one object (option + is enabled) or as different objects (option is disabled.) + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + image_stack: Optional[OptionsImageStack] + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically + converts them to WebP or AVIF format. + """ + + ip_address_acl: Optional[OptionsIPAddressACL] + """Controls access to the CDN resource content for specific IP addresses. + + If you want to use IPs from our CDN servers IP list for IP ACL configuration, + you have to independently monitor their relevance. We recommend you use a script + for automatically update IP ACL. + [Read more.](/docs/api-reference/cdn/ip-addresses-list/get-cdn-servers-ip-addresses) + """ + + limit_bandwidth: Optional[OptionsLimitBandwidth] + """Allows to control the download speed per connection.""" + + proxy_cache_key: Optional[OptionsProxyCacheKey] + """Allows you to modify your cache key. + + If omitted, the default value is `$request_uri`. + + Combine the specified variables to create a key for caching. + + - **$`request_uri`** + - **$scheme** + - **$uri** + + **Warning**: Enabling and changing this option can invalidate your current cache + and affect the cache hit ratio. Furthermore, the "Purge by pattern" option will + not work. + """ + + proxy_cache_methods_set: Optional[OptionsProxyCacheMethodsSet] + """Caching for POST requests along with default GET and HEAD.""" + + proxy_connect_timeout: Optional[OptionsProxyConnectTimeout] + """The time limit for establishing a connection with the origin.""" + + proxy_read_timeout: Optional[OptionsProxyReadTimeout] + """ + The time limit for receiving a partial response from the origin. If no response + is received within this time, the connection will be closed. + + **Note:** When used with a WebSocket connection, this option supports values + only in the range 1–20 seconds (instead of the usual 1–30 seconds). + """ + + query_params_blacklist: Optional[OptionsQueryParamsBlacklist] + """ + Files with the specified query parameters are cached as one object, files with + other parameters are cached as different objects. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_params_whitelist: Optional[OptionsQueryParamsWhitelist] + """ + Files with the specified query parameters are cached as different objects, files + with other parameters are cached as one object. + + `ignoreQueryString`, `query_params_whitelist` and `query_params_blacklist` + options cannot be enabled simultaneously. + """ + + query_string_forwarding: Optional[OptionsQueryStringForwarding] + """ + The Query String Forwarding feature allows for the seamless transfer of + parameters embedded in playlist files to the corresponding media chunk files. + This functionality ensures that specific attributes, such as authentication + tokens or tracking information, are consistently passed along from the playlist + manifest to the individual media segments. This is particularly useful for + maintaining continuity in security, analytics, and any other parameter-based + operations across the entire media delivery workflow. + """ + + redirect_http_to_https: Optional[OptionsRedirectHTTPToHTTPS] + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + redirect_https_to_http: Optional[OptionsRedirectHTTPSToHTTP] + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled + simultaneously. + """ + + referrer_acl: Optional[OptionsReferrerACL] + """Controls access to the CDN resource content for specified domain names.""" + + request_limiter: Optional[OptionsRequestLimiter] + """Option allows to limit the amount of HTTP requests.""" + + response_headers_hiding_policy: Optional[OptionsResponseHeadersHidingPolicy] + """Hides HTTP headers from an origin server in the CDN response.""" + + rewrite: Optional[OptionsRewrite] + """Changes and redirects requests from the CDN to the origin. + + It operates according to the + [Nginx](https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) + configuration. + """ + + secure_key: Optional[OptionsSecureKey] + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + + slice: Optional[OptionsSlice] + """ + Requests and caches files larger than 10 MB in parts (no larger than 10 MB per + part.) This reduces time to first byte. + + The option is based on the + [Slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html) module. + + Notes: + + 1. Origin must support HTTP Range requests. + 2. Not supported with `gzipON`, `brotli_compression` or `fetch_compressed` + options enabled. + """ + + sni: Optional[OptionsSni] + """ + The hostname that is added to SNI requests from CDN servers to the origin server + via HTTPS. + + SNI is generally only required if your origin uses shared hosting or does not + have a dedicated IP address. If the origin server presents multiple + certificates, SNI allows the origin server to know which certificate to use for + the connection. + + The option works only if `originProtocol` parameter is `HTTPS` or `MATCH`. + """ + + stale: Optional[OptionsStale] + """Serves stale cached content in case of origin unavailability.""" + + static_response_headers: Optional[OptionsStaticResponseHeaders] + """Custom HTTP Headers that a CDN server adds to a response.""" + + static_headers: Annotated[Optional[OptionsStaticHeaders], PropertyInfo(alias="staticHeaders")] + """**Legacy option**. Use the `static_response_headers` option instead. + + Custom HTTP Headers that a CDN server adds to response. Up to fifty custom HTTP + Headers can be specified. May contain a header with multiple values. + """ + + static_request_headers: Annotated[Optional[OptionsStaticRequestHeaders], PropertyInfo(alias="staticRequestHeaders")] + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + + user_agent_acl: Optional[OptionsUserAgentACL] + """Controls access to the content for specified User-Agents.""" + + waap: Optional[OptionsWaap] + """Allows to enable WAAP (Web Application and API Protection).""" + + websockets: Optional[OptionsWebsockets] + """Enables or disables WebSockets connections to an origin server.""" diff --git a/src/gcore/types/cdn/shield_aggregated_stats.py b/src/gcore/types/cdn/shield_aggregated_stats.py new file mode 100644 index 00000000..e13cf582 --- /dev/null +++ b/src/gcore/types/cdn/shield_aggregated_stats.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["ShieldAggregatedStats"] + + +class ShieldAggregatedStats(BaseModel): + api_1_example: Optional[object] = FieldInfo(alias="1 (example)", default=None) + """CDN resource ID for which statistics data is shown.""" + + metrics: Optional[object] = None + """Statistics parameters.""" + + resource: Optional[object] = None + """Resources IDs by which statistics data is grouped.""" + + shield_usage: Optional[str] = None + """Number of CDN resources that used origin shielding.""" diff --git a/src/gcore/types/cdn/shield_list_response.py b/src/gcore/types/cdn/shield_list_response.py new file mode 100644 index 00000000..4449e462 --- /dev/null +++ b/src/gcore/types/cdn/shield_list_response.py @@ -0,0 +1,25 @@ +# 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__ = ["ShieldListResponse", "ShieldListResponseItem"] + + +class ShieldListResponseItem(BaseModel): + id: Optional[int] = None + """Origin shielding location ID.""" + + city: Optional[str] = None + """City of origin shielding location.""" + + country: Optional[str] = None + """Country of origin shielding location.""" + + datacenter: Optional[str] = None + """Name of origin shielding location datacenter.""" + + +ShieldListResponse: TypeAlias = List[ShieldListResponseItem] diff --git a/src/gcore/types/cdn/ssl_detail.py b/src/gcore/types/cdn/ssl_detail.py new file mode 100644 index 00000000..aa57c7d5 --- /dev/null +++ b/src/gcore/types/cdn/ssl_detail.py @@ -0,0 +1,62 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["SslDetail"] + + +class SslDetail(BaseModel): + id: Optional[int] = None + """SSL certificate ID.""" + + automated: Optional[bool] = None + """How the SSL certificate was issued. + + Possible values: + + - **true** - Certificate was issued automatically. + - **false** - Certificate was added by a use. + """ + + cert_issuer: Optional[str] = None + """Name of the certification center issued the SSL certificate.""" + + cert_subject_alt: Optional[str] = None + """Alternative domain names that the SSL certificate secures.""" + + cert_subject_cn: Optional[str] = None + """Domain name that the SSL certificate secures.""" + + deleted: Optional[bool] = None + """Defines whether the certificate has been deleted. Parameter is **deprecated**. + + Possible values: + + - **true** - Certificate has been deleted. + - **false** - Certificate has not been deleted. + """ + + has_related_resources: Optional[bool] = FieldInfo(alias="hasRelatedResources", default=None) + """Defines whether the SSL certificate is used by a CDN resource. + + Possible values: + + - **true** - Certificate is used by a CDN resource. + - **false** - Certificate is not used by a CDN resource. + """ + + name: Optional[str] = None + """SSL certificate name.""" + + ssl_certificate_chain: Optional[str] = FieldInfo(alias="sslCertificateChain", default=None) + """Parameter is **deprecated**.""" + + validity_not_after: Optional[str] = None + """Date when certificate become untrusted (ISO 8601/RFC 3339 format, UTC.)""" + + validity_not_before: Optional[str] = None + """Date when certificate become valid (ISO 8601/RFC 3339 format, UTC.)""" diff --git a/src/gcore/types/cdn/ssl_detail_list.py b/src/gcore/types/cdn/ssl_detail_list.py new file mode 100644 index 00000000..8a6a991b --- /dev/null +++ b/src/gcore/types/cdn/ssl_detail_list.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 .ssl_detail import SslDetail + +__all__ = ["SslDetailList"] + +SslDetailList: TypeAlias = List[SslDetail] diff --git a/src/gcore/types/cdn/ssl_request_status.py b/src/gcore/types/cdn/ssl_request_status.py new file mode 100644 index 00000000..b1738272 --- /dev/null +++ b/src/gcore/types/cdn/ssl_request_status.py @@ -0,0 +1,135 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["SslRequestStatus", "LatestStatus", "Status"] + + +class LatestStatus(BaseModel): + id: Optional[int] = None + """ID of the attempt to issue the Let's Encrypt certificate.""" + + created: Optional[str] = None + """ + Date and time when the issuing attempt status was created (ISO 8601/RFC 3339 + format, UTC). + """ + + details: Optional[str] = None + """ + Detailed description of the error that occurred when trying to issue a Let's + Encrypt certificate. + """ + + error: Optional[str] = None + """ + Brief description of the error that occurred when trying to issue a Let's + Encrypt certificate. + """ + + retry_after: Optional[str] = None + """ + Date indicating when the certificate issuance limit will be lifted (ISO 8601/RFC + 3339 format, UTC). + + It is filled in only if error = RateLimited. + """ + + status: Optional[str] = None + """Status of the attempt to issue the Let's Encrypt certificate. + + Possible values: + + - **Done** - Attempt is successful. Let's Encrypt certificate was issued. + - **Failed** - Attempt failed. Let's Encrypt certificate was not issued. + - **Cancelled** - Attempt is canceled. Let's Encrypt certificate was not issued. + """ + + +class Status(BaseModel): + id: Optional[int] = None + """ID of the attempt to issue the Let's Encrypt certificate.""" + + created: Optional[str] = None + """ + Date and time when the issuing attempt status was created (ISO 8601/RFC 3339 + format, UTC). + """ + + details: Optional[str] = None + """ + Detailed description of the error that occurred when trying to issue a Let's + Encrypt certificate. + """ + + error: Optional[str] = None + """ + Brief description of the error that occurred when trying to issue a Let's + Encrypt certificate. + """ + + retry_after: Optional[str] = None + """ + Date indicating when the certificate issuance limit will be lifted (ISO 8601/RFC + 3339 format, UTC). + + It is filled in only if error = RateLimited. + """ + + status: Optional[str] = None + """Status of the attempt to issue the Let's Encrypt certificate. + + Possible values: + + - **Done** - Attempt is successful. Let's Encrypt certificate was issued. + - **Failed** - Attempt failed. Let's Encrypt certificate was not issued. + - **Cancelled** - Attempt is canceled. Let's Encrypt certificate was not issued. + """ + + +class SslRequestStatus(BaseModel): + id: Optional[int] = None + """ID of the attempt to issue a Let's Encrypt certificate.""" + + active: Optional[bool] = None + """Defines whether the Let's Encrypt certificate issuing process is active. + + Possible values: + + - **true** - Issuing process is active. + - **false** - Issuing process is completed. + """ + + attempts_count: Optional[int] = None + """Number of attempts to issue the Let's Encrypt certificate.""" + + finished: Optional[str] = None + """ + Date when the process of issuing a Let's Encrypt certificate was finished (ISO + 8601/RFC 3339 format, UTC). + + The field is **null** if the issuing process is not finished. + """ + + latest_status: Optional[LatestStatus] = None + """Detailed information about last attempt to issue a Let's Encrypt certificate.""" + + next_attempt_time: Optional[str] = None + """ + Time of the next scheduled attempt to issue the Let's Encrypt certificate (ISO + 8601/RFC 3339 format, UTC). + """ + + resource: Optional[int] = None + """CDN resource ID.""" + + started: Optional[str] = None + """ + Date when the process of issuing a Let's Encrypt certificate was started (ISO + 8601/RFC 3339 format, UTC). + """ + + statuses: Optional[List[Status]] = None + """Detailed information about attempts to issue a Let's Encrypt certificate.""" diff --git a/src/gcore/types/cdn/statistic_get_logs_usage_aggregated_params.py b/src/gcore/types/cdn/statistic_get_logs_usage_aggregated_params.py new file mode 100644 index 00000000..a1a50799 --- /dev/null +++ b/src/gcore/types/cdn/statistic_get_logs_usage_aggregated_params.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetLogsUsageAggregatedParams"] + + +class StatisticGetLogsUsageAggregatedParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" + + to: Required[str] + """End of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" + + flat: bool + """The waу parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + """ + + group_by: str + """Output data grouping. + + Possible value: + + - **resource** - Data is grouped by CDN resources. + """ + + resource: int + """CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + """ diff --git a/src/gcore/types/cdn/statistic_get_logs_usage_series_params.py b/src/gcore/types/cdn/statistic_get_logs_usage_series_params.py new file mode 100644 index 00000000..634f818e --- /dev/null +++ b/src/gcore/types/cdn/statistic_get_logs_usage_series_params.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetLogsUsageSeriesParams"] + + +class StatisticGetLogsUsageSeriesParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Example: + + - &from=2020-01-01T00:00:00.000 + """ + + to: Required[str] + """End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Example: + + - &from=2020-01-01T00:00:00.000 + """ + + resource: int + """CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + """ diff --git a/src/gcore/types/cdn/statistic_get_resource_usage_aggregated_params.py b/src/gcore/types/cdn/statistic_get_resource_usage_aggregated_params.py new file mode 100644 index 00000000..9518ebe1 --- /dev/null +++ b/src/gcore/types/cdn/statistic_get_resource_usage_aggregated_params.py @@ -0,0 +1,151 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetResourceUsageAggregatedParams"] + + +class StatisticGetResourceUsageAggregatedParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &from=2018-11-01T00:00:00.000 + - &from=2018-11-01 + """ + + metrics: Required[str] + """Types of statistics data. + + Possible values: + + - **`upstream_bytes`** – Traffic in bytes from an origin server to CDN servers + or to origin shielding when used. + - **`sent_bytes`** – Traffic in bytes from CDN servers to clients. + - **`shield_bytes`** – Traffic in bytes from origin shielding to CDN servers. + - **`backblaze_bytes`** - Traffic in bytes from Backblaze origin. + - **`total_bytes`** – `shield_bytes`, `upstream_bytes` and `sent_bytes` + combined. + - **`cdn_bytes`** – `sent_bytes` and `shield_bytes` combined. + - **requests** – Number of requests to edge servers. + - **`responses_2xx`** – Number of 2xx response codes. + - **`responses_3xx`** – Number of 3xx response codes. + - **`responses_4xx`** – Number of 4xx response codes. + - **`responses_5xx`** – Number of 5xx response codes. + - **`responses_hit`** – Number of responses with the header Cache: HIT. + - **`responses_miss`** – Number of responses with the header Cache: MISS. + - **`response_types`** – Statistics by content type. It returns a number of + responses for content with different MIME types. + - **`cache_hit_traffic_ratio`** – Formula: 1 - `upstream_bytes` / `sent_bytes`. + We deduct the non-cached traffic from the total traffic amount. + - **`cache_hit_requests_ratio`** – Formula: `responses_hit` / requests. The + share of sending cached content. + - **`shield_traffic_ratio`** – Formula: (`shield_bytes` - `upstream_bytes`) / + `shield_bytes`. The efficiency of the Origin Shielding: how much more traffic + is sent from the Origin Shielding than from the origin. + - **`image_processed`** - Number of images transformed on the Image optimization + service. + - **`request_time`** - Time elapsed between the first bytes of a request were + processed and logging after the last bytes were sent to a user. + - **`upstream_response_time`** - Number of milliseconds it took to receive a + response from an origin. If upstream `response_time_` contains several + indications for one request (in case of more than 1 origin), we summarize + them. In case of aggregating several queries, the average of this amount is + calculated. + - **`95_percentile`** - Represents the 95th percentile of network bandwidth + usage in bytes per second. This means that 95% of the time, the network + resource usage was below this value. + - **`max_bandwidth`** - The maximum network bandwidth that was used during the + selected time represented in bytes per second. + - **`min_bandwidth`** - The minimum network bandwidth that was used during the + selected time represented in bytes per second. + + Metrics **`upstream_response_time`** and **`request_time`** should be requested + separately from other metrics + """ + + service: Required[str] + """Service name. + + Possible value: + + - CDN + """ + + to: Required[str] + """End of the requested time period (ISO 8601/RFC 3339 format, UTC.) + + Examples: + + - &to=2018-11-01T00:00:00.000 + - &to=2018-11-01 + """ + + countries: str + """Names of countries for which data is displayed. + + English short name from [ISO 3166 standard][1] without the definite article + "the" should be used. + + [1]: https://www.iso.org/obp/ui/#search/code/ + + To request multiple values, use: + + - &countries=france&countries=denmark + """ + + flat: bool + """The waу the parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + """ + + group_by: str + """Output data grouping. + + Possible values: + + - **resource** – Data is grouped by CDN resources IDs. + - **region** – Data is grouped by regions of CDN edge servers. + - **country** – Data is grouped by countries of CDN edge servers. + - **vhost** – Data is grouped by resources CNAME. + + To request multiple values, use: + + - &`group_by`=region&`group_by`=resource + """ + + regions: str + """Regions for which data is displayed. + + Possible values: + + - **na** – North America + - **eu** – Europe + - **cis** – Commonwealth of Independent States + - **asia** – Asia + - **au** – Australia + - **latam** – Latin America + - **me** – Middle East + - **africa** - Africa + - **sa** - South America + """ + + resource: int + """CDN resources IDs by which statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + + If CDN resource ID is not specified, data related to all CDN resources is + returned. + """ diff --git a/src/gcore/types/cdn/statistic_get_resource_usage_series_params.py b/src/gcore/types/cdn/statistic_get_resource_usage_series_params.py new file mode 100644 index 00000000..e830094f --- /dev/null +++ b/src/gcore/types/cdn/statistic_get_resource_usage_series_params.py @@ -0,0 +1,131 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetResourceUsageSeriesParams"] + + +class StatisticGetResourceUsageSeriesParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" + + granularity: Required[str] + """Duration of the time blocks into which the data will be divided. + + Possible values: + + - **1m** - available only for up to 1 month in the past. + - **5m** + - **15m** + - **1h** + - **1d** + """ + + metrics: Required[str] + """Types of statistics data. + + Possible values: + + - **`upstream_bytes`** – Traffic in bytes from an origin server to CDN servers + or to origin shielding when used. + - **`sent_bytes`** – Traffic in bytes from CDN servers to clients. + - **`shield_bytes`** – Traffic in bytes from origin shielding to CDN servers. + - **`backblaze_bytes`** - Traffic in bytes from Backblaze origin. + - **`total_bytes`** – `shield_bytes`, `upstream_bytes` and `sent_bytes` + combined. + - **`cdn_bytes`** – `sent_bytes` and `shield_bytes` combined. + - **requests** – Number of requests to edge servers. + - **`responses_2xx`** – Number of 2xx response codes. + - **`responses_3xx`** – Number of 3xx response codes. + - **`responses_4xx`** – Number of 4xx response codes. + - **`responses_5xx`** – Number of 5xx response codes. + - **`responses_hit`** – Number of responses with the header Cache: HIT. + - **`responses_miss`** – Number of responses with the header Cache: MISS. + - **`response_types`** – Statistics by content type. It returns a number of + responses for content with different MIME types. + - **`cache_hit_traffic_ratio`** – Formula: 1 - `upstream_bytes` / `sent_bytes`. + We deduct the non-cached traffic from the total traffic amount. + - **`cache_hit_requests_ratio`** – Formula: `responses_hit` / requests. The + share of sending cached content. + - **`shield_traffic_ratio`** – Formula: (`shield_bytes` - `upstream_bytes`) / + `shield_bytes`. The efficiency of the Origin Shielding: how much more traffic + is sent from the Origin Shielding than from the origin. + - **`image_processed`** - Number of images transformed on the Image optimization + service. + - **`request_time`** - Time elapsed between the first bytes of a request were + processed and logging after the last bytes were sent to a user. + - **`upstream_response_time`** - Number of milliseconds it took to receive a + response from an origin. If upstream `response_time_` contains several + indications for one request (in case of more than 1 origin), we summarize + them. In case of aggregating several queries, the average of this amount is + calculated. + + Metrics **`upstream_response_time`** and **`request_time`** should be requested + separately from other metrics + """ + + service: Required[str] + """Service name. + + Possible value: + + - CDN + """ + + to: Required[str] + """End of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" + + countries: str + """ + Names of countries for which data should be displayed. English short name from + [ISO 3166 standard][1] without the definite article ("the") should be used. + + [1]: https://www.iso.org/obp/ui/#search/code/ + + To request multiple values, use: + + - &countries=france&countries=denmark + """ + + group_by: str + """Output data grouping. + + Possible values: + + - **resource** – Data is grouped by CDN resources IDs. + - **region** – Data is grouped by regions of CDN edge servers. + - **country** – Data is grouped by countries of CDN edge servers. + - **vhost** – Data is grouped by resources CNAMEs. + + To request multiple values, use: + + - &`group_by`=region&`group_by`=resource + """ + + regions: str + """Regions for which data is displayed. + + Possible values: + + - **na** – North America + - **eu** – Europe + - **cis** – Commonwealth of Independent States + - **asia** – Asia + - **au** – Australia + - **latam** – Latin America + - **me** – Middle East + - **africa** - Africa + - **sa** - South America + """ + + resource: int + """CDN resource IDs. + + To request multiple values, use: + + - &resource=1&resource=2 + """ diff --git a/src/gcore/types/cdn/statistic_get_shield_usage_aggregated_params.py b/src/gcore/types/cdn/statistic_get_shield_usage_aggregated_params.py new file mode 100644 index 00000000..eff1d4f0 --- /dev/null +++ b/src/gcore/types/cdn/statistic_get_shield_usage_aggregated_params.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetShieldUsageAggregatedParams"] + + +class StatisticGetShieldUsageAggregatedParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" + + to: Required[str] + """End of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" + + flat: bool + """The waу parameters are arranged in the response. + + Possible values: + + - **true** – Flat structure is used. + - **false** – Embedded structure is used (default.) + """ + + group_by: str + """Output data grouping. + + Possible value: + + - **resource** - Data is grouped by CDN resource. + """ + + resource: int + """CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + """ diff --git a/src/gcore/types/cdn/statistic_get_shield_usage_series_params.py b/src/gcore/types/cdn/statistic_get_shield_usage_series_params.py new file mode 100644 index 00000000..2b0e1a38 --- /dev/null +++ b/src/gcore/types/cdn/statistic_get_shield_usage_series_params.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["StatisticGetShieldUsageSeriesParams"] + + +class StatisticGetShieldUsageSeriesParams(TypedDict, total=False): + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Beginning of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" + + to: Required[str] + """End of the requested time period (ISO 8601/RFC 3339 format, UTC.)""" + + resource: int + """CDN resources IDs by that statistics data is grouped. + + To request multiple values, use: + + - &resource=1&resource=2 + """ diff --git a/src/gcore/types/cdn/trusted_ca_certificate_create_params.py b/src/gcore/types/cdn/trusted_ca_certificate_create_params.py new file mode 100644 index 00000000..0240b6df --- /dev/null +++ b/src/gcore/types/cdn/trusted_ca_certificate_create_params.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["TrustedCaCertificateCreateParams"] + + +class TrustedCaCertificateCreateParams(TypedDict, total=False): + name: Required[str] + """CA certificate name. + + It must be unique. + """ + + ssl_certificate: Required[Annotated[str, PropertyInfo(alias="sslCertificate")]] + """Public part of the CA certificate. + + It must be in the PEM format. + """ diff --git a/src/gcore/types/cdn/trusted_ca_certificate_list_params.py b/src/gcore/types/cdn/trusted_ca_certificate_list_params.py new file mode 100644 index 00000000..468e9a37 --- /dev/null +++ b/src/gcore/types/cdn/trusted_ca_certificate_list_params.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["TrustedCaCertificateListParams"] + + +class TrustedCaCertificateListParams(TypedDict, total=False): + automated: bool + """How the certificate was issued. + + Possible values: + + - **true** – Certificate was issued automatically. + - **false** – Certificate was added by a user. + """ + + resource_id: int + """CDN resource ID for which the certificates are requested.""" + + validity_not_after_lte: str + """ + Date and time when the certificate become untrusted (ISO 8601/RFC 3339 format, + UTC.) + + Response will contain certificates valid until the specified time. + """ diff --git a/src/gcore/types/cdn/trusted_ca_certificate_replace_params.py b/src/gcore/types/cdn/trusted_ca_certificate_replace_params.py new file mode 100644 index 00000000..882017d1 --- /dev/null +++ b/src/gcore/types/cdn/trusted_ca_certificate_replace_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["TrustedCaCertificateReplaceParams"] + + +class TrustedCaCertificateReplaceParams(TypedDict, total=False): + name: Required[str] + """CA certificate name. + + It must be unique. + """ diff --git a/src/gcore/types/cdn/usage_series_stats.py b/src/gcore/types/cdn/usage_series_stats.py new file mode 100644 index 00000000..f6ab393d --- /dev/null +++ b/src/gcore/types/cdn/usage_series_stats.py @@ -0,0 +1,31 @@ +# 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__ = ["UsageSeriesStats", "UsageSeriesStatItem"] + + +class UsageSeriesStatItem(BaseModel): + active_from: Optional[str] = None + """Date and time when paid feature was enabled (ISO 8601/RFC 3339 format, UTC.)""" + + active_to: Optional[str] = None + """Date and time when paid feature was disabled (ISO 8601/RFC 3339 format, UTC.) + + It returns **null** if the paid feature is enabled. + """ + + client_id: Optional[int] = None + """Client ID.""" + + cname: Optional[str] = None + """CDN resource CNAME.""" + + resource_id: Optional[int] = None + """CDN resource ID.""" + + +UsageSeriesStats: TypeAlias = List[UsageSeriesStatItem] diff --git a/tests/api_resources/cdn/__init__.py b/tests/api_resources/cdn/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cdn/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cdn/logs/__init__.py b/tests/api_resources/cdn/logs/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cdn/logs/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cdn/logs/test_settings.py b/tests/api_resources/cdn/logs/test_settings.py new file mode 100644 index 00000000..3384caf7 --- /dev/null +++ b/tests/api_resources/cdn/logs/test_settings.py @@ -0,0 +1,568 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn.logs import LogSettings + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSettings: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + setting = client.cdn.logs.settings.create( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) + assert setting is None + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + setting = client.cdn.logs.settings.create( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[ + { + "id": 0, + "bucket": "bucket", + "cdn_resource": 0, + "folder": "folder", + } + ], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + archive_size_mb=500, + enabled=True, + ftp_prepend_folder="ftp_prepend_folder", + ignore_empty_logs=True, + s3_aws_region=0, + s3_bucket_location="s3_bucket_location", + s3_host_bucket="s3_host_bucket", + sftp_key_passphrase="sftp_key_passphrase", + sftp_prepend_folder="sftp_prepend_folder", + sftp_private_key="sftp_private_key", + ) + assert setting is None + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cdn.logs.settings.with_raw_response.create( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = response.parse() + assert setting is None + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cdn.logs.settings.with_streaming_response.create( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = response.parse() + assert setting is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + setting = client.cdn.logs.settings.update( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) + assert setting is None + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + setting = client.cdn.logs.settings.update( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[ + { + "id": 0, + "bucket": "bucket", + "cdn_resource": 0, + "folder": "folder", + } + ], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + archive_size_mb=500, + enabled=True, + ftp_prepend_folder="ftp_prepend_folder", + ignore_empty_logs=True, + s3_aws_region=0, + s3_bucket_location="s3_bucket_location", + s3_host_bucket="s3_host_bucket", + sftp_key_passphrase="sftp_key_passphrase", + sftp_prepend_folder="sftp_prepend_folder", + sftp_private_key="sftp_private_key", + ) + assert setting is None + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cdn.logs.settings.with_raw_response.update( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = response.parse() + assert setting is None + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cdn.logs.settings.with_streaming_response.update( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = response.parse() + assert setting is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + setting = client.cdn.logs.settings.delete() + assert setting is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.logs.settings.with_raw_response.delete() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = response.parse() + assert setting is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.logs.settings.with_streaming_response.delete() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = response.parse() + assert setting is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + setting = client.cdn.logs.settings.get() + assert_matches_type(LogSettings, setting, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.logs.settings.with_raw_response.get() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = response.parse() + assert_matches_type(LogSettings, setting, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.logs.settings.with_streaming_response.get() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = response.parse() + assert_matches_type(LogSettings, setting, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncSettings: + 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: + setting = await async_client.cdn.logs.settings.create( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) + assert setting is None + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + setting = await async_client.cdn.logs.settings.create( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[ + { + "id": 0, + "bucket": "bucket", + "cdn_resource": 0, + "folder": "folder", + } + ], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + archive_size_mb=500, + enabled=True, + ftp_prepend_folder="ftp_prepend_folder", + ignore_empty_logs=True, + s3_aws_region=0, + s3_bucket_location="s3_bucket_location", + s3_host_bucket="s3_host_bucket", + sftp_key_passphrase="sftp_key_passphrase", + sftp_prepend_folder="sftp_prepend_folder", + sftp_private_key="sftp_private_key", + ) + assert setting is None + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs.settings.with_raw_response.create( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = await response.parse() + assert setting is None + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs.settings.with_streaming_response.create( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = await response.parse() + assert setting is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + setting = await async_client.cdn.logs.settings.update( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) + assert setting is None + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + setting = await async_client.cdn.logs.settings.update( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[ + { + "id": 0, + "bucket": "bucket", + "cdn_resource": 0, + "folder": "folder", + } + ], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + archive_size_mb=500, + enabled=True, + ftp_prepend_folder="ftp_prepend_folder", + ignore_empty_logs=True, + s3_aws_region=0, + s3_bucket_location="s3_bucket_location", + s3_host_bucket="s3_host_bucket", + sftp_key_passphrase="sftp_key_passphrase", + sftp_prepend_folder="sftp_prepend_folder", + sftp_private_key="sftp_private_key", + ) + assert setting is None + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs.settings.with_raw_response.update( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = await response.parse() + assert setting is None + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs.settings.with_streaming_response.update( + all_resources_bucket="all_resources_bucket", + all_resources_folder="all_resources_folder", + folders=[{}], + for_all_resources=True, + ftp_hostname="ftp_hostname", + ftp_login="ftp_login", + ftp_password="ftp_password", + s3_access_key_id="s3_access_key_id", + s3_hostname="s3_hostname", + s3_secret_key="s3_secret_key", + s3_type="s3_type", + sftp_hostname="sftp_hostname", + sftp_login="sftp_login", + sftp_password="sftp_password", + storage_type="storage_type", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = await response.parse() + assert setting is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + setting = await async_client.cdn.logs.settings.delete() + assert setting is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs.settings.with_raw_response.delete() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = await response.parse() + assert setting is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs.settings.with_streaming_response.delete() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = await response.parse() + assert setting is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + setting = await async_client.cdn.logs.settings.get() + assert_matches_type(LogSettings, setting, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs.settings.with_raw_response.get() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + setting = await response.parse() + assert_matches_type(LogSettings, setting, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs.settings.with_streaming_response.get() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + setting = await response.parse() + assert_matches_type(LogSettings, setting, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/logs_uploader/__init__.py b/tests/api_resources/cdn/logs_uploader/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cdn/logs_uploader/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cdn/logs_uploader/test_configs.py b/tests/api_resources/cdn/logs_uploader/test_configs.py new file mode 100644 index 00000000..77fc82eb --- /dev/null +++ b/tests/api_resources/cdn/logs_uploader/test_configs.py @@ -0,0 +1,572 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import LogsUploaderValidation +from gcore.types.cdn.logs_uploader import ( + LogsUploaderConfig, + LogsUploaderConfigList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestConfigs: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.create( + name="name", + policy=0, + target=0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.create( + name="name", + policy=0, + target=0, + enabled=True, + for_all_resources=True, + resources=[0], + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.configs.with_raw_response.create( + name="name", + policy=0, + target=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cdn.logs_uploader.configs.with_streaming_response.create( + name="name", + policy=0, + target=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.update( + id=0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.update( + id=0, + enabled=True, + for_all_resources=True, + name="name", + policy=0, + resources=[0], + target=0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.configs.with_raw_response.update( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cdn.logs_uploader.configs.with_streaming_response.update( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.list() + assert_matches_type(LogsUploaderConfigList, config, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.list( + resource_ids=[0], + search="search", + ) + assert_matches_type(LogsUploaderConfigList, config, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.configs.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = response.parse() + assert_matches_type(LogsUploaderConfigList, config, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.logs_uploader.configs.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = response.parse() + assert_matches_type(LogsUploaderConfigList, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.delete( + 0, + ) + assert config is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.configs.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = response.parse() + assert config is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.logs_uploader.configs.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = response.parse() + assert config is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.get( + 0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.configs.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.logs_uploader.configs.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.replace( + id=0, + name="name", + policy=0, + target=0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.replace( + id=0, + name="name", + policy=0, + target=0, + enabled=True, + for_all_resources=True, + resources=[0], + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.configs.with_raw_response.replace( + id=0, + name="name", + policy=0, + target=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.logs_uploader.configs.with_streaming_response.replace( + id=0, + name="name", + policy=0, + target=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_validate(self, client: Gcore) -> None: + config = client.cdn.logs_uploader.configs.validate( + 0, + ) + assert_matches_type(LogsUploaderValidation, config, path=["response"]) + + @parametrize + def test_raw_response_validate(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.configs.with_raw_response.validate( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = response.parse() + assert_matches_type(LogsUploaderValidation, config, path=["response"]) + + @parametrize + def test_streaming_response_validate(self, client: Gcore) -> None: + with client.cdn.logs_uploader.configs.with_streaming_response.validate( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = response.parse() + assert_matches_type(LogsUploaderValidation, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncConfigs: + 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: + config = await async_client.cdn.logs_uploader.configs.create( + name="name", + policy=0, + target=0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.create( + name="name", + policy=0, + target=0, + enabled=True, + for_all_resources=True, + resources=[0], + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.configs.with_raw_response.create( + name="name", + policy=0, + target=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = await response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.configs.with_streaming_response.create( + name="name", + policy=0, + target=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = await response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.update( + id=0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.update( + id=0, + enabled=True, + for_all_resources=True, + name="name", + policy=0, + resources=[0], + target=0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.configs.with_raw_response.update( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = await response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.configs.with_streaming_response.update( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = await response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.list() + assert_matches_type(LogsUploaderConfigList, config, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.list( + resource_ids=[0], + search="search", + ) + assert_matches_type(LogsUploaderConfigList, config, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.configs.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = await response.parse() + assert_matches_type(LogsUploaderConfigList, config, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.configs.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = await response.parse() + assert_matches_type(LogsUploaderConfigList, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.delete( + 0, + ) + assert config is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.configs.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = await response.parse() + assert config is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.configs.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = await response.parse() + assert config is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.get( + 0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.configs.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = await response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.configs.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = await response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.replace( + id=0, + name="name", + policy=0, + target=0, + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.replace( + id=0, + name="name", + policy=0, + target=0, + enabled=True, + for_all_resources=True, + resources=[0], + ) + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.configs.with_raw_response.replace( + id=0, + name="name", + policy=0, + target=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = await response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.configs.with_streaming_response.replace( + id=0, + name="name", + policy=0, + target=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = await response.parse() + assert_matches_type(LogsUploaderConfig, config, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_validate(self, async_client: AsyncGcore) -> None: + config = await async_client.cdn.logs_uploader.configs.validate( + 0, + ) + assert_matches_type(LogsUploaderValidation, config, path=["response"]) + + @parametrize + async def test_raw_response_validate(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.configs.with_raw_response.validate( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + config = await response.parse() + assert_matches_type(LogsUploaderValidation, config, path=["response"]) + + @parametrize + async def test_streaming_response_validate(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.configs.with_streaming_response.validate( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + config = await response.parse() + assert_matches_type(LogsUploaderValidation, config, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/logs_uploader/test_policies.py b/tests/api_resources/cdn/logs_uploader/test_policies.py new file mode 100644 index 00000000..07ed96bf --- /dev/null +++ b/tests/api_resources/cdn/logs_uploader/test_policies.py @@ -0,0 +1,572 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn.logs_uploader import ( + LogsUploaderPolicy, + LogsUploaderPolicyList, + PolicyListFieldsResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPolicies: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.create() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.create( + date_format="[02/Jan/2006:15:04:05 -0700]", + description="New policy", + field_delimiter=",", + field_separator=";", + fields=["remote_addr", "status"], + file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", + format_type="flvproxy", + include_empty_logs=True, + include_shield_logs=True, + name="Policy", + retry_interval_minutes=32, + rotate_interval_minutes=32, + rotate_threshold_lines=5000, + rotate_threshold_mb=252, + tags={}, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.policies.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cdn.logs_uploader.policies.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.update( + id=0, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.update( + id=0, + date_format="[02/Jan/2006:15:04:05 -0700]", + description="New policy", + field_delimiter=",", + field_separator=";", + fields=["remote_addr", "status"], + file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", + format_type="flvproxy", + include_empty_logs=True, + include_shield_logs=True, + name="Policy", + retry_interval_minutes=32, + rotate_interval_minutes=32, + rotate_threshold_lines=5000, + rotate_threshold_mb=252, + tags={}, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.policies.with_raw_response.update( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cdn.logs_uploader.policies.with_streaming_response.update( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.list() + assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.list( + config_ids=[0], + search="search", + ) + assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.policies.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.logs_uploader.policies.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.delete( + 0, + ) + assert policy is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.policies.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert policy is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.logs_uploader.policies.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert policy is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.get( + 0, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.policies.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.logs_uploader.policies.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_fields(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.list_fields() + assert_matches_type(PolicyListFieldsResponse, policy, path=["response"]) + + @parametrize + def test_raw_response_list_fields(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.policies.with_raw_response.list_fields() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(PolicyListFieldsResponse, policy, path=["response"]) + + @parametrize + def test_streaming_response_list_fields(self, client: Gcore) -> None: + with client.cdn.logs_uploader.policies.with_streaming_response.list_fields() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(PolicyListFieldsResponse, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.replace( + id=0, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + policy = client.cdn.logs_uploader.policies.replace( + id=0, + date_format="[02/Jan/2006:15:04:05 -0700]", + description="New policy", + field_delimiter=",", + field_separator=";", + fields=["remote_addr", "status"], + file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", + format_type="flvproxy", + include_empty_logs=True, + include_shield_logs=True, + name="Policy", + retry_interval_minutes=32, + rotate_interval_minutes=32, + rotate_threshold_lines=5000, + rotate_threshold_mb=252, + tags={}, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.policies.with_raw_response.replace( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.logs_uploader.policies.with_streaming_response.replace( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncPolicies: + 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: + policy = await async_client.cdn.logs_uploader.policies.create() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.create( + date_format="[02/Jan/2006:15:04:05 -0700]", + description="New policy", + field_delimiter=",", + field_separator=";", + fields=["remote_addr", "status"], + file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", + format_type="flvproxy", + include_empty_logs=True, + include_shield_logs=True, + name="Policy", + retry_interval_minutes=32, + rotate_interval_minutes=32, + rotate_threshold_lines=5000, + rotate_threshold_mb=252, + tags={}, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.policies.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.policies.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.update( + id=0, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.update( + id=0, + date_format="[02/Jan/2006:15:04:05 -0700]", + description="New policy", + field_delimiter=",", + field_separator=";", + fields=["remote_addr", "status"], + file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", + format_type="flvproxy", + include_empty_logs=True, + include_shield_logs=True, + name="Policy", + retry_interval_minutes=32, + rotate_interval_minutes=32, + rotate_threshold_lines=5000, + rotate_threshold_mb=252, + tags={}, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.policies.with_raw_response.update( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.policies.with_streaming_response.update( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.list() + assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.list( + config_ids=[0], + search="search", + ) + assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.policies.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.policies.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(LogsUploaderPolicyList, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.delete( + 0, + ) + assert policy is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.policies.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert policy is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.policies.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert policy is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.get( + 0, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.policies.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.policies.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_fields(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.list_fields() + assert_matches_type(PolicyListFieldsResponse, policy, path=["response"]) + + @parametrize + async def test_raw_response_list_fields(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.policies.with_raw_response.list_fields() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(PolicyListFieldsResponse, policy, path=["response"]) + + @parametrize + async def test_streaming_response_list_fields(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.policies.with_streaming_response.list_fields() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(PolicyListFieldsResponse, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.replace( + id=0, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + policy = await async_client.cdn.logs_uploader.policies.replace( + id=0, + date_format="[02/Jan/2006:15:04:05 -0700]", + description="New policy", + field_delimiter=",", + field_separator=";", + fields=["remote_addr", "status"], + file_name_template="{{YYYY}}_{{MM}}_{{DD}}_{{HH}}_{{mm}}_{{ss}}_access.log.gz", + format_type="flvproxy", + include_empty_logs=True, + include_shield_logs=True, + name="Policy", + retry_interval_minutes=32, + rotate_interval_minutes=32, + rotate_threshold_lines=5000, + rotate_threshold_mb=252, + tags={}, + ) + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.policies.with_raw_response.replace( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.policies.with_streaming_response.replace( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(LogsUploaderPolicy, policy, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/logs_uploader/test_targets.py b/tests/api_resources/cdn/logs_uploader/test_targets.py new file mode 100644 index 00000000..3cea5248 --- /dev/null +++ b/tests/api_resources/cdn/logs_uploader/test_targets.py @@ -0,0 +1,668 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import LogsUploaderValidation +from gcore.types.cdn.logs_uploader import ( + LogsUploaderTarget, + LogsUploaderTargetList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTargets: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.create( + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.create( + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + "directory": "directory", + "use_path_style": True, + }, + storage_type="s3_gcore", + description="description", + name="name", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.targets.with_raw_response.create( + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cdn.logs_uploader.targets.with_streaming_response.create( + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.update( + id=0, + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.update( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + "directory": "directory", + "use_path_style": True, + }, + description="description", + name="name", + storage_type="s3_gcore", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.targets.with_raw_response.update( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cdn.logs_uploader.targets.with_streaming_response.update( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.list() + assert_matches_type(LogsUploaderTargetList, target, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.list( + config_ids=[0], + search="search", + ) + assert_matches_type(LogsUploaderTargetList, target, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.targets.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = response.parse() + assert_matches_type(LogsUploaderTargetList, target, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.logs_uploader.targets.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = response.parse() + assert_matches_type(LogsUploaderTargetList, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.delete( + 0, + ) + assert target is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.targets.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = response.parse() + assert target is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.logs_uploader.targets.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = response.parse() + assert target is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.get( + 0, + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.targets.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.logs_uploader.targets.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.replace( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.replace( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + "directory": "directory", + "use_path_style": True, + }, + storage_type="s3_gcore", + description="description", + name="name", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.targets.with_raw_response.replace( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.logs_uploader.targets.with_streaming_response.replace( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_validate(self, client: Gcore) -> None: + target = client.cdn.logs_uploader.targets.validate( + 0, + ) + assert_matches_type(LogsUploaderValidation, target, path=["response"]) + + @parametrize + def test_raw_response_validate(self, client: Gcore) -> None: + response = client.cdn.logs_uploader.targets.with_raw_response.validate( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = response.parse() + assert_matches_type(LogsUploaderValidation, target, path=["response"]) + + @parametrize + def test_streaming_response_validate(self, client: Gcore) -> None: + with client.cdn.logs_uploader.targets.with_streaming_response.validate( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = response.parse() + assert_matches_type(LogsUploaderValidation, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncTargets: + 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: + target = await async_client.cdn.logs_uploader.targets.create( + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.create( + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + "directory": "directory", + "use_path_style": True, + }, + storage_type="s3_gcore", + description="description", + name="name", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.targets.with_raw_response.create( + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = await response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.targets.with_streaming_response.create( + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = await response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.update( + id=0, + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.update( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + "directory": "directory", + "use_path_style": True, + }, + description="description", + name="name", + storage_type="s3_gcore", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.targets.with_raw_response.update( + id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = await response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.targets.with_streaming_response.update( + id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = await response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.list() + assert_matches_type(LogsUploaderTargetList, target, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.list( + config_ids=[0], + search="search", + ) + assert_matches_type(LogsUploaderTargetList, target, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.targets.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = await response.parse() + assert_matches_type(LogsUploaderTargetList, target, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.targets.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = await response.parse() + assert_matches_type(LogsUploaderTargetList, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.delete( + 0, + ) + assert target is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.targets.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = await response.parse() + assert target is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.targets.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = await response.parse() + assert target is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.get( + 0, + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.targets.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = await response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.targets.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = await response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.replace( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.replace( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + "directory": "directory", + "use_path_style": True, + }, + storage_type="s3_gcore", + description="description", + name="name", + ) + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.targets.with_raw_response.replace( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = await response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.targets.with_streaming_response.replace( + id=0, + config={ + "access_key_id": "access_key_id", + "bucket_name": "bucket_name", + "endpoint": "endpoint", + "region": "region", + "secret_access_key": "secret_access_key", + }, + storage_type="s3_gcore", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = await response.parse() + assert_matches_type(LogsUploaderTarget, target, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_validate(self, async_client: AsyncGcore) -> None: + target = await async_client.cdn.logs_uploader.targets.validate( + 0, + ) + assert_matches_type(LogsUploaderValidation, target, path=["response"]) + + @parametrize + async def test_raw_response_validate(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs_uploader.targets.with_raw_response.validate( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + target = await response.parse() + assert_matches_type(LogsUploaderValidation, target, path=["response"]) + + @parametrize + async def test_streaming_response_validate(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs_uploader.targets.with_streaming_response.validate( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + target = await response.parse() + assert_matches_type(LogsUploaderValidation, target, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/resources/__init__.py b/tests/api_resources/cdn/resources/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/cdn/resources/__init__.py @@ -0,0 +1 @@ +# 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 new file mode 100644 index 00000000..fbb097c3 --- /dev/null +++ b/tests/api_resources/cdn/resources/test_rules.py @@ -0,0 +1,2101 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn.resources import ( + CdnResourceRule, + RuleListResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRules: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.create( + resource_id=0, + name="My first rule", + rule="/folder/images/*.png", + rule_type=0, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.create( + resource_id=0, + name="My first rule", + rule="/folder/images/*.png", + rule_type=0, + active=True, + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_group=None, + override_origin_protocol="HTTPS", + weight=1, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cdn.resources.rules.with_raw_response.create( + resource_id=0, + name="My first rule", + rule="/folder/images/*.png", + rule_type=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cdn.resources.rules.with_streaming_response.create( + resource_id=0, + name="My first rule", + rule="/folder/images/*.png", + rule_type=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.update( + rule_id=0, + resource_id=0, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.update( + rule_id=0, + resource_id=0, + active=True, + name="My first rule", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_group=None, + override_origin_protocol="HTTPS", + rule="/folder/images/*.png", + rule_type=0, + weight=1, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cdn.resources.rules.with_raw_response.update( + rule_id=0, + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cdn.resources.rules.with_streaming_response.update( + rule_id=0, + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.list( + 0, + ) + assert_matches_type(RuleListResponse, rule, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.resources.rules.with_raw_response.list( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleListResponse, rule, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.resources.rules.with_streaming_response.list( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleListResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.delete( + rule_id=0, + resource_id=0, + ) + assert rule is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.resources.rules.with_raw_response.delete( + rule_id=0, + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert rule is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.resources.rules.with_streaming_response.delete( + rule_id=0, + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.get( + rule_id=0, + resource_id=0, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.resources.rules.with_raw_response.get( + rule_id=0, + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.resources.rules.with_streaming_response.get( + rule_id=0, + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.replace( + rule_id=0, + resource_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + rule = client.cdn.resources.rules.replace( + rule_id=0, + resource_id=0, + rule="/folder/images/*.png", + rule_type=0, + active=True, + name="My first rule", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_group=None, + override_origin_protocol="HTTPS", + weight=1, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.resources.rules.with_raw_response.replace( + rule_id=0, + resource_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.resources.rules.with_streaming_response.replace( + rule_id=0, + resource_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncRules: + 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: + rule = await async_client.cdn.resources.rules.create( + resource_id=0, + name="My first rule", + rule="/folder/images/*.png", + rule_type=0, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.resources.rules.create( + resource_id=0, + name="My first rule", + rule="/folder/images/*.png", + rule_type=0, + active=True, + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_group=None, + override_origin_protocol="HTTPS", + weight=1, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.rules.with_raw_response.create( + resource_id=0, + name="My first rule", + rule="/folder/images/*.png", + rule_type=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.rules.with_streaming_response.create( + resource_id=0, + name="My first rule", + rule="/folder/images/*.png", + rule_type=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.resources.rules.update( + rule_id=0, + resource_id=0, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.resources.rules.update( + rule_id=0, + resource_id=0, + active=True, + name="My first rule", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_group=None, + override_origin_protocol="HTTPS", + rule="/folder/images/*.png", + rule_type=0, + weight=1, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.rules.with_raw_response.update( + rule_id=0, + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.rules.with_streaming_response.update( + rule_id=0, + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.resources.rules.list( + 0, + ) + assert_matches_type(RuleListResponse, rule, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.rules.with_raw_response.list( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(RuleListResponse, rule, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.rules.with_streaming_response.list( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleListResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.resources.rules.delete( + rule_id=0, + resource_id=0, + ) + assert rule is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.rules.with_raw_response.delete( + rule_id=0, + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert rule is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.rules.with_streaming_response.delete( + rule_id=0, + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert rule is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.resources.rules.get( + rule_id=0, + resource_id=0, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.rules.with_raw_response.get( + rule_id=0, + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.rules.with_streaming_response.get( + rule_id=0, + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.resources.rules.replace( + rule_id=0, + resource_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + rule = await async_client.cdn.resources.rules.replace( + rule_id=0, + resource_id=0, + rule="/folder/images/*.png", + rule_type=0, + active=True, + name="My first rule", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_group=None, + override_origin_protocol="HTTPS", + weight=1, + ) + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.rules.with_raw_response.replace( + rule_id=0, + resource_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = await response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.rules.with_streaming_response.replace( + rule_id=0, + resource_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(CdnResourceRule, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/resources/test_shield.py b/tests/api_resources/cdn/resources/test_shield.py new file mode 100644 index 00000000..40679e62 --- /dev/null +++ b/tests/api_resources/cdn/resources/test_shield.py @@ -0,0 +1,164 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn.resources import OriginShielding + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestShield: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get(self, client: Gcore) -> None: + shield = client.cdn.resources.shield.get( + 0, + ) + assert_matches_type(OriginShielding, shield, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.resources.shield.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + shield = response.parse() + assert_matches_type(OriginShielding, shield, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.resources.shield.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + shield = response.parse() + assert_matches_type(OriginShielding, shield, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + shield = client.cdn.resources.shield.replace( + resource_id=0, + ) + assert_matches_type(object, shield, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + shield = client.cdn.resources.shield.replace( + resource_id=0, + shielding_pop=4, + ) + assert_matches_type(object, shield, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.resources.shield.with_raw_response.replace( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + shield = response.parse() + assert_matches_type(object, shield, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.resources.shield.with_streaming_response.replace( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + shield = response.parse() + assert_matches_type(object, shield, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncShield: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + shield = await async_client.cdn.resources.shield.get( + 0, + ) + assert_matches_type(OriginShielding, shield, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.shield.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + shield = await response.parse() + assert_matches_type(OriginShielding, shield, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.shield.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + shield = await response.parse() + assert_matches_type(OriginShielding, shield, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + shield = await async_client.cdn.resources.shield.replace( + resource_id=0, + ) + assert_matches_type(object, shield, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + shield = await async_client.cdn.resources.shield.replace( + resource_id=0, + shielding_pop=4, + ) + assert_matches_type(object, shield, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.shield.with_raw_response.replace( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + shield = await response.parse() + assert_matches_type(object, shield, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.shield.with_streaming_response.replace( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + shield = await response.parse() + assert_matches_type(object, shield, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_audit_log.py b/tests/api_resources/cdn/test_audit_log.py new file mode 100644 index 00000000..5cd11748 --- /dev/null +++ b/tests/api_resources/cdn/test_audit_log.py @@ -0,0 +1,171 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import CdnAuditLogEntry +from gcore.pagination import SyncOffsetPage, AsyncOffsetPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAuditLog: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + audit_log = client.cdn.audit_log.list() + assert_matches_type(SyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + audit_log = client.cdn.audit_log.list( + client_id=0, + limit=0, + max_requested_at="max_requested_at", + method="method", + min_requested_at="min_requested_at", + offset=0, + path="path", + remote_ip_address="remote_ip_address", + status_code=0, + token_id=0, + user_id=0, + ) + assert_matches_type(SyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.audit_log.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + audit_log = response.parse() + assert_matches_type(SyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.audit_log.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + audit_log = response.parse() + assert_matches_type(SyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + audit_log = client.cdn.audit_log.get( + 0, + ) + assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.audit_log.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + audit_log = response.parse() + assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.audit_log.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + audit_log = response.parse() + assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncAuditLog: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + audit_log = await async_client.cdn.audit_log.list() + assert_matches_type(AsyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + audit_log = await async_client.cdn.audit_log.list( + client_id=0, + limit=0, + max_requested_at="max_requested_at", + method="method", + min_requested_at="min_requested_at", + offset=0, + path="path", + remote_ip_address="remote_ip_address", + status_code=0, + token_id=0, + user_id=0, + ) + assert_matches_type(AsyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.audit_log.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + audit_log = await response.parse() + assert_matches_type(AsyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.audit_log.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + audit_log = await response.parse() + assert_matches_type(AsyncOffsetPage[CdnAuditLogEntry], audit_log, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + audit_log = await async_client.cdn.audit_log.get( + 0, + ) + assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.audit_log.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + audit_log = await response.parse() + assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.audit_log.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + audit_log = await response.parse() + assert_matches_type(CdnAuditLogEntry, audit_log, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_certificates.py b/tests/api_resources/cdn/test_certificates.py new file mode 100644 index 00000000..da6d3aad --- /dev/null +++ b/tests/api_resources/cdn/test_certificates.py @@ -0,0 +1,686 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import ( + SslDetail, + SslDetailList, + SslRequestStatus, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCertificates: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create_overload_1(self, client: Gcore) -> None: + certificate = client.cdn.certificates.create( + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) + assert certificate is None + + @parametrize + def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: + certificate = client.cdn.certificates.create( + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + validate_root_ca=True, + ) + assert certificate is None + + @parametrize + def test_raw_response_create_overload_1(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.create( + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert certificate is None + + @parametrize + def test_streaming_response_create_overload_1(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.create( + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_overload_2(self, client: Gcore) -> None: + certificate = client.cdn.certificates.create( + automated=True, + name="New Let's Encrypt certificate", + ) + assert certificate is None + + @parametrize + def test_raw_response_create_overload_2(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.create( + automated=True, + name="New Let's Encrypt certificate", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert certificate is None + + @parametrize + def test_streaming_response_create_overload_2(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.create( + automated=True, + name="New Let's Encrypt certificate", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + certificate = client.cdn.certificates.list() + assert_matches_type(SslDetailList, certificate, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + certificate = client.cdn.certificates.list( + automated=True, + resource_id=0, + validity_not_after_lte="validity_not_after_lte", + ) + assert_matches_type(SslDetailList, certificate, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert_matches_type(SslDetailList, certificate, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert_matches_type(SslDetailList, certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + certificate = client.cdn.certificates.delete( + 0, + ) + assert certificate is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert certificate is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_force_retry(self, client: Gcore) -> None: + certificate = client.cdn.certificates.force_retry( + 0, + ) + assert certificate is None + + @parametrize + def test_raw_response_force_retry(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.force_retry( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert certificate is None + + @parametrize + def test_streaming_response_force_retry(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.force_retry( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + certificate = client.cdn.certificates.get( + 0, + ) + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert_matches_type(SslDetail, certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_status(self, client: Gcore) -> None: + certificate = client.cdn.certificates.get_status( + cert_id=0, + ) + assert_matches_type(SslRequestStatus, certificate, path=["response"]) + + @parametrize + def test_method_get_status_with_all_params(self, client: Gcore) -> None: + certificate = client.cdn.certificates.get_status( + cert_id=0, + exclude=["string"], + ) + assert_matches_type(SslRequestStatus, certificate, path=["response"]) + + @parametrize + def test_raw_response_get_status(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.get_status( + cert_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert_matches_type(SslRequestStatus, certificate, path=["response"]) + + @parametrize + def test_streaming_response_get_status(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.get_status( + cert_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert_matches_type(SslRequestStatus, certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_renew(self, client: Gcore) -> None: + certificate = client.cdn.certificates.renew( + 0, + ) + assert certificate is None + + @parametrize + def test_raw_response_renew(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.renew( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert certificate is None + + @parametrize + def test_streaming_response_renew(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.renew( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + certificate = client.cdn.certificates.replace( + ssl_id=0, + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + certificate = client.cdn.certificates.replace( + ssl_id=0, + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + validate_root_ca=True, + ) + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.certificates.with_raw_response.replace( + ssl_id=0, + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = response.parse() + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.certificates.with_streaming_response.replace( + ssl_id=0, + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = response.parse() + assert_matches_type(SslDetail, certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCertificates: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create_overload_1(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.create( + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) + assert certificate is None + + @parametrize + async def test_method_create_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.create( + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + validate_root_ca=True, + ) + assert certificate is None + + @parametrize + async def test_raw_response_create_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.create( + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert certificate is None + + @parametrize + async def test_streaming_response_create_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.create( + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_overload_2(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.create( + automated=True, + name="New Let's Encrypt certificate", + ) + assert certificate is None + + @parametrize + async def test_raw_response_create_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.create( + automated=True, + name="New Let's Encrypt certificate", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert certificate is None + + @parametrize + async def test_streaming_response_create_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.create( + automated=True, + name="New Let's Encrypt certificate", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.list() + assert_matches_type(SslDetailList, certificate, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.list( + automated=True, + resource_id=0, + validity_not_after_lte="validity_not_after_lte", + ) + assert_matches_type(SslDetailList, certificate, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert_matches_type(SslDetailList, certificate, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert_matches_type(SslDetailList, certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.delete( + 0, + ) + assert certificate is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert certificate is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_force_retry(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.force_retry( + 0, + ) + assert certificate is None + + @parametrize + async def test_raw_response_force_retry(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.force_retry( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert certificate is None + + @parametrize + async def test_streaming_response_force_retry(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.force_retry( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.get( + 0, + ) + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert_matches_type(SslDetail, certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_status(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.get_status( + cert_id=0, + ) + assert_matches_type(SslRequestStatus, certificate, path=["response"]) + + @parametrize + async def test_method_get_status_with_all_params(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.get_status( + cert_id=0, + exclude=["string"], + ) + assert_matches_type(SslRequestStatus, certificate, path=["response"]) + + @parametrize + async def test_raw_response_get_status(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.get_status( + cert_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert_matches_type(SslRequestStatus, certificate, path=["response"]) + + @parametrize + async def test_streaming_response_get_status(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.get_status( + cert_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert_matches_type(SslRequestStatus, certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_renew(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.renew( + 0, + ) + assert certificate is None + + @parametrize + async def test_raw_response_renew(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.renew( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert certificate is None + + @parametrize + async def test_streaming_response_renew(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.renew( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.replace( + ssl_id=0, + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + certificate = await async_client.cdn.certificates.replace( + ssl_id=0, + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + validate_root_ca=True, + ) + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.certificates.with_raw_response.replace( + ssl_id=0, + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + certificate = await response.parse() + assert_matches_type(SslDetail, certificate, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.certificates.with_streaming_response.replace( + ssl_id=0, + name="New certificate", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIFWzCCBEOgAwIBAgISBK6qoNitg//89H/YJamujpWlMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODExMTMxMjQwMDJaFw0x\nOTAyMTExMjQwMDJaMBwxGjAYBgNVBAMTEWNkbjIudG50LWNsdWIuY29tMIIBIjAN\nBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzaHExDEXNSf6ELS0WUR7qq8gs9cc\nxx99sM2zs3Jld0twPmuldkVNe5xte/Hj03r4SesfOBczR7pn+t60YujPvUQDN8lx\nWYpvRuetOneyf4gNPatwzR/W1GWGlahet1xPVYGrttqL4gCJeShIXvU4aCyzW941\nPt0wCs+bg9u+59fXFkigWrWJPkwbR7bJ14XTStYynMbYLfCg+VPeGWj3d8wOhQcf\nAD86o8TLTbVfK2BDXwS5S8Dgf5u8g+WvmVHYDIkYKCxcLj0jP61Y7uHoFbSg41oN\nA9yPOa+0cYxA7U702V2WjxbfIeATYtNLZvH17lk+DYlQl8q3MLwguqZdgwIDAQAB\niIqI2xquGONtHFDOKJvy1O2qYTVRtNRVZqhc1ol+mw==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\nMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\nDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\nSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\nGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\nq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\nSMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n", + ssl_private_key="-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDZcNCZiNNHfX2O\ndZpf12mv2rAZwqGZBAdpox0wntEPK3JciQ7ZRloLJeHuCNIJs9MidnH7Xk8zveju\nmab6HmfIzvMJAAm88OYWMFQRiYe1ggJEHMe7yYPQbtXwTqWDYdWmjPPma3Ujqqmb\nhmVX2rsYILD7cUjS+e0Ucfqx3QODQj/aujTt1rS0gFhJ0soY5m+C6VimPCx4Bjyw\n5rhtskJDRrfXxrIhVXOvSPFRyxDSfjt3win8vjhhZ3oFPWgrl9lVhn0zaB5hjDsd\n-----END PRIVATE KEY-----\n", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + certificate = await response.parse() + assert_matches_type(SslDetail, certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_ip_ranges.py b/tests/api_resources/cdn/test_ip_ranges.py new file mode 100644 index 00000000..c9bbdb5e --- /dev/null +++ b/tests/api_resources/cdn/test_ip_ranges.py @@ -0,0 +1,124 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import PublicIPList, PublicNetworkList + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestIPRanges: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + ip_range = client.cdn.ip_ranges.list() + assert_matches_type(PublicNetworkList, ip_range, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.ip_ranges.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_range = response.parse() + assert_matches_type(PublicNetworkList, ip_range, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.ip_ranges.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_range = response.parse() + assert_matches_type(PublicNetworkList, ip_range, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list_ips(self, client: Gcore) -> None: + ip_range = client.cdn.ip_ranges.list_ips() + assert_matches_type(PublicIPList, ip_range, path=["response"]) + + @parametrize + def test_raw_response_list_ips(self, client: Gcore) -> None: + response = client.cdn.ip_ranges.with_raw_response.list_ips() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_range = response.parse() + assert_matches_type(PublicIPList, ip_range, path=["response"]) + + @parametrize + def test_streaming_response_list_ips(self, client: Gcore) -> None: + with client.cdn.ip_ranges.with_streaming_response.list_ips() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_range = response.parse() + assert_matches_type(PublicIPList, ip_range, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncIPRanges: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + ip_range = await async_client.cdn.ip_ranges.list() + assert_matches_type(PublicNetworkList, ip_range, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.ip_ranges.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_range = await response.parse() + assert_matches_type(PublicNetworkList, ip_range, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.ip_ranges.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_range = await response.parse() + assert_matches_type(PublicNetworkList, ip_range, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list_ips(self, async_client: AsyncGcore) -> None: + ip_range = await async_client.cdn.ip_ranges.list_ips() + assert_matches_type(PublicIPList, ip_range, path=["response"]) + + @parametrize + async def test_raw_response_list_ips(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.ip_ranges.with_raw_response.list_ips() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip_range = await response.parse() + assert_matches_type(PublicIPList, ip_range, path=["response"]) + + @parametrize + async def test_streaming_response_list_ips(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.ip_ranges.with_streaming_response.list_ips() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip_range = await response.parse() + assert_matches_type(PublicIPList, ip_range, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_logs.py b/tests/api_resources/cdn/test_logs.py new file mode 100644 index 00000000..c585876e --- /dev/null +++ b/tests/api_resources/cdn/test_logs.py @@ -0,0 +1,437 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import httpx +import pytest +from respx import MockRouter + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore._response import ( + BinaryAPIResponse, + AsyncBinaryAPIResponse, + StreamedBinaryAPIResponse, + AsyncStreamedBinaryAPIResponse, +) +from gcore.pagination import SyncOffsetPageCdnLogs, AsyncOffsetPageCdnLogs +from gcore.types.cdn.cdn_log_entry import Data + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestLogs: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + log = client.cdn.logs.list( + from_="from", + to="to", + ) + assert_matches_type(SyncOffsetPageCdnLogs[Data], log, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + log = client.cdn.logs.list( + from_="from", + to="to", + cache_status_eq="cache_status__eq", + cache_status_in="cache_status__in", + cache_status_ne="cache_status__ne", + cache_status_not_in="cache_status__not_in", + client_ip_eq="client_ip__eq", + client_ip_in="client_ip__in", + client_ip_ne="client_ip__ne", + client_ip_not_in="client_ip__not_in", + cname_contains="cname__contains", + cname_eq="cname__eq", + cname_in="cname__in", + cname_ne="cname__ne", + cname_not_in="cname__not_in", + datacenter_eq="datacenter__eq", + datacenter_in="datacenter__in", + datacenter_ne="datacenter__ne", + datacenter_not_in="datacenter__not_in", + fields="fields", + limit=1, + method_eq="method__eq", + method_in="method__in", + method_ne="method__ne", + method_not_in="method__not_in", + offset=0, + ordering="ordering", + resource_id_eq=0, + resource_id_gt=0, + resource_id_gte=0, + resource_id_in="resource_id__in", + resource_id_lt=0, + resource_id_lte=0, + resource_id_ne=0, + resource_id_not_in="resource_id__not_in", + size_eq=0, + size_gt=0, + size_gte=0, + size_in="size__in", + size_lt=0, + size_lte=0, + size_ne=0, + size_not_in="size__not_in", + status_eq=0, + status_gt=0, + status_gte=0, + status_in="status__in", + status_lt=0, + status_lte=0, + status_ne=0, + status_not_in="status__not_in", + ) + assert_matches_type(SyncOffsetPageCdnLogs[Data], log, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.logs.with_raw_response.list( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + log = response.parse() + assert_matches_type(SyncOffsetPageCdnLogs[Data], log, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.logs.with_streaming_response.list( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + log = response.parse() + assert_matches_type(SyncOffsetPageCdnLogs[Data], log, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + @pytest.mark.respx(base_url=base_url) + def test_method_download(self, client: Gcore, respx_mock: MockRouter) -> None: + respx_mock.get("/cdn/advanced/v1/logs/download").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + log = client.cdn.logs.download( + format="format", + from_="from", + to="to", + ) + assert log.is_closed + assert log.json() == {"foo": "bar"} + assert cast(Any, log.is_closed) is True + assert isinstance(log, BinaryAPIResponse) + + @parametrize + @pytest.mark.respx(base_url=base_url) + def test_method_download_with_all_params(self, client: Gcore, respx_mock: MockRouter) -> None: + respx_mock.get("/cdn/advanced/v1/logs/download").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + log = client.cdn.logs.download( + format="format", + from_="from", + to="to", + cache_status_eq="cache_status__eq", + cache_status_in="cache_status__in", + cache_status_ne="cache_status__ne", + cache_status_not_in="cache_status__not_in", + client_ip_eq="client_ip__eq", + client_ip_in="client_ip__in", + client_ip_ne="client_ip__ne", + client_ip_not_in="client_ip__not_in", + cname_contains="cname__contains", + cname_eq="cname__eq", + cname_in="cname__in", + cname_ne="cname__ne", + cname_not_in="cname__not_in", + datacenter_eq="datacenter__eq", + datacenter_in="datacenter__in", + datacenter_ne="datacenter__ne", + datacenter_not_in="datacenter__not_in", + fields="fields", + limit=10000, + method_eq="method__eq", + method_in="method__in", + method_ne="method__ne", + method_not_in="method__not_in", + offset=0, + resource_id_eq=0, + resource_id_gt=0, + resource_id_gte=0, + resource_id_in="resource_id__in", + resource_id_lt=0, + resource_id_lte=0, + resource_id_ne=0, + resource_id_not_in="resource_id__not_in", + size_eq=0, + size_gt=0, + size_gte=0, + size_in="size__in", + size_lt=0, + size_lte=0, + size_ne=0, + size_not_in="size__not_in", + sort="sort", + status_eq=0, + status_gt=0, + status_gte=0, + status_in="status__in", + status_lt=0, + status_lte=0, + status_ne=0, + status_not_in="status__not_in", + ) + assert log.is_closed + assert log.json() == {"foo": "bar"} + assert cast(Any, log.is_closed) is True + assert isinstance(log, BinaryAPIResponse) + + @parametrize + @pytest.mark.respx(base_url=base_url) + def test_raw_response_download(self, client: Gcore, respx_mock: MockRouter) -> None: + respx_mock.get("/cdn/advanced/v1/logs/download").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + log = client.cdn.logs.with_raw_response.download( + format="format", + from_="from", + to="to", + ) + + assert log.is_closed is True + assert log.http_request.headers.get("X-Stainless-Lang") == "python" + assert log.json() == {"foo": "bar"} + assert isinstance(log, BinaryAPIResponse) + + @parametrize + @pytest.mark.respx(base_url=base_url) + def test_streaming_response_download(self, client: Gcore, respx_mock: MockRouter) -> None: + respx_mock.get("/cdn/advanced/v1/logs/download").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + with client.cdn.logs.with_streaming_response.download( + format="format", + from_="from", + to="to", + ) as log: + assert not log.is_closed + assert log.http_request.headers.get("X-Stainless-Lang") == "python" + + assert log.json() == {"foo": "bar"} + assert cast(Any, log.is_closed) is True + assert isinstance(log, StreamedBinaryAPIResponse) + + assert cast(Any, log.is_closed) is True + + +class TestAsyncLogs: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + log = await async_client.cdn.logs.list( + from_="from", + to="to", + ) + assert_matches_type(AsyncOffsetPageCdnLogs[Data], log, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + log = await async_client.cdn.logs.list( + from_="from", + to="to", + cache_status_eq="cache_status__eq", + cache_status_in="cache_status__in", + cache_status_ne="cache_status__ne", + cache_status_not_in="cache_status__not_in", + client_ip_eq="client_ip__eq", + client_ip_in="client_ip__in", + client_ip_ne="client_ip__ne", + client_ip_not_in="client_ip__not_in", + cname_contains="cname__contains", + cname_eq="cname__eq", + cname_in="cname__in", + cname_ne="cname__ne", + cname_not_in="cname__not_in", + datacenter_eq="datacenter__eq", + datacenter_in="datacenter__in", + datacenter_ne="datacenter__ne", + datacenter_not_in="datacenter__not_in", + fields="fields", + limit=1, + method_eq="method__eq", + method_in="method__in", + method_ne="method__ne", + method_not_in="method__not_in", + offset=0, + ordering="ordering", + resource_id_eq=0, + resource_id_gt=0, + resource_id_gte=0, + resource_id_in="resource_id__in", + resource_id_lt=0, + resource_id_lte=0, + resource_id_ne=0, + resource_id_not_in="resource_id__not_in", + size_eq=0, + size_gt=0, + size_gte=0, + size_in="size__in", + size_lt=0, + size_lte=0, + size_ne=0, + size_not_in="size__not_in", + status_eq=0, + status_gt=0, + status_gte=0, + status_in="status__in", + status_lt=0, + status_lte=0, + status_ne=0, + status_not_in="status__not_in", + ) + assert_matches_type(AsyncOffsetPageCdnLogs[Data], log, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.logs.with_raw_response.list( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + log = await response.parse() + assert_matches_type(AsyncOffsetPageCdnLogs[Data], log, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.logs.with_streaming_response.list( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + log = await response.parse() + assert_matches_type(AsyncOffsetPageCdnLogs[Data], log, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + @pytest.mark.respx(base_url=base_url) + async def test_method_download(self, async_client: AsyncGcore, respx_mock: MockRouter) -> None: + respx_mock.get("/cdn/advanced/v1/logs/download").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + log = await async_client.cdn.logs.download( + format="format", + from_="from", + to="to", + ) + assert log.is_closed + assert await log.json() == {"foo": "bar"} + assert cast(Any, log.is_closed) is True + assert isinstance(log, AsyncBinaryAPIResponse) + + @parametrize + @pytest.mark.respx(base_url=base_url) + async def test_method_download_with_all_params(self, async_client: AsyncGcore, respx_mock: MockRouter) -> None: + respx_mock.get("/cdn/advanced/v1/logs/download").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + log = await async_client.cdn.logs.download( + format="format", + from_="from", + to="to", + cache_status_eq="cache_status__eq", + cache_status_in="cache_status__in", + cache_status_ne="cache_status__ne", + cache_status_not_in="cache_status__not_in", + client_ip_eq="client_ip__eq", + client_ip_in="client_ip__in", + client_ip_ne="client_ip__ne", + client_ip_not_in="client_ip__not_in", + cname_contains="cname__contains", + cname_eq="cname__eq", + cname_in="cname__in", + cname_ne="cname__ne", + cname_not_in="cname__not_in", + datacenter_eq="datacenter__eq", + datacenter_in="datacenter__in", + datacenter_ne="datacenter__ne", + datacenter_not_in="datacenter__not_in", + fields="fields", + limit=10000, + method_eq="method__eq", + method_in="method__in", + method_ne="method__ne", + method_not_in="method__not_in", + offset=0, + resource_id_eq=0, + resource_id_gt=0, + resource_id_gte=0, + resource_id_in="resource_id__in", + resource_id_lt=0, + resource_id_lte=0, + resource_id_ne=0, + resource_id_not_in="resource_id__not_in", + size_eq=0, + size_gt=0, + size_gte=0, + size_in="size__in", + size_lt=0, + size_lte=0, + size_ne=0, + size_not_in="size__not_in", + sort="sort", + status_eq=0, + status_gt=0, + status_gte=0, + status_in="status__in", + status_lt=0, + status_lte=0, + status_ne=0, + status_not_in="status__not_in", + ) + assert log.is_closed + assert await log.json() == {"foo": "bar"} + assert cast(Any, log.is_closed) is True + assert isinstance(log, AsyncBinaryAPIResponse) + + @parametrize + @pytest.mark.respx(base_url=base_url) + async def test_raw_response_download(self, async_client: AsyncGcore, respx_mock: MockRouter) -> None: + respx_mock.get("/cdn/advanced/v1/logs/download").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + log = await async_client.cdn.logs.with_raw_response.download( + format="format", + from_="from", + to="to", + ) + + assert log.is_closed is True + assert log.http_request.headers.get("X-Stainless-Lang") == "python" + assert await log.json() == {"foo": "bar"} + assert isinstance(log, AsyncBinaryAPIResponse) + + @parametrize + @pytest.mark.respx(base_url=base_url) + async def test_streaming_response_download(self, async_client: AsyncGcore, respx_mock: MockRouter) -> None: + respx_mock.get("/cdn/advanced/v1/logs/download").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + async with async_client.cdn.logs.with_streaming_response.download( + format="format", + from_="from", + to="to", + ) as log: + assert not log.is_closed + assert log.http_request.headers.get("X-Stainless-Lang") == "python" + + assert await log.json() == {"foo": "bar"} + assert cast(Any, log.is_closed) is True + assert isinstance(log, AsyncStreamedBinaryAPIResponse) + + assert cast(Any, log.is_closed) is True diff --git a/tests/api_resources/cdn/test_metrics.py b/tests/api_resources/cdn/test_metrics.py new file mode 100644 index 00000000..dcfd8767 --- /dev/null +++ b/tests/api_resources/cdn/test_metrics.py @@ -0,0 +1,134 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import CdnMetrics + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestMetrics: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + metric = client.cdn.metrics.list( + from_="2021-06-14T00:00:00Z", + metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], + to="2021-06-15T00:00:00Z", + ) + assert_matches_type(CdnMetrics, metric, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + metric = client.cdn.metrics.list( + from_="2021-06-14T00:00:00Z", + metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], + to="2021-06-15T00:00:00Z", + filter_by=[ + { + "field": "resource", + "op": "eq", + "values": [1234], + } + ], + granularity="P1D", + group_by=["cname"], + ) + assert_matches_type(CdnMetrics, metric, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.metrics.with_raw_response.list( + from_="2021-06-14T00:00:00Z", + metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], + to="2021-06-15T00:00:00Z", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metric = response.parse() + assert_matches_type(CdnMetrics, metric, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.metrics.with_streaming_response.list( + from_="2021-06-14T00:00:00Z", + metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], + to="2021-06-15T00:00:00Z", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metric = response.parse() + assert_matches_type(CdnMetrics, metric, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncMetrics: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + metric = await async_client.cdn.metrics.list( + from_="2021-06-14T00:00:00Z", + metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], + to="2021-06-15T00:00:00Z", + ) + assert_matches_type(CdnMetrics, metric, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + metric = await async_client.cdn.metrics.list( + from_="2021-06-14T00:00:00Z", + metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], + to="2021-06-15T00:00:00Z", + filter_by=[ + { + "field": "resource", + "op": "eq", + "values": [1234], + } + ], + granularity="P1D", + group_by=["cname"], + ) + assert_matches_type(CdnMetrics, metric, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.metrics.with_raw_response.list( + from_="2021-06-14T00:00:00Z", + metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], + to="2021-06-15T00:00:00Z", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metric = await response.parse() + assert_matches_type(CdnMetrics, metric, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.metrics.with_streaming_response.list( + from_="2021-06-14T00:00:00Z", + metrics=["edge_status_2xx", "edge_status_3xx", "edge_status_4xx", "edge_status_5xx"], + to="2021-06-15T00:00:00Z", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metric = await response.parse() + assert_matches_type(CdnMetrics, metric, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_network_capacity.py b/tests/api_resources/cdn/test_network_capacity.py new file mode 100644 index 00000000..39fc89da --- /dev/null +++ b/tests/api_resources/cdn/test_network_capacity.py @@ -0,0 +1,74 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import NetworkCapacity + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestNetworkCapacity: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + network_capacity = client.cdn.network_capacity.list() + assert_matches_type(NetworkCapacity, network_capacity, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.network_capacity.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_capacity = response.parse() + assert_matches_type(NetworkCapacity, network_capacity, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.network_capacity.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_capacity = response.parse() + assert_matches_type(NetworkCapacity, network_capacity, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncNetworkCapacity: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + network_capacity = await async_client.cdn.network_capacity.list() + assert_matches_type(NetworkCapacity, network_capacity, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.network_capacity.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_capacity = await response.parse() + assert_matches_type(NetworkCapacity, network_capacity, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.network_capacity.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_capacity = await response.parse() + assert_matches_type(NetworkCapacity, network_capacity, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_origin_groups.py b/tests/api_resources/cdn/test_origin_groups.py new file mode 100644 index 00000000..43dc567c --- /dev/null +++ b/tests/api_resources/cdn/test_origin_groups.py @@ -0,0 +1,971 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import ( + OriginGroups, + OriginGroupsList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestOriginGroups: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create_overload_1(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.create( + name="YourOriginGroup", + sources=[{}, {}], + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_1(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.create( + name="YourOriginGroup", + sources=[ + { + "backup": False, + "enabled": True, + "source": "yourwebsite.com", + }, + { + "backup": True, + "enabled": True, + "source": "1.2.3.4:5500", + }, + ], + auth_type="none", + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_raw_response_create_overload_1(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.create( + name="YourOriginGroup", + sources=[{}, {}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_1(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.create( + name="YourOriginGroup", + sources=[{}, {}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_overload_2(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.create( + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_2(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.create( + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + "s3_region": "us-east-2", + "s3_storage_hostname": "s3_storage_hostname", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_raw_response_create_overload_2(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.create( + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_2(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.create( + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update_overload_1(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.update( + origin_group_id=0, + name="YourOriginGroup", + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_method_update_with_all_params_overload_1(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.update( + origin_group_id=0, + name="YourOriginGroup", + auth_type="none", + path="", + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + sources=[ + { + "backup": False, + "enabled": True, + "source": "yourdomain.com", + } + ], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_raw_response_update_overload_1(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.update( + origin_group_id=0, + name="YourOriginGroup", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_streaming_response_update_overload_1(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.update( + origin_group_id=0, + name="YourOriginGroup", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update_overload_2(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.update( + origin_group_id=0, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_method_update_with_all_params_overload_2(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.update( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + "s3_region": "us-east-2", + "s3_storage_hostname": "s3_storage_hostname", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_raw_response_update_overload_2(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.update( + origin_group_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_streaming_response_update_overload_2(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.update( + origin_group_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.list() + assert_matches_type(OriginGroupsList, origin_group, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.list( + has_related_resources=True, + name="name", + sources="sources", + ) + assert_matches_type(OriginGroupsList, origin_group, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert_matches_type(OriginGroupsList, origin_group, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert_matches_type(OriginGroupsList, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.delete( + 0, + ) + assert origin_group is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert origin_group is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert origin_group is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.get( + 0, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace_overload_1(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.replace( + origin_group_id=0, + auth_type="none", + name="YourOriginGroup", + path="", + sources=[{}], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_method_replace_with_all_params_overload_1(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.replace( + origin_group_id=0, + auth_type="none", + name="YourOriginGroup", + path="", + sources=[ + { + "backup": False, + "enabled": True, + "source": "yourdomain.com", + } + ], + use_next=True, + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_raw_response_replace_overload_1(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.replace( + origin_group_id=0, + auth_type="none", + name="YourOriginGroup", + path="", + sources=[{}], + use_next=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_streaming_response_replace_overload_1(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.replace( + origin_group_id=0, + auth_type="none", + name="YourOriginGroup", + path="", + sources=[{}], + use_next=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace_overload_2(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.replace( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_method_replace_with_all_params_overload_2(self, client: Gcore) -> None: + origin_group = client.cdn.origin_groups.replace( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + "s3_region": "us-east-2", + "s3_storage_hostname": "s3_storage_hostname", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + use_next=True, + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_raw_response_replace_overload_2(self, client: Gcore) -> None: + response = client.cdn.origin_groups.with_raw_response.replace( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + use_next=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + def test_streaming_response_replace_overload_2(self, client: Gcore) -> None: + with client.cdn.origin_groups.with_streaming_response.replace( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + use_next=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncOriginGroups: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create_overload_1(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.create( + name="YourOriginGroup", + sources=[{}, {}], + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.create( + name="YourOriginGroup", + sources=[ + { + "backup": False, + "enabled": True, + "source": "yourwebsite.com", + }, + { + "backup": True, + "enabled": True, + "source": "1.2.3.4:5500", + }, + ], + auth_type="none", + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.create( + name="YourOriginGroup", + sources=[{}, {}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.create( + name="YourOriginGroup", + sources=[{}, {}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_overload_2(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.create( + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.create( + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + "s3_region": "us-east-2", + "s3_storage_hostname": "s3_storage_hostname", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.create( + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.create( + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update_overload_1(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.update( + origin_group_id=0, + name="YourOriginGroup", + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_method_update_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.update( + origin_group_id=0, + name="YourOriginGroup", + auth_type="none", + path="", + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + sources=[ + { + "backup": False, + "enabled": True, + "source": "yourdomain.com", + } + ], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_raw_response_update_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.update( + origin_group_id=0, + name="YourOriginGroup", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_streaming_response_update_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.update( + origin_group_id=0, + name="YourOriginGroup", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update_overload_2(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.update( + origin_group_id=0, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_method_update_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.update( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + "s3_region": "us-east-2", + "s3_storage_hostname": "s3_storage_hostname", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_raw_response_update_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.update( + origin_group_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_streaming_response_update_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.update( + origin_group_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.list() + assert_matches_type(OriginGroupsList, origin_group, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.list( + has_related_resources=True, + name="name", + sources="sources", + ) + assert_matches_type(OriginGroupsList, origin_group, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert_matches_type(OriginGroupsList, origin_group, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert_matches_type(OriginGroupsList, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.delete( + 0, + ) + assert origin_group is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert origin_group is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert origin_group is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.get( + 0, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace_overload_1(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.replace( + origin_group_id=0, + auth_type="none", + name="YourOriginGroup", + path="", + sources=[{}], + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.replace( + origin_group_id=0, + auth_type="none", + name="YourOriginGroup", + path="", + sources=[ + { + "backup": False, + "enabled": True, + "source": "yourdomain.com", + } + ], + use_next=True, + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_raw_response_replace_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.replace( + origin_group_id=0, + auth_type="none", + name="YourOriginGroup", + path="", + sources=[{}], + use_next=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_streaming_response_replace_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.replace( + origin_group_id=0, + auth_type="none", + name="YourOriginGroup", + path="", + sources=[{}], + use_next=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace_overload_2(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.replace( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + use_next=True, + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: + origin_group = await async_client.cdn.origin_groups.replace( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + "s3_region": "us-east-2", + "s3_storage_hostname": "s3_storage_hostname", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + use_next=True, + proxy_next_upstream=["error", "timeout", "invalid_header", "http_500", "http_502", "http_503", "http_504"], + ) + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_raw_response_replace_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.origin_groups.with_raw_response.replace( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + use_next=True, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + @parametrize + async def test_streaming_response_replace_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.origin_groups.with_streaming_response.replace( + origin_group_id=0, + auth={ + "s3_access_key_id": "EXAMPLEFODNN7EXAMPLE", + "s3_bucket_name": "bucket_name", + "s3_secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "s3_type": "amazon", + }, + auth_type="awsSignatureV4", + name="YourOriginGroup", + path="", + use_next=True, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin_group = await response.parse() + assert_matches_type(OriginGroups, origin_group, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_resources.py b/tests/api_resources/cdn/test_resources.py new file mode 100644 index 00000000..1f5c43bb --- /dev/null +++ b/tests/api_resources/cdn/test_resources.py @@ -0,0 +1,2617 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import ( + CdnResource, + CdnResourceList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestResources: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + resource = client.cdn.resources.create( + cname="cdn.site.com", + origin="example.com", + origin_group=132, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + resource = client.cdn.resources.create( + cname="cdn.site.com", + origin="example.com", + origin_group=132, + active=True, + description="My resource", + name="Resource for images", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "http3_enabled": { + "enabled": True, + "value": True, + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "tls_versions": { + "enabled": True, + "value": ["SSLv3", "TLSv1.3"], + }, + "use_default_le_chain": { + "enabled": True, + "value": True, + }, + "use_dns01_le_challenge": { + "enabled": True, + "value": True, + }, + "use_rsa_le_cert": { + "enabled": True, + "value": True, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_protocol="HTTPS", + primary_resource=None, + proxy_ssl_ca=None, + proxy_ssl_data=None, + proxy_ssl_enabled=False, + secondary_hostnames=["first.example.com", "second.example.com"], + ssl_data=192, + ssl_enabled=False, + waap_api_domain_enabled=True, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.create( + cname="cdn.site.com", + origin="example.com", + origin_group=132, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.create( + cname="cdn.site.com", + origin="example.com", + origin_group=132, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="unexpected prism python test failures") + @parametrize + def test_method_update(self, client: Gcore) -> None: + resource = client.cdn.resources.update( + resource_id=0, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @pytest.mark.skip(reason="unexpected prism python test failures") + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + resource = client.cdn.resources.update( + resource_id=0, + active=True, + description="My resource", + name="Resource for images", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "http3_enabled": { + "enabled": True, + "value": True, + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "tls_versions": { + "enabled": True, + "value": ["SSLv3", "TLSv1.3"], + }, + "use_default_le_chain": { + "enabled": True, + "value": True, + }, + "use_dns01_le_challenge": { + "enabled": True, + "value": True, + }, + "use_rsa_le_cert": { + "enabled": True, + "value": True, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_group=132, + origin_protocol="HTTPS", + proxy_ssl_ca=None, + proxy_ssl_data=None, + proxy_ssl_enabled=False, + secondary_hostnames=["first.example.com", "second.example.com"], + ssl_data=192, + ssl_enabled=False, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @pytest.mark.skip(reason="unexpected prism python test failures") + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.update( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + @pytest.mark.skip(reason="unexpected prism python test failures") + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.update( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + resource = client.cdn.resources.list() + assert_matches_type(CdnResourceList, resource, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + resource = client.cdn.resources.list( + cname="cname", + deleted=True, + enabled=True, + max_created="max_created", + min_created="min_created", + origin_group=0, + rules="rules", + secondary_hostnames="secondaryHostnames", + shield_dc="shield_dc", + shielded=True, + ssl_data=0, + ssl_data_in=0, + ssl_enabled=True, + status="active", + suspend=True, + vp_enabled=True, + ) + assert_matches_type(CdnResourceList, resource, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert_matches_type(CdnResourceList, resource, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert_matches_type(CdnResourceList, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + resource = client.cdn.resources.delete( + 0, + ) + assert resource is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert resource is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + resource = client.cdn.resources.get( + 0, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_prefetch(self, client: Gcore) -> None: + resource = client.cdn.resources.prefetch( + resource_id=0, + paths=["/test.jpg", "test1.jpg"], + ) + assert resource is None + + @parametrize + def test_raw_response_prefetch(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.prefetch( + resource_id=0, + paths=["/test.jpg", "test1.jpg"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert resource is None + + @parametrize + def test_streaming_response_prefetch(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.prefetch( + resource_id=0, + paths=["/test.jpg", "test1.jpg"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_prevalidate_ssl_le_certificate(self, client: Gcore) -> None: + resource = client.cdn.resources.prevalidate_ssl_le_certificate( + 0, + ) + assert resource is None + + @parametrize + def test_raw_response_prevalidate_ssl_le_certificate(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.prevalidate_ssl_le_certificate( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert resource is None + + @parametrize + def test_streaming_response_prevalidate_ssl_le_certificate(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.prevalidate_ssl_le_certificate( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_purge_overload_1(self, client: Gcore) -> None: + resource = client.cdn.resources.purge( + resource_id=0, + ) + assert resource is None + + @parametrize + def test_method_purge_with_all_params_overload_1(self, client: Gcore) -> None: + resource = client.cdn.resources.purge( + resource_id=0, + urls=["string"], + ) + assert resource is None + + @parametrize + def test_raw_response_purge_overload_1(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.purge( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert resource is None + + @parametrize + def test_streaming_response_purge_overload_1(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.purge( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_purge_overload_2(self, client: Gcore) -> None: + resource = client.cdn.resources.purge( + resource_id=0, + ) + assert resource is None + + @parametrize + def test_method_purge_with_all_params_overload_2(self, client: Gcore) -> None: + resource = client.cdn.resources.purge( + resource_id=0, + paths=["string"], + ) + assert resource is None + + @parametrize + def test_raw_response_purge_overload_2(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.purge( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert resource is None + + @parametrize + def test_streaming_response_purge_overload_2(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.purge( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_purge_overload_3(self, client: Gcore) -> None: + resource = client.cdn.resources.purge( + resource_id=0, + ) + assert resource is None + + @parametrize + def test_method_purge_with_all_params_overload_3(self, client: Gcore) -> None: + resource = client.cdn.resources.purge( + resource_id=0, + paths=["string"], + ) + assert resource is None + + @parametrize + def test_raw_response_purge_overload_3(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.purge( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert resource is None + + @parametrize + def test_streaming_response_purge_overload_3(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.purge( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + resource = client.cdn.resources.replace( + resource_id=0, + origin_group=132, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + resource = client.cdn.resources.replace( + resource_id=0, + origin_group=132, + active=True, + description="My resource", + name="Resource for images", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "http3_enabled": { + "enabled": True, + "value": True, + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "tls_versions": { + "enabled": True, + "value": ["SSLv3", "TLSv1.3"], + }, + "use_default_le_chain": { + "enabled": True, + "value": True, + }, + "use_dns01_le_challenge": { + "enabled": True, + "value": True, + }, + "use_rsa_le_cert": { + "enabled": True, + "value": True, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_protocol="HTTPS", + proxy_ssl_ca=None, + proxy_ssl_data=None, + proxy_ssl_enabled=False, + secondary_hostnames=["first.example.com", "second.example.com"], + ssl_data=192, + ssl_enabled=False, + waap_api_domain_enabled=True, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.resources.with_raw_response.replace( + resource_id=0, + origin_group=132, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.resources.with_streaming_response.replace( + resource_id=0, + origin_group=132, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncResources: + 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: + resource = await async_client.cdn.resources.create( + cname="cdn.site.com", + origin="example.com", + origin_group=132, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.create( + cname="cdn.site.com", + origin="example.com", + origin_group=132, + active=True, + description="My resource", + name="Resource for images", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "http3_enabled": { + "enabled": True, + "value": True, + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "tls_versions": { + "enabled": True, + "value": ["SSLv3", "TLSv1.3"], + }, + "use_default_le_chain": { + "enabled": True, + "value": True, + }, + "use_dns01_le_challenge": { + "enabled": True, + "value": True, + }, + "use_rsa_le_cert": { + "enabled": True, + "value": True, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_protocol="HTTPS", + primary_resource=None, + proxy_ssl_ca=None, + proxy_ssl_data=None, + proxy_ssl_enabled=False, + secondary_hostnames=["first.example.com", "second.example.com"], + ssl_data=192, + ssl_enabled=False, + waap_api_domain_enabled=True, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.create( + cname="cdn.site.com", + origin="example.com", + origin_group=132, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.create( + cname="cdn.site.com", + origin="example.com", + origin_group=132, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="unexpected prism python test failures") + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.update( + resource_id=0, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @pytest.mark.skip(reason="unexpected prism python test failures") + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.update( + resource_id=0, + active=True, + description="My resource", + name="Resource for images", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "http3_enabled": { + "enabled": True, + "value": True, + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "tls_versions": { + "enabled": True, + "value": ["SSLv3", "TLSv1.3"], + }, + "use_default_le_chain": { + "enabled": True, + "value": True, + }, + "use_dns01_le_challenge": { + "enabled": True, + "value": True, + }, + "use_rsa_le_cert": { + "enabled": True, + "value": True, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_group=132, + origin_protocol="HTTPS", + proxy_ssl_ca=None, + proxy_ssl_data=None, + proxy_ssl_enabled=False, + secondary_hostnames=["first.example.com", "second.example.com"], + ssl_data=192, + ssl_enabled=False, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @pytest.mark.skip(reason="unexpected prism python test failures") + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.update( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + @pytest.mark.skip(reason="unexpected prism python test failures") + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.update( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.list() + assert_matches_type(CdnResourceList, resource, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.list( + cname="cname", + deleted=True, + enabled=True, + max_created="max_created", + min_created="min_created", + origin_group=0, + rules="rules", + secondary_hostnames="secondaryHostnames", + shield_dc="shield_dc", + shielded=True, + ssl_data=0, + ssl_data_in=0, + ssl_enabled=True, + status="active", + suspend=True, + vp_enabled=True, + ) + assert_matches_type(CdnResourceList, resource, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert_matches_type(CdnResourceList, resource, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert_matches_type(CdnResourceList, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.delete( + 0, + ) + assert resource is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert resource is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.get( + 0, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_prefetch(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.prefetch( + resource_id=0, + paths=["/test.jpg", "test1.jpg"], + ) + assert resource is None + + @parametrize + async def test_raw_response_prefetch(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.prefetch( + resource_id=0, + paths=["/test.jpg", "test1.jpg"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert resource is None + + @parametrize + async def test_streaming_response_prefetch(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.prefetch( + resource_id=0, + paths=["/test.jpg", "test1.jpg"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_prevalidate_ssl_le_certificate(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.prevalidate_ssl_le_certificate( + 0, + ) + assert resource is None + + @parametrize + async def test_raw_response_prevalidate_ssl_le_certificate(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.prevalidate_ssl_le_certificate( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert resource is None + + @parametrize + async def test_streaming_response_prevalidate_ssl_le_certificate(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.prevalidate_ssl_le_certificate( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_purge_overload_1(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.purge( + resource_id=0, + ) + assert resource is None + + @parametrize + async def test_method_purge_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.purge( + resource_id=0, + urls=["string"], + ) + assert resource is None + + @parametrize + async def test_raw_response_purge_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.purge( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert resource is None + + @parametrize + async def test_streaming_response_purge_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.purge( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_purge_overload_2(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.purge( + resource_id=0, + ) + assert resource is None + + @parametrize + async def test_method_purge_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.purge( + resource_id=0, + paths=["string"], + ) + assert resource is None + + @parametrize + async def test_raw_response_purge_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.purge( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert resource is None + + @parametrize + async def test_streaming_response_purge_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.purge( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_purge_overload_3(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.purge( + resource_id=0, + ) + assert resource is None + + @parametrize + async def test_method_purge_with_all_params_overload_3(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.purge( + resource_id=0, + paths=["string"], + ) + assert resource is None + + @parametrize + async def test_raw_response_purge_overload_3(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.purge( + resource_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert resource is None + + @parametrize + async def test_streaming_response_purge_overload_3(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.purge( + resource_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert resource is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.replace( + resource_id=0, + origin_group=132, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + resource = await async_client.cdn.resources.replace( + resource_id=0, + origin_group=132, + active=True, + description="My resource", + name="Resource for images", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "http3_enabled": { + "enabled": True, + "value": True, + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "tls_versions": { + "enabled": True, + "value": ["SSLv3", "TLSv1.3"], + }, + "use_default_le_chain": { + "enabled": True, + "value": True, + }, + "use_dns01_le_challenge": { + "enabled": True, + "value": True, + }, + "use_rsa_le_cert": { + "enabled": True, + "value": True, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + origin_protocol="HTTPS", + proxy_ssl_ca=None, + proxy_ssl_data=None, + proxy_ssl_enabled=False, + secondary_hostnames=["first.example.com", "second.example.com"], + ssl_data=192, + ssl_enabled=False, + waap_api_domain_enabled=True, + ) + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.resources.with_raw_response.replace( + resource_id=0, + origin_group=132, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource = await response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.resources.with_streaming_response.replace( + resource_id=0, + origin_group=132, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource = await response.parse() + assert_matches_type(CdnResource, resource, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_rule_templates.py b/tests/api_resources/cdn/test_rule_templates.py new file mode 100644 index 00000000..7f1d616d --- /dev/null +++ b/tests/api_resources/cdn/test_rule_templates.py @@ -0,0 +1,2035 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import ( + RuleTemplate, + RuleTemplateList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRuleTemplates: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.create( + rule="/folder/images/*.png", + rule_type=0, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.create( + rule="/folder/images/*.png", + rule_type=0, + name="All images template", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + override_origin_protocol="HTTPS", + weight=1, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cdn.rule_templates.with_raw_response.create( + rule="/folder/images/*.png", + rule_type=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cdn.rule_templates.with_streaming_response.create( + rule="/folder/images/*.png", + rule_type=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.update( + rule_template_id=0, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.update( + rule_template_id=0, + name="All images template", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + override_origin_protocol="HTTPS", + rule="/folder/images/*.png", + rule_type=0, + weight=1, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Gcore) -> None: + response = client.cdn.rule_templates.with_raw_response.update( + rule_template_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Gcore) -> None: + with client.cdn.rule_templates.with_streaming_response.update( + rule_template_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.list() + assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.rule_templates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = response.parse() + assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.rule_templates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = response.parse() + assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.delete( + 0, + ) + assert rule_template is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.rule_templates.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = response.parse() + assert rule_template is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.rule_templates.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = response.parse() + assert rule_template is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.get( + 0, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.rule_templates.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.rule_templates.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.replace( + rule_template_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + rule_template = client.cdn.rule_templates.replace( + rule_template_id=0, + rule="/folder/images/*.png", + rule_type=0, + name="All images template", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + override_origin_protocol="HTTPS", + weight=1, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.rule_templates.with_raw_response.replace( + rule_template_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.rule_templates.with_streaming_response.replace( + rule_template_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncRuleTemplates: + 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: + rule_template = await async_client.cdn.rule_templates.create( + rule="/folder/images/*.png", + rule_type=0, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.create( + rule="/folder/images/*.png", + rule_type=0, + name="All images template", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + override_origin_protocol="HTTPS", + weight=1, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.rule_templates.with_raw_response.create( + rule="/folder/images/*.png", + rule_type=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = await response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.rule_templates.with_streaming_response.create( + rule="/folder/images/*.png", + rule_type=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = await response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.update( + rule_template_id=0, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.update( + rule_template_id=0, + name="All images template", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + override_origin_protocol="HTTPS", + rule="/folder/images/*.png", + rule_type=0, + weight=1, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.rule_templates.with_raw_response.update( + rule_template_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = await response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.rule_templates.with_streaming_response.update( + rule_template_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = await response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.list() + assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.rule_templates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = await response.parse() + assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.rule_templates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = await response.parse() + assert_matches_type(RuleTemplateList, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.delete( + 0, + ) + assert rule_template is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.rule_templates.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = await response.parse() + assert rule_template is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.rule_templates.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = await response.parse() + assert rule_template is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.get( + 0, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.rule_templates.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = await response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.rule_templates.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = await response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.replace( + rule_template_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + rule_template = await async_client.cdn.rule_templates.replace( + rule_template_id=0, + rule="/folder/images/*.png", + rule_type=0, + name="All images template", + options={ + "allowed_http_methods": { + "enabled": True, + "value": ["GET", "POST"], + }, + "bot_protection": { + "bot_challenge": {"enabled": True}, + "enabled": True, + }, + "brotli_compression": { + "enabled": True, + "value": ["text/html", "text/plain"], + }, + "browser_cache_settings": { + "enabled": True, + "value": "3600s", + }, + "cache_http_headers": { + "enabled": False, + "value": [ + "vary", + "content-length", + "last-modified", + "connection", + "accept-ranges", + "content-type", + "content-encoding", + "etag", + "cache-control", + "expires", + "keep-alive", + "server", + ], + }, + "cors": { + "enabled": True, + "value": ["domain.com", "domain2.com"], + "always": True, + }, + "country_acl": { + "enabled": True, + "excepted_values": ["GB", "DE"], + "policy_type": "allow", + }, + "disable_cache": { + "enabled": True, + "value": False, + }, + "disable_proxy_force_ranges": { + "enabled": True, + "value": True, + }, + "edge_cache_settings": { + "enabled": True, + "custom_values": {"100": "43200s"}, + "default": "321669910225", + "value": "43200s", + }, + "fastedge": { + "enabled": True, + "on_request_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_request_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_body": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + "on_response_headers": { + "app_id": "1001", + "enabled": True, + "execute_on_edge": True, + "execute_on_shield": False, + "interrupt_on_error": True, + }, + }, + "fetch_compressed": { + "enabled": True, + "value": False, + }, + "follow_origin_redirect": { + "codes": [302, 308], + "enabled": True, + }, + "force_return": { + "body": "body", + "code": 100, + "enabled": True, + "time_interval": { + "end_time": "18:11:19.117Z", + "start_time": "18:11:19.117Z", + "time_zone": "Europe/Luxembourg", + }, + }, + "forward_host_header": { + "enabled": False, + "value": False, + }, + "gzip_on": { + "enabled": True, + "value": True, + }, + "host_header": { + "enabled": True, + "value": "host.com", + }, + "ignore_cookie": { + "enabled": True, + "value": True, + }, + "ignore_query_string": { + "enabled": True, + "value": False, + }, + "image_stack": { + "enabled": True, + "avif_enabled": True, + "png_lossless": True, + "quality": 80, + "webp_enabled": False, + }, + "ip_address_acl": { + "enabled": True, + "excepted_values": ["192.168.1.100/32"], + "policy_type": "deny", + }, + "limit_bandwidth": { + "enabled": True, + "limit_type": "static", + "buffer": 200, + "speed": 100, + }, + "proxy_cache_key": { + "enabled": True, + "value": "$scheme$uri", + }, + "proxy_cache_methods_set": { + "enabled": True, + "value": False, + }, + "proxy_connect_timeout": { + "enabled": True, + "value": "4s", + }, + "proxy_read_timeout": { + "enabled": True, + "value": "10s", + }, + "query_params_blacklist": { + "enabled": True, + "value": ["some", "blacklisted", "query"], + }, + "query_params_whitelist": { + "enabled": True, + "value": ["some", "whitelisted", "query"], + }, + "query_string_forwarding": { + "enabled": True, + "forward_from_file_types": ["m3u8", "mpd"], + "forward_to_file_types": ["ts", "mp4"], + }, + "redirect_http_to_https": { + "enabled": True, + "value": True, + }, + "redirect_https_to_http": { + "enabled": False, + "value": True, + }, + "referrer_acl": { + "enabled": True, + "excepted_values": ["example.com", "*.example.net"], + "policy_type": "deny", + }, + "request_limiter": { + "enabled": True, + "rate": 5, + "rate_unit": "r/s", + }, + "response_headers_hiding_policy": { + "enabled": True, + "excepted": ["my-header"], + "mode": "hide", + }, + "rewrite": { + "body": "/(.*) /additional_path/$1", + "enabled": True, + "flag": "break", + }, + "secure_key": { + "enabled": True, + "key": "secretkey", + "type": 2, + }, + "slice": { + "enabled": True, + "value": True, + }, + "sni": { + "custom_hostname": "custom.example.com", + "enabled": True, + "sni_type": "custom", + }, + "stale": { + "enabled": True, + "value": ["http_404", "http_500"], + }, + "static_response_headers": { + "enabled": True, + "value": [ + { + "name": "X-Example", + "value": ["Value_1"], + "always": True, + }, + { + "name": "X-Example-Multiple", + "value": ["Value_1", "Value_2", "Value_3"], + "always": False, + }, + ], + }, + "static_headers": { + "enabled": True, + "value": {"foo": "string"}, + }, + "static_request_headers": { + "enabled": True, + "value": { + "Header-One": "Value 1", + "Header-Two": "Value 2", + }, + }, + "user_agent_acl": { + "enabled": True, + "excepted_values": ["UserAgent Value", ""], + "policy_type": "allow", + }, + "waap": { + "enabled": True, + "value": True, + }, + "websockets": { + "enabled": True, + "value": True, + }, + }, + override_origin_protocol="HTTPS", + weight=1, + ) + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.rule_templates.with_raw_response.replace( + rule_template_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule_template = await response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.rule_templates.with_streaming_response.replace( + rule_template_id=0, + rule="/folder/images/*.png", + rule_type=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule_template = await response.parse() + assert_matches_type(RuleTemplate, rule_template, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_shields.py b/tests/api_resources/cdn/test_shields.py new file mode 100644 index 00000000..0600aa49 --- /dev/null +++ b/tests/api_resources/cdn/test_shields.py @@ -0,0 +1,74 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import ShieldListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestShields: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Gcore) -> None: + shield = client.cdn.shields.list() + assert_matches_type(ShieldListResponse, shield, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.shields.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + shield = response.parse() + assert_matches_type(ShieldListResponse, shield, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.shields.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + shield = response.parse() + assert_matches_type(ShieldListResponse, shield, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncShields: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + shield = await async_client.cdn.shields.list() + assert_matches_type(ShieldListResponse, shield, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.shields.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + shield = await response.parse() + assert_matches_type(ShieldListResponse, shield, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.shields.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + shield = await response.parse() + assert_matches_type(ShieldListResponse, shield, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_statistics.py b/tests/api_resources/cdn/test_statistics.py new file mode 100644 index 00000000..3aca8e28 --- /dev/null +++ b/tests/api_resources/cdn/test_statistics.py @@ -0,0 +1,608 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import ( + UsageSeriesStats, + ResourceUsageStats, + LogsAggregatedStats, + ShieldAggregatedStats, + ResourceAggregatedStats, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestStatistics: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_logs_usage_aggregated(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_logs_usage_aggregated( + from_="from", + to="to", + ) + assert_matches_type(LogsAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_method_get_logs_usage_aggregated_with_all_params(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_logs_usage_aggregated( + from_="from", + to="to", + flat=True, + group_by="group_by", + resource=0, + ) + assert_matches_type(LogsAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_logs_usage_aggregated(self, client: Gcore) -> None: + response = client.cdn.statistics.with_raw_response.get_logs_usage_aggregated( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(LogsAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_logs_usage_aggregated(self, client: Gcore) -> None: + with client.cdn.statistics.with_streaming_response.get_logs_usage_aggregated( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(LogsAggregatedStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_logs_usage_series(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_logs_usage_series( + from_="from", + to="to", + ) + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + def test_method_get_logs_usage_series_with_all_params(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_logs_usage_series( + from_="from", + to="to", + resource=0, + ) + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_logs_usage_series(self, client: Gcore) -> None: + response = client.cdn.statistics.with_raw_response.get_logs_usage_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_logs_usage_series(self, client: Gcore) -> None: + with client.cdn.statistics.with_streaming_response.get_logs_usage_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_resource_usage_aggregated(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_resource_usage_aggregated( + from_="from", + metrics="metrics", + service="service", + to="to", + ) + assert_matches_type(ResourceAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_method_get_resource_usage_aggregated_with_all_params(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_resource_usage_aggregated( + from_="from", + metrics="metrics", + service="service", + to="to", + countries="countries", + flat=True, + group_by="group_by", + regions="regions", + resource=0, + ) + assert_matches_type(ResourceAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_resource_usage_aggregated(self, client: Gcore) -> None: + response = client.cdn.statistics.with_raw_response.get_resource_usage_aggregated( + from_="from", + metrics="metrics", + service="service", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(ResourceAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_resource_usage_aggregated(self, client: Gcore) -> None: + with client.cdn.statistics.with_streaming_response.get_resource_usage_aggregated( + from_="from", + metrics="metrics", + service="service", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(ResourceAggregatedStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_resource_usage_series(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_resource_usage_series( + from_="from", + granularity="granularity", + metrics="metrics", + service="service", + to="to", + ) + assert_matches_type(ResourceUsageStats, statistic, path=["response"]) + + @parametrize + def test_method_get_resource_usage_series_with_all_params(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_resource_usage_series( + from_="from", + granularity="granularity", + metrics="metrics", + service="service", + to="to", + countries="countries", + group_by="group_by", + regions="regions", + resource=0, + ) + assert_matches_type(ResourceUsageStats, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_resource_usage_series(self, client: Gcore) -> None: + response = client.cdn.statistics.with_raw_response.get_resource_usage_series( + from_="from", + granularity="granularity", + metrics="metrics", + service="service", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(ResourceUsageStats, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_resource_usage_series(self, client: Gcore) -> None: + with client.cdn.statistics.with_streaming_response.get_resource_usage_series( + from_="from", + granularity="granularity", + metrics="metrics", + service="service", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(ResourceUsageStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_shield_usage_aggregated(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_shield_usage_aggregated( + from_="from", + to="to", + ) + assert_matches_type(ShieldAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_method_get_shield_usage_aggregated_with_all_params(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_shield_usage_aggregated( + from_="from", + to="to", + flat=True, + group_by="group_by", + resource=0, + ) + assert_matches_type(ShieldAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_shield_usage_aggregated(self, client: Gcore) -> None: + response = client.cdn.statistics.with_raw_response.get_shield_usage_aggregated( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(ShieldAggregatedStats, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_shield_usage_aggregated(self, client: Gcore) -> None: + with client.cdn.statistics.with_streaming_response.get_shield_usage_aggregated( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(ShieldAggregatedStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_shield_usage_series(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_shield_usage_series( + from_="from", + to="to", + ) + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + def test_method_get_shield_usage_series_with_all_params(self, client: Gcore) -> None: + statistic = client.cdn.statistics.get_shield_usage_series( + from_="from", + to="to", + resource=0, + ) + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + def test_raw_response_get_shield_usage_series(self, client: Gcore) -> None: + response = client.cdn.statistics.with_raw_response.get_shield_usage_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = response.parse() + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + def test_streaming_response_get_shield_usage_series(self, client: Gcore) -> None: + with client.cdn.statistics.with_streaming_response.get_shield_usage_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = response.parse() + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncStatistics: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_get_logs_usage_aggregated(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_logs_usage_aggregated( + from_="from", + to="to", + ) + assert_matches_type(LogsAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_method_get_logs_usage_aggregated_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_logs_usage_aggregated( + from_="from", + to="to", + flat=True, + group_by="group_by", + resource=0, + ) + assert_matches_type(LogsAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_logs_usage_aggregated(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.statistics.with_raw_response.get_logs_usage_aggregated( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(LogsAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_logs_usage_aggregated(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.statistics.with_streaming_response.get_logs_usage_aggregated( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(LogsAggregatedStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_logs_usage_series(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_logs_usage_series( + from_="from", + to="to", + ) + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + async def test_method_get_logs_usage_series_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_logs_usage_series( + from_="from", + to="to", + resource=0, + ) + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_logs_usage_series(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.statistics.with_raw_response.get_logs_usage_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_logs_usage_series(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.statistics.with_streaming_response.get_logs_usage_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_resource_usage_aggregated(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_resource_usage_aggregated( + from_="from", + metrics="metrics", + service="service", + to="to", + ) + assert_matches_type(ResourceAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_method_get_resource_usage_aggregated_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_resource_usage_aggregated( + from_="from", + metrics="metrics", + service="service", + to="to", + countries="countries", + flat=True, + group_by="group_by", + regions="regions", + resource=0, + ) + assert_matches_type(ResourceAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_resource_usage_aggregated(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.statistics.with_raw_response.get_resource_usage_aggregated( + from_="from", + metrics="metrics", + service="service", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(ResourceAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_resource_usage_aggregated(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.statistics.with_streaming_response.get_resource_usage_aggregated( + from_="from", + metrics="metrics", + service="service", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(ResourceAggregatedStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_resource_usage_series(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_resource_usage_series( + from_="from", + granularity="granularity", + metrics="metrics", + service="service", + to="to", + ) + assert_matches_type(ResourceUsageStats, statistic, path=["response"]) + + @parametrize + async def test_method_get_resource_usage_series_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_resource_usage_series( + from_="from", + granularity="granularity", + metrics="metrics", + service="service", + to="to", + countries="countries", + group_by="group_by", + regions="regions", + resource=0, + ) + assert_matches_type(ResourceUsageStats, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_resource_usage_series(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.statistics.with_raw_response.get_resource_usage_series( + from_="from", + granularity="granularity", + metrics="metrics", + service="service", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(ResourceUsageStats, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_resource_usage_series(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.statistics.with_streaming_response.get_resource_usage_series( + from_="from", + granularity="granularity", + metrics="metrics", + service="service", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(ResourceUsageStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_shield_usage_aggregated(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_shield_usage_aggregated( + from_="from", + to="to", + ) + assert_matches_type(ShieldAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_method_get_shield_usage_aggregated_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_shield_usage_aggregated( + from_="from", + to="to", + flat=True, + group_by="group_by", + resource=0, + ) + assert_matches_type(ShieldAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_shield_usage_aggregated(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.statistics.with_raw_response.get_shield_usage_aggregated( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(ShieldAggregatedStats, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_shield_usage_aggregated(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.statistics.with_streaming_response.get_shield_usage_aggregated( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(ShieldAggregatedStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_shield_usage_series(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_shield_usage_series( + from_="from", + to="to", + ) + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + async def test_method_get_shield_usage_series_with_all_params(self, async_client: AsyncGcore) -> None: + statistic = await async_client.cdn.statistics.get_shield_usage_series( + from_="from", + to="to", + resource=0, + ) + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + async def test_raw_response_get_shield_usage_series(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.statistics.with_raw_response.get_shield_usage_series( + from_="from", + to="to", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + statistic = await response.parse() + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + @parametrize + async def test_streaming_response_get_shield_usage_series(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.statistics.with_streaming_response.get_shield_usage_series( + from_="from", + to="to", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + statistic = await response.parse() + assert_matches_type(UsageSeriesStats, statistic, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cdn/test_trusted_ca_certificates.py b/tests/api_resources/cdn/test_trusted_ca_certificates.py new file mode 100644 index 00000000..0d0df832 --- /dev/null +++ b/tests/api_resources/cdn/test_trusted_ca_certificates.py @@ -0,0 +1,355 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import ( + CaCertificate, + CaCertificateList, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTrustedCaCertificates: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + trusted_ca_certificate = client.cdn.trusted_ca_certificates.create( + name="Example CA cert", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIC0zCCAbugAwIBAgICA+gwDQYJKoZIhvcNAQELBQAwFjEUMBIGA1UEAwwLZXhh\nbXBsZS5jb20wHhcNMjAwNjI2MTIwMzUzWhcNMjEwNjI2MTIwMzUzWjAWMRQwEgYD\nVQQDDAtleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\nAN4nnSfTsMEnfPgL7rkbImxZAQoND+bpPoX8q16iXZz3fFfqdRk+uEIpU3Brleeg\np0zrrT2eI3+c2h/PRod0Fam4TO6EcfwuboUFzV3j6yw6aWdfBjWZsWBR/FoqWLYq\nb3UejN7yiTYNSiIy3zVpi9pnFM8N8qT+VGBrRDGef2v9JCzhsSSU7wAYM5HKZTp+\nWHojjiyB2hOYqft7A2WlTEDmHFa5UcPHMRZKATUYI1T2TRVqLlSiE2mJ3dFRXGM2\nZAS33J0NVUjkx3w8RmJ7DNflEFJt/6IXdfaokVgfza7LFarrQFQP/YURXEeJT7jm\nDvKpZ/a8wu3ve6N4ykC+CBsCAwEAAaMrMCkwDwYDVR0TBAgwBgEB/wIBADAWBgNV\nHREEDzANggtleGFtcGxlLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAovxY5lm89Eod\nL8CH3dZzIH7nv8MXtwgpv2vth4PDq2btLS8xrqm2SsA/cV+DsbDjh5CxQLoDX+8V\ng8NtY+ipOE0hdJAUo7UVlsxuAY4frkmLL1/RwpjZg+Z2NAxpR7xGWgoMn7CH481w\nAOBypAuCxcfcyyAOttdS+YMRJnpL6z8/C3W0LGkNOs26Qhu1/U8lfz1f9F4XummD\nu2SCmJsAd1PrL1shsyh4HtmFjuY698aTjYUDUleAnx7ytrGlZuLOIeoQi7tcsLJJ\nTPMbxTLgGN2HEkdJerFRBNViuWvqioEyYlzZ3MshOCR2wsL4wrXrCF0Y3cNOYcIh\nZ8z+wUAP2g==\n-----END CERTIFICATE-----\n", + ) + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cdn.trusted_ca_certificates.with_raw_response.create( + name="Example CA cert", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIC0zCCAbugAwIBAgICA+gwDQYJKoZIhvcNAQELBQAwFjEUMBIGA1UEAwwLZXhh\nbXBsZS5jb20wHhcNMjAwNjI2MTIwMzUzWhcNMjEwNjI2MTIwMzUzWjAWMRQwEgYD\nVQQDDAtleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\nAN4nnSfTsMEnfPgL7rkbImxZAQoND+bpPoX8q16iXZz3fFfqdRk+uEIpU3Brleeg\np0zrrT2eI3+c2h/PRod0Fam4TO6EcfwuboUFzV3j6yw6aWdfBjWZsWBR/FoqWLYq\nb3UejN7yiTYNSiIy3zVpi9pnFM8N8qT+VGBrRDGef2v9JCzhsSSU7wAYM5HKZTp+\nWHojjiyB2hOYqft7A2WlTEDmHFa5UcPHMRZKATUYI1T2TRVqLlSiE2mJ3dFRXGM2\nZAS33J0NVUjkx3w8RmJ7DNflEFJt/6IXdfaokVgfza7LFarrQFQP/YURXEeJT7jm\nDvKpZ/a8wu3ve6N4ykC+CBsCAwEAAaMrMCkwDwYDVR0TBAgwBgEB/wIBADAWBgNV\nHREEDzANggtleGFtcGxlLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAovxY5lm89Eod\nL8CH3dZzIH7nv8MXtwgpv2vth4PDq2btLS8xrqm2SsA/cV+DsbDjh5CxQLoDX+8V\ng8NtY+ipOE0hdJAUo7UVlsxuAY4frkmLL1/RwpjZg+Z2NAxpR7xGWgoMn7CH481w\nAOBypAuCxcfcyyAOttdS+YMRJnpL6z8/C3W0LGkNOs26Qhu1/U8lfz1f9F4XummD\nu2SCmJsAd1PrL1shsyh4HtmFjuY698aTjYUDUleAnx7ytrGlZuLOIeoQi7tcsLJJ\nTPMbxTLgGN2HEkdJerFRBNViuWvqioEyYlzZ3MshOCR2wsL4wrXrCF0Y3cNOYcIh\nZ8z+wUAP2g==\n-----END CERTIFICATE-----\n", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cdn.trusted_ca_certificates.with_streaming_response.create( + name="Example CA cert", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIC0zCCAbugAwIBAgICA+gwDQYJKoZIhvcNAQELBQAwFjEUMBIGA1UEAwwLZXhh\nbXBsZS5jb20wHhcNMjAwNjI2MTIwMzUzWhcNMjEwNjI2MTIwMzUzWjAWMRQwEgYD\nVQQDDAtleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\nAN4nnSfTsMEnfPgL7rkbImxZAQoND+bpPoX8q16iXZz3fFfqdRk+uEIpU3Brleeg\np0zrrT2eI3+c2h/PRod0Fam4TO6EcfwuboUFzV3j6yw6aWdfBjWZsWBR/FoqWLYq\nb3UejN7yiTYNSiIy3zVpi9pnFM8N8qT+VGBrRDGef2v9JCzhsSSU7wAYM5HKZTp+\nWHojjiyB2hOYqft7A2WlTEDmHFa5UcPHMRZKATUYI1T2TRVqLlSiE2mJ3dFRXGM2\nZAS33J0NVUjkx3w8RmJ7DNflEFJt/6IXdfaokVgfza7LFarrQFQP/YURXEeJT7jm\nDvKpZ/a8wu3ve6N4ykC+CBsCAwEAAaMrMCkwDwYDVR0TBAgwBgEB/wIBADAWBgNV\nHREEDzANggtleGFtcGxlLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAovxY5lm89Eod\nL8CH3dZzIH7nv8MXtwgpv2vth4PDq2btLS8xrqm2SsA/cV+DsbDjh5CxQLoDX+8V\ng8NtY+ipOE0hdJAUo7UVlsxuAY4frkmLL1/RwpjZg+Z2NAxpR7xGWgoMn7CH481w\nAOBypAuCxcfcyyAOttdS+YMRJnpL6z8/C3W0LGkNOs26Qhu1/U8lfz1f9F4XummD\nu2SCmJsAd1PrL1shsyh4HtmFjuY698aTjYUDUleAnx7ytrGlZuLOIeoQi7tcsLJJ\nTPMbxTLgGN2HEkdJerFRBNViuWvqioEyYlzZ3MshOCR2wsL4wrXrCF0Y3cNOYcIh\nZ8z+wUAP2g==\n-----END CERTIFICATE-----\n", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + trusted_ca_certificate = client.cdn.trusted_ca_certificates.list() + assert_matches_type(CaCertificateList, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + trusted_ca_certificate = client.cdn.trusted_ca_certificates.list( + automated=True, + resource_id=0, + validity_not_after_lte="validity_not_after_lte", + ) + assert_matches_type(CaCertificateList, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.cdn.trusted_ca_certificates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = response.parse() + assert_matches_type(CaCertificateList, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.cdn.trusted_ca_certificates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = response.parse() + assert_matches_type(CaCertificateList, trusted_ca_certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + trusted_ca_certificate = client.cdn.trusted_ca_certificates.delete( + 0, + ) + assert trusted_ca_certificate is None + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cdn.trusted_ca_certificates.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = response.parse() + assert trusted_ca_certificate is None + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cdn.trusted_ca_certificates.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = response.parse() + assert trusted_ca_certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + trusted_ca_certificate = client.cdn.trusted_ca_certificates.get( + 0, + ) + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.cdn.trusted_ca_certificates.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.cdn.trusted_ca_certificates.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + trusted_ca_certificate = client.cdn.trusted_ca_certificates.replace( + id=0, + name="Example CA cert 2", + ) + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.cdn.trusted_ca_certificates.with_raw_response.replace( + id=0, + name="Example CA cert 2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.cdn.trusted_ca_certificates.with_streaming_response.replace( + id=0, + name="Example CA cert 2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncTrustedCaCertificates: + 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: + trusted_ca_certificate = await async_client.cdn.trusted_ca_certificates.create( + name="Example CA cert", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIC0zCCAbugAwIBAgICA+gwDQYJKoZIhvcNAQELBQAwFjEUMBIGA1UEAwwLZXhh\nbXBsZS5jb20wHhcNMjAwNjI2MTIwMzUzWhcNMjEwNjI2MTIwMzUzWjAWMRQwEgYD\nVQQDDAtleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\nAN4nnSfTsMEnfPgL7rkbImxZAQoND+bpPoX8q16iXZz3fFfqdRk+uEIpU3Brleeg\np0zrrT2eI3+c2h/PRod0Fam4TO6EcfwuboUFzV3j6yw6aWdfBjWZsWBR/FoqWLYq\nb3UejN7yiTYNSiIy3zVpi9pnFM8N8qT+VGBrRDGef2v9JCzhsSSU7wAYM5HKZTp+\nWHojjiyB2hOYqft7A2WlTEDmHFa5UcPHMRZKATUYI1T2TRVqLlSiE2mJ3dFRXGM2\nZAS33J0NVUjkx3w8RmJ7DNflEFJt/6IXdfaokVgfza7LFarrQFQP/YURXEeJT7jm\nDvKpZ/a8wu3ve6N4ykC+CBsCAwEAAaMrMCkwDwYDVR0TBAgwBgEB/wIBADAWBgNV\nHREEDzANggtleGFtcGxlLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAovxY5lm89Eod\nL8CH3dZzIH7nv8MXtwgpv2vth4PDq2btLS8xrqm2SsA/cV+DsbDjh5CxQLoDX+8V\ng8NtY+ipOE0hdJAUo7UVlsxuAY4frkmLL1/RwpjZg+Z2NAxpR7xGWgoMn7CH481w\nAOBypAuCxcfcyyAOttdS+YMRJnpL6z8/C3W0LGkNOs26Qhu1/U8lfz1f9F4XummD\nu2SCmJsAd1PrL1shsyh4HtmFjuY698aTjYUDUleAnx7ytrGlZuLOIeoQi7tcsLJJ\nTPMbxTLgGN2HEkdJerFRBNViuWvqioEyYlzZ3MshOCR2wsL4wrXrCF0Y3cNOYcIh\nZ8z+wUAP2g==\n-----END CERTIFICATE-----\n", + ) + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.trusted_ca_certificates.with_raw_response.create( + name="Example CA cert", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIC0zCCAbugAwIBAgICA+gwDQYJKoZIhvcNAQELBQAwFjEUMBIGA1UEAwwLZXhh\nbXBsZS5jb20wHhcNMjAwNjI2MTIwMzUzWhcNMjEwNjI2MTIwMzUzWjAWMRQwEgYD\nVQQDDAtleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\nAN4nnSfTsMEnfPgL7rkbImxZAQoND+bpPoX8q16iXZz3fFfqdRk+uEIpU3Brleeg\np0zrrT2eI3+c2h/PRod0Fam4TO6EcfwuboUFzV3j6yw6aWdfBjWZsWBR/FoqWLYq\nb3UejN7yiTYNSiIy3zVpi9pnFM8N8qT+VGBrRDGef2v9JCzhsSSU7wAYM5HKZTp+\nWHojjiyB2hOYqft7A2WlTEDmHFa5UcPHMRZKATUYI1T2TRVqLlSiE2mJ3dFRXGM2\nZAS33J0NVUjkx3w8RmJ7DNflEFJt/6IXdfaokVgfza7LFarrQFQP/YURXEeJT7jm\nDvKpZ/a8wu3ve6N4ykC+CBsCAwEAAaMrMCkwDwYDVR0TBAgwBgEB/wIBADAWBgNV\nHREEDzANggtleGFtcGxlLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAovxY5lm89Eod\nL8CH3dZzIH7nv8MXtwgpv2vth4PDq2btLS8xrqm2SsA/cV+DsbDjh5CxQLoDX+8V\ng8NtY+ipOE0hdJAUo7UVlsxuAY4frkmLL1/RwpjZg+Z2NAxpR7xGWgoMn7CH481w\nAOBypAuCxcfcyyAOttdS+YMRJnpL6z8/C3W0LGkNOs26Qhu1/U8lfz1f9F4XummD\nu2SCmJsAd1PrL1shsyh4HtmFjuY698aTjYUDUleAnx7ytrGlZuLOIeoQi7tcsLJJ\nTPMbxTLgGN2HEkdJerFRBNViuWvqioEyYlzZ3MshOCR2wsL4wrXrCF0Y3cNOYcIh\nZ8z+wUAP2g==\n-----END CERTIFICATE-----\n", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = await response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.trusted_ca_certificates.with_streaming_response.create( + name="Example CA cert", + ssl_certificate="-----BEGIN CERTIFICATE-----\nMIIC0zCCAbugAwIBAgICA+gwDQYJKoZIhvcNAQELBQAwFjEUMBIGA1UEAwwLZXhh\nbXBsZS5jb20wHhcNMjAwNjI2MTIwMzUzWhcNMjEwNjI2MTIwMzUzWjAWMRQwEgYD\nVQQDDAtleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\nAN4nnSfTsMEnfPgL7rkbImxZAQoND+bpPoX8q16iXZz3fFfqdRk+uEIpU3Brleeg\np0zrrT2eI3+c2h/PRod0Fam4TO6EcfwuboUFzV3j6yw6aWdfBjWZsWBR/FoqWLYq\nb3UejN7yiTYNSiIy3zVpi9pnFM8N8qT+VGBrRDGef2v9JCzhsSSU7wAYM5HKZTp+\nWHojjiyB2hOYqft7A2WlTEDmHFa5UcPHMRZKATUYI1T2TRVqLlSiE2mJ3dFRXGM2\nZAS33J0NVUjkx3w8RmJ7DNflEFJt/6IXdfaokVgfza7LFarrQFQP/YURXEeJT7jm\nDvKpZ/a8wu3ve6N4ykC+CBsCAwEAAaMrMCkwDwYDVR0TBAgwBgEB/wIBADAWBgNV\nHREEDzANggtleGFtcGxlLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAovxY5lm89Eod\nL8CH3dZzIH7nv8MXtwgpv2vth4PDq2btLS8xrqm2SsA/cV+DsbDjh5CxQLoDX+8V\ng8NtY+ipOE0hdJAUo7UVlsxuAY4frkmLL1/RwpjZg+Z2NAxpR7xGWgoMn7CH481w\nAOBypAuCxcfcyyAOttdS+YMRJnpL6z8/C3W0LGkNOs26Qhu1/U8lfz1f9F4XummD\nu2SCmJsAd1PrL1shsyh4HtmFjuY698aTjYUDUleAnx7ytrGlZuLOIeoQi7tcsLJJ\nTPMbxTLgGN2HEkdJerFRBNViuWvqioEyYlzZ3MshOCR2wsL4wrXrCF0Y3cNOYcIh\nZ8z+wUAP2g==\n-----END CERTIFICATE-----\n", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = await response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + trusted_ca_certificate = await async_client.cdn.trusted_ca_certificates.list() + assert_matches_type(CaCertificateList, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + trusted_ca_certificate = await async_client.cdn.trusted_ca_certificates.list( + automated=True, + resource_id=0, + validity_not_after_lte="validity_not_after_lte", + ) + assert_matches_type(CaCertificateList, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.trusted_ca_certificates.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = await response.parse() + assert_matches_type(CaCertificateList, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.trusted_ca_certificates.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = await response.parse() + assert_matches_type(CaCertificateList, trusted_ca_certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + trusted_ca_certificate = await async_client.cdn.trusted_ca_certificates.delete( + 0, + ) + assert trusted_ca_certificate is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.trusted_ca_certificates.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = await response.parse() + assert trusted_ca_certificate is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.trusted_ca_certificates.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = await response.parse() + assert trusted_ca_certificate is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + trusted_ca_certificate = await async_client.cdn.trusted_ca_certificates.get( + 0, + ) + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.trusted_ca_certificates.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = await response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.trusted_ca_certificates.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = await response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + trusted_ca_certificate = await async_client.cdn.trusted_ca_certificates.replace( + id=0, + name="Example CA cert 2", + ) + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.trusted_ca_certificates.with_raw_response.replace( + id=0, + name="Example CA cert 2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trusted_ca_certificate = await response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.trusted_ca_certificates.with_streaming_response.replace( + id=0, + name="Example CA cert 2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trusted_ca_certificate = await response.parse() + assert_matches_type(CaCertificate, trusted_ca_certificate, 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 new file mode 100644 index 00000000..8e256e1f --- /dev/null +++ b/tests/api_resources/test_cdn.py @@ -0,0 +1,320 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from gcore import Gcore, AsyncGcore +from tests.utils import assert_matches_type +from gcore.types.cdn import ( + CdnAccount, + PurgeStatus, + CdnAccountLimits, + CdnAvailableFeatures, +) +from gcore.pagination import SyncOffsetPageCdn, AsyncOffsetPageCdn + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCdn: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get_account_limits(self, client: Gcore) -> None: + cdn = client.cdn.get_account_limits() + assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + + @parametrize + def test_raw_response_get_account_limits(self, client: Gcore) -> None: + response = client.cdn.with_raw_response.get_account_limits() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = response.parse() + assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + + @parametrize + def test_streaming_response_get_account_limits(self, client: Gcore) -> None: + with client.cdn.with_streaming_response.get_account_limits() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = response.parse() + assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_account_overview(self, client: Gcore) -> None: + cdn = client.cdn.get_account_overview() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + def test_raw_response_get_account_overview(self, client: Gcore) -> None: + response = client.cdn.with_raw_response.get_account_overview() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = response.parse() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + def test_streaming_response_get_account_overview(self, client: Gcore) -> None: + with client.cdn.with_streaming_response.get_account_overview() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = response.parse() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_available_features(self, client: Gcore) -> None: + cdn = client.cdn.get_available_features() + assert_matches_type(CdnAvailableFeatures, cdn, path=["response"]) + + @parametrize + def test_raw_response_get_available_features(self, client: Gcore) -> None: + response = client.cdn.with_raw_response.get_available_features() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = response.parse() + assert_matches_type(CdnAvailableFeatures, cdn, path=["response"]) + + @parametrize + def test_streaming_response_get_available_features(self, client: Gcore) -> None: + with client.cdn.with_streaming_response.get_available_features() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = response.parse() + assert_matches_type(CdnAvailableFeatures, 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"]) + + @parametrize + def test_method_list_purge_statuses_with_all_params(self, client: Gcore) -> None: + cdn = client.cdn.list_purge_statuses( + cname="cname", + from_created="from_created", + limit=100, + offset=0, + purge_type="purge_type", + status="status", + to_created="to_created", + ) + assert_matches_type(SyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + + @parametrize + def test_raw_response_list_purge_statuses(self, client: Gcore) -> None: + response = client.cdn.with_raw_response.list_purge_statuses() + + 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"]) + + @parametrize + def test_streaming_response_list_purge_statuses(self, client: Gcore) -> None: + with client.cdn.with_streaming_response.list_purge_statuses() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = response.parse() + assert_matches_type(SyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update_account(self, client: Gcore) -> None: + cdn = client.cdn.update_account() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + def test_method_update_account_with_all_params(self, client: Gcore) -> None: + cdn = client.cdn.update_account( + utilization_level=1111, + ) + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + def test_raw_response_update_account(self, client: Gcore) -> None: + response = client.cdn.with_raw_response.update_account() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = response.parse() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + def test_streaming_response_update_account(self, client: Gcore) -> None: + with client.cdn.with_streaming_response.update_account() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = response.parse() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCdn: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_get_account_limits(self, async_client: AsyncGcore) -> None: + cdn = await async_client.cdn.get_account_limits() + assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + + @parametrize + async def test_raw_response_get_account_limits(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.with_raw_response.get_account_limits() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = await response.parse() + assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + + @parametrize + async def test_streaming_response_get_account_limits(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.with_streaming_response.get_account_limits() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = await response.parse() + assert_matches_type(CdnAccountLimits, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_account_overview(self, async_client: AsyncGcore) -> None: + cdn = await async_client.cdn.get_account_overview() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + async def test_raw_response_get_account_overview(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.with_raw_response.get_account_overview() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = await response.parse() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + async def test_streaming_response_get_account_overview(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.with_streaming_response.get_account_overview() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = await response.parse() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_available_features(self, async_client: AsyncGcore) -> None: + cdn = await async_client.cdn.get_available_features() + assert_matches_type(CdnAvailableFeatures, cdn, path=["response"]) + + @parametrize + async def test_raw_response_get_available_features(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.with_raw_response.get_available_features() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = await response.parse() + assert_matches_type(CdnAvailableFeatures, cdn, path=["response"]) + + @parametrize + async def test_streaming_response_get_available_features(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.with_streaming_response.get_available_features() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = await response.parse() + assert_matches_type(CdnAvailableFeatures, 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"]) + + @parametrize + async def test_method_list_purge_statuses_with_all_params(self, async_client: AsyncGcore) -> None: + cdn = await async_client.cdn.list_purge_statuses( + cname="cname", + from_created="from_created", + limit=100, + offset=0, + purge_type="purge_type", + status="status", + to_created="to_created", + ) + assert_matches_type(AsyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + + @parametrize + async def test_raw_response_list_purge_statuses(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.with_raw_response.list_purge_statuses() + + 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"]) + + @parametrize + async def test_streaming_response_list_purge_statuses(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.with_streaming_response.list_purge_statuses() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = await response.parse() + assert_matches_type(AsyncOffsetPageCdn[PurgeStatus], cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update_account(self, async_client: AsyncGcore) -> None: + cdn = await async_client.cdn.update_account() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + async def test_method_update_account_with_all_params(self, async_client: AsyncGcore) -> None: + cdn = await async_client.cdn.update_account( + utilization_level=1111, + ) + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + async def test_raw_response_update_account(self, async_client: AsyncGcore) -> None: + response = await async_client.cdn.with_raw_response.update_account() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cdn = await response.parse() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + @parametrize + async def test_streaming_response_update_account(self, async_client: AsyncGcore) -> None: + async with async_client.cdn.with_streaming_response.update_account() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cdn = await response.parse() + assert_matches_type(CdnAccount, cdn, path=["response"]) + + assert cast(Any, response.is_closed) is True From 0281f970f6a422ed5e2609f2bc775a0d8fd9a021 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 30 Sep 2025 05:01:24 +0000 Subject: [PATCH 23/23] release: 0.14.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d52d2b97..a26ebfc1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.13.0" + ".": "0.14.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e7b72504..05bda150 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,33 @@ # Changelog +## 0.14.0 (2025-09-30) + +Full Changelog: [v0.13.0...v0.14.0](https://github.com/G-Core/gcore-python/compare/v0.13.0...v0.14.0) + +### Features + +* **api:** aggregated API specs update ([0e7967b](https://github.com/G-Core/gcore-python/commit/0e7967b1f6be77cac807f5a1e3d3483c9151902b)) +* **api:** aggregated API specs update ([0199b8c](https://github.com/G-Core/gcore-python/commit/0199b8ccce3fc74ba60586b9cbe6411b29bf9ece)) +* **api:** aggregated API specs update ([0784cf9](https://github.com/G-Core/gcore-python/commit/0784cf918ef8d820a7a5ecfd9dc5b185829041a1)) +* **api:** aggregated API specs update ([f1ff659](https://github.com/G-Core/gcore-python/commit/f1ff65992ff4992554d00f10b1b17794155cc129)) +* **api:** aggregated API specs update ([fc88cbd](https://github.com/G-Core/gcore-python/commit/fc88cbd66531167d50927d4a87c53d5f05fbdce1)) +* **cdn:** add API support ([e07d4e7](https://github.com/G-Core/gcore-python/commit/e07d4e7427042c2996c6dae86f70f0cc86a8d6d5)) +* **cloud:** enable TF for floating IPs ([634f34b](https://github.com/G-Core/gcore-python/commit/634f34b96fb7e74f7566493af8716f90d85016b9)) + + +### Bug Fixes + +* **client:** correctly generate K8sClusterSlurmAddonV2Serializers ([e5961ca](https://github.com/G-Core/gcore-python/commit/e5961ca7683a89bf6e551bd4bedd82c1b76e4052)) + + +### Chores + +* do not install brew dependencies in ./scripts/bootstrap by default ([9482c47](https://github.com/G-Core/gcore-python/commit/9482c4755e629b9411290d189efc5f1de4bbbec1)) +* improve example values ([2560541](https://github.com/G-Core/gcore-python/commit/25605419cf1878d28e77251f44246b68212efb8a)) +* **internal:** update pydantic dependency ([adf8df6](https://github.com/G-Core/gcore-python/commit/adf8df69810c6e978395aefe12b4ba6f88772d16)) +* **types:** change optional parameter type from NotGiven to Omit ([24bebe1](https://github.com/G-Core/gcore-python/commit/24bebe1a809b38732c6b960f5cc6703fa2d6d1be)) +* use Omit in more places ([2a4abf1](https://github.com/G-Core/gcore-python/commit/2a4abf1aa6f07c9c9f8d16150caed76e8e35a146)) + ## 0.13.0 (2025-09-16) Full Changelog: [v0.12.0...v0.13.0](https://github.com/G-Core/gcore-python/compare/v0.12.0...v0.13.0) diff --git a/pyproject.toml b/pyproject.toml index 4e7dd1c1..21dd7b46 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.13.0" +version = "0.14.0" description = "The official Python library for the gcore API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/gcore/_version.py b/src/gcore/_version.py index 30d62a13..426ebfb3 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.13.0" # x-release-please-version +__version__ = "0.14.0" # x-release-please-version