From ece45355779bfa9a8d3c68783cd3512236f83f96 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Dec 2025 17:20:55 +0000 Subject: [PATCH 01/27] chore: update lockfile --- pyproject.toml | 14 +++--- requirements-dev.lock | 108 +++++++++++++++++++++++------------------- requirements.lock | 31 ++++++------ 3 files changed, 84 insertions(+), 69 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 73044cac..2e7bb86e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,14 +7,16 @@ license = "Apache-2.0" authors = [ { name = "Gcore", email = "support@gcore.com" }, ] + dependencies = [ - "httpx>=0.23.0, <1", - "pydantic>=1.9.0, <3", - "typing-extensions>=4.10, <5", - "anyio>=3.5.0, <5", - "distro>=1.7.0, <2", - "sniffio", + "httpx>=0.23.0, <1", + "pydantic>=1.9.0, <3", + "typing-extensions>=4.10, <5", + "anyio>=3.5.0, <5", + "distro>=1.7.0, <2", + "sniffio", ] + requires-python = ">= 3.9" classifiers = [ "Typing :: Typed", diff --git a/requirements-dev.lock b/requirements-dev.lock index 62af3e02..272bfd52 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -12,45 +12,50 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.12.8 +aiohttp==3.13.2 # via gcore # via httpx-aiohttp -aiosignal==1.3.2 +aiosignal==1.4.0 # via aiohttp -annotated-types==0.6.0 +annotated-types==0.7.0 # via pydantic -anyio==4.4.0 +anyio==4.12.0 # via gcore # via httpx -argcomplete==3.1.2 +argcomplete==3.6.3 # via nox async-timeout==5.0.1 # via aiohttp -attrs==25.3.0 +attrs==25.4.0 # via aiohttp -certifi==2023.7.22 + # via nox +backports-asyncio-runner==1.2.0 + # via pytest-asyncio +certifi==2025.11.12 # via httpcore # via httpx colorama==0.4.6 # via griffe -colorlog==6.7.0 +colorlog==6.10.1 + # via nox +dependency-groups==1.3.1 # via nox -dirty-equals==0.6.0 -distlib==0.3.7 +dirty-equals==0.11 +distlib==0.4.0 # via virtualenv -distro==1.8.0 +distro==1.9.0 # via gcore -exceptiongroup==1.2.2 +exceptiongroup==1.3.1 # via anyio # via pytest -execnet==2.1.1 +execnet==2.1.2 # via pytest-xdist -filelock==3.12.4 +filelock==3.19.1 # via virtualenv -frozenlist==1.6.2 +frozenlist==1.8.0 # via aiohttp # via aiosignal -griffe==1.13.0 +griffe==1.14.0 h11==0.16.0 # via httpcore httpcore==1.0.9 @@ -61,83 +66,90 @@ httpx==0.28.1 # via respx httpx-aiohttp==0.1.9 # via gcore -idna==3.4 +humanize==4.13.0 + # via nox +idna==3.11 # via anyio # via httpx # via yarl -importlib-metadata==7.0.0 -iniconfig==2.0.0 +importlib-metadata==8.7.0 +iniconfig==2.1.0 # via pytest markdown-it-py==3.0.0 # via rich mdurl==0.1.2 # via markdown-it-py -multidict==6.4.4 +multidict==6.7.0 # via aiohttp # via yarl mypy==1.17.0 -mypy-extensions==1.0.0 +mypy-extensions==1.1.0 # via mypy -nodeenv==1.8.0 +nodeenv==1.9.1 # via pyright -nox==2023.4.22 -packaging==23.2 +nox==2025.11.12 +packaging==25.0 + # via dependency-groups # via nox # via pytest pathspec==0.12.1 # via mypy -platformdirs==3.11.0 +platformdirs==4.4.0 # via virtualenv -pluggy==1.5.0 +pluggy==1.6.0 # via pytest -propcache==0.3.1 +propcache==0.4.1 # via aiohttp # via yarl -pydantic==2.11.9 +pydantic==2.12.5 # via gcore -pydantic-core==2.33.2 +pydantic-core==2.41.5 # via pydantic -pygments==2.18.0 +pygments==2.19.2 + # via pytest # via rich pyright==1.1.399 -pytest==8.3.3 +pytest==8.4.2 # via pytest-asyncio # via pytest-xdist -pytest-asyncio==0.24.0 -pytest-xdist==3.7.0 -python-dateutil==2.8.2 +pytest-asyncio==1.2.0 +pytest-xdist==3.8.0 +python-dateutil==2.9.0.post0 # via time-machine python-dotenv==1.1.1 pytz==2023.3.post1 # via dirty-equals respx==0.22.0 -rich==13.7.1 -ruff==0.9.4 -setuptools==68.2.2 - # via nodeenv -six==1.16.0 +rich==14.2.0 +ruff==0.14.7 +six==1.17.0 # via python-dateutil -sniffio==1.3.0 - # via anyio +sniffio==1.3.1 # via gcore -time-machine==2.9.0 -tomli==2.0.2 +time-machine==2.19.0 +tomli==2.3.0 + # via dependency-groups # via mypy + # via nox # via pytest -typing-extensions==4.12.2 +typing-extensions==4.15.0 + # via aiosignal # via anyio + # via exceptiongroup # via gcore # via multidict # via mypy # via pydantic # via pydantic-core # via pyright + # via pytest-asyncio # via typing-inspection -typing-inspection==0.4.1 + # via virtualenv +typing-inspection==0.4.2 # via pydantic -virtualenv==20.24.5 +virtualenv==20.35.4 # via nox -yarl==1.20.0 +yarl==1.22.0 # via aiohttp -zipp==3.17.0 +zipp==3.23.0 # via importlib-metadata diff --git a/requirements.lock b/requirements.lock index 5275f060..1e9ebf6f 100644 --- a/requirements.lock +++ b/requirements.lock @@ -12,28 +12,28 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.12.8 +aiohttp==3.13.2 # via gcore # via httpx-aiohttp -aiosignal==1.3.2 +aiosignal==1.4.0 # via aiohttp -annotated-types==0.6.0 +annotated-types==0.7.0 # via pydantic -anyio==4.4.0 +anyio==4.12.0 # via gcore # via httpx async-timeout==5.0.1 # via aiohttp -attrs==25.3.0 +attrs==25.4.0 # via aiohttp -certifi==2023.7.22 +certifi==2025.11.12 # via httpcore # via httpx -distro==1.8.0 +distro==1.9.0 # via gcore -exceptiongroup==1.2.2 +exceptiongroup==1.3.1 # via anyio -frozenlist==1.6.2 +frozenlist==1.8.0 # via aiohttp # via aiosignal h11==0.16.0 @@ -45,25 +45,26 @@ httpx==0.28.1 # via httpx-aiohttp httpx-aiohttp==0.1.9 # via gcore -idna==3.4 +idna==3.11 # via anyio # via httpx # via yarl -multidict==6.4.4 +multidict==6.7.0 # via aiohttp # via yarl -propcache==0.3.1 +propcache==0.4.1 # via aiohttp # via yarl pydantic==2.12.5 # via gcore pydantic-core==2.41.5 # via pydantic -sniffio==1.3.0 - # via anyio +sniffio==1.3.1 # via gcore typing-extensions==4.15.0 + # via aiosignal # via anyio + # via exceptiongroup # via gcore # via multidict # via pydantic @@ -71,5 +72,5 @@ typing-extensions==4.15.0 # via typing-inspection typing-inspection==0.4.2 # via pydantic -yarl==1.20.0 +yarl==1.22.0 # via aiohttp From 2c2fa1790799aab90409f65669bcb7f48659a7cb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Dec 2025 21:24:11 +0000 Subject: [PATCH 02/27] chore(docs): use environment variables for authentication in code snippets --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3c62683a..22851c56 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,7 @@ pip install gcore[aiohttp] Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`: ```python +import os import asyncio from gcore import DefaultAioHttpClient from gcore import AsyncGcore @@ -91,7 +92,7 @@ from gcore import AsyncGcore async def main() -> None: async with AsyncGcore( - api_key="My API Key", + api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted http_client=DefaultAioHttpClient(), ) as client: project = await client.cloud.projects.create( From b745f43a066be1d41dd690c0e767d60e495c4a6c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 06:14:01 +0000 Subject: [PATCH 03/27] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- .../resources/cloud/load_balancers/l7_policies/rules.py | 8 ++++---- .../load_balancers/l7_policies/rule_create_params.py | 2 +- .../load_balancers/l7_policies/rule_replace_params.py | 2 +- .../cloud/load_balancers/l7_policies/test_rules.py | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.stats.yml b/.stats.yml index c2b1ebe1..bb436f42 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 633 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-415b3e1ff98241ebe58f65df0e6ee1381f07ced3d6e9af8bbf9ff8ba25ad655d.yml -openapi_spec_hash: cbcb8f94fedaa853d6fa4763016ce6e0 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8f63354e3e247d4c5010b1c3a26dde23083f7f750c7f4906ec4417e42696b8b3.yml +openapi_spec_hash: ff1ed42b10de1567fa35e3c5260bf431 config_hash: c71c5fd84e30d315500ae54ec3a83b71 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 28405ffb..d6ff597a 100644 --- a/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py +++ b/src/gcore/resources/cloud/load_balancers/l7_policies/rules.py @@ -91,7 +91,7 @@ def create( invert: When true the logic of the rule is inverted. - key: The key to use for the comparison. + key: The key to use for the comparison. Required for COOKIE and HEADER `type` only. tags: A list of simple strings assigned to the l7 rule @@ -319,7 +319,7 @@ def replace( invert: When true the logic of the rule is inverted. - key: The key to use for the comparison. + key: The key to use for the comparison. Required for COOKIE and HEADER `type` only. tags: A list of simple strings assigned to the l7 rule @@ -598,7 +598,7 @@ async def create( invert: When true the logic of the rule is inverted. - key: The key to use for the comparison. + key: The key to use for the comparison. Required for COOKIE and HEADER `type` only. tags: A list of simple strings assigned to the l7 rule @@ -826,7 +826,7 @@ async def replace( invert: When true the logic of the rule is inverted. - key: The key to use for the comparison. + key: The key to use for the comparison. Required for COOKIE and HEADER `type` only. tags: A list of simple strings assigned to the l7 rule diff --git a/src/gcore/types/cloud/load_balancers/l7_policies/rule_create_params.py b/src/gcore/types/cloud/load_balancers/l7_policies/rule_create_params.py index 30ab9c53..36ffd53e 100644 --- a/src/gcore/types/cloud/load_balancers/l7_policies/rule_create_params.py +++ b/src/gcore/types/cloud/load_balancers/l7_policies/rule_create_params.py @@ -40,7 +40,7 @@ class RuleCreateParams(TypedDict, total=False): """When true the logic of the rule is inverted.""" key: str - """The key to use for the comparison.""" + """The key to use for the comparison. Required for COOKIE and HEADER `type` only.""" tags: SequenceNotStr[str] """A list of simple strings assigned to the l7 rule""" diff --git a/src/gcore/types/cloud/load_balancers/l7_policies/rule_replace_params.py b/src/gcore/types/cloud/load_balancers/l7_policies/rule_replace_params.py index 0d8e5c97..ab64c93b 100644 --- a/src/gcore/types/cloud/load_balancers/l7_policies/rule_replace_params.py +++ b/src/gcore/types/cloud/load_balancers/l7_policies/rule_replace_params.py @@ -26,7 +26,7 @@ class RuleReplaceParams(TypedDict, total=False): """When true the logic of the rule is inverted.""" key: str - """The key to use for the comparison.""" + """The key to use for the comparison. Required for COOKIE and HEADER `type` only.""" tags: SequenceNotStr[str] """A list of simple strings assigned to the l7 rule""" diff --git a/tests/api_resources/cloud/load_balancers/l7_policies/test_rules.py b/tests/api_resources/cloud/load_balancers/l7_policies/test_rules.py index bb3a27f2..2538e125 100644 --- a/tests/api_resources/cloud/load_balancers/l7_policies/test_rules.py +++ b/tests/api_resources/cloud/load_balancers/l7_policies/test_rules.py @@ -39,7 +39,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: type="PATH", value="/images*", invert=True, - key="the name of the cookie to evaluate.", + key="the name of the cookie or header to evaluate.", tags=["test_tag_1", "test_tag_2"], ) assert_matches_type(TaskIDList, rule, path=["response"]) @@ -272,7 +272,7 @@ def test_method_replace_with_all_params(self, client: Gcore) -> None: l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", compare_type="REGEX", invert=True, - key="the name of the cookie to evaluate.", + key="the name of the cookie or header to evaluate.", tags=["test_tag_1", "test_tag_2"], type="PATH", value="/images*", @@ -359,7 +359,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> type="PATH", value="/images*", invert=True, - key="the name of the cookie to evaluate.", + key="the name of the cookie or header to evaluate.", tags=["test_tag_1", "test_tag_2"], ) assert_matches_type(TaskIDList, rule, path=["response"]) @@ -592,7 +592,7 @@ async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", compare_type="REGEX", invert=True, - key="the name of the cookie to evaluate.", + key="the name of the cookie or header to evaluate.", tags=["test_tag_1", "test_tag_2"], type="PATH", value="/images*", From 61299edb52f077ab1cd4ac198b3ce59283fe779c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 18:13:50 +0000 Subject: [PATCH 04/27] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/streaming/quality_sets.py | 4 +- .../resources/streaming/streams/streams.py | 14 ++-- .../resources/streaming/videos/videos.py | 42 +++++----- src/gcore/types/streaming/stream.py | 20 +++-- src/gcore/types/streaming/video.py | 81 ++++++++++--------- 6 files changed, 86 insertions(+), 79 deletions(-) diff --git a/.stats.yml b/.stats.yml index bb436f42..a58d69ba 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 633 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8f63354e3e247d4c5010b1c3a26dde23083f7f750c7f4906ec4417e42696b8b3.yml -openapi_spec_hash: ff1ed42b10de1567fa35e3c5260bf431 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5a4b8411d18f52b85677665c177979374da5c60ab6757f83b0b949826f0099aa.yml +openapi_spec_hash: c2464785b6a2754e1a62d0b416715934 config_hash: c71c5fd84e30d315500ae54ec3a83b71 diff --git a/src/gcore/resources/streaming/quality_sets.py b/src/gcore/resources/streaming/quality_sets.py index d91c5569..a860d454 100644 --- a/src/gcore/resources/streaming/quality_sets.py +++ b/src/gcore/resources/streaming/quality_sets.py @@ -62,7 +62,7 @@ def list( Our experts have selected the optimal parameters for transcoding, to ensure maximum video/audio quality with the best compression. Default quality sets are 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). + [documentation](/docs/streaming-platform/live-streams-and-videos-protocols-and-codecs/output-parameters-and-codecs#custom-quality-sets). These values are the default for everyone. There is no need to configure anything additional. @@ -204,7 +204,7 @@ async def list( Our experts have selected the optimal parameters for transcoding, to ensure maximum video/audio quality with the best compression. Default quality sets are 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). + [documentation](/docs/streaming-platform/live-streams-and-videos-protocols-and-codecs/output-parameters-and-codecs#custom-quality-sets). These values are the default for everyone. There is no need to configure anything additional. diff --git a/src/gcore/resources/streaming/streams/streams.py b/src/gcore/resources/streaming/streams/streams.py index acc3a7f3..35a3bfca 100644 --- a/src/gcore/resources/streaming/streams/streams.py +++ b/src/gcore/resources/streaming/streams/streams.py @@ -126,9 +126,7 @@ def create( - Restreaming - (soon) AI Automatic Speech Recognition for subtitles/captions generating - 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. + For more information see specific API methods, and the Knowledge Base. ![HTML Overlays](https://demo-files.gvideo.io/apidocs/low-latency-football.gif) @@ -471,6 +469,9 @@ def create_clip( highlights in sport events, or cutting an important moment in the news or live performance. + DVR function must be enabled for clip recording. If the DVR is disabled, the + response will be error 422. + Instant clip becomes available for viewing in the following formats: - HLS .m3u8, @@ -863,9 +864,7 @@ async def create( - Restreaming - (soon) AI Automatic Speech Recognition for subtitles/captions generating - 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. + For more information see specific API methods, and the Knowledge Base. ![HTML Overlays](https://demo-files.gvideo.io/apidocs/low-latency-football.gif) @@ -1208,6 +1207,9 @@ async def create_clip( highlights in sport events, or cutting an important moment in the news or live performance. + DVR function must be enabled for clip recording. If the DVR is disabled, the + response will be error 422. + Instant clip becomes available for viewing in the following formats: - HLS .m3u8, diff --git a/src/gcore/resources/streaming/videos/videos.py b/src/gcore/resources/streaming/videos/videos.py index 256d7d6f..cc829118 100644 --- a/src/gcore/resources/streaming/videos/videos.py +++ b/src/gcore/resources/streaming/videos/videos.py @@ -135,18 +135,15 @@ def create( 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. + **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. @@ -886,18 +883,15 @@ async def create( 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. + **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. diff --git a/src/gcore/types/streaming/stream.py b/src/gcore/types/streaming/stream.py index 9a43c77c..c467567c 100644 --- a/src/gcore/types/streaming/stream.py +++ b/src/gcore/types/streaming/stream.py @@ -327,8 +327,8 @@ class Stream(BaseModel): Double-check the documentation for your encoder. 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. + time per unique stream key input. Trying to send 2+ connection requests into the + single `push_url`, or 2+ protocols at once will not lead to a result. For example, transcoding process will fail if: @@ -373,8 +373,8 @@ class Stream(BaseModel): 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. + time per unique stream key input. Trying to send 2+ connection requests into the + single `push_url_srt`, or 2+ protocols at once will not lead to a result. For example, transcoding process will fail if: @@ -431,8 +431,8 @@ class Stream(BaseModel): 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. + time per unique stream key input. Trying to send 2+ connection requests into the + single `push_url_whip`, or 2+ protocols at once will not lead to a result. For example, transcoding process will fail if: @@ -493,6 +493,14 @@ class Stream(BaseModel): then only the time of the last session is displayed here. """ + stream_source_type: Optional[Literal["rtmp", "srt", "webrtc", "https"]] = None + """ + For the current transcoding, this specifies the source protocol: RTMP, SRT, + WebRTC, or HTTPS. This does not specify which source is used primary or backup, + only the source protocol type. If transcoding is inactive, the value will be + null. + """ + transcoded_qualities: Optional[List[str]] = None """Array of qualities to which live stream is transcoded""" diff --git a/src/gcore/types/streaming/video.py b/src/gcore/types/streaming/video.py index 30c725c2..23830bad 100644 --- a/src/gcore/types/streaming/video.py +++ b/src/gcore/types/streaming/video.py @@ -31,28 +31,28 @@ class ConvertedVideo(BaseModel): 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`} + 1. `/videos/{client_id}_{slug}/{filename}.mp4` + 2. `/videos/{client_id}_{slug}/{filename}.mp4/download` + 3. `/videos/{client_id}_{slug}/{filename}.mp4/download={custom_filename}` The first option returns the file as is. Response will be: ``` - GET .mp4 - ... - content-type: video/mp4 + GET .mp4 + ... + content-type: video/mp4 ``` - The second option with /download will respond with HTTP response header that + The second option with `/download` will respond with HTTP response header that directly tells browsers to download the file instead of playing it in the browser: ``` - GET .mp4/download - ... - content-type: video/mp4 - content-disposition: attachment - access-control-expose-headers: Content-Disposition + GET .mp4/download + ... + content-type: video/mp4 + content-disposition: attachment + access-control-expose-headers: Content-Disposition ``` The third option allows you to set a custom name for the file being downloaded. @@ -68,18 +68,18 @@ class ConvertedVideo(BaseModel): - Example valid filenames: `holiday2025`, `_backup.final`, `clip-v1.2` ``` - GET .mp4/download={custom_filename} - ... - content-type: video/mp4 - content-disposition: attachment; filename="{custom_filename}.mp4" - access-control-expose-headers: Content-Disposition + GET .mp4/download={custom_filename} + ... + content-type: video/mp4 + content-disposition: attachment; filename="{custom_filename}.mp4" + access-control-expose-headers: Content-Disposition ``` Examples: - - Video: + - MP4: `https://demo-public.gvideo.io/videos/2675_1OFgHZ1FWZNNvx1A/qid3567v1_h264_4050_1080.mp4/download` - - Video with custom download filename: + - MP4 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** @@ -107,11 +107,10 @@ class ConvertedVideo(BaseModel): Read more in Product Documentation in CDN section "Network limits". - **Secure token authentication (updated)** + **Secure token authentication for MP4 (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. + Access to MP4 download links only can be protected using advanced secure tokens + passed as query parameters. 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 @@ -207,7 +206,10 @@ class Video(BaseModel): 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` + + ``` + /videos/{client_id}_{slug}/master[-min-N][-max-N][-(h264|hevc|av1)].mpd + ``` List of suffix-options: @@ -259,9 +261,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 @@ -270,7 +272,10 @@ 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` + + ``` + /videos/{client_id}_{video_slug}/master[-cmaf][-min-N][-max-N][-img][-(h264|hevc|av1)].m3u8 + ``` List of suffix-options: @@ -287,15 +292,16 @@ class Video(BaseModel): 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): + need. 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): ABR soft-limiting + examples: - 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 - `.../master-min-320-max-320-h264.m3u8` + `.../master-min-320-max-320-h264.m3u8` For more details look at the Product + Documentation. Caution. Solely master.m3u8 (and master[-options].m3u8) is officially documented and intended for your use. Any additional internal manifests, sub-manifests, @@ -353,12 +359,9 @@ class Video(BaseModel): - 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** + **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 From 143cc715528ae31d876ca9ac3a651fc8eebb90f2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Dec 2025 12:16:26 +0000 Subject: [PATCH 05/27] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index a58d69ba..03878b51 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 633 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-5a4b8411d18f52b85677665c177979374da5c60ab6757f83b0b949826f0099aa.yml -openapi_spec_hash: c2464785b6a2754e1a62d0b416715934 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-13b60e34552837742dacb42e3d25d8131082d2f5362fa2bde2d2e0d2c7f40424.yml +openapi_spec_hash: 3e9d9a4580d1579dadb5096822f9eb74 config_hash: c71c5fd84e30d315500ae54ec3a83b71 From 06e1dc32499533ad16b88458164ec5a9ea385cc5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Dec 2025 16:35:38 +0000 Subject: [PATCH 06/27] fix!: streamline naming for create/replace models --- .stats.yml | 2 +- api.md | 14 ++++----- src/gcore/resources/cloud/registries/users.py | 18 +++++------ src/gcore/resources/cloud/ssh_keys.py | 10 +++---- src/gcore/types/cloud/__init__.py | 2 +- src/gcore/types/cloud/registries/__init__.py | 2 +- ...ser_created.py => registry_user_create.py} | 4 +-- .../{ssh_key_created.py => ssh_key_create.py} | 4 +-- .../cloud/registries/test_users.py | 30 +++++++++---------- tests/api_resources/cloud/test_ssh_keys.py | 18 +++++------ 10 files changed, 52 insertions(+), 52 deletions(-) rename src/gcore/types/cloud/registries/{registry_user_created.py => registry_user_create.py} (88%) rename src/gcore/types/cloud/{ssh_key_created.py => ssh_key_create.py} (96%) diff --git a/.stats.yml b/.stats.yml index 03878b51..339c0ee1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 633 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-13b60e34552837742dacb42e3d25d8131082d2f5362fa2bde2d2e0d2c7f40424.yml openapi_spec_hash: 3e9d9a4580d1579dadb5096822f9eb74 -config_hash: c71c5fd84e30d315500ae54ec3a83b71 +config_hash: d269f66003019c08690390a35368f05c diff --git a/api.md b/api.md index 5d4b590b..74e3741c 100644 --- a/api.md +++ b/api.md @@ -149,12 +149,12 @@ Methods: Types: ```python -from gcore.types.cloud import SSHKey, SSHKeyCreated +from gcore.types.cloud import SSHKey, SSHKeyCreate ``` Methods: -- client.cloud.ssh_keys.create(\*, project_id, \*\*params) -> SSHKeyCreated +- client.cloud.ssh_keys.create(\*, project_id, \*\*params) -> SSHKeyCreate - client.cloud.ssh_keys.update(ssh_key_id, \*, project_id, \*\*params) -> SSHKey - client.cloud.ssh_keys.list(\*, project_id, \*\*params) -> SyncOffsetPage[SSHKey] - client.cloud.ssh_keys.delete(ssh_key_id, \*, project_id) -> None @@ -699,7 +699,7 @@ Types: ```python from gcore.types.cloud.registries import ( RegistryUser, - RegistryUserCreated, + RegistryUserCreate, RegistryUserList, UserRefreshSecretResponse, ) @@ -707,11 +707,11 @@ from gcore.types.cloud.registries import ( Methods: -- client.cloud.registries.users.create(registry_id, \*, project_id, region_id, \*\*params) -> RegistryUserCreated +- client.cloud.registries.users.create(registry_id, \*, project_id, region_id, \*\*params) -> RegistryUserCreate - client.cloud.registries.users.update(user_id, \*, project_id, region_id, registry_id, \*\*params) -> RegistryUser - client.cloud.registries.users.list(registry_id, \*, project_id, region_id) -> RegistryUserList - client.cloud.registries.users.delete(user_id, \*, project_id, region_id, registry_id) -> None -- client.cloud.registries.users.create_multiple(registry_id, \*, project_id, region_id, \*\*params) -> RegistryUserCreated +- client.cloud.registries.users.create_multiple(registry_id, \*, project_id, region_id, \*\*params) -> RegistryUserCreate - client.cloud.registries.users.refresh_secret(user_id, \*, project_id, region_id, registry_id) -> UserRefreshSecretResponse ## FileShares @@ -2266,13 +2266,13 @@ Methods: Types: ```python -from gcore.types.cdn.resources import OriginShielding, OriginShieldingUpdated +from gcore.types.cdn.resources import OriginShielding, OriginShieldingReplace ``` Methods: - client.cdn.resources.shield.get(resource_id) -> OriginShielding -- client.cdn.resources.shield.replace(resource_id, \*\*params) -> object +- client.cdn.resources.shield.replace(resource_id, \*\*params) -> object ### Rules diff --git a/src/gcore/resources/cloud/registries/users.py b/src/gcore/resources/cloud/registries/users.py index 5225429a..ee880e0a 100644 --- a/src/gcore/resources/cloud/registries/users.py +++ b/src/gcore/resources/cloud/registries/users.py @@ -20,7 +20,7 @@ from ....types.cloud.registries import user_create_params, user_update_params, user_create_multiple_params from ....types.cloud.registries.registry_user import RegistryUser from ....types.cloud.registries.registry_user_list import RegistryUserList -from ....types.cloud.registries.registry_user_created import RegistryUserCreated +from ....types.cloud.registries.registry_user_create import RegistryUserCreate from ....types.cloud.registries.user_refresh_secret_response import UserRefreshSecretResponse __all__ = ["UsersResource", "AsyncUsersResource"] @@ -62,7 +62,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RegistryUserCreated: + ) -> RegistryUserCreate: """ Create a new user for accessing the container registry. @@ -105,7 +105,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=RegistryUserCreated, + cast_to=RegistryUserCreate, ) def update( @@ -248,7 +248,7 @@ def create_multiple( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RegistryUserCreated: + ) -> RegistryUserCreate: """ Create multiple users for accessing the container registry in a single request. @@ -273,7 +273,7 @@ def create_multiple( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=RegistryUserCreated, + cast_to=RegistryUserCreate, ) def refresh_secret( @@ -351,7 +351,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RegistryUserCreated: + ) -> RegistryUserCreate: """ Create a new user for accessing the container registry. @@ -394,7 +394,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=RegistryUserCreated, + cast_to=RegistryUserCreate, ) async def update( @@ -537,7 +537,7 @@ async def create_multiple( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> RegistryUserCreated: + ) -> RegistryUserCreate: """ Create multiple users for accessing the container registry in a single request. @@ -562,7 +562,7 @@ async def create_multiple( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=RegistryUserCreated, + cast_to=RegistryUserCreate, ) async def refresh_secret( diff --git a/src/gcore/resources/cloud/ssh_keys.py b/src/gcore/resources/cloud/ssh_keys.py index cd2c058d..9ecc18ab 100644 --- a/src/gcore/resources/cloud/ssh_keys.py +++ b/src/gcore/resources/cloud/ssh_keys.py @@ -20,7 +20,7 @@ from ...types.cloud import ssh_key_list_params, ssh_key_create_params, ssh_key_update_params from ..._base_client import AsyncPaginator, make_request_options from ...types.cloud.ssh_key import SSHKey -from ...types.cloud.ssh_key_created import SSHKeyCreated +from ...types.cloud.ssh_key_create import SSHKeyCreate __all__ = ["SSHKeysResource", "AsyncSSHKeysResource"] @@ -58,7 +58,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SSHKeyCreated: + ) -> SSHKeyCreate: """ To generate a key, omit the `public_key` parameter from the request body @@ -102,7 +102,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=SSHKeyCreated, + cast_to=SSHKeyCreate, ) def update( @@ -325,7 +325,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SSHKeyCreated: + ) -> SSHKeyCreate: """ To generate a key, omit the `public_key` parameter from the request body @@ -369,7 +369,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=SSHKeyCreated, + cast_to=SSHKeyCreate, ) async def update( diff --git a/src/gcore/types/cloud/__init__.py b/src/gcore/types/cloud/__init__.py index 73915dd5..33f051d9 100644 --- a/src/gcore/types/cloud/__init__.py +++ b/src/gcore/types/cloud/__init__.py @@ -41,11 +41,11 @@ from .gpu_image_list import GPUImageList as GPUImageList from .health_monitor import HealthMonitor as HealthMonitor from .security_group import SecurityGroup as SecurityGroup +from .ssh_key_create import SSHKeyCreate as SSHKeyCreate from .audit_log_entry import AuditLogEntry as AuditLogEntry from .listener_status import ListenerStatus as ListenerStatus from .network_details import NetworkDetails as NetworkDetails from .placement_group import PlacementGroup as PlacementGroup -from .ssh_key_created import SSHKeyCreated as SSHKeyCreated from .baremetal_flavor import BaremetalFlavor as BaremetalFlavor from .floating_address import FloatingAddress as FloatingAddress from .lb_pool_protocol import LbPoolProtocol as LbPoolProtocol diff --git a/src/gcore/types/cloud/registries/__init__.py b/src/gcore/types/cloud/registries/__init__.py index a4e5934f..daf9c94e 100644 --- a/src/gcore/types/cloud/registries/__init__.py +++ b/src/gcore/types/cloud/registries/__init__.py @@ -8,7 +8,7 @@ from .user_create_params import UserCreateParams as UserCreateParams from .user_update_params import UserUpdateParams as UserUpdateParams from .registry_repository import RegistryRepository as RegistryRepository -from .registry_user_created import RegistryUserCreated as RegistryUserCreated +from .registry_user_create import RegistryUserCreate as RegistryUserCreate from .registry_artifact_list import RegistryArtifactList as RegistryArtifactList from .registry_repository_list import RegistryRepositoryList as RegistryRepositoryList from .user_create_multiple_params import UserCreateMultipleParams as UserCreateMultipleParams diff --git a/src/gcore/types/cloud/registries/registry_user_created.py b/src/gcore/types/cloud/registries/registry_user_create.py similarity index 88% rename from src/gcore/types/cloud/registries/registry_user_created.py rename to src/gcore/types/cloud/registries/registry_user_create.py index 6cb1ae87..cdace476 100644 --- a/src/gcore/types/cloud/registries/registry_user_created.py +++ b/src/gcore/types/cloud/registries/registry_user_create.py @@ -5,10 +5,10 @@ from ...._models import BaseModel -__all__ = ["RegistryUserCreated"] +__all__ = ["RegistryUserCreate"] -class RegistryUserCreated(BaseModel): +class RegistryUserCreate(BaseModel): id: int """User ID""" diff --git a/src/gcore/types/cloud/ssh_key_created.py b/src/gcore/types/cloud/ssh_key_create.py similarity index 96% rename from src/gcore/types/cloud/ssh_key_created.py rename to src/gcore/types/cloud/ssh_key_create.py index c889ff5a..f0aa9b31 100644 --- a/src/gcore/types/cloud/ssh_key_created.py +++ b/src/gcore/types/cloud/ssh_key_create.py @@ -6,10 +6,10 @@ from ..._models import BaseModel -__all__ = ["SSHKeyCreated"] +__all__ = ["SSHKeyCreate"] -class SSHKeyCreated(BaseModel): +class SSHKeyCreate(BaseModel): id: str """SSH key ID""" diff --git a/tests/api_resources/cloud/registries/test_users.py b/tests/api_resources/cloud/registries/test_users.py index 1167b206..a5280bed 100644 --- a/tests/api_resources/cloud/registries/test_users.py +++ b/tests/api_resources/cloud/registries/test_users.py @@ -12,7 +12,7 @@ from gcore.types.cloud.registries import ( RegistryUser, RegistryUserList, - RegistryUserCreated, + RegistryUserCreate, UserRefreshSecretResponse, ) @@ -31,7 +31,7 @@ def test_method_create(self, client: Gcore) -> None: duration=14, name="user1", ) - assert_matches_type(RegistryUserCreated, user, path=["response"]) + assert_matches_type(RegistryUserCreate, user, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: @@ -44,7 +44,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: read_only=False, secret="secret", ) - assert_matches_type(RegistryUserCreated, user, path=["response"]) + assert_matches_type(RegistryUserCreate, user, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: @@ -59,7 +59,7 @@ def test_raw_response_create(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(RegistryUserCreated, user, path=["response"]) + assert_matches_type(RegistryUserCreate, user, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: @@ -74,7 +74,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(RegistryUserCreated, user, path=["response"]) + assert_matches_type(RegistryUserCreate, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -223,7 +223,7 @@ def test_method_create_multiple(self, client: Gcore) -> None: } ], ) - assert_matches_type(RegistryUserCreated, user, path=["response"]) + assert_matches_type(RegistryUserCreate, user, path=["response"]) @parametrize def test_raw_response_create_multiple(self, client: Gcore) -> None: @@ -242,7 +242,7 @@ def test_raw_response_create_multiple(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(RegistryUserCreated, user, path=["response"]) + assert_matches_type(RegistryUserCreate, user, path=["response"]) @parametrize def test_streaming_response_create_multiple(self, client: Gcore) -> None: @@ -261,7 +261,7 @@ def test_streaming_response_create_multiple(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(RegistryUserCreated, user, path=["response"]) + assert_matches_type(RegistryUserCreate, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -320,7 +320,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: duration=14, name="user1", ) - assert_matches_type(RegistryUserCreated, user, path=["response"]) + assert_matches_type(RegistryUserCreate, user, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: @@ -333,7 +333,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> read_only=False, secret="secret", ) - assert_matches_type(RegistryUserCreated, user, path=["response"]) + assert_matches_type(RegistryUserCreate, user, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @@ -348,7 +348,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(RegistryUserCreated, user, path=["response"]) + assert_matches_type(RegistryUserCreate, user, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: @@ -363,7 +363,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(RegistryUserCreated, user, path=["response"]) + assert_matches_type(RegistryUserCreate, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -512,7 +512,7 @@ async def test_method_create_multiple(self, async_client: AsyncGcore) -> None: } ], ) - assert_matches_type(RegistryUserCreated, user, path=["response"]) + assert_matches_type(RegistryUserCreate, user, path=["response"]) @parametrize async def test_raw_response_create_multiple(self, async_client: AsyncGcore) -> None: @@ -531,7 +531,7 @@ async def test_raw_response_create_multiple(self, async_client: AsyncGcore) -> N assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(RegistryUserCreated, user, path=["response"]) + assert_matches_type(RegistryUserCreate, user, path=["response"]) @parametrize async def test_streaming_response_create_multiple(self, async_client: AsyncGcore) -> None: @@ -550,7 +550,7 @@ async def test_streaming_response_create_multiple(self, async_client: AsyncGcore assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(RegistryUserCreated, user, path=["response"]) + assert_matches_type(RegistryUserCreate, user, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloud/test_ssh_keys.py b/tests/api_resources/cloud/test_ssh_keys.py index 14428dbf..6d72feb6 100644 --- a/tests/api_resources/cloud/test_ssh_keys.py +++ b/tests/api_resources/cloud/test_ssh_keys.py @@ -10,7 +10,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type from gcore.pagination import SyncOffsetPage, AsyncOffsetPage -from gcore.types.cloud import SSHKey, SSHKeyCreated +from gcore.types.cloud import SSHKey, SSHKeyCreate base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +24,7 @@ def test_method_create(self, client: Gcore) -> None: project_id=1, name="my-ssh-key", ) - assert_matches_type(SSHKeyCreated, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreate, ssh_key, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Gcore) -> None: @@ -34,7 +34,7 @@ def test_method_create_with_all_params(self, client: Gcore) -> None: public_key="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIjxL6g1II8NsO8odvBwGKvq2Dx/h/xrvsV9b9LVIYKm my-username@my-hostname", shared_in_project=True, ) - assert_matches_type(SSHKeyCreated, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreate, ssh_key, path=["response"]) @parametrize def test_raw_response_create(self, client: Gcore) -> None: @@ -46,7 +46,7 @@ def test_raw_response_create(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ssh_key = response.parse() - assert_matches_type(SSHKeyCreated, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreate, ssh_key, path=["response"]) @parametrize def test_streaming_response_create(self, client: Gcore) -> None: @@ -58,7 +58,7 @@ def test_streaming_response_create(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ssh_key = response.parse() - assert_matches_type(SSHKeyCreated, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreate, ssh_key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -246,7 +246,7 @@ async def test_method_create(self, async_client: AsyncGcore) -> None: project_id=1, name="my-ssh-key", ) - assert_matches_type(SSHKeyCreated, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreate, ssh_key, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: @@ -256,7 +256,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> public_key="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIjxL6g1II8NsO8odvBwGKvq2Dx/h/xrvsV9b9LVIYKm my-username@my-hostname", shared_in_project=True, ) - assert_matches_type(SSHKeyCreated, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreate, ssh_key, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGcore) -> None: @@ -268,7 +268,7 @@ async def test_raw_response_create(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ssh_key = await response.parse() - assert_matches_type(SSHKeyCreated, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreate, ssh_key, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: @@ -280,7 +280,7 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" ssh_key = await response.parse() - assert_matches_type(SSHKeyCreated, ssh_key, path=["response"]) + assert_matches_type(SSHKeyCreate, ssh_key, path=["response"]) assert cast(Any, response.is_closed) is True From 86346d4fd0f464f120dd0ed6c1e7fb2b0107a625 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Dec 2025 16:37:26 +0000 Subject: [PATCH 07/27] fix(cloud)!: rename load balancer pool member methods to create/delete --- .stats.yml | 2 +- api.md | 4 +- .../cloud/load_balancers/pools/members.py | 46 +++++------ .../cloud/load_balancers/pools/__init__.py | 2 +- ..._add_params.py => member_create_params.py} | 4 +- .../load_balancers/pools/test_members.py | 76 +++++++++---------- 6 files changed, 67 insertions(+), 67 deletions(-) rename src/gcore/types/cloud/load_balancers/pools/{member_add_params.py => member_create_params.py} (97%) diff --git a/.stats.yml b/.stats.yml index 339c0ee1..0994aea4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 633 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-13b60e34552837742dacb42e3d25d8131082d2f5362fa2bde2d2e0d2c7f40424.yml openapi_spec_hash: 3e9d9a4580d1579dadb5096822f9eb74 -config_hash: d269f66003019c08690390a35368f05c +config_hash: eab3769b63345eca456685edb8706543 diff --git a/api.md b/api.md index 74e3741c..cbfb0bce 100644 --- a/api.md +++ b/api.md @@ -274,8 +274,8 @@ Methods: Methods: -- client.cloud.load_balancers.pools.members.add(pool_id, \*, project_id, region_id, \*\*params) -> TaskIDList -- client.cloud.load_balancers.pools.members.remove(member_id, \*, project_id, region_id, pool_id) -> TaskIDList +- client.cloud.load_balancers.pools.members.create(pool_id, \*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.pools.members.delete(member_id, \*, project_id, region_id, pool_id) -> TaskIDList ### Metrics diff --git a/src/gcore/resources/cloud/load_balancers/pools/members.py b/src/gcore/resources/cloud/load_balancers/pools/members.py index 29d440f7..2e475708 100644 --- a/src/gcore/resources/cloud/load_balancers/pools/members.py +++ b/src/gcore/resources/cloud/load_balancers/pools/members.py @@ -18,7 +18,7 @@ ) from ....._base_client import make_request_options from .....types.cloud.task_id_list import TaskIDList -from .....types.cloud.load_balancers.pools import member_add_params +from .....types.cloud.load_balancers.pools import member_create_params __all__ = ["MembersResource", "AsyncMembersResource"] @@ -43,7 +43,7 @@ def with_streaming_response(self) -> MembersResourceWithStreamingResponse: """ return MembersResourceWithStreamingResponse(self) - def add( + def create( self, pool_id: str, *, @@ -144,7 +144,7 @@ def add( "subnet_id": subnet_id, "weight": weight, }, - member_add_params.MemberAddParams, + member_create_params.MemberCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -152,7 +152,7 @@ def add( cast_to=TaskIDList, ) - def remove( + def delete( self, member_id: str, *, @@ -223,7 +223,7 @@ def with_streaming_response(self) -> AsyncMembersResourceWithStreamingResponse: """ return AsyncMembersResourceWithStreamingResponse(self) - async def add( + async def create( self, pool_id: str, *, @@ -324,7 +324,7 @@ async def add( "subnet_id": subnet_id, "weight": weight, }, - member_add_params.MemberAddParams, + member_create_params.MemberCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -332,7 +332,7 @@ async def add( cast_to=TaskIDList, ) - async def remove( + async def delete( self, member_id: str, *, @@ -387,11 +387,11 @@ class MembersResourceWithRawResponse: def __init__(self, members: MembersResource) -> None: self._members = members - self.add = to_raw_response_wrapper( - members.add, + self.create = to_raw_response_wrapper( + members.create, ) - self.remove = to_raw_response_wrapper( - members.remove, + self.delete = to_raw_response_wrapper( + members.delete, ) @@ -399,11 +399,11 @@ class AsyncMembersResourceWithRawResponse: def __init__(self, members: AsyncMembersResource) -> None: self._members = members - self.add = async_to_raw_response_wrapper( - members.add, + self.create = async_to_raw_response_wrapper( + members.create, ) - self.remove = async_to_raw_response_wrapper( - members.remove, + self.delete = async_to_raw_response_wrapper( + members.delete, ) @@ -411,11 +411,11 @@ class MembersResourceWithStreamingResponse: def __init__(self, members: MembersResource) -> None: self._members = members - self.add = to_streamed_response_wrapper( - members.add, + self.create = to_streamed_response_wrapper( + members.create, ) - self.remove = to_streamed_response_wrapper( - members.remove, + self.delete = to_streamed_response_wrapper( + members.delete, ) @@ -423,9 +423,9 @@ class AsyncMembersResourceWithStreamingResponse: def __init__(self, members: AsyncMembersResource) -> None: self._members = members - self.add = async_to_streamed_response_wrapper( - members.add, + self.create = async_to_streamed_response_wrapper( + members.create, ) - self.remove = async_to_streamed_response_wrapper( - members.remove, + self.delete = async_to_streamed_response_wrapper( + members.delete, ) diff --git a/src/gcore/types/cloud/load_balancers/pools/__init__.py b/src/gcore/types/cloud/load_balancers/pools/__init__.py index 0b6f1f5d..9eff4e72 100644 --- a/src/gcore/types/cloud/load_balancers/pools/__init__.py +++ b/src/gcore/types/cloud/load_balancers/pools/__init__.py @@ -2,5 +2,5 @@ from __future__ import annotations -from .member_add_params import MemberAddParams as MemberAddParams +from .member_create_params import MemberCreateParams as MemberCreateParams from .health_monitor_create_params import HealthMonitorCreateParams as HealthMonitorCreateParams diff --git a/src/gcore/types/cloud/load_balancers/pools/member_add_params.py b/src/gcore/types/cloud/load_balancers/pools/member_create_params.py similarity index 97% rename from src/gcore/types/cloud/load_balancers/pools/member_add_params.py rename to src/gcore/types/cloud/load_balancers/pools/member_create_params.py index 7b62edc9..ceab4077 100644 --- a/src/gcore/types/cloud/load_balancers/pools/member_add_params.py +++ b/src/gcore/types/cloud/load_balancers/pools/member_create_params.py @@ -5,10 +5,10 @@ from typing import Optional from typing_extensions import Required, TypedDict -__all__ = ["MemberAddParams"] +__all__ = ["MemberCreateParams"] -class MemberAddParams(TypedDict, total=False): +class MemberCreateParams(TypedDict, total=False): project_id: int """Project ID""" diff --git a/tests/api_resources/cloud/load_balancers/pools/test_members.py b/tests/api_resources/cloud/load_balancers/pools/test_members.py index d6500e26..3037fa30 100644 --- a/tests/api_resources/cloud/load_balancers/pools/test_members.py +++ b/tests/api_resources/cloud/load_balancers/pools/test_members.py @@ -18,8 +18,8 @@ class TestMembers: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_add(self, client: Gcore) -> None: - member = client.cloud.load_balancers.pools.members.add( + def test_method_create(self, client: Gcore) -> None: + member = client.cloud.load_balancers.pools.members.create( pool_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, @@ -29,8 +29,8 @@ def test_method_add(self, client: Gcore) -> None: assert_matches_type(TaskIDList, member, path=["response"]) @parametrize - def test_method_add_with_all_params(self, client: Gcore) -> None: - member = client.cloud.load_balancers.pools.members.add( + def test_method_create_with_all_params(self, client: Gcore) -> None: + member = client.cloud.load_balancers.pools.members.create( pool_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, @@ -47,8 +47,8 @@ def test_method_add_with_all_params(self, client: Gcore) -> None: assert_matches_type(TaskIDList, member, path=["response"]) @parametrize - def test_raw_response_add(self, client: Gcore) -> None: - response = client.cloud.load_balancers.pools.members.with_raw_response.add( + def test_raw_response_create(self, client: Gcore) -> None: + response = client.cloud.load_balancers.pools.members.with_raw_response.create( pool_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, @@ -62,8 +62,8 @@ def test_raw_response_add(self, client: Gcore) -> None: assert_matches_type(TaskIDList, member, path=["response"]) @parametrize - def test_streaming_response_add(self, client: Gcore) -> None: - with client.cloud.load_balancers.pools.members.with_streaming_response.add( + def test_streaming_response_create(self, client: Gcore) -> None: + with client.cloud.load_balancers.pools.members.with_streaming_response.create( pool_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, @@ -79,9 +79,9 @@ def test_streaming_response_add(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_add(self, client: Gcore) -> None: + def test_path_params_create(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - client.cloud.load_balancers.pools.members.with_raw_response.add( + client.cloud.load_balancers.pools.members.with_raw_response.create( pool_id="", project_id=1, region_id=1, @@ -90,8 +90,8 @@ def test_path_params_add(self, client: Gcore) -> None: ) @parametrize - def test_method_remove(self, client: Gcore) -> None: - member = client.cloud.load_balancers.pools.members.remove( + def test_method_delete(self, client: Gcore) -> None: + member = client.cloud.load_balancers.pools.members.delete( member_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, @@ -100,8 +100,8 @@ def test_method_remove(self, client: Gcore) -> None: assert_matches_type(TaskIDList, member, path=["response"]) @parametrize - def test_raw_response_remove(self, client: Gcore) -> None: - response = client.cloud.load_balancers.pools.members.with_raw_response.remove( + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.cloud.load_balancers.pools.members.with_raw_response.delete( member_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, @@ -114,8 +114,8 @@ def test_raw_response_remove(self, client: Gcore) -> None: assert_matches_type(TaskIDList, member, path=["response"]) @parametrize - def test_streaming_response_remove(self, client: Gcore) -> None: - with client.cloud.load_balancers.pools.members.with_streaming_response.remove( + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.cloud.load_balancers.pools.members.with_streaming_response.delete( member_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, @@ -130,9 +130,9 @@ def test_streaming_response_remove(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_remove(self, client: Gcore) -> None: + def test_path_params_delete(self, client: Gcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - client.cloud.load_balancers.pools.members.with_raw_response.remove( + client.cloud.load_balancers.pools.members.with_raw_response.delete( member_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, @@ -140,7 +140,7 @@ def test_path_params_remove(self, client: Gcore) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `member_id` but received ''"): - client.cloud.load_balancers.pools.members.with_raw_response.remove( + client.cloud.load_balancers.pools.members.with_raw_response.delete( member_id="", project_id=1, region_id=1, @@ -154,8 +154,8 @@ class TestAsyncMembers: ) @parametrize - async def test_method_add(self, async_client: AsyncGcore) -> None: - member = await async_client.cloud.load_balancers.pools.members.add( + async def test_method_create(self, async_client: AsyncGcore) -> None: + member = await async_client.cloud.load_balancers.pools.members.create( pool_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, @@ -165,8 +165,8 @@ async def test_method_add(self, async_client: AsyncGcore) -> None: assert_matches_type(TaskIDList, member, path=["response"]) @parametrize - async def test_method_add_with_all_params(self, async_client: AsyncGcore) -> None: - member = await async_client.cloud.load_balancers.pools.members.add( + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + member = await async_client.cloud.load_balancers.pools.members.create( pool_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, @@ -183,8 +183,8 @@ async def test_method_add_with_all_params(self, async_client: AsyncGcore) -> Non assert_matches_type(TaskIDList, member, path=["response"]) @parametrize - async def test_raw_response_add(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.pools.members.with_raw_response.add( + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.pools.members.with_raw_response.create( pool_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, @@ -198,8 +198,8 @@ async def test_raw_response_add(self, async_client: AsyncGcore) -> None: assert_matches_type(TaskIDList, member, path=["response"]) @parametrize - async def test_streaming_response_add(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.pools.members.with_streaming_response.add( + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.pools.members.with_streaming_response.create( pool_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, @@ -215,9 +215,9 @@ async def test_streaming_response_add(self, async_client: AsyncGcore) -> None: assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_add(self, async_client: AsyncGcore) -> None: + async def test_path_params_create(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - await async_client.cloud.load_balancers.pools.members.with_raw_response.add( + await async_client.cloud.load_balancers.pools.members.with_raw_response.create( pool_id="", project_id=1, region_id=1, @@ -226,8 +226,8 @@ async def test_path_params_add(self, async_client: AsyncGcore) -> None: ) @parametrize - async def test_method_remove(self, async_client: AsyncGcore) -> None: - member = await async_client.cloud.load_balancers.pools.members.remove( + async def test_method_delete(self, async_client: AsyncGcore) -> None: + member = await async_client.cloud.load_balancers.pools.members.delete( member_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, @@ -236,8 +236,8 @@ async def test_method_remove(self, async_client: AsyncGcore) -> None: assert_matches_type(TaskIDList, member, path=["response"]) @parametrize - async def test_raw_response_remove(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.pools.members.with_raw_response.remove( + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.pools.members.with_raw_response.delete( member_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, @@ -250,8 +250,8 @@ async def test_raw_response_remove(self, async_client: AsyncGcore) -> None: assert_matches_type(TaskIDList, member, path=["response"]) @parametrize - async def test_streaming_response_remove(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.pools.members.with_streaming_response.remove( + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.pools.members.with_streaming_response.delete( member_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, @@ -266,9 +266,9 @@ async def test_streaming_response_remove(self, async_client: AsyncGcore) -> None assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_remove(self, async_client: AsyncGcore) -> None: + async def test_path_params_delete(self, async_client: AsyncGcore) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pool_id` but received ''"): - await async_client.cloud.load_balancers.pools.members.with_raw_response.remove( + await async_client.cloud.load_balancers.pools.members.with_raw_response.delete( member_id="00000000-0000-4000-8000-000000000000", project_id=1, region_id=1, @@ -276,7 +276,7 @@ async def test_path_params_remove(self, async_client: AsyncGcore) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `member_id` but received ''"): - await async_client.cloud.load_balancers.pools.members.with_raw_response.remove( + await async_client.cloud.load_balancers.pools.members.with_raw_response.delete( member_id="", project_id=1, region_id=1, From cb075f51ee3bda135fbeb9eae1957ad0cda1c22a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Dec 2025 16:38:11 +0000 Subject: [PATCH 08/27] fix(cdn)!: streamline audit_logs naming --- .stats.yml | 2 +- api.md | 6 +- src/gcore/resources/cdn/__init__.py | 28 ++++----- .../cdn/{audit_log.py => audit_logs.py} | 62 +++++++++---------- src/gcore/resources/cdn/cdn.py | 40 ++++++------ .../{test_audit_log.py => test_audit_logs.py} | 32 +++++----- 6 files changed, 85 insertions(+), 85 deletions(-) rename src/gcore/resources/cdn/{audit_log.py => audit_logs.py} (89%) rename tests/api_resources/cdn/{test_audit_log.py => test_audit_logs.py} (85%) diff --git a/.stats.yml b/.stats.yml index 0994aea4..2ac30ba2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 633 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-13b60e34552837742dacb42e3d25d8131082d2f5362fa2bde2d2e0d2c7f40424.yml openapi_spec_hash: 3e9d9a4580d1579dadb5096822f9eb74 -config_hash: eab3769b63345eca456685edb8706543 +config_hash: b436dbdfaaf4871ac42950232fbc3116 diff --git a/api.md b/api.md index cbfb0bce..c93a96df 100644 --- a/api.md +++ b/api.md @@ -2372,7 +2372,7 @@ Methods: - client.cdn.trusted_ca_certificates.get(id) -> CaCertificate - client.cdn.trusted_ca_certificates.replace(id, \*\*params) -> CaCertificate -## AuditLog +## AuditLogs Types: @@ -2382,8 +2382,8 @@ from gcore.types.cdn import CdnAuditLogEntry Methods: -- client.cdn.audit_log.list(\*\*params) -> SyncOffsetPage[CdnAuditLogEntry] -- client.cdn.audit_log.get(log_id) -> CdnAuditLogEntry +- client.cdn.audit_logs.list(\*\*params) -> SyncOffsetPage[CdnAuditLogEntry] +- client.cdn.audit_logs.get(log_id) -> CdnAuditLogEntry ## Logs diff --git a/src/gcore/resources/cdn/__init__.py b/src/gcore/resources/cdn/__init__.py index 83661f58..6fcdaceb 100644 --- a/src/gcore/resources/cdn/__init__.py +++ b/src/gcore/resources/cdn/__init__.py @@ -32,14 +32,6 @@ ShieldsResourceWithStreamingResponse, AsyncShieldsResourceWithStreamingResponse, ) -from .audit_log import ( - AuditLogResource, - AsyncAuditLogResource, - AuditLogResourceWithRawResponse, - AsyncAuditLogResourceWithRawResponse, - AuditLogResourceWithStreamingResponse, - AsyncAuditLogResourceWithStreamingResponse, -) from .ip_ranges import ( IPRangesResource, AsyncIPRangesResource, @@ -56,6 +48,14 @@ ResourcesResourceWithStreamingResponse, AsyncResourcesResourceWithStreamingResponse, ) +from .audit_logs import ( + AuditLogsResource, + AsyncAuditLogsResource, + AuditLogsResourceWithRawResponse, + AsyncAuditLogsResourceWithRawResponse, + AuditLogsResourceWithStreamingResponse, + AsyncAuditLogsResourceWithStreamingResponse, +) from .statistics import ( StatisticsResource, AsyncStatisticsResource, @@ -150,12 +150,12 @@ "AsyncTrustedCaCertificatesResourceWithRawResponse", "TrustedCaCertificatesResourceWithStreamingResponse", "AsyncTrustedCaCertificatesResourceWithStreamingResponse", - "AuditLogResource", - "AsyncAuditLogResource", - "AuditLogResourceWithRawResponse", - "AsyncAuditLogResourceWithRawResponse", - "AuditLogResourceWithStreamingResponse", - "AsyncAuditLogResourceWithStreamingResponse", + "AuditLogsResource", + "AsyncAuditLogsResource", + "AuditLogsResourceWithRawResponse", + "AsyncAuditLogsResourceWithRawResponse", + "AuditLogsResourceWithStreamingResponse", + "AsyncAuditLogsResourceWithStreamingResponse", "LogsResource", "AsyncLogsResource", "LogsResourceWithRawResponse", diff --git a/src/gcore/resources/cdn/audit_log.py b/src/gcore/resources/cdn/audit_logs.py similarity index 89% rename from src/gcore/resources/cdn/audit_log.py rename to src/gcore/resources/cdn/audit_logs.py index a80c335e..910d3524 100644 --- a/src/gcore/resources/cdn/audit_log.py +++ b/src/gcore/resources/cdn/audit_logs.py @@ -19,28 +19,28 @@ from ..._base_client import AsyncPaginator, make_request_options from ...types.cdn.cdn_audit_log_entry import CdnAuditLogEntry -__all__ = ["AuditLogResource", "AsyncAuditLogResource"] +__all__ = ["AuditLogsResource", "AsyncAuditLogsResource"] -class AuditLogResource(SyncAPIResource): +class AuditLogsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AuditLogResourceWithRawResponse: + def with_raw_response(self) -> AuditLogsResourceWithRawResponse: """ 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) + return AuditLogsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AuditLogResourceWithStreamingResponse: + def with_streaming_response(self) -> AuditLogsResourceWithStreamingResponse: """ 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) + return AuditLogsResourceWithStreamingResponse(self) def list( self, @@ -186,25 +186,25 @@ def get( ) -class AsyncAuditLogResource(AsyncAPIResource): +class AsyncAuditLogsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAuditLogResourceWithRawResponse: + def with_raw_response(self) -> AsyncAuditLogsResourceWithRawResponse: """ 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) + return AsyncAuditLogsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAuditLogResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncAuditLogsResourceWithStreamingResponse: """ 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) + return AsyncAuditLogsResourceWithStreamingResponse(self) def list( self, @@ -350,49 +350,49 @@ async def get( ) -class AuditLogResourceWithRawResponse: - def __init__(self, audit_log: AuditLogResource) -> None: - self._audit_log = audit_log +class AuditLogsResourceWithRawResponse: + def __init__(self, audit_logs: AuditLogsResource) -> None: + self._audit_logs = audit_logs self.list = to_raw_response_wrapper( - audit_log.list, + audit_logs.list, ) self.get = to_raw_response_wrapper( - audit_log.get, + audit_logs.get, ) -class AsyncAuditLogResourceWithRawResponse: - def __init__(self, audit_log: AsyncAuditLogResource) -> None: - self._audit_log = audit_log +class AsyncAuditLogsResourceWithRawResponse: + def __init__(self, audit_logs: AsyncAuditLogsResource) -> None: + self._audit_logs = audit_logs self.list = async_to_raw_response_wrapper( - audit_log.list, + audit_logs.list, ) self.get = async_to_raw_response_wrapper( - audit_log.get, + audit_logs.get, ) -class AuditLogResourceWithStreamingResponse: - def __init__(self, audit_log: AuditLogResource) -> None: - self._audit_log = audit_log +class AuditLogsResourceWithStreamingResponse: + def __init__(self, audit_logs: AuditLogsResource) -> None: + self._audit_logs = audit_logs self.list = to_streamed_response_wrapper( - audit_log.list, + audit_logs.list, ) self.get = to_streamed_response_wrapper( - audit_log.get, + audit_logs.get, ) -class AsyncAuditLogResourceWithStreamingResponse: - def __init__(self, audit_log: AsyncAuditLogResource) -> None: - self._audit_log = audit_log +class AsyncAuditLogsResourceWithStreamingResponse: + def __init__(self, audit_logs: AsyncAuditLogsResource) -> None: + self._audit_logs = audit_logs self.list = async_to_streamed_response_wrapper( - audit_log.list, + audit_logs.list, ) self.get = async_to_streamed_response_wrapper( - audit_log.get, + audit_logs.get, ) diff --git a/src/gcore/resources/cdn/cdn.py b/src/gcore/resources/cdn/cdn.py index c08f226c..0fb78a73 100644 --- a/src/gcore/resources/cdn/cdn.py +++ b/src/gcore/resources/cdn/cdn.py @@ -31,14 +31,6 @@ 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, @@ -47,6 +39,14 @@ IPRangesResourceWithStreamingResponse, AsyncIPRangesResourceWithStreamingResponse, ) +from .audit_logs import ( + AuditLogsResource, + AsyncAuditLogsResource, + AuditLogsResourceWithRawResponse, + AsyncAuditLogsResourceWithRawResponse, + AuditLogsResourceWithStreamingResponse, + AsyncAuditLogsResourceWithStreamingResponse, +) from .statistics import ( StatisticsResource, AsyncStatisticsResource, @@ -156,8 +156,8 @@ def trusted_ca_certificates(self) -> TrustedCaCertificatesResource: return TrustedCaCertificatesResource(self._client) @cached_property - def audit_log(self) -> AuditLogResource: - return AuditLogResource(self._client) + def audit_logs(self) -> AuditLogsResource: + return AuditLogsResource(self._client) @cached_property def logs(self) -> LogsResource: @@ -457,8 +457,8 @@ def trusted_ca_certificates(self) -> AsyncTrustedCaCertificatesResource: return AsyncTrustedCaCertificatesResource(self._client) @cached_property - def audit_log(self) -> AsyncAuditLogResource: - return AsyncAuditLogResource(self._client) + def audit_logs(self) -> AsyncAuditLogsResource: + return AsyncAuditLogsResource(self._client) @cached_property def logs(self) -> AsyncLogsResource: @@ -783,8 +783,8 @@ def trusted_ca_certificates(self) -> TrustedCaCertificatesResourceWithRawRespons return TrustedCaCertificatesResourceWithRawResponse(self._cdn.trusted_ca_certificates) @cached_property - def audit_log(self) -> AuditLogResourceWithRawResponse: - return AuditLogResourceWithRawResponse(self._cdn.audit_log) + def audit_logs(self) -> AuditLogsResourceWithRawResponse: + return AuditLogsResourceWithRawResponse(self._cdn.audit_logs) @cached_property def logs(self) -> LogsResourceWithRawResponse: @@ -862,8 +862,8 @@ def trusted_ca_certificates(self) -> AsyncTrustedCaCertificatesResourceWithRawRe return AsyncTrustedCaCertificatesResourceWithRawResponse(self._cdn.trusted_ca_certificates) @cached_property - def audit_log(self) -> AsyncAuditLogResourceWithRawResponse: - return AsyncAuditLogResourceWithRawResponse(self._cdn.audit_log) + def audit_logs(self) -> AsyncAuditLogsResourceWithRawResponse: + return AsyncAuditLogsResourceWithRawResponse(self._cdn.audit_logs) @cached_property def logs(self) -> AsyncLogsResourceWithRawResponse: @@ -941,8 +941,8 @@ def trusted_ca_certificates(self) -> TrustedCaCertificatesResourceWithStreamingR return TrustedCaCertificatesResourceWithStreamingResponse(self._cdn.trusted_ca_certificates) @cached_property - def audit_log(self) -> AuditLogResourceWithStreamingResponse: - return AuditLogResourceWithStreamingResponse(self._cdn.audit_log) + def audit_logs(self) -> AuditLogsResourceWithStreamingResponse: + return AuditLogsResourceWithStreamingResponse(self._cdn.audit_logs) @cached_property def logs(self) -> LogsResourceWithStreamingResponse: @@ -1020,8 +1020,8 @@ def trusted_ca_certificates(self) -> AsyncTrustedCaCertificatesResourceWithStrea return AsyncTrustedCaCertificatesResourceWithStreamingResponse(self._cdn.trusted_ca_certificates) @cached_property - def audit_log(self) -> AsyncAuditLogResourceWithStreamingResponse: - return AsyncAuditLogResourceWithStreamingResponse(self._cdn.audit_log) + def audit_logs(self) -> AsyncAuditLogsResourceWithStreamingResponse: + return AsyncAuditLogsResourceWithStreamingResponse(self._cdn.audit_logs) @cached_property def logs(self) -> AsyncLogsResourceWithStreamingResponse: diff --git a/tests/api_resources/cdn/test_audit_log.py b/tests/api_resources/cdn/test_audit_logs.py similarity index 85% rename from tests/api_resources/cdn/test_audit_log.py rename to tests/api_resources/cdn/test_audit_logs.py index 5cd11748..3aace823 100644 --- a/tests/api_resources/cdn/test_audit_log.py +++ b/tests/api_resources/cdn/test_audit_logs.py @@ -15,17 +15,17 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestAuditLog: +class TestAuditLogs: 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() + audit_log = client.cdn.audit_logs.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( + audit_log = client.cdn.audit_logs.list( client_id=0, limit=0, max_requested_at="max_requested_at", @@ -42,7 +42,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: @parametrize def test_raw_response_list(self, client: Gcore) -> None: - response = client.cdn.audit_log.with_raw_response.list() + response = client.cdn.audit_logs.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -51,7 +51,7 @@ def test_raw_response_list(self, client: Gcore) -> None: @parametrize def test_streaming_response_list(self, client: Gcore) -> None: - with client.cdn.audit_log.with_streaming_response.list() as response: + with client.cdn.audit_logs.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -62,14 +62,14 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_get(self, client: Gcore) -> None: - audit_log = client.cdn.audit_log.get( + audit_log = client.cdn.audit_logs.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( + response = client.cdn.audit_logs.with_raw_response.get( 0, ) @@ -80,7 +80,7 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: - with client.cdn.audit_log.with_streaming_response.get( + with client.cdn.audit_logs.with_streaming_response.get( 0, ) as response: assert not response.is_closed @@ -92,19 +92,19 @@ def test_streaming_response_get(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True -class TestAsyncAuditLog: +class TestAsyncAuditLogs: 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() + audit_log = await async_client.cdn.audit_logs.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( + audit_log = await async_client.cdn.audit_logs.list( client_id=0, limit=0, max_requested_at="max_requested_at", @@ -121,7 +121,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: - response = await async_client.cdn.audit_log.with_raw_response.list() + response = await async_client.cdn.audit_logs.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -130,7 +130,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.audit_log.with_streaming_response.list() as response: + async with async_client.cdn.audit_logs.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -141,14 +141,14 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: - audit_log = await async_client.cdn.audit_log.get( + audit_log = await async_client.cdn.audit_logs.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( + response = await async_client.cdn.audit_logs.with_raw_response.get( 0, ) @@ -159,7 +159,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: - async with async_client.cdn.audit_log.with_streaming_response.get( + async with async_client.cdn.audit_logs.with_streaming_response.get( 0, ) as response: assert not response.is_closed From d7c7261055647840e656d142ae4e36247b584cad Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 8 Dec 2025 08:03:00 +0000 Subject: [PATCH 09/27] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 2ac30ba2..cf855d81 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 633 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-13b60e34552837742dacb42e3d25d8131082d2f5362fa2bde2d2e0d2c7f40424.yml openapi_spec_hash: 3e9d9a4580d1579dadb5096822f9eb74 -config_hash: b436dbdfaaf4871ac42950232fbc3116 +config_hash: bee20b00df18a5b8f06accb23fbe2dc2 From c5159efb03e551f71ed83f7efd3a9b73f5017d1d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 8 Dec 2025 10:11:51 +0000 Subject: [PATCH 10/27] feat(api): aggregated API specs update --- .stats.yml | 6 +- api.md | 1 - src/gcore/resources/cloud/tasks.py | 66 +-- .../types/cloud/load_balancers/__init__.py | 1 - .../l7_policy_replace_params.py | 130 ----- .../cloud/task_acknowledge_all_params.py | 5 +- src/gcore/types/cloud/task_list_params.py | 30 +- .../cloud/load_balancers/test_l7_policies.py | 538 ------------------ tests/api_resources/cloud/test_tasks.py | 12 +- 9 files changed, 59 insertions(+), 730 deletions(-) delete mode 100644 src/gcore/types/cloud/load_balancers/l7_policy_replace_params.py diff --git a/.stats.yml b/.stats.yml index cf855d81..25af54bd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 633 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-13b60e34552837742dacb42e3d25d8131082d2f5362fa2bde2d2e0d2c7f40424.yml -openapi_spec_hash: 3e9d9a4580d1579dadb5096822f9eb74 +configured_endpoints: 632 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-af877f4bcacb08ddb1febe8cf82da30454f95a010d02d30720d4f6e79a42883f.yml +openapi_spec_hash: 27676e14bc9581a1a395bb0f9514f883 config_hash: bee20b00df18a5b8f06accb23fbe2dc2 diff --git a/api.md b/api.md index c93a96df..2981071e 100644 --- a/api.md +++ b/api.md @@ -225,7 +225,6 @@ Methods: - client.cloud.load_balancers.l7_policies.list(\*, project_id, region_id) -> LoadBalancerL7PolicyList - client.cloud.load_balancers.l7_policies.delete(l7policy_id, \*, project_id, region_id) -> TaskIDList - client.cloud.load_balancers.l7_policies.get(l7policy_id, \*, project_id, region_id) -> LoadBalancerL7Policy -- client.cloud.load_balancers.l7_policies.replace(l7policy_id, \*, project_id, region_id, \*\*params) -> TaskIDList #### Rules diff --git a/src/gcore/resources/cloud/tasks.py b/src/gcore/resources/cloud/tasks.py index f7cb9972..c8449a3a 100644 --- a/src/gcore/resources/cloud/tasks.py +++ b/src/gcore/resources/cloud/tasks.py @@ -3,7 +3,7 @@ from __future__ import annotations import time -from typing import List, Union, Iterable, Optional, cast +from typing import List, Union, Iterable, cast from datetime import datetime from typing_extensions import Literal @@ -93,17 +93,17 @@ def poll( def list( self, *, - from_timestamp: Union[str, datetime, None] | Omit = omit, - is_acknowledged: Optional[bool] | Omit = omit, + from_timestamp: Union[str, datetime] | Omit = omit, + is_acknowledged: 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, + project_id: Iterable[int] | Omit = omit, + region_id: 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, + state: List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]] | Omit = omit, + task_type: str | 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, @@ -163,17 +163,17 @@ def list( '`delete_k8s_cluster_v2`', '`delete_l7policy`', '`delete_l7rule`', '`delete_lblistener`', '`delete_lbmember`', '`delete_lbmetadata`', '`delete_lbpool`', '`delete_loadbalancer`', '`delete_network`', - '`delete_reserved_fixed_ip`', '`delete_router`', '`delete_secret`', - '`delete_servergroup`', '`delete_sfs`', '`delete_snapshot`', '`delete_subnet`', - '`delete_vm`', '`delete_volume`', '`detach_vm_interface`', '`detach_volume`', - '`download_image`', '`downscale_ai_cluster_gpu`', + '`delete_project`', '`delete_reserved_fixed_ip`', '`delete_router`', + '`delete_secret`', '`delete_servergroup`', '`delete_sfs`', '`delete_snapshot`', + '`delete_subnet`', '`delete_vm`', '`delete_volume`', '`detach_vm_interface`', + '`detach_volume`', '`download_image`', '`downscale_ai_cluster_gpu`', '`downscale_gpu_virtual_cluster`', '`extend_sfs`', '`extend_volume`', '`failover_loadbalancer`', '`hard_reboot_gpu_baremetal_server`', '`hard_reboot_gpu_virtual_cluster`', '`hard_reboot_gpu_virtual_server`', '`hard_reboot_vm`', '`patch_caas_container`', '`patch_dbaas_postgres_cluster`', '`patch_faas_function`', '`patch_faas_namespace`', '`patch_lblistener`', - '`patch_lbpool`', '`put_into_server_group`', '`put_l7policy`', '`put_l7rule`', - '`rebuild_bm`', '`rebuild_gpu_baremetal_node`', '`remove_from_server_group`', + '`patch_lbpool`', '`put_into_server_group`', '`put_l7rule`', '`rebuild_bm`', + '`rebuild_gpu_baremetal_node`', '`remove_from_server_group`', '`replace_lbmetadata`', '`resize_k8s_cluster_v2`', '`resize_loadbalancer`', '`resize_vm`', '`resume_vm`', '`revert_volume`', '`soft_reboot_gpu_baremetal_server`', '`soft_reboot_gpu_virtual_cluster`', @@ -183,7 +183,7 @@ def list( '`stop_gpu_virtual_cluster`', '`stop_gpu_virtual_server`', '`stop_vm`', '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', '`update_inference_application`', '`update_inference_instance`', - '`update_k8s_cluster_v2`', '`update_lbmetadata`', + '`update_k8s_cluster_v2`', '`update_l7policy`', '`update_lbmetadata`', '`update_port_allowed_address_pairs`', '`update_sfs`', '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`'] @@ -230,8 +230,8 @@ def list( def acknowledge_all( self, *, - project_id: Optional[int] | Omit = omit, - region_id: Optional[int] | Omit = omit, + project_id: int | Omit = omit, + region_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, @@ -411,17 +411,17 @@ async def poll( def list( self, *, - from_timestamp: Union[str, datetime, None] | Omit = omit, - is_acknowledged: Optional[bool] | Omit = omit, + from_timestamp: Union[str, datetime] | Omit = omit, + is_acknowledged: 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, + project_id: Iterable[int] | Omit = omit, + region_id: 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, + state: List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]] | Omit = omit, + task_type: str | 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, @@ -481,17 +481,17 @@ def list( '`delete_k8s_cluster_v2`', '`delete_l7policy`', '`delete_l7rule`', '`delete_lblistener`', '`delete_lbmember`', '`delete_lbmetadata`', '`delete_lbpool`', '`delete_loadbalancer`', '`delete_network`', - '`delete_reserved_fixed_ip`', '`delete_router`', '`delete_secret`', - '`delete_servergroup`', '`delete_sfs`', '`delete_snapshot`', '`delete_subnet`', - '`delete_vm`', '`delete_volume`', '`detach_vm_interface`', '`detach_volume`', - '`download_image`', '`downscale_ai_cluster_gpu`', + '`delete_project`', '`delete_reserved_fixed_ip`', '`delete_router`', + '`delete_secret`', '`delete_servergroup`', '`delete_sfs`', '`delete_snapshot`', + '`delete_subnet`', '`delete_vm`', '`delete_volume`', '`detach_vm_interface`', + '`detach_volume`', '`download_image`', '`downscale_ai_cluster_gpu`', '`downscale_gpu_virtual_cluster`', '`extend_sfs`', '`extend_volume`', '`failover_loadbalancer`', '`hard_reboot_gpu_baremetal_server`', '`hard_reboot_gpu_virtual_cluster`', '`hard_reboot_gpu_virtual_server`', '`hard_reboot_vm`', '`patch_caas_container`', '`patch_dbaas_postgres_cluster`', '`patch_faas_function`', '`patch_faas_namespace`', '`patch_lblistener`', - '`patch_lbpool`', '`put_into_server_group`', '`put_l7policy`', '`put_l7rule`', - '`rebuild_bm`', '`rebuild_gpu_baremetal_node`', '`remove_from_server_group`', + '`patch_lbpool`', '`put_into_server_group`', '`put_l7rule`', '`rebuild_bm`', + '`rebuild_gpu_baremetal_node`', '`remove_from_server_group`', '`replace_lbmetadata`', '`resize_k8s_cluster_v2`', '`resize_loadbalancer`', '`resize_vm`', '`resume_vm`', '`revert_volume`', '`soft_reboot_gpu_baremetal_server`', '`soft_reboot_gpu_virtual_cluster`', @@ -501,7 +501,7 @@ def list( '`stop_gpu_virtual_cluster`', '`stop_gpu_virtual_server`', '`stop_vm`', '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', '`update_inference_application`', '`update_inference_instance`', - '`update_k8s_cluster_v2`', '`update_lbmetadata`', + '`update_k8s_cluster_v2`', '`update_l7policy`', '`update_lbmetadata`', '`update_port_allowed_address_pairs`', '`update_sfs`', '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`'] @@ -548,8 +548,8 @@ def list( async def acknowledge_all( self, *, - project_id: Optional[int] | Omit = omit, - region_id: Optional[int] | Omit = omit, + project_id: int | Omit = omit, + region_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, diff --git a/src/gcore/types/cloud/load_balancers/__init__.py b/src/gcore/types/cloud/load_balancers/__init__.py index c68b77c9..7752f579 100644 --- a/src/gcore/types/cloud/load_balancers/__init__.py +++ b/src/gcore/types/cloud/load_balancers/__init__.py @@ -13,4 +13,3 @@ from .listener_delete_params import ListenerDeleteParams as ListenerDeleteParams from .listener_update_params import ListenerUpdateParams as ListenerUpdateParams from .l7_policy_create_params import L7PolicyCreateParams as L7PolicyCreateParams -from .l7_policy_replace_params import L7PolicyReplaceParams as L7PolicyReplaceParams diff --git a/src/gcore/types/cloud/load_balancers/l7_policy_replace_params.py b/src/gcore/types/cloud/load_balancers/l7_policy_replace_params.py deleted file mode 100644 index 806e90ac..00000000 --- a/src/gcore/types/cloud/load_balancers/l7_policy_replace_params.py +++ /dev/null @@ -1,130 +0,0 @@ -# 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 Literal, Required, TypeAlias, TypedDict - -from ...._types import SequenceNotStr - -__all__ = [ - "L7PolicyReplaceParams", - "UpdateL7PolicyRedirectToURLSerializer", - "UpdateL7PolicyRedirectPrefixSerializer", - "UpdateL7PolicyRedirectToPoolSerializer", - "UpdateL7PolicyRejectSerializer", -] - - -class UpdateL7PolicyRedirectToURLSerializer(TypedDict, total=False): - project_id: int - """Project ID""" - - region_id: int - """Region ID""" - - action: Required[Literal["REDIRECT_TO_URL"]] - """Action""" - - redirect_url: Required[str] - """Requests matching this policy will be redirected to this URL. - - Only valid if action is `REDIRECT_TO_URL`. - """ - - name: str - """Human-readable name of the policy""" - - position: int - """The position of this policy on the listener""" - - redirect_http_code: int - """ - Requests matching this policy will be redirected to the specified URL or Prefix - URL with the HTTP response code. Valid if action is `REDIRECT_TO_URL` or - `REDIRECT_PREFIX`. Valid options are 301, 302, 303, 307, or 308. Default is 302. - """ - - tags: SequenceNotStr[str] - """A list of simple strings assigned to the resource.""" - - -class UpdateL7PolicyRedirectPrefixSerializer(TypedDict, total=False): - project_id: int - """Project ID""" - - region_id: int - """Region ID""" - - action: Required[Literal["REDIRECT_PREFIX"]] - """Action""" - - redirect_prefix: Required[str] - """Requests matching this policy will be redirected to this Prefix URL.""" - - name: str - """Human-readable name of the policy""" - - position: int - """The position of this policy on the listener""" - - redirect_http_code: int - """ - Requests matching this policy will be redirected to the specified URL or Prefix - URL with the HTTP response code. Valid options are 301, 302, 303, 307, or 308. - Default is 302. - """ - - tags: SequenceNotStr[str] - """A list of simple strings assigned to the resource.""" - - -class UpdateL7PolicyRedirectToPoolSerializer(TypedDict, total=False): - project_id: int - """Project ID""" - - region_id: int - """Region ID""" - - action: Required[Literal["REDIRECT_TO_POOL"]] - """Action""" - - redirect_pool_id: Required[str] - """Requests matching this policy will be redirected to the pool with this ID.""" - - name: str - """Human-readable name of the policy""" - - position: int - """The position of this policy on the listener""" - - tags: SequenceNotStr[str] - """A list of simple strings assigned to the resource.""" - - -class UpdateL7PolicyRejectSerializer(TypedDict, total=False): - project_id: int - """Project ID""" - - region_id: int - """Region ID""" - - action: Required[Literal["REJECT"]] - """Action""" - - name: str - """Human-readable name of the policy""" - - position: int - """The position of this policy on the listener""" - - tags: SequenceNotStr[str] - """A list of simple strings assigned to the resource.""" - - -L7PolicyReplaceParams: TypeAlias = Union[ - UpdateL7PolicyRedirectToURLSerializer, - UpdateL7PolicyRedirectPrefixSerializer, - UpdateL7PolicyRedirectToPoolSerializer, - UpdateL7PolicyRejectSerializer, -] diff --git a/src/gcore/types/cloud/task_acknowledge_all_params.py b/src/gcore/types/cloud/task_acknowledge_all_params.py index d35c39b7..4637c9b7 100644 --- a/src/gcore/types/cloud/task_acknowledge_all_params.py +++ b/src/gcore/types/cloud/task_acknowledge_all_params.py @@ -2,15 +2,14 @@ from __future__ import annotations -from typing import Optional from typing_extensions import TypedDict __all__ = ["TaskAcknowledgeAllParams"] class TaskAcknowledgeAllParams(TypedDict, total=False): - project_id: Optional[int] + project_id: int """Project ID""" - region_id: Optional[int] + region_id: int """Region ID""" diff --git a/src/gcore/types/cloud/task_list_params.py b/src/gcore/types/cloud/task_list_params.py index c7248550..0fc29cca 100644 --- a/src/gcore/types/cloud/task_list_params.py +++ b/src/gcore/types/cloud/task_list_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Union, Iterable, Optional +from typing import List, Union, Iterable from datetime import datetime from typing_extensions import Literal, Annotated, TypedDict @@ -12,13 +12,13 @@ class TaskListParams(TypedDict, total=False): - from_timestamp: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + from_timestamp: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] """ISO formatted datetime string. Filter the tasks by creation date greater than or equal to `from_timestamp` """ - is_acknowledged: Optional[bool] + is_acknowledged: bool """Filter the tasks by their acknowledgement status""" limit: int @@ -33,13 +33,13 @@ class TaskListParams(TypedDict, total=False): order_by: Literal["asc", "desc"] """Sorting by creation date. Oldest first, or most recent first""" - project_id: Optional[Iterable[int]] + project_id: Iterable[int] """The project ID to filter the tasks by project. Supports multiple values of kind key=value1&key=value2 """ - region_id: Optional[Iterable[int]] + region_id: Iterable[int] """The region ID to filter the tasks by region. Supports multiple values of kind key=value1&key=value2 @@ -51,13 +51,13 @@ class TaskListParams(TypedDict, total=False): Oldest first, or most recent first """ - state: Optional[List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]]] + state: List[Literal["ERROR", "FINISHED", "NEW", "RUNNING"]] """Filter the tasks by state. Supports multiple values of kind key=value1&key=value2 """ - task_type: Optional[str] + task_type: str """ Filter the tasks by their type one of ['`activate_ddos_profile`', '`attach_bm_to_reserved_fixed_ip`', '`attach_vm_interface`', @@ -82,17 +82,17 @@ class TaskListParams(TypedDict, total=False): '`delete_k8s_cluster_v2`', '`delete_l7policy`', '`delete_l7rule`', '`delete_lblistener`', '`delete_lbmember`', '`delete_lbmetadata`', '`delete_lbpool`', '`delete_loadbalancer`', '`delete_network`', - '`delete_reserved_fixed_ip`', '`delete_router`', '`delete_secret`', - '`delete_servergroup`', '`delete_sfs`', '`delete_snapshot`', '`delete_subnet`', - '`delete_vm`', '`delete_volume`', '`detach_vm_interface`', '`detach_volume`', - '`download_image`', '`downscale_ai_cluster_gpu`', + '`delete_project`', '`delete_reserved_fixed_ip`', '`delete_router`', + '`delete_secret`', '`delete_servergroup`', '`delete_sfs`', '`delete_snapshot`', + '`delete_subnet`', '`delete_vm`', '`delete_volume`', '`detach_vm_interface`', + '`detach_volume`', '`download_image`', '`downscale_ai_cluster_gpu`', '`downscale_gpu_virtual_cluster`', '`extend_sfs`', '`extend_volume`', '`failover_loadbalancer`', '`hard_reboot_gpu_baremetal_server`', '`hard_reboot_gpu_virtual_cluster`', '`hard_reboot_gpu_virtual_server`', '`hard_reboot_vm`', '`patch_caas_container`', '`patch_dbaas_postgres_cluster`', '`patch_faas_function`', '`patch_faas_namespace`', '`patch_lblistener`', - '`patch_lbpool`', '`put_into_server_group`', '`put_l7policy`', '`put_l7rule`', - '`rebuild_bm`', '`rebuild_gpu_baremetal_node`', '`remove_from_server_group`', + '`patch_lbpool`', '`put_into_server_group`', '`put_l7rule`', '`rebuild_bm`', + '`rebuild_gpu_baremetal_node`', '`remove_from_server_group`', '`replace_lbmetadata`', '`resize_k8s_cluster_v2`', '`resize_loadbalancer`', '`resize_vm`', '`resume_vm`', '`revert_volume`', '`soft_reboot_gpu_baremetal_server`', '`soft_reboot_gpu_virtual_cluster`', @@ -102,13 +102,13 @@ class TaskListParams(TypedDict, total=False): '`stop_gpu_virtual_cluster`', '`stop_gpu_virtual_server`', '`stop_vm`', '`suspend_vm`', '`sync_private_flavors`', '`update_ddos_profile`', '`update_inference_application`', '`update_inference_instance`', - '`update_k8s_cluster_v2`', '`update_lbmetadata`', + '`update_k8s_cluster_v2`', '`update_l7policy`', '`update_lbmetadata`', '`update_port_allowed_address_pairs`', '`update_sfs`', '`update_tags_gpu_virtual_cluster`', '`upgrade_k8s_cluster_v2`', '`upscale_ai_cluster_gpu`', '`upscale_gpu_virtual_cluster`'] """ - to_timestamp: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + to_timestamp: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] """ISO formatted datetime string. Filter the tasks by creation date less than or equal to `to_timestamp` diff --git a/tests/api_resources/cloud/load_balancers/test_l7_policies.py b/tests/api_resources/cloud/load_balancers/test_l7_policies.py index 5cff8201..585dda0a 100644 --- a/tests/api_resources/cloud/load_balancers/test_l7_policies.py +++ b/tests/api_resources/cloud/load_balancers/test_l7_policies.py @@ -369,275 +369,6 @@ def test_path_params_get(self, client: Gcore) -> None: region_id=1, ) - @parametrize - def test_method_replace_overload_1(self, client: Gcore) -> None: - l7_policy = client.cloud.load_balancers.l7_policies.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_TO_URL", - redirect_url="https://www.example.com", - ) - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - def test_method_replace_with_all_params_overload_1(self, client: Gcore) -> None: - l7_policy = client.cloud.load_balancers.l7_policies.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_TO_URL", - redirect_url="https://www.example.com", - name="redirect-example.com", - position=1, - redirect_http_code=301, - tags=["test_tag"], - ) - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - def test_raw_response_replace_overload_1(self, client: Gcore) -> None: - response = client.cloud.load_balancers.l7_policies.with_raw_response.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_TO_URL", - redirect_url="https://www.example.com", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - l7_policy = response.parse() - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - def test_streaming_response_replace_overload_1(self, client: Gcore) -> None: - with client.cloud.load_balancers.l7_policies.with_streaming_response.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_TO_URL", - redirect_url="https://www.example.com", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - l7_policy = response.parse() - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_replace_overload_1(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): - client.cloud.load_balancers.l7_policies.with_raw_response.replace( - l7policy_id="", - project_id=1, - region_id=1, - action="REDIRECT_TO_URL", - redirect_url="https://www.example.com", - ) - - @parametrize - def test_method_replace_overload_2(self, client: Gcore) -> None: - l7_policy = client.cloud.load_balancers.l7_policies.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_PREFIX", - redirect_prefix="/api/v1/policies", - ) - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - def test_method_replace_with_all_params_overload_2(self, client: Gcore) -> None: - l7_policy = client.cloud.load_balancers.l7_policies.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_PREFIX", - redirect_prefix="/api/v1/policies", - name="redirect-example.com", - position=1, - redirect_http_code=301, - tags=["test_tag"], - ) - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - def test_raw_response_replace_overload_2(self, client: Gcore) -> None: - response = client.cloud.load_balancers.l7_policies.with_raw_response.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_PREFIX", - redirect_prefix="/api/v1/policies", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - l7_policy = response.parse() - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - def test_streaming_response_replace_overload_2(self, client: Gcore) -> None: - with client.cloud.load_balancers.l7_policies.with_streaming_response.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_PREFIX", - redirect_prefix="/api/v1/policies", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - l7_policy = response.parse() - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_replace_overload_2(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): - client.cloud.load_balancers.l7_policies.with_raw_response.replace( - l7policy_id="", - project_id=1, - region_id=1, - action="REDIRECT_PREFIX", - redirect_prefix="/api/v1/policies", - ) - - @parametrize - def test_method_replace_overload_3(self, client: Gcore) -> None: - l7_policy = client.cloud.load_balancers.l7_policies.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_TO_POOL", - redirect_pool_id="00000000-0000-4000-8000-000000000000", - ) - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - def test_method_replace_with_all_params_overload_3(self, client: Gcore) -> None: - l7_policy = client.cloud.load_balancers.l7_policies.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_TO_POOL", - redirect_pool_id="00000000-0000-4000-8000-000000000000", - name="redirect-example.com", - position=1, - tags=["test_tag"], - ) - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - def test_raw_response_replace_overload_3(self, client: Gcore) -> None: - response = client.cloud.load_balancers.l7_policies.with_raw_response.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_TO_POOL", - redirect_pool_id="00000000-0000-4000-8000-000000000000", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - l7_policy = response.parse() - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - def test_streaming_response_replace_overload_3(self, client: Gcore) -> None: - with client.cloud.load_balancers.l7_policies.with_streaming_response.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_TO_POOL", - redirect_pool_id="00000000-0000-4000-8000-000000000000", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - l7_policy = response.parse() - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_replace_overload_3(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): - client.cloud.load_balancers.l7_policies.with_raw_response.replace( - l7policy_id="", - project_id=1, - region_id=1, - action="REDIRECT_TO_POOL", - redirect_pool_id="00000000-0000-4000-8000-000000000000", - ) - - @parametrize - def test_method_replace_overload_4(self, client: Gcore) -> None: - l7_policy = client.cloud.load_balancers.l7_policies.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REJECT", - ) - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - def test_method_replace_with_all_params_overload_4(self, client: Gcore) -> None: - l7_policy = client.cloud.load_balancers.l7_policies.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REJECT", - name="redirect-example.com", - position=1, - tags=["test_tag"], - ) - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - def test_raw_response_replace_overload_4(self, client: Gcore) -> None: - response = client.cloud.load_balancers.l7_policies.with_raw_response.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REJECT", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - l7_policy = response.parse() - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - def test_streaming_response_replace_overload_4(self, client: Gcore) -> None: - with client.cloud.load_balancers.l7_policies.with_streaming_response.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REJECT", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - l7_policy = response.parse() - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_replace_overload_4(self, client: Gcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): - client.cloud.load_balancers.l7_policies.with_raw_response.replace( - l7policy_id="", - project_id=1, - region_id=1, - action="REJECT", - ) - class TestAsyncL7Policies: parametrize = pytest.mark.parametrize( @@ -995,272 +726,3 @@ async def test_path_params_get(self, async_client: AsyncGcore) -> None: project_id=1, region_id=1, ) - - @parametrize - async def test_method_replace_overload_1(self, async_client: AsyncGcore) -> None: - l7_policy = await async_client.cloud.load_balancers.l7_policies.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_TO_URL", - redirect_url="https://www.example.com", - ) - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - async def test_method_replace_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: - l7_policy = await async_client.cloud.load_balancers.l7_policies.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_TO_URL", - redirect_url="https://www.example.com", - name="redirect-example.com", - position=1, - redirect_http_code=301, - tags=["test_tag"], - ) - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - async def test_raw_response_replace_overload_1(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_TO_URL", - redirect_url="https://www.example.com", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - l7_policy = await response.parse() - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - async def test_streaming_response_replace_overload_1(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_TO_URL", - redirect_url="https://www.example.com", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - l7_policy = await response.parse() - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_replace_overload_1(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): - await async_client.cloud.load_balancers.l7_policies.with_raw_response.replace( - l7policy_id="", - project_id=1, - region_id=1, - action="REDIRECT_TO_URL", - redirect_url="https://www.example.com", - ) - - @parametrize - async def test_method_replace_overload_2(self, async_client: AsyncGcore) -> None: - l7_policy = await async_client.cloud.load_balancers.l7_policies.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_PREFIX", - redirect_prefix="/api/v1/policies", - ) - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - async def test_method_replace_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: - l7_policy = await async_client.cloud.load_balancers.l7_policies.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_PREFIX", - redirect_prefix="/api/v1/policies", - name="redirect-example.com", - position=1, - redirect_http_code=301, - tags=["test_tag"], - ) - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - async def test_raw_response_replace_overload_2(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_PREFIX", - redirect_prefix="/api/v1/policies", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - l7_policy = await response.parse() - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - async def test_streaming_response_replace_overload_2(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_PREFIX", - redirect_prefix="/api/v1/policies", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - l7_policy = await response.parse() - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_replace_overload_2(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): - await async_client.cloud.load_balancers.l7_policies.with_raw_response.replace( - l7policy_id="", - project_id=1, - region_id=1, - action="REDIRECT_PREFIX", - redirect_prefix="/api/v1/policies", - ) - - @parametrize - async def test_method_replace_overload_3(self, async_client: AsyncGcore) -> None: - l7_policy = await async_client.cloud.load_balancers.l7_policies.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_TO_POOL", - redirect_pool_id="00000000-0000-4000-8000-000000000000", - ) - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - async def test_method_replace_with_all_params_overload_3(self, async_client: AsyncGcore) -> None: - l7_policy = await async_client.cloud.load_balancers.l7_policies.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_TO_POOL", - redirect_pool_id="00000000-0000-4000-8000-000000000000", - name="redirect-example.com", - position=1, - tags=["test_tag"], - ) - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - async def test_raw_response_replace_overload_3(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_TO_POOL", - redirect_pool_id="00000000-0000-4000-8000-000000000000", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - l7_policy = await response.parse() - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - async def test_streaming_response_replace_overload_3(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REDIRECT_TO_POOL", - redirect_pool_id="00000000-0000-4000-8000-000000000000", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - l7_policy = await response.parse() - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_replace_overload_3(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): - await async_client.cloud.load_balancers.l7_policies.with_raw_response.replace( - l7policy_id="", - project_id=1, - region_id=1, - action="REDIRECT_TO_POOL", - redirect_pool_id="00000000-0000-4000-8000-000000000000", - ) - - @parametrize - async def test_method_replace_overload_4(self, async_client: AsyncGcore) -> None: - l7_policy = await async_client.cloud.load_balancers.l7_policies.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REJECT", - ) - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - async def test_method_replace_with_all_params_overload_4(self, async_client: AsyncGcore) -> None: - l7_policy = await async_client.cloud.load_balancers.l7_policies.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REJECT", - name="redirect-example.com", - position=1, - tags=["test_tag"], - ) - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - async def test_raw_response_replace_overload_4(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REJECT", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - l7_policy = await response.parse() - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - @parametrize - async def test_streaming_response_replace_overload_4(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.replace( - l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", - project_id=1, - region_id=1, - action="REJECT", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - l7_policy = await response.parse() - assert_matches_type(TaskIDList, l7_policy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_replace_overload_4(self, async_client: AsyncGcore) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): - await async_client.cloud.load_balancers.l7_policies.with_raw_response.replace( - l7policy_id="", - project_id=1, - region_id=1, - action="REJECT", - ) diff --git a/tests/api_resources/cloud/test_tasks.py b/tests/api_resources/cloud/test_tasks.py index eeb37cb3..abe25c27 100644 --- a/tests/api_resources/cloud/test_tasks.py +++ b/tests/api_resources/cloud/test_tasks.py @@ -32,10 +32,10 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: limit=100, offset=0, order_by="asc", - project_id=[0, 0], - region_id=[0, 0], + project_id=[0], + region_id=[0], sorting="asc", - state=["ERROR", "FINISHED"], + state=["ERROR"], task_type="task_type", to_timestamp=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -189,10 +189,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No limit=100, offset=0, order_by="asc", - project_id=[0, 0], - region_id=[0, 0], + project_id=[0], + region_id=[0], sorting="asc", - state=["ERROR", "FINISHED"], + state=["ERROR"], task_type="task_type", to_timestamp=parse_datetime("2019-12-27T18:11:19.117Z"), ) From 8b73b2ae7a25cd187f5eeeb8e264c8ea6b22aaa1 Mon Sep 17 00:00:00 2001 From: Danil Krox Date: Mon, 8 Dec 2025 18:15:15 +0100 Subject: [PATCH 11/27] fix(cloud): fix types in examples --- examples/cloud/ssh_keys.py | 4 ++-- examples/cloud/ssh_keys_async.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/cloud/ssh_keys.py b/examples/cloud/ssh_keys.py index 231111d0..28d59498 100644 --- a/examples/cloud/ssh_keys.py +++ b/examples/cloud/ssh_keys.py @@ -1,6 +1,6 @@ from gcore import Gcore from gcore.pagination import SyncOffsetPage -from gcore.types.cloud import SSHKey, SSHKeyCreated +from gcore.types.cloud import SSHKey, SSHKeyCreate def main() -> None: @@ -25,7 +25,7 @@ def main() -> None: delete_ssh_key(client=gcore, ssh_key_id=ssh_key.id) -def create_ssh_key(*, client: Gcore) -> SSHKeyCreated: +def create_ssh_key(*, client: Gcore) -> SSHKeyCreate: print("\n=== CREATE SSH KEY ===") ssh_key = client.cloud.ssh_keys.create(name="gcore-go-example") print(f"Created SSH key: ID={ssh_key.id}, name={ssh_key.name}") diff --git a/examples/cloud/ssh_keys_async.py b/examples/cloud/ssh_keys_async.py index bf34abab..f2c451e9 100644 --- a/examples/cloud/ssh_keys_async.py +++ b/examples/cloud/ssh_keys_async.py @@ -2,7 +2,7 @@ from gcore import AsyncGcore from gcore.pagination import AsyncOffsetPage -from gcore.types.cloud import SSHKey, SSHKeyCreated +from gcore.types.cloud import SSHKey, SSHKeyCreate async def main() -> None: @@ -27,7 +27,7 @@ async def main() -> None: await delete_ssh_key(client=gcore, ssh_key_id=ssh_key.id) -async def create_ssh_key(*, client: AsyncGcore) -> SSHKeyCreated: +async def create_ssh_key(*, client: AsyncGcore) -> SSHKeyCreate: print("\n=== CREATE SSH KEY ===") ssh_key = await client.cloud.ssh_keys.create(name="gcore-go-example") print(f"Created SSH key: ID={ssh_key.id}, name={ssh_key.name}") From a1d51b8ff11dc70e5f8f534cb45e87e1eba2cc14 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 15:53:28 +0000 Subject: [PATCH 12/27] feat(api): aggregated API specs update --- .../load_balancers/l7_policies/l7_policies.py | 562 +----------------- 1 file changed, 1 insertion(+), 561 deletions(-) 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 c2bc8c83..037f3a2d 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 @@ -26,7 +26,7 @@ ) from ....._base_client import make_request_options from .....types.cloud.task_id_list import TaskIDList -from .....types.cloud.load_balancers import l7_policy_create_params, l7_policy_replace_params +from .....types.cloud.load_balancers import l7_policy_create_params from .....types.cloud.load_balancer_l7_policy import LoadBalancerL7Policy from .....types.cloud.load_balancer_l7_policy_list import LoadBalancerL7PolicyList @@ -446,280 +446,6 @@ def get( cast_to=LoadBalancerL7Policy, ) - @overload - def replace( - self, - l7policy_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - action: Literal["REDIRECT_TO_URL"], - redirect_url: str, - name: str | Omit = omit, - position: int | Omit = omit, - redirect_http_code: int | 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, - ) -> TaskIDList: - """Replaces the entire L7 policy configuration with the provided data. - - Any fields - omitted from the request body will be unset (set to null) or reset to their - default values (such as "`redirect_http_code`") depending on the "action". This - is a destructive operation that overwrites the complete policy configuration. - - Args: - project_id: Project ID - - region_id: Region ID - - l7policy_id: L7 policy ID - - action: Action - - redirect_url: Requests matching this policy will be redirected to this URL. Only valid if - action is `REDIRECT_TO_URL`. - - name: Human-readable name of the policy - - position: The position of this policy on the listener - - redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix - URL with the HTTP response code. Valid if action is `REDIRECT_TO_URL` or - `REDIRECT_PREFIX`. Valid options are 301, 302, 303, 307, or 308. Default is 302. - - tags: A list of simple strings assigned to the resource. - - 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, - l7policy_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - action: Literal["REDIRECT_PREFIX"], - redirect_prefix: str, - name: str | Omit = omit, - position: int | Omit = omit, - redirect_http_code: int | 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, - ) -> TaskIDList: - """Replaces the entire L7 policy configuration with the provided data. - - Any fields - omitted from the request body will be unset (set to null) or reset to their - default values (such as "`redirect_http_code`") depending on the "action". This - is a destructive operation that overwrites the complete policy configuration. - - Args: - project_id: Project ID - - region_id: Region ID - - l7policy_id: L7 policy ID - - action: Action - - redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. - - name: Human-readable name of the policy - - position: The position of this policy on the listener - - redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix - URL with the HTTP response code. Valid options are 301, 302, 303, 307, or 308. - Default is 302. - - tags: A list of simple strings assigned to the resource. - - 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, - l7policy_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - action: Literal["REDIRECT_TO_POOL"], - redirect_pool_id: str, - name: str | Omit = omit, - position: int | 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, - ) -> TaskIDList: - """Replaces the entire L7 policy configuration with the provided data. - - Any fields - omitted from the request body will be unset (set to null) or reset to their - default values (such as "`redirect_http_code`") depending on the "action". This - is a destructive operation that overwrites the complete policy configuration. - - Args: - project_id: Project ID - - region_id: Region ID - - l7policy_id: L7 policy ID - - action: Action - - redirect_pool_id: Requests matching this policy will be redirected to the pool with this ID. - - name: Human-readable name of the policy - - position: The position of this policy on the listener - - tags: A list of simple strings assigned to the resource. - - 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, - l7policy_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - action: Literal["REJECT"], - name: str | Omit = omit, - position: int | 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, - ) -> TaskIDList: - """Replaces the entire L7 policy configuration with the provided data. - - Any fields - omitted from the request body will be unset (set to null) or reset to their - default values (such as "`redirect_http_code`") depending on the "action". This - is a destructive operation that overwrites the complete policy configuration. - - Args: - project_id: Project ID - - region_id: Region ID - - l7policy_id: L7 policy ID - - action: Action - - name: Human-readable name of the policy - - position: The position of this policy on the listener - - tags: A list of simple strings assigned to the resource. - - 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( - ["action", "redirect_url"], ["action", "redirect_prefix"], ["action", "redirect_pool_id"], ["action"] - ) - def replace( - self, - l7policy_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - action: Literal["REDIRECT_TO_URL"] - | Literal["REDIRECT_PREFIX"] - | Literal["REDIRECT_TO_POOL"] - | Literal["REJECT"], - redirect_url: str | Omit = omit, - name: str | Omit = omit, - position: int | Omit = omit, - redirect_http_code: int | Omit = omit, - tags: SequenceNotStr[str] | Omit = omit, - redirect_prefix: str | Omit = omit, - redirect_pool_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not 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}", - body=maybe_transform( - { - "action": action, - "redirect_url": redirect_url, - "name": name, - "position": position, - "redirect_http_code": redirect_http_code, - "tags": tags, - "redirect_prefix": redirect_prefix, - "redirect_pool_id": redirect_pool_id, - }, - l7_policy_replace_params.L7PolicyReplaceParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - @overload def create_and_poll( self, @@ -1476,280 +1202,6 @@ async def get( cast_to=LoadBalancerL7Policy, ) - @overload - async def replace( - self, - l7policy_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - action: Literal["REDIRECT_TO_URL"], - redirect_url: str, - name: str | Omit = omit, - position: int | Omit = omit, - redirect_http_code: int | 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, - ) -> TaskIDList: - """Replaces the entire L7 policy configuration with the provided data. - - Any fields - omitted from the request body will be unset (set to null) or reset to their - default values (such as "`redirect_http_code`") depending on the "action". This - is a destructive operation that overwrites the complete policy configuration. - - Args: - project_id: Project ID - - region_id: Region ID - - l7policy_id: L7 policy ID - - action: Action - - redirect_url: Requests matching this policy will be redirected to this URL. Only valid if - action is `REDIRECT_TO_URL`. - - name: Human-readable name of the policy - - position: The position of this policy on the listener - - redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix - URL with the HTTP response code. Valid if action is `REDIRECT_TO_URL` or - `REDIRECT_PREFIX`. Valid options are 301, 302, 303, 307, or 308. Default is 302. - - tags: A list of simple strings assigned to the resource. - - 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, - l7policy_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - action: Literal["REDIRECT_PREFIX"], - redirect_prefix: str, - name: str | Omit = omit, - position: int | Omit = omit, - redirect_http_code: int | 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, - ) -> TaskIDList: - """Replaces the entire L7 policy configuration with the provided data. - - Any fields - omitted from the request body will be unset (set to null) or reset to their - default values (such as "`redirect_http_code`") depending on the "action". This - is a destructive operation that overwrites the complete policy configuration. - - Args: - project_id: Project ID - - region_id: Region ID - - l7policy_id: L7 policy ID - - action: Action - - redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. - - name: Human-readable name of the policy - - position: The position of this policy on the listener - - redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix - URL with the HTTP response code. Valid options are 301, 302, 303, 307, or 308. - Default is 302. - - tags: A list of simple strings assigned to the resource. - - 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, - l7policy_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - action: Literal["REDIRECT_TO_POOL"], - redirect_pool_id: str, - name: str | Omit = omit, - position: int | 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, - ) -> TaskIDList: - """Replaces the entire L7 policy configuration with the provided data. - - Any fields - omitted from the request body will be unset (set to null) or reset to their - default values (such as "`redirect_http_code`") depending on the "action". This - is a destructive operation that overwrites the complete policy configuration. - - Args: - project_id: Project ID - - region_id: Region ID - - l7policy_id: L7 policy ID - - action: Action - - redirect_pool_id: Requests matching this policy will be redirected to the pool with this ID. - - name: Human-readable name of the policy - - position: The position of this policy on the listener - - tags: A list of simple strings assigned to the resource. - - 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, - l7policy_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - action: Literal["REJECT"], - name: str | Omit = omit, - position: int | 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, - ) -> TaskIDList: - """Replaces the entire L7 policy configuration with the provided data. - - Any fields - omitted from the request body will be unset (set to null) or reset to their - default values (such as "`redirect_http_code`") depending on the "action". This - is a destructive operation that overwrites the complete policy configuration. - - Args: - project_id: Project ID - - region_id: Region ID - - l7policy_id: L7 policy ID - - action: Action - - name: Human-readable name of the policy - - position: The position of this policy on the listener - - tags: A list of simple strings assigned to the resource. - - 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( - ["action", "redirect_url"], ["action", "redirect_prefix"], ["action", "redirect_pool_id"], ["action"] - ) - async def replace( - self, - l7policy_id: str, - *, - project_id: int | None = None, - region_id: int | None = None, - action: Literal["REDIRECT_TO_URL"] - | Literal["REDIRECT_PREFIX"] - | Literal["REDIRECT_TO_POOL"] - | Literal["REJECT"], - redirect_url: str | Omit = omit, - name: str | Omit = omit, - position: int | Omit = omit, - redirect_http_code: int | Omit = omit, - tags: SequenceNotStr[str] | Omit = omit, - redirect_prefix: str | Omit = omit, - redirect_pool_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TaskIDList: - if project_id is None: - project_id = self._client._get_cloud_project_id_path_param() - if region_id is None: - region_id = self._client._get_cloud_region_id_path_param() - if not 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}", - body=await async_maybe_transform( - { - "action": action, - "redirect_url": redirect_url, - "name": name, - "position": position, - "redirect_http_code": redirect_http_code, - "tags": tags, - "redirect_prefix": redirect_prefix, - "redirect_pool_id": redirect_pool_id, - }, - l7_policy_replace_params.L7PolicyReplaceParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TaskIDList, - ) - @overload async def create_and_poll( self, @@ -2109,9 +1561,6 @@ def __init__(self, l7_policies: L7PoliciesResource) -> None: self.get = to_raw_response_wrapper( l7_policies.get, ) - self.replace = to_raw_response_wrapper( - l7_policies.replace, - ) self.create_and_poll = to_raw_response_wrapper( l7_policies.create_and_poll, ) @@ -2143,9 +1592,6 @@ def __init__(self, l7_policies: AsyncL7PoliciesResource) -> None: self.get = async_to_raw_response_wrapper( l7_policies.get, ) - self.replace = async_to_raw_response_wrapper( - l7_policies.replace, - ) self.create_and_poll = async_to_raw_response_wrapper( l7_policies.create_and_poll, ) @@ -2177,9 +1623,6 @@ def __init__(self, l7_policies: L7PoliciesResource) -> None: self.get = to_streamed_response_wrapper( l7_policies.get, ) - self.replace = to_streamed_response_wrapper( - l7_policies.replace, - ) self.create_and_poll = to_streamed_response_wrapper( l7_policies.create_and_poll, ) @@ -2211,9 +1654,6 @@ def __init__(self, l7_policies: AsyncL7PoliciesResource) -> None: self.get = async_to_streamed_response_wrapper( l7_policies.get, ) - self.replace = async_to_streamed_response_wrapper( - l7_policies.replace, - ) self.create_and_poll = async_to_streamed_response_wrapper( l7_policies.create_and_poll, ) From 27d5cb30ecbdd9f79fa2484dbeee104170431874 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 8 Dec 2025 11:13:48 +0000 Subject: [PATCH 13/27] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 25af54bd..b1d886a8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 632 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-af877f4bcacb08ddb1febe8cf82da30454f95a010d02d30720d4f6e79a42883f.yml openapi_spec_hash: 27676e14bc9581a1a395bb0f9514f883 -config_hash: bee20b00df18a5b8f06accb23fbe2dc2 +config_hash: b42b8cd553a836e3e80a9ddddd396a53 From 616698d4f75cd79685904b3ff5cf7a4057525332 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 8 Dec 2025 18:39:02 +0000 Subject: [PATCH 14/27] fix(types): allow pyright to infer TypedDict types within SequenceNotStr --- src/gcore/_types.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gcore/_types.py b/src/gcore/_types.py index 7ed4155b..6877c20a 100644 --- a/src/gcore/_types.py +++ b/src/gcore/_types.py @@ -243,6 +243,9 @@ class HttpxSendArgs(TypedDict, total=False): if TYPE_CHECKING: # This works because str.__contains__ does not accept object (either in typeshed or at runtime) # https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285 + # + # Note: index() and count() methods are intentionally omitted to allow pyright to properly + # infer TypedDict types when dict literals are used in lists assigned to SequenceNotStr. class SequenceNotStr(Protocol[_T_co]): @overload def __getitem__(self, index: SupportsIndex, /) -> _T_co: ... @@ -251,8 +254,6 @@ def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ... def __contains__(self, value: object, /) -> bool: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T_co]: ... - def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ... - def count(self, value: Any, /) -> int: ... def __reversed__(self) -> Iterator[_T_co]: ... else: # just point this to a normal `Sequence` at runtime to avoid having to special case From 91761cb4af0ee9824166a9b4eb966f981547d9ec Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 8 Dec 2025 19:29:32 +0000 Subject: [PATCH 15/27] chore: add missing docstrings --- src/gcore/types/cdn/cdn_account.py | 2 + src/gcore/types/cdn/cdn_log_entry.py | 2 + src/gcore/types/cdn/cdn_resource.py | 284 ++++++++++++++++++ .../cdn/logs_uploader/logs_uploader_config.py | 2 + .../cdn/logs_uploader/logs_uploader_target.py | 5 + .../types/cdn/origin_group_create_params.py | 2 + .../types/cdn/origin_group_replace_params.py | 2 + .../types/cdn/origin_group_update_params.py | 2 + src/gcore/types/cdn/origin_groups.py | 2 + src/gcore/types/cdn/resource_create_params.py | 284 ++++++++++++++++++ .../types/cdn/resource_replace_params.py | 284 ++++++++++++++++++ src/gcore/types/cdn/resource_update_params.py | 284 ++++++++++++++++++ .../types/cdn/resources/cdn_resource_rule.py | 258 ++++++++++++++++ .../types/cdn/resources/rule_create_params.py | 258 ++++++++++++++++ .../cdn/resources/rule_replace_params.py | 258 ++++++++++++++++ .../types/cdn/resources/rule_update_params.py | 258 ++++++++++++++++ src/gcore/types/cdn/rule_template.py | 258 ++++++++++++++++ .../types/cdn/rule_template_create_params.py | 258 ++++++++++++++++ .../types/cdn/rule_template_replace_params.py | 258 ++++++++++++++++ .../types/cdn/rule_template_update_params.py | 258 ++++++++++++++++ src/gcore/types/cdn/ssl_request_status.py | 2 + src/gcore/types/cloud/audit_log_entry.py | 2 + .../baremetal/baremetal_fixed_address.py | 2 + .../types/cloud/baremetal/baremetal_server.py | 4 + .../cloud/baremetal/server_create_params.py | 10 + src/gcore/types/cloud/baremetal_flavor.py | 2 + src/gcore/types/cloud/billing_reservation.py | 6 + src/gcore/types/cloud/console.py | 2 + ...st_report_get_aggregated_monthly_params.py | 2 + .../cost_report_get_aggregated_params.py | 2 + .../cloud/cost_report_get_detailed_params.py | 2 + .../postgres/cluster_create_params.py | 8 + .../postgres/cluster_update_params.py | 8 + .../databases/postgres/postgres_cluster.py | 6 + .../types/cloud/file_share_create_params.py | 4 + .../types/cloud/file_share_update_params.py | 2 + src/gcore/types/cloud/fixed_address.py | 5 + src/gcore/types/cloud/fixed_address_short.py | 6 + src/gcore/types/cloud/floating_address.py | 2 + src/gcore/types/cloud/floating_ip_detailed.py | 4 + .../types/cloud/gpu_baremetal_cluster.py | 4 + .../gpu_baremetal_cluster_create_params.py | 8 + .../gpu_baremetal_cluster_server_v1.py | 4 + .../gpu_baremetal_flavor.py | 14 + .../server_attach_interface_params.py | 16 + src/gcore/types/cloud/gpu_virtual_cluster.py | 4 + .../gpu_virtual_cluster_create_params.py | 8 + .../gpu_virtual_flavor.py | 14 + .../gpu_virtual_interface.py | 2 + .../applications/deployment_create_params.py | 2 + .../applications/deployment_update_params.py | 2 + .../inference_application_deployment.py | 4 + .../inference/deployment_create_params.py | 61 ++++ .../inference/deployment_update_params.py | 58 ++++ .../cloud/inference/inference_deployment.py | 28 ++ .../types/cloud/inference/inference_secret.py | 2 + .../cloud/inference/secret_create_params.py | 2 + .../cloud/inference/secret_replace_params.py | 2 + src/gcore/types/cloud/instance.py | 12 + .../instance_assign_security_group_params.py | 2 + .../types/cloud/instance_create_params.py | 8 + ...instance_unassign_security_group_params.py | 2 + .../types/cloud/instances/instance_flavor.py | 2 + .../instances/interface_attach_params.py | 16 + src/gcore/types/cloud/instances/metrics.py | 4 + .../types/cloud/k8s/cluster_create_params.py | 20 ++ .../types/cloud/k8s/cluster_update_params.py | 14 + src/gcore/types/cloud/k8s/k8s_cluster.py | 18 ++ src/gcore/types/cloud/load_balancer.py | 2 + .../cloud/load_balancer_create_params.py | 6 + .../cloud/load_balancer_update_params.py | 2 + .../load_balancers/pool_create_params.py | 4 + .../load_balancers/pool_update_params.py | 4 + src/gcore/types/cloud/networks/router.py | 2 + .../cloud/networks/router_update_params.py | 2 + .../types/cloud/quota_get_all_response.py | 2 + .../cloud/quotas/request_create_params.py | 4 + .../cloud/quotas/request_get_response.py | 4 + .../cloud/quotas/request_list_response.py | 4 + src/gcore/types/cloud/region.py | 2 + src/gcore/types/cloud/reserved_fixed_ip.py | 2 + .../secret_upload_tls_certificate_params.py | 2 + .../cloud/security_group_create_params.py | 2 + src/gcore/types/cloud/tag.py | 7 + src/gcore/types/cloud/task.py | 2 + src/gcore/types/cloud/usage_report.py | 90 ++++++ .../types/cloud/usage_report_get_params.py | 2 + src/gcore/types/cloud/volume.py | 2 + src/gcore/types/dns/dns_name_server.py | 2 + src/gcore/types/dns/zone_get_response.py | 8 + .../types/dns/zone_get_statistics_response.py | 2 + src/gcore/types/dns/zone_import_response.py | 2 + src/gcore/types/dns/zone_list_response.py | 6 + src/gcore/types/dns/zones/dns_failover_log.py | 2 + .../types/dns/zones/rrset_create_params.py | 2 + .../types/dns/zones/rrset_replace_params.py | 2 + src/gcore/types/fastedge/app.py | 2 + src/gcore/types/fastedge/app_create_params.py | 2 + src/gcore/types/fastedge/app_param.py | 2 + src/gcore/types/fastedge/app_update_params.py | 2 + src/gcore/types/fastedge/call_status.py | 2 + src/gcore/types/fastedge/duration_stats.py | 2 + src/gcore/types/fastedge/kv_store.py | 2 + .../types/fastedge/kv_store_create_params.py | 2 + .../types/fastedge/kv_store_replace_params.py | 2 + src/gcore/types/fastedge/kv_store_stats.py | 2 + src/gcore/types/iam/account_overview.py | 36 +++ .../types/iam/api_token_create_params.py | 2 + src/gcore/types/storage/bucket.py | 2 + .../types/storage/buckets/bucket_cors.py | 2 + src/gcore/types/storage/location.py | 2 + src/gcore/types/storage/usage_total.py | 2 + src/gcore/types/streaming/player.py | 5 + src/gcore/types/streaming/player_param.py | 5 + .../stream_start_recording_response.py | 6 + .../domains/advanced_rule_create_params.py | 11 + .../domains/advanced_rule_update_params.py | 8 + .../types/waap/domains/api_path_group_list.py | 2 + .../waap/domains/custom_rule_create_params.py | 55 ++++ .../waap/domains/custom_rule_update_params.py | 52 ++++ .../domains/firewall_rule_create_params.py | 14 + .../domains/firewall_rule_update_params.py | 14 + .../waap/domains/setting_update_params.py | 4 + .../types/waap/domains/waap_advanced_rule.py | 13 + .../domains/waap_api_discovery_settings.py | 2 + src/gcore/types/waap/domains/waap_api_path.py | 2 + .../waap/domains/waap_api_scan_result.py | 2 + .../waap/domains/waap_blocked_statistics.py | 2 + .../waap/domains/waap_count_statistics.py | 2 + .../types/waap/domains/waap_custom_rule.py | 57 ++++ .../waap/domains/waap_event_statistics.py | 2 + .../types/waap/domains/waap_firewall_rule.py | 14 + .../waap/domains/waap_request_details.py | 12 + .../waap/domains/waap_request_summary.py | 2 + src/gcore/types/waap/domains/waap_task_id.py | 2 + .../waap/domains/waap_traffic_metrics.py | 2 + .../waap/waap_advanced_rule_descriptor.py | 6 + .../waap_advanced_rule_descriptor_list.py | 2 + src/gcore/types/waap/waap_detailed_domain.py | 8 + .../types/waap/waap_domain_api_settings.py | 2 + .../types/waap/waap_domain_ddos_settings.py | 2 + .../types/waap/waap_domain_settings_model.py | 2 + .../waap_get_account_overview_response.py | 4 + src/gcore/types/waap/waap_ip_info.py | 2 + src/gcore/types/waap/waap_organization.py | 2 + src/gcore/types/waap/waap_policy_mode.py | 2 + src/gcore/types/waap/waap_rule_set.py | 6 + src/gcore/types/waap/waap_statistic_item.py | 2 + .../types/waap/waap_statistics_series.py | 2 + src/gcore/types/waap/waap_summary_domain.py | 2 + src/gcore/types/waap/waap_tag.py | 4 + 151 files changed, 4210 insertions(+) diff --git a/src/gcore/types/cdn/cdn_account.py b/src/gcore/types/cdn/cdn_account.py index 44e8165e..a1a34e7e 100644 --- a/src/gcore/types/cdn/cdn_account.py +++ b/src/gcore/types/cdn/cdn_account.py @@ -8,6 +8,8 @@ class Service(BaseModel): + """Information about the CDN service status.""" + enabled: Optional[bool] = None """Defines whether the CDN service is activated. diff --git a/src/gcore/types/cdn/cdn_log_entry.py b/src/gcore/types/cdn/cdn_log_entry.py index 5e13d3ac..017462cd 100644 --- a/src/gcore/types/cdn/cdn_log_entry.py +++ b/src/gcore/types/cdn/cdn_log_entry.py @@ -58,6 +58,8 @@ class Data(BaseModel): class Meta(BaseModel): + """Contains meta-information.""" + count: Optional[int] = None """Total number of records which match given parameters.""" diff --git a/src/gcore/types/cdn/cdn_resource.py b/src/gcore/types/cdn/cdn_resource.py index b0302fb4..9f24e9f9 100644 --- a/src/gcore/types/cdn/cdn_resource.py +++ b/src/gcore/types/cdn/cdn_resource.py @@ -71,6 +71,8 @@ class OptionsAllowedHTTPMethods(BaseModel): + """HTTP methods allowed for content requests from the CDN.""" + enabled: bool """Controls the option state. @@ -84,6 +86,8 @@ class OptionsAllowedHTTPMethods(BaseModel): class OptionsBotProtectionBotChallenge(BaseModel): + """Controls the bot challenge module state.""" + enabled: Optional[bool] = None """Possible values: @@ -93,6 +97,10 @@ class OptionsBotProtectionBotChallenge(BaseModel): class OptionsBotProtection(BaseModel): + """ + Allows to prevent online services from overloading and ensure your business workflow running smoothly. + """ + bot_challenge: OptionsBotProtectionBotChallenge """Controls the bot challenge module state.""" @@ -107,6 +115,18 @@ class OptionsBotProtection(BaseModel): class OptionsBrotliCompression(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -142,6 +162,13 @@ class OptionsBrotliCompression(BaseModel): class OptionsBrowserCacheSettings(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -159,6 +186,11 @@ class OptionsBrowserCacheSettings(BaseModel): class OptionsCacheHTTPHeaders(BaseModel): + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + enabled: bool """Controls the option state. @@ -172,6 +204,11 @@ class OptionsCacheHTTPHeaders(BaseModel): class OptionsCors(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -212,6 +249,8 @@ class OptionsCors(BaseModel): class OptionsCountryACL(BaseModel): + """Enables control access to content for specified countries.""" + enabled: bool """Controls the option state. @@ -243,6 +282,11 @@ class OptionsCountryACL(BaseModel): class OptionsDisableCache(BaseModel): + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + enabled: bool """Controls the option state. @@ -261,6 +305,8 @@ class OptionsDisableCache(BaseModel): class OptionsDisableProxyForceRanges(BaseModel): + """Allows 206 responses regardless of the settings of an origin source.""" + enabled: bool """Controls the option state. @@ -279,6 +325,11 @@ class OptionsDisableProxyForceRanges(BaseModel): class OptionsEdgeCacheSettings(BaseModel): + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + enabled: bool """Controls the option state. @@ -323,6 +374,10 @@ class OptionsEdgeCacheSettings(BaseModel): class OptionsFastedgeOnRequestBody(BaseModel): + """ + Allows to configure FastEdge application that will be called to handle request body as soon as CDN receives incoming HTTP request. + """ + app_id: str """The ID of the application in FastEdge.""" @@ -343,6 +398,10 @@ class OptionsFastedgeOnRequestBody(BaseModel): class OptionsFastedgeOnRequestHeaders(BaseModel): + """ + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request. + """ + app_id: str """The ID of the application in FastEdge.""" @@ -363,6 +422,10 @@ class OptionsFastedgeOnRequestHeaders(BaseModel): class OptionsFastedgeOnResponseBody(BaseModel): + """ + Allows to configure FastEdge application that will be called to handle response body before CDN sends the HTTP response. + """ + app_id: str """The ID of the application in FastEdge.""" @@ -383,6 +446,10 @@ class OptionsFastedgeOnResponseBody(BaseModel): class OptionsFastedgeOnResponseHeaders(BaseModel): + """ + Allows to configure FastEdge application that will be called to handle response headers before CDN sends the HTTP response. + """ + app_id: str """The ID of the application in FastEdge.""" @@ -403,6 +470,12 @@ class OptionsFastedgeOnResponseHeaders(BaseModel): class OptionsFastedge(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -438,6 +511,16 @@ class OptionsFastedge(BaseModel): class OptionsFetchCompressed(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -456,6 +539,11 @@ class OptionsFetchCompressed(BaseModel): class OptionsFollowOriginRedirect(BaseModel): + """ + 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. + """ + codes: List[Literal[301, 302, 303, 307, 308]] """Redirect status code that the origin server returns. @@ -474,6 +562,11 @@ class OptionsFollowOriginRedirect(BaseModel): class OptionsForceReturnTimeInterval(BaseModel): + """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. + """ + end_time: str """Time until which a custom HTTP response code should be applied. @@ -491,6 +584,11 @@ class OptionsForceReturnTimeInterval(BaseModel): class OptionsForceReturn(BaseModel): + """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. + """ + body: str """URL for redirection or text.""" @@ -514,6 +612,11 @@ class OptionsForceReturn(BaseModel): class OptionsForwardHostHeader(BaseModel): + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + enabled: bool """Controls the option state. @@ -532,6 +635,16 @@ class OptionsForwardHostHeader(BaseModel): class OptionsGzipOn(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -550,6 +663,15 @@ class OptionsGzipOn(BaseModel): class OptionsHostHeader(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -564,6 +686,11 @@ class OptionsHostHeader(BaseModel): class OptionsHttp3Enabled(BaseModel): + """Enables HTTP/3 protocol for content delivery. + + `http3_enabled` option works only with `"sslEnabled": true`. + """ + enabled: bool """Controls the option state. @@ -582,6 +709,10 @@ class OptionsHttp3Enabled(BaseModel): class OptionsIgnoreCookie(BaseModel): + """ + Defines whether the files with the Set-Cookies header are cached as one file or as different ones. + """ + enabled: bool """Controls the option state. @@ -601,6 +732,12 @@ class OptionsIgnoreCookie(BaseModel): class OptionsIgnoreQueryString(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -619,6 +756,10 @@ class OptionsIgnoreQueryString(BaseModel): class OptionsImageStack(BaseModel): + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically converts them to WebP or AVIF format. + """ + enabled: bool """Controls the option state. @@ -646,6 +787,12 @@ class OptionsImageStack(BaseModel): class OptionsIPAddressACL(BaseModel): + """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) + """ + enabled: bool """Controls the option state. @@ -682,6 +829,8 @@ class OptionsIPAddressACL(BaseModel): class OptionsLimitBandwidth(BaseModel): + """Allows to control the download speed per connection.""" + enabled: bool """Controls the option state. @@ -717,6 +866,18 @@ class OptionsLimitBandwidth(BaseModel): class OptionsProxyCacheKey(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -731,6 +892,8 @@ class OptionsProxyCacheKey(BaseModel): class OptionsProxyCacheMethodsSet(BaseModel): + """Caching for POST requests along with default GET and HEAD.""" + enabled: bool """Controls the option state. @@ -749,6 +912,8 @@ class OptionsProxyCacheMethodsSet(BaseModel): class OptionsProxyConnectTimeout(BaseModel): + """The time limit for establishing a connection with the origin.""" + enabled: bool """Controls the option state. @@ -766,6 +931,14 @@ class OptionsProxyConnectTimeout(BaseModel): class OptionsProxyReadTimeout(BaseModel): + """ + 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). + """ + enabled: bool """Controls the option state. @@ -783,6 +956,12 @@ class OptionsProxyReadTimeout(BaseModel): class OptionsQueryParamsBlacklist(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -797,6 +976,12 @@ class OptionsQueryParamsBlacklist(BaseModel): class OptionsQueryParamsWhitelist(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -811,6 +996,12 @@ class OptionsQueryParamsWhitelist(BaseModel): class OptionsQueryStringForwarding(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -860,6 +1051,11 @@ class OptionsQueryStringForwarding(BaseModel): class OptionsRedirectHTTPToHTTPS(BaseModel): + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: bool """Controls the option state. @@ -878,6 +1074,11 @@ class OptionsRedirectHTTPToHTTPS(BaseModel): class OptionsRedirectHTTPSToHTTP(BaseModel): + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: bool """Controls the option state. @@ -896,6 +1097,8 @@ class OptionsRedirectHTTPSToHTTP(BaseModel): class OptionsReferrerACL(BaseModel): + """Controls access to the CDN resource content for specified domain names.""" + enabled: bool """Controls the option state. @@ -934,6 +1137,8 @@ class OptionsReferrerACL(BaseModel): class OptionsRequestLimiter(BaseModel): + """Option allows to limit the amount of HTTP requests.""" + enabled: bool """Controls the option state. @@ -964,6 +1169,8 @@ class OptionsRequestLimiter(BaseModel): class OptionsResponseHeadersHidingPolicy(BaseModel): + """Hides HTTP headers from an origin server in the CDN response.""" + enabled: bool """Controls the option state. @@ -1003,6 +1210,11 @@ class OptionsResponseHeadersHidingPolicy(BaseModel): class OptionsRewrite(BaseModel): + """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. + """ + body: str """Path for the Rewrite option. @@ -1035,6 +1247,11 @@ class OptionsRewrite(BaseModel): class OptionsSecureKey(BaseModel): + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + enabled: bool """Controls the option state. @@ -1058,6 +1275,17 @@ class OptionsSecureKey(BaseModel): class OptionsSlice(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -1076,6 +1304,15 @@ class OptionsSlice(BaseModel): class OptionsSni(BaseModel): + """ + 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`. + """ + custom_hostname: str """Custom SNI hostname. @@ -1109,6 +1346,8 @@ class OptionsSni(BaseModel): class OptionsStale(BaseModel): + """Serves stale cached content in case of origin unavailability.""" + enabled: bool """Controls the option state. @@ -1173,6 +1412,8 @@ class OptionsStaticResponseHeadersValue(BaseModel): class OptionsStaticResponseHeaders(BaseModel): + """Custom HTTP Headers that a CDN server adds to a response.""" + enabled: bool """Controls the option state. @@ -1186,6 +1427,11 @@ class OptionsStaticResponseHeaders(BaseModel): class OptionsStaticHeaders(BaseModel): + """**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. + """ + enabled: bool """Controls the option state. @@ -1209,6 +1455,11 @@ class OptionsStaticHeaders(BaseModel): class OptionsStaticRequestHeaders(BaseModel): + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + enabled: bool """Controls the option state. @@ -1232,6 +1483,12 @@ class OptionsStaticRequestHeaders(BaseModel): class OptionsTlsVersions(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -1246,6 +1503,11 @@ class OptionsTlsVersions(BaseModel): class OptionsUseDefaultLeChain(BaseModel): + """Let's Encrypt certificate chain. + + The specified chain will be used during the next Let's Encrypt certificate issue or renewal. + """ + enabled: bool """Controls the option state. @@ -1265,6 +1527,11 @@ class OptionsUseDefaultLeChain(BaseModel): class OptionsUseDns01LeChallenge(BaseModel): + """DNS-01 challenge to issue a Let's Encrypt certificate for the resource. + + DNS service should be activated to enable this option. + """ + enabled: bool """Controls the option state. @@ -1283,6 +1550,11 @@ class OptionsUseDns01LeChallenge(BaseModel): class OptionsUseRsaLeCert(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -1301,6 +1573,8 @@ class OptionsUseRsaLeCert(BaseModel): class OptionsUserAgentACL(BaseModel): + """Controls access to the content for specified User-Agents.""" + enabled: bool """Controls the option state. @@ -1335,6 +1609,8 @@ class OptionsUserAgentACL(BaseModel): class OptionsWaap(BaseModel): + """Allows to enable WAAP (Web Application and API Protection).""" + enabled: bool """Controls the option state. @@ -1353,6 +1629,8 @@ class OptionsWaap(BaseModel): class OptionsWebsockets(BaseModel): + """Enables or disables WebSockets connections to an origin server.""" + enabled: bool """Controls the option state. @@ -1371,6 +1649,12 @@ class OptionsWebsockets(BaseModel): class Options(BaseModel): + """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. + """ + allowed_http_methods: Optional[OptionsAllowedHTTPMethods] = FieldInfo(alias="allowedHttpMethods", default=None) """HTTP methods allowed for content requests from the CDN.""" diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_config.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_config.py index 71914495..25edbfe1 100644 --- a/src/gcore/types/cdn/logs_uploader/logs_uploader_config.py +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_config.py @@ -10,6 +10,8 @@ class Status(LogsUploaderValidation): + """Validation status of the logs uploader config.""" + pass diff --git a/src/gcore/types/cdn/logs_uploader/logs_uploader_target.py b/src/gcore/types/cdn/logs_uploader/logs_uploader_target.py index 05eb1f25..786af310 100644 --- a/src/gcore/types/cdn/logs_uploader/logs_uploader_target.py +++ b/src/gcore/types/cdn/logs_uploader/logs_uploader_target.py @@ -197,6 +197,11 @@ class ConfigHTTPConfigResponse(BaseModel): class Status(LogsUploaderValidation): + """Validation status of the logs uploader target. + + Informs if the specified target is reachable. + """ + pass diff --git a/src/gcore/types/cdn/origin_group_create_params.py b/src/gcore/types/cdn/origin_group_create_params.py index 74f3a60a..540730d7 100644 --- a/src/gcore/types/cdn/origin_group_create_params.py +++ b/src/gcore/types/cdn/origin_group_create_params.py @@ -131,6 +131,8 @@ class AwsSignatureV4(TypedDict, total=False): class AwsSignatureV4Auth(TypedDict, total=False): + """Credentials to access the private bucket.""" + s3_access_key_id: Required[str] """Access key ID for the S3 account. diff --git a/src/gcore/types/cdn/origin_group_replace_params.py b/src/gcore/types/cdn/origin_group_replace_params.py index 4125cae7..bfca4218 100644 --- a/src/gcore/types/cdn/origin_group_replace_params.py +++ b/src/gcore/types/cdn/origin_group_replace_params.py @@ -137,6 +137,8 @@ class AwsSignatureV4(TypedDict, total=False): class AwsSignatureV4Auth(TypedDict, total=False): + """Credentials to access the private bucket.""" + s3_access_key_id: Required[str] """Access key ID for the S3 account. diff --git a/src/gcore/types/cdn/origin_group_update_params.py b/src/gcore/types/cdn/origin_group_update_params.py index 47d5a0d7..09fe43f1 100644 --- a/src/gcore/types/cdn/origin_group_update_params.py +++ b/src/gcore/types/cdn/origin_group_update_params.py @@ -137,6 +137,8 @@ class AwsSignatureV4(TypedDict, total=False): class AwsSignatureV4Auth(TypedDict, total=False): + """Credentials to access the private bucket.""" + s3_access_key_id: Required[str] """Access key ID for the S3 account. diff --git a/src/gcore/types/cdn/origin_groups.py b/src/gcore/types/cdn/origin_groups.py index 50c3eb01..fd41af74 100644 --- a/src/gcore/types/cdn/origin_groups.py +++ b/src/gcore/types/cdn/origin_groups.py @@ -99,6 +99,8 @@ class NoneAuth(BaseModel): class AwsSignatureV4Auth(BaseModel): + """Credentials to access the private bucket.""" + s3_access_key_id: str """Access key ID for the S3 account. diff --git a/src/gcore/types/cdn/resource_create_params.py b/src/gcore/types/cdn/resource_create_params.py index 8bbcce76..488f1f94 100644 --- a/src/gcore/types/cdn/resource_create_params.py +++ b/src/gcore/types/cdn/resource_create_params.py @@ -192,6 +192,8 @@ class ResourceCreateParams(TypedDict, total=False): class OptionsAllowedHTTPMethods(TypedDict, total=False): + """HTTP methods allowed for content requests from the CDN.""" + enabled: Required[bool] """Controls the option state. @@ -205,6 +207,8 @@ class OptionsAllowedHTTPMethods(TypedDict, total=False): class OptionsBotProtectionBotChallenge(TypedDict, total=False): + """Controls the bot challenge module state.""" + enabled: bool """Possible values: @@ -214,6 +218,10 @@ class OptionsBotProtectionBotChallenge(TypedDict, total=False): class OptionsBotProtection(TypedDict, total=False): + """ + Allows to prevent online services from overloading and ensure your business workflow running smoothly. + """ + bot_challenge: Required[OptionsBotProtectionBotChallenge] """Controls the bot challenge module state.""" @@ -228,6 +236,18 @@ class OptionsBotProtection(TypedDict, total=False): class OptionsBrotliCompression(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -265,6 +285,13 @@ class OptionsBrotliCompression(TypedDict, total=False): class OptionsBrowserCacheSettings(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -282,6 +309,11 @@ class OptionsBrowserCacheSettings(TypedDict, total=False): class OptionsCacheHTTPHeaders(TypedDict, total=False): + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + enabled: Required[bool] """Controls the option state. @@ -295,6 +327,11 @@ class OptionsCacheHTTPHeaders(TypedDict, total=False): class OptionsCors(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -335,6 +372,8 @@ class OptionsCors(TypedDict, total=False): class OptionsCountryACL(TypedDict, total=False): + """Enables control access to content for specified countries.""" + enabled: Required[bool] """Controls the option state. @@ -366,6 +405,11 @@ class OptionsCountryACL(TypedDict, total=False): class OptionsDisableCache(TypedDict, total=False): + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + enabled: Required[bool] """Controls the option state. @@ -384,6 +428,8 @@ class OptionsDisableCache(TypedDict, total=False): class OptionsDisableProxyForceRanges(TypedDict, total=False): + """Allows 206 responses regardless of the settings of an origin source.""" + enabled: Required[bool] """Controls the option state. @@ -402,6 +448,11 @@ class OptionsDisableProxyForceRanges(TypedDict, total=False): class OptionsEdgeCacheSettings(TypedDict, total=False): + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -446,6 +497,10 @@ class OptionsEdgeCacheSettings(TypedDict, total=False): class OptionsFastedgeOnRequestBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request body as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -466,6 +521,10 @@ class OptionsFastedgeOnRequestBody(TypedDict, total=False): class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -486,6 +545,10 @@ class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): class OptionsFastedgeOnResponseBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response body before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -506,6 +569,10 @@ class OptionsFastedgeOnResponseBody(TypedDict, total=False): class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response headers before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -526,6 +593,12 @@ class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): class OptionsFastedge(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -561,6 +634,16 @@ class OptionsFastedge(TypedDict, total=False): class OptionsFetchCompressed(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -579,6 +662,11 @@ class OptionsFetchCompressed(TypedDict, total=False): class OptionsFollowOriginRedirect(TypedDict, total=False): + """ + 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. + """ + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] """Redirect status code that the origin server returns. @@ -597,6 +685,11 @@ class OptionsFollowOriginRedirect(TypedDict, total=False): class OptionsForceReturnTimeInterval(TypedDict, total=False): + """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. + """ + end_time: Required[str] """Time until which a custom HTTP response code should be applied. @@ -614,6 +707,11 @@ class OptionsForceReturnTimeInterval(TypedDict, total=False): class OptionsForceReturn(TypedDict, total=False): + """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. + """ + body: Required[str] """URL for redirection or text.""" @@ -637,6 +735,11 @@ class OptionsForceReturn(TypedDict, total=False): class OptionsForwardHostHeader(TypedDict, total=False): + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -655,6 +758,16 @@ class OptionsForwardHostHeader(TypedDict, total=False): class OptionsGzipOn(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -673,6 +786,15 @@ class OptionsGzipOn(TypedDict, total=False): class OptionsHostHeader(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -687,6 +809,11 @@ class OptionsHostHeader(TypedDict, total=False): class OptionsHttp3Enabled(TypedDict, total=False): + """Enables HTTP/3 protocol for content delivery. + + `http3_enabled` option works only with `"sslEnabled": true`. + """ + enabled: Required[bool] """Controls the option state. @@ -705,6 +832,10 @@ class OptionsHttp3Enabled(TypedDict, total=False): class OptionsIgnoreCookie(TypedDict, total=False): + """ + Defines whether the files with the Set-Cookies header are cached as one file or as different ones. + """ + enabled: Required[bool] """Controls the option state. @@ -724,6 +855,12 @@ class OptionsIgnoreCookie(TypedDict, total=False): class OptionsIgnoreQueryString(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -742,6 +879,10 @@ class OptionsIgnoreQueryString(TypedDict, total=False): class OptionsImageStack(TypedDict, total=False): + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically converts them to WebP or AVIF format. + """ + enabled: Required[bool] """Controls the option state. @@ -769,6 +910,12 @@ class OptionsImageStack(TypedDict, total=False): class OptionsIPAddressACL(TypedDict, total=False): + """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) + """ + enabled: Required[bool] """Controls the option state. @@ -805,6 +952,8 @@ class OptionsIPAddressACL(TypedDict, total=False): class OptionsLimitBandwidth(TypedDict, total=False): + """Allows to control the download speed per connection.""" + enabled: Required[bool] """Controls the option state. @@ -840,6 +989,18 @@ class OptionsLimitBandwidth(TypedDict, total=False): class OptionsProxyCacheKey(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -854,6 +1015,8 @@ class OptionsProxyCacheKey(TypedDict, total=False): class OptionsProxyCacheMethodsSet(TypedDict, total=False): + """Caching for POST requests along with default GET and HEAD.""" + enabled: Required[bool] """Controls the option state. @@ -872,6 +1035,8 @@ class OptionsProxyCacheMethodsSet(TypedDict, total=False): class OptionsProxyConnectTimeout(TypedDict, total=False): + """The time limit for establishing a connection with the origin.""" + enabled: Required[bool] """Controls the option state. @@ -889,6 +1054,14 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): class OptionsProxyReadTimeout(TypedDict, total=False): + """ + 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). + """ + enabled: Required[bool] """Controls the option state. @@ -906,6 +1079,12 @@ class OptionsProxyReadTimeout(TypedDict, total=False): class OptionsQueryParamsBlacklist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -920,6 +1099,12 @@ class OptionsQueryParamsBlacklist(TypedDict, total=False): class OptionsQueryParamsWhitelist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -934,6 +1119,12 @@ class OptionsQueryParamsWhitelist(TypedDict, total=False): class OptionsQueryStringForwarding(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -983,6 +1174,11 @@ class OptionsQueryStringForwarding(TypedDict, total=False): class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -1001,6 +1197,11 @@ class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -1019,6 +1220,8 @@ class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): class OptionsReferrerACL(TypedDict, total=False): + """Controls access to the CDN resource content for specified domain names.""" + enabled: Required[bool] """Controls the option state. @@ -1057,6 +1260,8 @@ class OptionsReferrerACL(TypedDict, total=False): class OptionsRequestLimiter(TypedDict, total=False): + """Option allows to limit the amount of HTTP requests.""" + enabled: Required[bool] """Controls the option state. @@ -1083,6 +1288,8 @@ class OptionsRequestLimiter(TypedDict, total=False): class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + """Hides HTTP headers from an origin server in the CDN response.""" + enabled: Required[bool] """Controls the option state. @@ -1122,6 +1329,11 @@ class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): class OptionsRewrite(TypedDict, total=False): + """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. + """ + body: Required[str] """Path for the Rewrite option. @@ -1154,6 +1366,11 @@ class OptionsRewrite(TypedDict, total=False): class OptionsSecureKey(TypedDict, total=False): + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + enabled: Required[bool] """Controls the option state. @@ -1177,6 +1394,17 @@ class OptionsSecureKey(TypedDict, total=False): class OptionsSlice(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -1195,6 +1423,15 @@ class OptionsSlice(TypedDict, total=False): class OptionsSni(TypedDict, total=False): + """ + 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`. + """ + custom_hostname: Required[str] """Custom SNI hostname. @@ -1228,6 +1465,8 @@ class OptionsSni(TypedDict, total=False): class OptionsStale(TypedDict, total=False): + """Serves stale cached content in case of origin unavailability.""" + enabled: Required[bool] """Controls the option state. @@ -1294,6 +1533,8 @@ class OptionsStaticResponseHeadersValue(TypedDict, total=False): class OptionsStaticResponseHeaders(TypedDict, total=False): + """Custom HTTP Headers that a CDN server adds to a response.""" + enabled: Required[bool] """Controls the option state. @@ -1307,6 +1548,11 @@ class OptionsStaticResponseHeaders(TypedDict, total=False): class OptionsStaticHeaders(TypedDict, total=False): + """**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. + """ + enabled: Required[bool] """Controls the option state. @@ -1330,6 +1576,11 @@ class OptionsStaticHeaders(TypedDict, total=False): class OptionsStaticRequestHeaders(TypedDict, total=False): + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + enabled: Required[bool] """Controls the option state. @@ -1353,6 +1604,12 @@ class OptionsStaticRequestHeaders(TypedDict, total=False): class OptionsTlsVersions(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -1367,6 +1624,11 @@ class OptionsTlsVersions(TypedDict, total=False): class OptionsUseDefaultLeChain(TypedDict, total=False): + """Let's Encrypt certificate chain. + + The specified chain will be used during the next Let's Encrypt certificate issue or renewal. + """ + enabled: Required[bool] """Controls the option state. @@ -1386,6 +1648,11 @@ class OptionsUseDefaultLeChain(TypedDict, total=False): class OptionsUseDns01LeChallenge(TypedDict, total=False): + """DNS-01 challenge to issue a Let's Encrypt certificate for the resource. + + DNS service should be activated to enable this option. + """ + enabled: Required[bool] """Controls the option state. @@ -1404,6 +1671,11 @@ class OptionsUseDns01LeChallenge(TypedDict, total=False): class OptionsUseRsaLeCert(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -1422,6 +1694,8 @@ class OptionsUseRsaLeCert(TypedDict, total=False): class OptionsUserAgentACL(TypedDict, total=False): + """Controls access to the content for specified User-Agents.""" + enabled: Required[bool] """Controls the option state. @@ -1456,6 +1730,8 @@ class OptionsUserAgentACL(TypedDict, total=False): class OptionsWaap(TypedDict, total=False): + """Allows to enable WAAP (Web Application and API Protection).""" + enabled: Required[bool] """Controls the option state. @@ -1474,6 +1750,8 @@ class OptionsWaap(TypedDict, total=False): class OptionsWebsockets(TypedDict, total=False): + """Enables or disables WebSockets connections to an origin server.""" + enabled: Required[bool] """Controls the option state. @@ -1492,6 +1770,12 @@ class OptionsWebsockets(TypedDict, total=False): class Options(TypedDict, total=False): + """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. + """ + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] """HTTP methods allowed for content requests from the CDN.""" diff --git a/src/gcore/types/cdn/resource_replace_params.py b/src/gcore/types/cdn/resource_replace_params.py index 0d888ff0..cb423c40 100644 --- a/src/gcore/types/cdn/resource_replace_params.py +++ b/src/gcore/types/cdn/resource_replace_params.py @@ -170,6 +170,8 @@ class ResourceReplaceParams(TypedDict, total=False): class OptionsAllowedHTTPMethods(TypedDict, total=False): + """HTTP methods allowed for content requests from the CDN.""" + enabled: Required[bool] """Controls the option state. @@ -183,6 +185,8 @@ class OptionsAllowedHTTPMethods(TypedDict, total=False): class OptionsBotProtectionBotChallenge(TypedDict, total=False): + """Controls the bot challenge module state.""" + enabled: bool """Possible values: @@ -192,6 +196,10 @@ class OptionsBotProtectionBotChallenge(TypedDict, total=False): class OptionsBotProtection(TypedDict, total=False): + """ + Allows to prevent online services from overloading and ensure your business workflow running smoothly. + """ + bot_challenge: Required[OptionsBotProtectionBotChallenge] """Controls the bot challenge module state.""" @@ -206,6 +214,18 @@ class OptionsBotProtection(TypedDict, total=False): class OptionsBrotliCompression(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -243,6 +263,13 @@ class OptionsBrotliCompression(TypedDict, total=False): class OptionsBrowserCacheSettings(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -260,6 +287,11 @@ class OptionsBrowserCacheSettings(TypedDict, total=False): class OptionsCacheHTTPHeaders(TypedDict, total=False): + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + enabled: Required[bool] """Controls the option state. @@ -273,6 +305,11 @@ class OptionsCacheHTTPHeaders(TypedDict, total=False): class OptionsCors(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -313,6 +350,8 @@ class OptionsCors(TypedDict, total=False): class OptionsCountryACL(TypedDict, total=False): + """Enables control access to content for specified countries.""" + enabled: Required[bool] """Controls the option state. @@ -344,6 +383,11 @@ class OptionsCountryACL(TypedDict, total=False): class OptionsDisableCache(TypedDict, total=False): + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + enabled: Required[bool] """Controls the option state. @@ -362,6 +406,8 @@ class OptionsDisableCache(TypedDict, total=False): class OptionsDisableProxyForceRanges(TypedDict, total=False): + """Allows 206 responses regardless of the settings of an origin source.""" + enabled: Required[bool] """Controls the option state. @@ -380,6 +426,11 @@ class OptionsDisableProxyForceRanges(TypedDict, total=False): class OptionsEdgeCacheSettings(TypedDict, total=False): + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -424,6 +475,10 @@ class OptionsEdgeCacheSettings(TypedDict, total=False): class OptionsFastedgeOnRequestBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request body as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -444,6 +499,10 @@ class OptionsFastedgeOnRequestBody(TypedDict, total=False): class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -464,6 +523,10 @@ class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): class OptionsFastedgeOnResponseBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response body before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -484,6 +547,10 @@ class OptionsFastedgeOnResponseBody(TypedDict, total=False): class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response headers before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -504,6 +571,12 @@ class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): class OptionsFastedge(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -539,6 +612,16 @@ class OptionsFastedge(TypedDict, total=False): class OptionsFetchCompressed(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -557,6 +640,11 @@ class OptionsFetchCompressed(TypedDict, total=False): class OptionsFollowOriginRedirect(TypedDict, total=False): + """ + 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. + """ + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] """Redirect status code that the origin server returns. @@ -575,6 +663,11 @@ class OptionsFollowOriginRedirect(TypedDict, total=False): class OptionsForceReturnTimeInterval(TypedDict, total=False): + """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. + """ + end_time: Required[str] """Time until which a custom HTTP response code should be applied. @@ -592,6 +685,11 @@ class OptionsForceReturnTimeInterval(TypedDict, total=False): class OptionsForceReturn(TypedDict, total=False): + """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. + """ + body: Required[str] """URL for redirection or text.""" @@ -615,6 +713,11 @@ class OptionsForceReturn(TypedDict, total=False): class OptionsForwardHostHeader(TypedDict, total=False): + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -633,6 +736,16 @@ class OptionsForwardHostHeader(TypedDict, total=False): class OptionsGzipOn(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -651,6 +764,15 @@ class OptionsGzipOn(TypedDict, total=False): class OptionsHostHeader(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -665,6 +787,11 @@ class OptionsHostHeader(TypedDict, total=False): class OptionsHttp3Enabled(TypedDict, total=False): + """Enables HTTP/3 protocol for content delivery. + + `http3_enabled` option works only with `"sslEnabled": true`. + """ + enabled: Required[bool] """Controls the option state. @@ -683,6 +810,10 @@ class OptionsHttp3Enabled(TypedDict, total=False): class OptionsIgnoreCookie(TypedDict, total=False): + """ + Defines whether the files with the Set-Cookies header are cached as one file or as different ones. + """ + enabled: Required[bool] """Controls the option state. @@ -702,6 +833,12 @@ class OptionsIgnoreCookie(TypedDict, total=False): class OptionsIgnoreQueryString(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -720,6 +857,10 @@ class OptionsIgnoreQueryString(TypedDict, total=False): class OptionsImageStack(TypedDict, total=False): + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically converts them to WebP or AVIF format. + """ + enabled: Required[bool] """Controls the option state. @@ -747,6 +888,12 @@ class OptionsImageStack(TypedDict, total=False): class OptionsIPAddressACL(TypedDict, total=False): + """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) + """ + enabled: Required[bool] """Controls the option state. @@ -783,6 +930,8 @@ class OptionsIPAddressACL(TypedDict, total=False): class OptionsLimitBandwidth(TypedDict, total=False): + """Allows to control the download speed per connection.""" + enabled: Required[bool] """Controls the option state. @@ -818,6 +967,18 @@ class OptionsLimitBandwidth(TypedDict, total=False): class OptionsProxyCacheKey(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -832,6 +993,8 @@ class OptionsProxyCacheKey(TypedDict, total=False): class OptionsProxyCacheMethodsSet(TypedDict, total=False): + """Caching for POST requests along with default GET and HEAD.""" + enabled: Required[bool] """Controls the option state. @@ -850,6 +1013,8 @@ class OptionsProxyCacheMethodsSet(TypedDict, total=False): class OptionsProxyConnectTimeout(TypedDict, total=False): + """The time limit for establishing a connection with the origin.""" + enabled: Required[bool] """Controls the option state. @@ -867,6 +1032,14 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): class OptionsProxyReadTimeout(TypedDict, total=False): + """ + 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). + """ + enabled: Required[bool] """Controls the option state. @@ -884,6 +1057,12 @@ class OptionsProxyReadTimeout(TypedDict, total=False): class OptionsQueryParamsBlacklist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -898,6 +1077,12 @@ class OptionsQueryParamsBlacklist(TypedDict, total=False): class OptionsQueryParamsWhitelist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -912,6 +1097,12 @@ class OptionsQueryParamsWhitelist(TypedDict, total=False): class OptionsQueryStringForwarding(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -961,6 +1152,11 @@ class OptionsQueryStringForwarding(TypedDict, total=False): class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -979,6 +1175,11 @@ class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -997,6 +1198,8 @@ class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): class OptionsReferrerACL(TypedDict, total=False): + """Controls access to the CDN resource content for specified domain names.""" + enabled: Required[bool] """Controls the option state. @@ -1035,6 +1238,8 @@ class OptionsReferrerACL(TypedDict, total=False): class OptionsRequestLimiter(TypedDict, total=False): + """Option allows to limit the amount of HTTP requests.""" + enabled: Required[bool] """Controls the option state. @@ -1061,6 +1266,8 @@ class OptionsRequestLimiter(TypedDict, total=False): class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + """Hides HTTP headers from an origin server in the CDN response.""" + enabled: Required[bool] """Controls the option state. @@ -1100,6 +1307,11 @@ class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): class OptionsRewrite(TypedDict, total=False): + """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. + """ + body: Required[str] """Path for the Rewrite option. @@ -1132,6 +1344,11 @@ class OptionsRewrite(TypedDict, total=False): class OptionsSecureKey(TypedDict, total=False): + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + enabled: Required[bool] """Controls the option state. @@ -1155,6 +1372,17 @@ class OptionsSecureKey(TypedDict, total=False): class OptionsSlice(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -1173,6 +1401,15 @@ class OptionsSlice(TypedDict, total=False): class OptionsSni(TypedDict, total=False): + """ + 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`. + """ + custom_hostname: Required[str] """Custom SNI hostname. @@ -1206,6 +1443,8 @@ class OptionsSni(TypedDict, total=False): class OptionsStale(TypedDict, total=False): + """Serves stale cached content in case of origin unavailability.""" + enabled: Required[bool] """Controls the option state. @@ -1272,6 +1511,8 @@ class OptionsStaticResponseHeadersValue(TypedDict, total=False): class OptionsStaticResponseHeaders(TypedDict, total=False): + """Custom HTTP Headers that a CDN server adds to a response.""" + enabled: Required[bool] """Controls the option state. @@ -1285,6 +1526,11 @@ class OptionsStaticResponseHeaders(TypedDict, total=False): class OptionsStaticHeaders(TypedDict, total=False): + """**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. + """ + enabled: Required[bool] """Controls the option state. @@ -1308,6 +1554,11 @@ class OptionsStaticHeaders(TypedDict, total=False): class OptionsStaticRequestHeaders(TypedDict, total=False): + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + enabled: Required[bool] """Controls the option state. @@ -1331,6 +1582,12 @@ class OptionsStaticRequestHeaders(TypedDict, total=False): class OptionsTlsVersions(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -1345,6 +1602,11 @@ class OptionsTlsVersions(TypedDict, total=False): class OptionsUseDefaultLeChain(TypedDict, total=False): + """Let's Encrypt certificate chain. + + The specified chain will be used during the next Let's Encrypt certificate issue or renewal. + """ + enabled: Required[bool] """Controls the option state. @@ -1364,6 +1626,11 @@ class OptionsUseDefaultLeChain(TypedDict, total=False): class OptionsUseDns01LeChallenge(TypedDict, total=False): + """DNS-01 challenge to issue a Let's Encrypt certificate for the resource. + + DNS service should be activated to enable this option. + """ + enabled: Required[bool] """Controls the option state. @@ -1382,6 +1649,11 @@ class OptionsUseDns01LeChallenge(TypedDict, total=False): class OptionsUseRsaLeCert(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -1400,6 +1672,8 @@ class OptionsUseRsaLeCert(TypedDict, total=False): class OptionsUserAgentACL(TypedDict, total=False): + """Controls access to the content for specified User-Agents.""" + enabled: Required[bool] """Controls the option state. @@ -1434,6 +1708,8 @@ class OptionsUserAgentACL(TypedDict, total=False): class OptionsWaap(TypedDict, total=False): + """Allows to enable WAAP (Web Application and API Protection).""" + enabled: Required[bool] """Controls the option state. @@ -1452,6 +1728,8 @@ class OptionsWaap(TypedDict, total=False): class OptionsWebsockets(TypedDict, total=False): + """Enables or disables WebSockets connections to an origin server.""" + enabled: Required[bool] """Controls the option state. @@ -1470,6 +1748,12 @@ class OptionsWebsockets(TypedDict, total=False): class Options(TypedDict, total=False): + """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. + """ + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] """HTTP methods allowed for content requests from the CDN.""" diff --git a/src/gcore/types/cdn/resource_update_params.py b/src/gcore/types/cdn/resource_update_params.py index 2a8bd492..f96093b8 100644 --- a/src/gcore/types/cdn/resource_update_params.py +++ b/src/gcore/types/cdn/resource_update_params.py @@ -161,6 +161,8 @@ class ResourceUpdateParams(TypedDict, total=False): class OptionsAllowedHTTPMethods(TypedDict, total=False): + """HTTP methods allowed for content requests from the CDN.""" + enabled: Required[bool] """Controls the option state. @@ -174,6 +176,8 @@ class OptionsAllowedHTTPMethods(TypedDict, total=False): class OptionsBotProtectionBotChallenge(TypedDict, total=False): + """Controls the bot challenge module state.""" + enabled: bool """Possible values: @@ -183,6 +187,10 @@ class OptionsBotProtectionBotChallenge(TypedDict, total=False): class OptionsBotProtection(TypedDict, total=False): + """ + Allows to prevent online services from overloading and ensure your business workflow running smoothly. + """ + bot_challenge: Required[OptionsBotProtectionBotChallenge] """Controls the bot challenge module state.""" @@ -197,6 +205,18 @@ class OptionsBotProtection(TypedDict, total=False): class OptionsBrotliCompression(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -234,6 +254,13 @@ class OptionsBrotliCompression(TypedDict, total=False): class OptionsBrowserCacheSettings(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -251,6 +278,11 @@ class OptionsBrowserCacheSettings(TypedDict, total=False): class OptionsCacheHTTPHeaders(TypedDict, total=False): + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + enabled: Required[bool] """Controls the option state. @@ -264,6 +296,11 @@ class OptionsCacheHTTPHeaders(TypedDict, total=False): class OptionsCors(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -304,6 +341,8 @@ class OptionsCors(TypedDict, total=False): class OptionsCountryACL(TypedDict, total=False): + """Enables control access to content for specified countries.""" + enabled: Required[bool] """Controls the option state. @@ -335,6 +374,11 @@ class OptionsCountryACL(TypedDict, total=False): class OptionsDisableCache(TypedDict, total=False): + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + enabled: Required[bool] """Controls the option state. @@ -353,6 +397,8 @@ class OptionsDisableCache(TypedDict, total=False): class OptionsDisableProxyForceRanges(TypedDict, total=False): + """Allows 206 responses regardless of the settings of an origin source.""" + enabled: Required[bool] """Controls the option state. @@ -371,6 +417,11 @@ class OptionsDisableProxyForceRanges(TypedDict, total=False): class OptionsEdgeCacheSettings(TypedDict, total=False): + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -415,6 +466,10 @@ class OptionsEdgeCacheSettings(TypedDict, total=False): class OptionsFastedgeOnRequestBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request body as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -435,6 +490,10 @@ class OptionsFastedgeOnRequestBody(TypedDict, total=False): class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -455,6 +514,10 @@ class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): class OptionsFastedgeOnResponseBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response body before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -475,6 +538,10 @@ class OptionsFastedgeOnResponseBody(TypedDict, total=False): class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response headers before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -495,6 +562,12 @@ class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): class OptionsFastedge(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -530,6 +603,16 @@ class OptionsFastedge(TypedDict, total=False): class OptionsFetchCompressed(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -548,6 +631,11 @@ class OptionsFetchCompressed(TypedDict, total=False): class OptionsFollowOriginRedirect(TypedDict, total=False): + """ + 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. + """ + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] """Redirect status code that the origin server returns. @@ -566,6 +654,11 @@ class OptionsFollowOriginRedirect(TypedDict, total=False): class OptionsForceReturnTimeInterval(TypedDict, total=False): + """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. + """ + end_time: Required[str] """Time until which a custom HTTP response code should be applied. @@ -583,6 +676,11 @@ class OptionsForceReturnTimeInterval(TypedDict, total=False): class OptionsForceReturn(TypedDict, total=False): + """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. + """ + body: Required[str] """URL for redirection or text.""" @@ -606,6 +704,11 @@ class OptionsForceReturn(TypedDict, total=False): class OptionsForwardHostHeader(TypedDict, total=False): + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -624,6 +727,16 @@ class OptionsForwardHostHeader(TypedDict, total=False): class OptionsGzipOn(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -642,6 +755,15 @@ class OptionsGzipOn(TypedDict, total=False): class OptionsHostHeader(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -656,6 +778,11 @@ class OptionsHostHeader(TypedDict, total=False): class OptionsHttp3Enabled(TypedDict, total=False): + """Enables HTTP/3 protocol for content delivery. + + `http3_enabled` option works only with `"sslEnabled": true`. + """ + enabled: Required[bool] """Controls the option state. @@ -674,6 +801,10 @@ class OptionsHttp3Enabled(TypedDict, total=False): class OptionsIgnoreCookie(TypedDict, total=False): + """ + Defines whether the files with the Set-Cookies header are cached as one file or as different ones. + """ + enabled: Required[bool] """Controls the option state. @@ -693,6 +824,12 @@ class OptionsIgnoreCookie(TypedDict, total=False): class OptionsIgnoreQueryString(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -711,6 +848,10 @@ class OptionsIgnoreQueryString(TypedDict, total=False): class OptionsImageStack(TypedDict, total=False): + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically converts them to WebP or AVIF format. + """ + enabled: Required[bool] """Controls the option state. @@ -738,6 +879,12 @@ class OptionsImageStack(TypedDict, total=False): class OptionsIPAddressACL(TypedDict, total=False): + """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) + """ + enabled: Required[bool] """Controls the option state. @@ -774,6 +921,8 @@ class OptionsIPAddressACL(TypedDict, total=False): class OptionsLimitBandwidth(TypedDict, total=False): + """Allows to control the download speed per connection.""" + enabled: Required[bool] """Controls the option state. @@ -809,6 +958,18 @@ class OptionsLimitBandwidth(TypedDict, total=False): class OptionsProxyCacheKey(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -823,6 +984,8 @@ class OptionsProxyCacheKey(TypedDict, total=False): class OptionsProxyCacheMethodsSet(TypedDict, total=False): + """Caching for POST requests along with default GET and HEAD.""" + enabled: Required[bool] """Controls the option state. @@ -841,6 +1004,8 @@ class OptionsProxyCacheMethodsSet(TypedDict, total=False): class OptionsProxyConnectTimeout(TypedDict, total=False): + """The time limit for establishing a connection with the origin.""" + enabled: Required[bool] """Controls the option state. @@ -858,6 +1023,14 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): class OptionsProxyReadTimeout(TypedDict, total=False): + """ + 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). + """ + enabled: Required[bool] """Controls the option state. @@ -875,6 +1048,12 @@ class OptionsProxyReadTimeout(TypedDict, total=False): class OptionsQueryParamsBlacklist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -889,6 +1068,12 @@ class OptionsQueryParamsBlacklist(TypedDict, total=False): class OptionsQueryParamsWhitelist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -903,6 +1088,12 @@ class OptionsQueryParamsWhitelist(TypedDict, total=False): class OptionsQueryStringForwarding(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -952,6 +1143,11 @@ class OptionsQueryStringForwarding(TypedDict, total=False): class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -970,6 +1166,11 @@ class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -988,6 +1189,8 @@ class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): class OptionsReferrerACL(TypedDict, total=False): + """Controls access to the CDN resource content for specified domain names.""" + enabled: Required[bool] """Controls the option state. @@ -1026,6 +1229,8 @@ class OptionsReferrerACL(TypedDict, total=False): class OptionsRequestLimiter(TypedDict, total=False): + """Option allows to limit the amount of HTTP requests.""" + enabled: Required[bool] """Controls the option state. @@ -1052,6 +1257,8 @@ class OptionsRequestLimiter(TypedDict, total=False): class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + """Hides HTTP headers from an origin server in the CDN response.""" + enabled: Required[bool] """Controls the option state. @@ -1091,6 +1298,11 @@ class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): class OptionsRewrite(TypedDict, total=False): + """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. + """ + body: Required[str] """Path for the Rewrite option. @@ -1123,6 +1335,11 @@ class OptionsRewrite(TypedDict, total=False): class OptionsSecureKey(TypedDict, total=False): + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + enabled: Required[bool] """Controls the option state. @@ -1146,6 +1363,17 @@ class OptionsSecureKey(TypedDict, total=False): class OptionsSlice(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -1164,6 +1392,15 @@ class OptionsSlice(TypedDict, total=False): class OptionsSni(TypedDict, total=False): + """ + 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`. + """ + custom_hostname: Required[str] """Custom SNI hostname. @@ -1197,6 +1434,8 @@ class OptionsSni(TypedDict, total=False): class OptionsStale(TypedDict, total=False): + """Serves stale cached content in case of origin unavailability.""" + enabled: Required[bool] """Controls the option state. @@ -1263,6 +1502,8 @@ class OptionsStaticResponseHeadersValue(TypedDict, total=False): class OptionsStaticResponseHeaders(TypedDict, total=False): + """Custom HTTP Headers that a CDN server adds to a response.""" + enabled: Required[bool] """Controls the option state. @@ -1276,6 +1517,11 @@ class OptionsStaticResponseHeaders(TypedDict, total=False): class OptionsStaticHeaders(TypedDict, total=False): + """**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. + """ + enabled: Required[bool] """Controls the option state. @@ -1299,6 +1545,11 @@ class OptionsStaticHeaders(TypedDict, total=False): class OptionsStaticRequestHeaders(TypedDict, total=False): + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + enabled: Required[bool] """Controls the option state. @@ -1322,6 +1573,12 @@ class OptionsStaticRequestHeaders(TypedDict, total=False): class OptionsTlsVersions(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -1336,6 +1593,11 @@ class OptionsTlsVersions(TypedDict, total=False): class OptionsUseDefaultLeChain(TypedDict, total=False): + """Let's Encrypt certificate chain. + + The specified chain will be used during the next Let's Encrypt certificate issue or renewal. + """ + enabled: Required[bool] """Controls the option state. @@ -1355,6 +1617,11 @@ class OptionsUseDefaultLeChain(TypedDict, total=False): class OptionsUseDns01LeChallenge(TypedDict, total=False): + """DNS-01 challenge to issue a Let's Encrypt certificate for the resource. + + DNS service should be activated to enable this option. + """ + enabled: Required[bool] """Controls the option state. @@ -1373,6 +1640,11 @@ class OptionsUseDns01LeChallenge(TypedDict, total=False): class OptionsUseRsaLeCert(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -1391,6 +1663,8 @@ class OptionsUseRsaLeCert(TypedDict, total=False): class OptionsUserAgentACL(TypedDict, total=False): + """Controls access to the content for specified User-Agents.""" + enabled: Required[bool] """Controls the option state. @@ -1425,6 +1699,8 @@ class OptionsUserAgentACL(TypedDict, total=False): class OptionsWaap(TypedDict, total=False): + """Allows to enable WAAP (Web Application and API Protection).""" + enabled: Required[bool] """Controls the option state. @@ -1443,6 +1719,8 @@ class OptionsWaap(TypedDict, total=False): class OptionsWebsockets(TypedDict, total=False): + """Enables or disables WebSockets connections to an origin server.""" + enabled: Required[bool] """Controls the option state. @@ -1461,6 +1739,12 @@ class OptionsWebsockets(TypedDict, total=False): class Options(TypedDict, total=False): + """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. + """ + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] """HTTP methods allowed for content requests from the CDN.""" diff --git a/src/gcore/types/cdn/resources/cdn_resource_rule.py b/src/gcore/types/cdn/resources/cdn_resource_rule.py index 268172bc..9118e322 100644 --- a/src/gcore/types/cdn/resources/cdn_resource_rule.py +++ b/src/gcore/types/cdn/resources/cdn_resource_rule.py @@ -66,6 +66,8 @@ class OptionsAllowedHTTPMethods(BaseModel): + """HTTP methods allowed for content requests from the CDN.""" + enabled: bool """Controls the option state. @@ -79,6 +81,8 @@ class OptionsAllowedHTTPMethods(BaseModel): class OptionsBotProtectionBotChallenge(BaseModel): + """Controls the bot challenge module state.""" + enabled: Optional[bool] = None """Possible values: @@ -88,6 +92,10 @@ class OptionsBotProtectionBotChallenge(BaseModel): class OptionsBotProtection(BaseModel): + """ + Allows to prevent online services from overloading and ensure your business workflow running smoothly. + """ + bot_challenge: OptionsBotProtectionBotChallenge """Controls the bot challenge module state.""" @@ -102,6 +110,18 @@ class OptionsBotProtection(BaseModel): class OptionsBrotliCompression(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -137,6 +157,13 @@ class OptionsBrotliCompression(BaseModel): class OptionsBrowserCacheSettings(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -154,6 +181,11 @@ class OptionsBrowserCacheSettings(BaseModel): class OptionsCacheHTTPHeaders(BaseModel): + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + enabled: bool """Controls the option state. @@ -167,6 +199,11 @@ class OptionsCacheHTTPHeaders(BaseModel): class OptionsCors(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -207,6 +244,8 @@ class OptionsCors(BaseModel): class OptionsCountryACL(BaseModel): + """Enables control access to content for specified countries.""" + enabled: bool """Controls the option state. @@ -238,6 +277,11 @@ class OptionsCountryACL(BaseModel): class OptionsDisableCache(BaseModel): + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + enabled: bool """Controls the option state. @@ -256,6 +300,8 @@ class OptionsDisableCache(BaseModel): class OptionsDisableProxyForceRanges(BaseModel): + """Allows 206 responses regardless of the settings of an origin source.""" + enabled: bool """Controls the option state. @@ -274,6 +320,11 @@ class OptionsDisableProxyForceRanges(BaseModel): class OptionsEdgeCacheSettings(BaseModel): + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + enabled: bool """Controls the option state. @@ -318,6 +369,10 @@ class OptionsEdgeCacheSettings(BaseModel): class OptionsFastedgeOnRequestBody(BaseModel): + """ + Allows to configure FastEdge application that will be called to handle request body as soon as CDN receives incoming HTTP request. + """ + app_id: str """The ID of the application in FastEdge.""" @@ -338,6 +393,10 @@ class OptionsFastedgeOnRequestBody(BaseModel): class OptionsFastedgeOnRequestHeaders(BaseModel): + """ + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request. + """ + app_id: str """The ID of the application in FastEdge.""" @@ -358,6 +417,10 @@ class OptionsFastedgeOnRequestHeaders(BaseModel): class OptionsFastedgeOnResponseBody(BaseModel): + """ + Allows to configure FastEdge application that will be called to handle response body before CDN sends the HTTP response. + """ + app_id: str """The ID of the application in FastEdge.""" @@ -378,6 +441,10 @@ class OptionsFastedgeOnResponseBody(BaseModel): class OptionsFastedgeOnResponseHeaders(BaseModel): + """ + Allows to configure FastEdge application that will be called to handle response headers before CDN sends the HTTP response. + """ + app_id: str """The ID of the application in FastEdge.""" @@ -398,6 +465,12 @@ class OptionsFastedgeOnResponseHeaders(BaseModel): class OptionsFastedge(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -433,6 +506,16 @@ class OptionsFastedge(BaseModel): class OptionsFetchCompressed(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -451,6 +534,11 @@ class OptionsFetchCompressed(BaseModel): class OptionsFollowOriginRedirect(BaseModel): + """ + 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. + """ + codes: List[Literal[301, 302, 303, 307, 308]] """Redirect status code that the origin server returns. @@ -469,6 +557,11 @@ class OptionsFollowOriginRedirect(BaseModel): class OptionsForceReturnTimeInterval(BaseModel): + """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. + """ + end_time: str """Time until which a custom HTTP response code should be applied. @@ -486,6 +579,11 @@ class OptionsForceReturnTimeInterval(BaseModel): class OptionsForceReturn(BaseModel): + """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. + """ + body: str """URL for redirection or text.""" @@ -509,6 +607,11 @@ class OptionsForceReturn(BaseModel): class OptionsForwardHostHeader(BaseModel): + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + enabled: bool """Controls the option state. @@ -527,6 +630,16 @@ class OptionsForwardHostHeader(BaseModel): class OptionsGzipOn(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -545,6 +658,15 @@ class OptionsGzipOn(BaseModel): class OptionsHostHeader(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -559,6 +681,10 @@ class OptionsHostHeader(BaseModel): class OptionsIgnoreCookie(BaseModel): + """ + Defines whether the files with the Set-Cookies header are cached as one file or as different ones. + """ + enabled: bool """Controls the option state. @@ -578,6 +704,12 @@ class OptionsIgnoreCookie(BaseModel): class OptionsIgnoreQueryString(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -596,6 +728,10 @@ class OptionsIgnoreQueryString(BaseModel): class OptionsImageStack(BaseModel): + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically converts them to WebP or AVIF format. + """ + enabled: bool """Controls the option state. @@ -623,6 +759,12 @@ class OptionsImageStack(BaseModel): class OptionsIPAddressACL(BaseModel): + """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) + """ + enabled: bool """Controls the option state. @@ -659,6 +801,8 @@ class OptionsIPAddressACL(BaseModel): class OptionsLimitBandwidth(BaseModel): + """Allows to control the download speed per connection.""" + enabled: bool """Controls the option state. @@ -694,6 +838,18 @@ class OptionsLimitBandwidth(BaseModel): class OptionsProxyCacheKey(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -708,6 +864,8 @@ class OptionsProxyCacheKey(BaseModel): class OptionsProxyCacheMethodsSet(BaseModel): + """Caching for POST requests along with default GET and HEAD.""" + enabled: bool """Controls the option state. @@ -726,6 +884,8 @@ class OptionsProxyCacheMethodsSet(BaseModel): class OptionsProxyConnectTimeout(BaseModel): + """The time limit for establishing a connection with the origin.""" + enabled: bool """Controls the option state. @@ -743,6 +903,14 @@ class OptionsProxyConnectTimeout(BaseModel): class OptionsProxyReadTimeout(BaseModel): + """ + 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). + """ + enabled: bool """Controls the option state. @@ -760,6 +928,12 @@ class OptionsProxyReadTimeout(BaseModel): class OptionsQueryParamsBlacklist(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -774,6 +948,12 @@ class OptionsQueryParamsBlacklist(BaseModel): class OptionsQueryParamsWhitelist(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -788,6 +968,12 @@ class OptionsQueryParamsWhitelist(BaseModel): class OptionsQueryStringForwarding(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -837,6 +1023,11 @@ class OptionsQueryStringForwarding(BaseModel): class OptionsRedirectHTTPToHTTPS(BaseModel): + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: bool """Controls the option state. @@ -855,6 +1046,11 @@ class OptionsRedirectHTTPToHTTPS(BaseModel): class OptionsRedirectHTTPSToHTTP(BaseModel): + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: bool """Controls the option state. @@ -873,6 +1069,8 @@ class OptionsRedirectHTTPSToHTTP(BaseModel): class OptionsReferrerACL(BaseModel): + """Controls access to the CDN resource content for specified domain names.""" + enabled: bool """Controls the option state. @@ -911,6 +1109,8 @@ class OptionsReferrerACL(BaseModel): class OptionsRequestLimiter(BaseModel): + """Option allows to limit the amount of HTTP requests.""" + enabled: bool """Controls the option state. @@ -941,6 +1141,8 @@ class OptionsRequestLimiter(BaseModel): class OptionsResponseHeadersHidingPolicy(BaseModel): + """Hides HTTP headers from an origin server in the CDN response.""" + enabled: bool """Controls the option state. @@ -980,6 +1182,11 @@ class OptionsResponseHeadersHidingPolicy(BaseModel): class OptionsRewrite(BaseModel): + """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. + """ + body: str """Path for the Rewrite option. @@ -1012,6 +1219,11 @@ class OptionsRewrite(BaseModel): class OptionsSecureKey(BaseModel): + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + enabled: bool """Controls the option state. @@ -1035,6 +1247,17 @@ class OptionsSecureKey(BaseModel): class OptionsSlice(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -1053,6 +1276,15 @@ class OptionsSlice(BaseModel): class OptionsSni(BaseModel): + """ + 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`. + """ + custom_hostname: str """Custom SNI hostname. @@ -1086,6 +1318,8 @@ class OptionsSni(BaseModel): class OptionsStale(BaseModel): + """Serves stale cached content in case of origin unavailability.""" + enabled: bool """Controls the option state. @@ -1150,6 +1384,8 @@ class OptionsStaticResponseHeadersValue(BaseModel): class OptionsStaticResponseHeaders(BaseModel): + """Custom HTTP Headers that a CDN server adds to a response.""" + enabled: bool """Controls the option state. @@ -1163,6 +1399,11 @@ class OptionsStaticResponseHeaders(BaseModel): class OptionsStaticHeaders(BaseModel): + """**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. + """ + enabled: bool """Controls the option state. @@ -1186,6 +1427,11 @@ class OptionsStaticHeaders(BaseModel): class OptionsStaticRequestHeaders(BaseModel): + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + enabled: bool """Controls the option state. @@ -1209,6 +1455,8 @@ class OptionsStaticRequestHeaders(BaseModel): class OptionsUserAgentACL(BaseModel): + """Controls access to the content for specified User-Agents.""" + enabled: bool """Controls the option state. @@ -1243,6 +1491,8 @@ class OptionsUserAgentACL(BaseModel): class OptionsWaap(BaseModel): + """Allows to enable WAAP (Web Application and API Protection).""" + enabled: bool """Controls the option state. @@ -1261,6 +1511,8 @@ class OptionsWaap(BaseModel): class OptionsWebsockets(BaseModel): + """Enables or disables WebSockets connections to an origin server.""" + enabled: bool """Controls the option state. @@ -1279,6 +1531,12 @@ class OptionsWebsockets(BaseModel): class Options(BaseModel): + """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. + """ + allowed_http_methods: Optional[OptionsAllowedHTTPMethods] = FieldInfo(alias="allowedHttpMethods", default=None) """HTTP methods allowed for content requests from the CDN.""" diff --git a/src/gcore/types/cdn/resources/rule_create_params.py b/src/gcore/types/cdn/resources/rule_create_params.py index ca1e05a9..243c958e 100644 --- a/src/gcore/types/cdn/resources/rule_create_params.py +++ b/src/gcore/types/cdn/resources/rule_create_params.py @@ -140,6 +140,8 @@ class RuleCreateParams(TypedDict, total=False): class OptionsAllowedHTTPMethods(TypedDict, total=False): + """HTTP methods allowed for content requests from the CDN.""" + enabled: Required[bool] """Controls the option state. @@ -153,6 +155,8 @@ class OptionsAllowedHTTPMethods(TypedDict, total=False): class OptionsBotProtectionBotChallenge(TypedDict, total=False): + """Controls the bot challenge module state.""" + enabled: bool """Possible values: @@ -162,6 +166,10 @@ class OptionsBotProtectionBotChallenge(TypedDict, total=False): class OptionsBotProtection(TypedDict, total=False): + """ + Allows to prevent online services from overloading and ensure your business workflow running smoothly. + """ + bot_challenge: Required[OptionsBotProtectionBotChallenge] """Controls the bot challenge module state.""" @@ -176,6 +184,18 @@ class OptionsBotProtection(TypedDict, total=False): class OptionsBrotliCompression(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -213,6 +233,13 @@ class OptionsBrotliCompression(TypedDict, total=False): class OptionsBrowserCacheSettings(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -230,6 +257,11 @@ class OptionsBrowserCacheSettings(TypedDict, total=False): class OptionsCacheHTTPHeaders(TypedDict, total=False): + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + enabled: Required[bool] """Controls the option state. @@ -243,6 +275,11 @@ class OptionsCacheHTTPHeaders(TypedDict, total=False): class OptionsCors(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -283,6 +320,8 @@ class OptionsCors(TypedDict, total=False): class OptionsCountryACL(TypedDict, total=False): + """Enables control access to content for specified countries.""" + enabled: Required[bool] """Controls the option state. @@ -314,6 +353,11 @@ class OptionsCountryACL(TypedDict, total=False): class OptionsDisableCache(TypedDict, total=False): + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + enabled: Required[bool] """Controls the option state. @@ -332,6 +376,8 @@ class OptionsDisableCache(TypedDict, total=False): class OptionsDisableProxyForceRanges(TypedDict, total=False): + """Allows 206 responses regardless of the settings of an origin source.""" + enabled: Required[bool] """Controls the option state. @@ -350,6 +396,11 @@ class OptionsDisableProxyForceRanges(TypedDict, total=False): class OptionsEdgeCacheSettings(TypedDict, total=False): + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -394,6 +445,10 @@ class OptionsEdgeCacheSettings(TypedDict, total=False): class OptionsFastedgeOnRequestBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request body as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -414,6 +469,10 @@ class OptionsFastedgeOnRequestBody(TypedDict, total=False): class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -434,6 +493,10 @@ class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): class OptionsFastedgeOnResponseBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response body before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -454,6 +517,10 @@ class OptionsFastedgeOnResponseBody(TypedDict, total=False): class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response headers before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -474,6 +541,12 @@ class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): class OptionsFastedge(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -509,6 +582,16 @@ class OptionsFastedge(TypedDict, total=False): class OptionsFetchCompressed(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -527,6 +610,11 @@ class OptionsFetchCompressed(TypedDict, total=False): class OptionsFollowOriginRedirect(TypedDict, total=False): + """ + 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. + """ + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] """Redirect status code that the origin server returns. @@ -545,6 +633,11 @@ class OptionsFollowOriginRedirect(TypedDict, total=False): class OptionsForceReturnTimeInterval(TypedDict, total=False): + """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. + """ + end_time: Required[str] """Time until which a custom HTTP response code should be applied. @@ -562,6 +655,11 @@ class OptionsForceReturnTimeInterval(TypedDict, total=False): class OptionsForceReturn(TypedDict, total=False): + """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. + """ + body: Required[str] """URL for redirection or text.""" @@ -585,6 +683,11 @@ class OptionsForceReturn(TypedDict, total=False): class OptionsForwardHostHeader(TypedDict, total=False): + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -603,6 +706,16 @@ class OptionsForwardHostHeader(TypedDict, total=False): class OptionsGzipOn(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -621,6 +734,15 @@ class OptionsGzipOn(TypedDict, total=False): class OptionsHostHeader(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -635,6 +757,10 @@ class OptionsHostHeader(TypedDict, total=False): class OptionsIgnoreCookie(TypedDict, total=False): + """ + Defines whether the files with the Set-Cookies header are cached as one file or as different ones. + """ + enabled: Required[bool] """Controls the option state. @@ -654,6 +780,12 @@ class OptionsIgnoreCookie(TypedDict, total=False): class OptionsIgnoreQueryString(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -672,6 +804,10 @@ class OptionsIgnoreQueryString(TypedDict, total=False): class OptionsImageStack(TypedDict, total=False): + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically converts them to WebP or AVIF format. + """ + enabled: Required[bool] """Controls the option state. @@ -699,6 +835,12 @@ class OptionsImageStack(TypedDict, total=False): class OptionsIPAddressACL(TypedDict, total=False): + """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) + """ + enabled: Required[bool] """Controls the option state. @@ -735,6 +877,8 @@ class OptionsIPAddressACL(TypedDict, total=False): class OptionsLimitBandwidth(TypedDict, total=False): + """Allows to control the download speed per connection.""" + enabled: Required[bool] """Controls the option state. @@ -770,6 +914,18 @@ class OptionsLimitBandwidth(TypedDict, total=False): class OptionsProxyCacheKey(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -784,6 +940,8 @@ class OptionsProxyCacheKey(TypedDict, total=False): class OptionsProxyCacheMethodsSet(TypedDict, total=False): + """Caching for POST requests along with default GET and HEAD.""" + enabled: Required[bool] """Controls the option state. @@ -802,6 +960,8 @@ class OptionsProxyCacheMethodsSet(TypedDict, total=False): class OptionsProxyConnectTimeout(TypedDict, total=False): + """The time limit for establishing a connection with the origin.""" + enabled: Required[bool] """Controls the option state. @@ -819,6 +979,14 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): class OptionsProxyReadTimeout(TypedDict, total=False): + """ + 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). + """ + enabled: Required[bool] """Controls the option state. @@ -836,6 +1004,12 @@ class OptionsProxyReadTimeout(TypedDict, total=False): class OptionsQueryParamsBlacklist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -850,6 +1024,12 @@ class OptionsQueryParamsBlacklist(TypedDict, total=False): class OptionsQueryParamsWhitelist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -864,6 +1044,12 @@ class OptionsQueryParamsWhitelist(TypedDict, total=False): class OptionsQueryStringForwarding(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -913,6 +1099,11 @@ class OptionsQueryStringForwarding(TypedDict, total=False): class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -931,6 +1122,11 @@ class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -949,6 +1145,8 @@ class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): class OptionsReferrerACL(TypedDict, total=False): + """Controls access to the CDN resource content for specified domain names.""" + enabled: Required[bool] """Controls the option state. @@ -987,6 +1185,8 @@ class OptionsReferrerACL(TypedDict, total=False): class OptionsRequestLimiter(TypedDict, total=False): + """Option allows to limit the amount of HTTP requests.""" + enabled: Required[bool] """Controls the option state. @@ -1013,6 +1213,8 @@ class OptionsRequestLimiter(TypedDict, total=False): class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + """Hides HTTP headers from an origin server in the CDN response.""" + enabled: Required[bool] """Controls the option state. @@ -1052,6 +1254,11 @@ class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): class OptionsRewrite(TypedDict, total=False): + """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. + """ + body: Required[str] """Path for the Rewrite option. @@ -1084,6 +1291,11 @@ class OptionsRewrite(TypedDict, total=False): class OptionsSecureKey(TypedDict, total=False): + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + enabled: Required[bool] """Controls the option state. @@ -1107,6 +1319,17 @@ class OptionsSecureKey(TypedDict, total=False): class OptionsSlice(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -1125,6 +1348,15 @@ class OptionsSlice(TypedDict, total=False): class OptionsSni(TypedDict, total=False): + """ + 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`. + """ + custom_hostname: Required[str] """Custom SNI hostname. @@ -1158,6 +1390,8 @@ class OptionsSni(TypedDict, total=False): class OptionsStale(TypedDict, total=False): + """Serves stale cached content in case of origin unavailability.""" + enabled: Required[bool] """Controls the option state. @@ -1224,6 +1458,8 @@ class OptionsStaticResponseHeadersValue(TypedDict, total=False): class OptionsStaticResponseHeaders(TypedDict, total=False): + """Custom HTTP Headers that a CDN server adds to a response.""" + enabled: Required[bool] """Controls the option state. @@ -1237,6 +1473,11 @@ class OptionsStaticResponseHeaders(TypedDict, total=False): class OptionsStaticHeaders(TypedDict, total=False): + """**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. + """ + enabled: Required[bool] """Controls the option state. @@ -1260,6 +1501,11 @@ class OptionsStaticHeaders(TypedDict, total=False): class OptionsStaticRequestHeaders(TypedDict, total=False): + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + enabled: Required[bool] """Controls the option state. @@ -1283,6 +1529,8 @@ class OptionsStaticRequestHeaders(TypedDict, total=False): class OptionsUserAgentACL(TypedDict, total=False): + """Controls access to the content for specified User-Agents.""" + enabled: Required[bool] """Controls the option state. @@ -1317,6 +1565,8 @@ class OptionsUserAgentACL(TypedDict, total=False): class OptionsWaap(TypedDict, total=False): + """Allows to enable WAAP (Web Application and API Protection).""" + enabled: Required[bool] """Controls the option state. @@ -1335,6 +1585,8 @@ class OptionsWaap(TypedDict, total=False): class OptionsWebsockets(TypedDict, total=False): + """Enables or disables WebSockets connections to an origin server.""" + enabled: Required[bool] """Controls the option state. @@ -1353,6 +1605,12 @@ class OptionsWebsockets(TypedDict, total=False): class Options(TypedDict, total=False): + """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. + """ + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] """HTTP methods allowed for content requests from the CDN.""" diff --git a/src/gcore/types/cdn/resources/rule_replace_params.py b/src/gcore/types/cdn/resources/rule_replace_params.py index c1bf7fea..49d31ee5 100644 --- a/src/gcore/types/cdn/resources/rule_replace_params.py +++ b/src/gcore/types/cdn/resources/rule_replace_params.py @@ -142,6 +142,8 @@ class RuleReplaceParams(TypedDict, total=False): class OptionsAllowedHTTPMethods(TypedDict, total=False): + """HTTP methods allowed for content requests from the CDN.""" + enabled: Required[bool] """Controls the option state. @@ -155,6 +157,8 @@ class OptionsAllowedHTTPMethods(TypedDict, total=False): class OptionsBotProtectionBotChallenge(TypedDict, total=False): + """Controls the bot challenge module state.""" + enabled: bool """Possible values: @@ -164,6 +168,10 @@ class OptionsBotProtectionBotChallenge(TypedDict, total=False): class OptionsBotProtection(TypedDict, total=False): + """ + Allows to prevent online services from overloading and ensure your business workflow running smoothly. + """ + bot_challenge: Required[OptionsBotProtectionBotChallenge] """Controls the bot challenge module state.""" @@ -178,6 +186,18 @@ class OptionsBotProtection(TypedDict, total=False): class OptionsBrotliCompression(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -215,6 +235,13 @@ class OptionsBrotliCompression(TypedDict, total=False): class OptionsBrowserCacheSettings(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -232,6 +259,11 @@ class OptionsBrowserCacheSettings(TypedDict, total=False): class OptionsCacheHTTPHeaders(TypedDict, total=False): + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + enabled: Required[bool] """Controls the option state. @@ -245,6 +277,11 @@ class OptionsCacheHTTPHeaders(TypedDict, total=False): class OptionsCors(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -285,6 +322,8 @@ class OptionsCors(TypedDict, total=False): class OptionsCountryACL(TypedDict, total=False): + """Enables control access to content for specified countries.""" + enabled: Required[bool] """Controls the option state. @@ -316,6 +355,11 @@ class OptionsCountryACL(TypedDict, total=False): class OptionsDisableCache(TypedDict, total=False): + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + enabled: Required[bool] """Controls the option state. @@ -334,6 +378,8 @@ class OptionsDisableCache(TypedDict, total=False): class OptionsDisableProxyForceRanges(TypedDict, total=False): + """Allows 206 responses regardless of the settings of an origin source.""" + enabled: Required[bool] """Controls the option state. @@ -352,6 +398,11 @@ class OptionsDisableProxyForceRanges(TypedDict, total=False): class OptionsEdgeCacheSettings(TypedDict, total=False): + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -396,6 +447,10 @@ class OptionsEdgeCacheSettings(TypedDict, total=False): class OptionsFastedgeOnRequestBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request body as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -416,6 +471,10 @@ class OptionsFastedgeOnRequestBody(TypedDict, total=False): class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -436,6 +495,10 @@ class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): class OptionsFastedgeOnResponseBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response body before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -456,6 +519,10 @@ class OptionsFastedgeOnResponseBody(TypedDict, total=False): class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response headers before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -476,6 +543,12 @@ class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): class OptionsFastedge(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -511,6 +584,16 @@ class OptionsFastedge(TypedDict, total=False): class OptionsFetchCompressed(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -529,6 +612,11 @@ class OptionsFetchCompressed(TypedDict, total=False): class OptionsFollowOriginRedirect(TypedDict, total=False): + """ + 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. + """ + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] """Redirect status code that the origin server returns. @@ -547,6 +635,11 @@ class OptionsFollowOriginRedirect(TypedDict, total=False): class OptionsForceReturnTimeInterval(TypedDict, total=False): + """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. + """ + end_time: Required[str] """Time until which a custom HTTP response code should be applied. @@ -564,6 +657,11 @@ class OptionsForceReturnTimeInterval(TypedDict, total=False): class OptionsForceReturn(TypedDict, total=False): + """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. + """ + body: Required[str] """URL for redirection or text.""" @@ -587,6 +685,11 @@ class OptionsForceReturn(TypedDict, total=False): class OptionsForwardHostHeader(TypedDict, total=False): + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -605,6 +708,16 @@ class OptionsForwardHostHeader(TypedDict, total=False): class OptionsGzipOn(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -623,6 +736,15 @@ class OptionsGzipOn(TypedDict, total=False): class OptionsHostHeader(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -637,6 +759,10 @@ class OptionsHostHeader(TypedDict, total=False): class OptionsIgnoreCookie(TypedDict, total=False): + """ + Defines whether the files with the Set-Cookies header are cached as one file or as different ones. + """ + enabled: Required[bool] """Controls the option state. @@ -656,6 +782,12 @@ class OptionsIgnoreCookie(TypedDict, total=False): class OptionsIgnoreQueryString(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -674,6 +806,10 @@ class OptionsIgnoreQueryString(TypedDict, total=False): class OptionsImageStack(TypedDict, total=False): + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically converts them to WebP or AVIF format. + """ + enabled: Required[bool] """Controls the option state. @@ -701,6 +837,12 @@ class OptionsImageStack(TypedDict, total=False): class OptionsIPAddressACL(TypedDict, total=False): + """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) + """ + enabled: Required[bool] """Controls the option state. @@ -737,6 +879,8 @@ class OptionsIPAddressACL(TypedDict, total=False): class OptionsLimitBandwidth(TypedDict, total=False): + """Allows to control the download speed per connection.""" + enabled: Required[bool] """Controls the option state. @@ -772,6 +916,18 @@ class OptionsLimitBandwidth(TypedDict, total=False): class OptionsProxyCacheKey(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -786,6 +942,8 @@ class OptionsProxyCacheKey(TypedDict, total=False): class OptionsProxyCacheMethodsSet(TypedDict, total=False): + """Caching for POST requests along with default GET and HEAD.""" + enabled: Required[bool] """Controls the option state. @@ -804,6 +962,8 @@ class OptionsProxyCacheMethodsSet(TypedDict, total=False): class OptionsProxyConnectTimeout(TypedDict, total=False): + """The time limit for establishing a connection with the origin.""" + enabled: Required[bool] """Controls the option state. @@ -821,6 +981,14 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): class OptionsProxyReadTimeout(TypedDict, total=False): + """ + 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). + """ + enabled: Required[bool] """Controls the option state. @@ -838,6 +1006,12 @@ class OptionsProxyReadTimeout(TypedDict, total=False): class OptionsQueryParamsBlacklist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -852,6 +1026,12 @@ class OptionsQueryParamsBlacklist(TypedDict, total=False): class OptionsQueryParamsWhitelist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -866,6 +1046,12 @@ class OptionsQueryParamsWhitelist(TypedDict, total=False): class OptionsQueryStringForwarding(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -915,6 +1101,11 @@ class OptionsQueryStringForwarding(TypedDict, total=False): class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -933,6 +1124,11 @@ class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -951,6 +1147,8 @@ class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): class OptionsReferrerACL(TypedDict, total=False): + """Controls access to the CDN resource content for specified domain names.""" + enabled: Required[bool] """Controls the option state. @@ -989,6 +1187,8 @@ class OptionsReferrerACL(TypedDict, total=False): class OptionsRequestLimiter(TypedDict, total=False): + """Option allows to limit the amount of HTTP requests.""" + enabled: Required[bool] """Controls the option state. @@ -1015,6 +1215,8 @@ class OptionsRequestLimiter(TypedDict, total=False): class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + """Hides HTTP headers from an origin server in the CDN response.""" + enabled: Required[bool] """Controls the option state. @@ -1054,6 +1256,11 @@ class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): class OptionsRewrite(TypedDict, total=False): + """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. + """ + body: Required[str] """Path for the Rewrite option. @@ -1086,6 +1293,11 @@ class OptionsRewrite(TypedDict, total=False): class OptionsSecureKey(TypedDict, total=False): + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + enabled: Required[bool] """Controls the option state. @@ -1109,6 +1321,17 @@ class OptionsSecureKey(TypedDict, total=False): class OptionsSlice(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -1127,6 +1350,15 @@ class OptionsSlice(TypedDict, total=False): class OptionsSni(TypedDict, total=False): + """ + 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`. + """ + custom_hostname: Required[str] """Custom SNI hostname. @@ -1160,6 +1392,8 @@ class OptionsSni(TypedDict, total=False): class OptionsStale(TypedDict, total=False): + """Serves stale cached content in case of origin unavailability.""" + enabled: Required[bool] """Controls the option state. @@ -1226,6 +1460,8 @@ class OptionsStaticResponseHeadersValue(TypedDict, total=False): class OptionsStaticResponseHeaders(TypedDict, total=False): + """Custom HTTP Headers that a CDN server adds to a response.""" + enabled: Required[bool] """Controls the option state. @@ -1239,6 +1475,11 @@ class OptionsStaticResponseHeaders(TypedDict, total=False): class OptionsStaticHeaders(TypedDict, total=False): + """**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. + """ + enabled: Required[bool] """Controls the option state. @@ -1262,6 +1503,11 @@ class OptionsStaticHeaders(TypedDict, total=False): class OptionsStaticRequestHeaders(TypedDict, total=False): + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + enabled: Required[bool] """Controls the option state. @@ -1285,6 +1531,8 @@ class OptionsStaticRequestHeaders(TypedDict, total=False): class OptionsUserAgentACL(TypedDict, total=False): + """Controls access to the content for specified User-Agents.""" + enabled: Required[bool] """Controls the option state. @@ -1319,6 +1567,8 @@ class OptionsUserAgentACL(TypedDict, total=False): class OptionsWaap(TypedDict, total=False): + """Allows to enable WAAP (Web Application and API Protection).""" + enabled: Required[bool] """Controls the option state. @@ -1337,6 +1587,8 @@ class OptionsWaap(TypedDict, total=False): class OptionsWebsockets(TypedDict, total=False): + """Enables or disables WebSockets connections to an origin server.""" + enabled: Required[bool] """Controls the option state. @@ -1355,6 +1607,12 @@ class OptionsWebsockets(TypedDict, total=False): class Options(TypedDict, total=False): + """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. + """ + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] """HTTP methods allowed for content requests from the CDN.""" diff --git a/src/gcore/types/cdn/resources/rule_update_params.py b/src/gcore/types/cdn/resources/rule_update_params.py index 24b47a1b..f604e673 100644 --- a/src/gcore/types/cdn/resources/rule_update_params.py +++ b/src/gcore/types/cdn/resources/rule_update_params.py @@ -142,6 +142,8 @@ class RuleUpdateParams(TypedDict, total=False): class OptionsAllowedHTTPMethods(TypedDict, total=False): + """HTTP methods allowed for content requests from the CDN.""" + enabled: Required[bool] """Controls the option state. @@ -155,6 +157,8 @@ class OptionsAllowedHTTPMethods(TypedDict, total=False): class OptionsBotProtectionBotChallenge(TypedDict, total=False): + """Controls the bot challenge module state.""" + enabled: bool """Possible values: @@ -164,6 +168,10 @@ class OptionsBotProtectionBotChallenge(TypedDict, total=False): class OptionsBotProtection(TypedDict, total=False): + """ + Allows to prevent online services from overloading and ensure your business workflow running smoothly. + """ + bot_challenge: Required[OptionsBotProtectionBotChallenge] """Controls the bot challenge module state.""" @@ -178,6 +186,18 @@ class OptionsBotProtection(TypedDict, total=False): class OptionsBrotliCompression(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -215,6 +235,13 @@ class OptionsBrotliCompression(TypedDict, total=False): class OptionsBrowserCacheSettings(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -232,6 +259,11 @@ class OptionsBrowserCacheSettings(TypedDict, total=False): class OptionsCacheHTTPHeaders(TypedDict, total=False): + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + enabled: Required[bool] """Controls the option state. @@ -245,6 +277,11 @@ class OptionsCacheHTTPHeaders(TypedDict, total=False): class OptionsCors(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -285,6 +322,8 @@ class OptionsCors(TypedDict, total=False): class OptionsCountryACL(TypedDict, total=False): + """Enables control access to content for specified countries.""" + enabled: Required[bool] """Controls the option state. @@ -316,6 +355,11 @@ class OptionsCountryACL(TypedDict, total=False): class OptionsDisableCache(TypedDict, total=False): + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + enabled: Required[bool] """Controls the option state. @@ -334,6 +378,8 @@ class OptionsDisableCache(TypedDict, total=False): class OptionsDisableProxyForceRanges(TypedDict, total=False): + """Allows 206 responses regardless of the settings of an origin source.""" + enabled: Required[bool] """Controls the option state. @@ -352,6 +398,11 @@ class OptionsDisableProxyForceRanges(TypedDict, total=False): class OptionsEdgeCacheSettings(TypedDict, total=False): + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -396,6 +447,10 @@ class OptionsEdgeCacheSettings(TypedDict, total=False): class OptionsFastedgeOnRequestBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request body as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -416,6 +471,10 @@ class OptionsFastedgeOnRequestBody(TypedDict, total=False): class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -436,6 +495,10 @@ class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): class OptionsFastedgeOnResponseBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response body before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -456,6 +519,10 @@ class OptionsFastedgeOnResponseBody(TypedDict, total=False): class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response headers before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -476,6 +543,12 @@ class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): class OptionsFastedge(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -511,6 +584,16 @@ class OptionsFastedge(TypedDict, total=False): class OptionsFetchCompressed(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -529,6 +612,11 @@ class OptionsFetchCompressed(TypedDict, total=False): class OptionsFollowOriginRedirect(TypedDict, total=False): + """ + 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. + """ + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] """Redirect status code that the origin server returns. @@ -547,6 +635,11 @@ class OptionsFollowOriginRedirect(TypedDict, total=False): class OptionsForceReturnTimeInterval(TypedDict, total=False): + """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. + """ + end_time: Required[str] """Time until which a custom HTTP response code should be applied. @@ -564,6 +657,11 @@ class OptionsForceReturnTimeInterval(TypedDict, total=False): class OptionsForceReturn(TypedDict, total=False): + """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. + """ + body: Required[str] """URL for redirection or text.""" @@ -587,6 +685,11 @@ class OptionsForceReturn(TypedDict, total=False): class OptionsForwardHostHeader(TypedDict, total=False): + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -605,6 +708,16 @@ class OptionsForwardHostHeader(TypedDict, total=False): class OptionsGzipOn(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -623,6 +736,15 @@ class OptionsGzipOn(TypedDict, total=False): class OptionsHostHeader(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -637,6 +759,10 @@ class OptionsHostHeader(TypedDict, total=False): class OptionsIgnoreCookie(TypedDict, total=False): + """ + Defines whether the files with the Set-Cookies header are cached as one file or as different ones. + """ + enabled: Required[bool] """Controls the option state. @@ -656,6 +782,12 @@ class OptionsIgnoreCookie(TypedDict, total=False): class OptionsIgnoreQueryString(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -674,6 +806,10 @@ class OptionsIgnoreQueryString(TypedDict, total=False): class OptionsImageStack(TypedDict, total=False): + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically converts them to WebP or AVIF format. + """ + enabled: Required[bool] """Controls the option state. @@ -701,6 +837,12 @@ class OptionsImageStack(TypedDict, total=False): class OptionsIPAddressACL(TypedDict, total=False): + """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) + """ + enabled: Required[bool] """Controls the option state. @@ -737,6 +879,8 @@ class OptionsIPAddressACL(TypedDict, total=False): class OptionsLimitBandwidth(TypedDict, total=False): + """Allows to control the download speed per connection.""" + enabled: Required[bool] """Controls the option state. @@ -772,6 +916,18 @@ class OptionsLimitBandwidth(TypedDict, total=False): class OptionsProxyCacheKey(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -786,6 +942,8 @@ class OptionsProxyCacheKey(TypedDict, total=False): class OptionsProxyCacheMethodsSet(TypedDict, total=False): + """Caching for POST requests along with default GET and HEAD.""" + enabled: Required[bool] """Controls the option state. @@ -804,6 +962,8 @@ class OptionsProxyCacheMethodsSet(TypedDict, total=False): class OptionsProxyConnectTimeout(TypedDict, total=False): + """The time limit for establishing a connection with the origin.""" + enabled: Required[bool] """Controls the option state. @@ -821,6 +981,14 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): class OptionsProxyReadTimeout(TypedDict, total=False): + """ + 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). + """ + enabled: Required[bool] """Controls the option state. @@ -838,6 +1006,12 @@ class OptionsProxyReadTimeout(TypedDict, total=False): class OptionsQueryParamsBlacklist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -852,6 +1026,12 @@ class OptionsQueryParamsBlacklist(TypedDict, total=False): class OptionsQueryParamsWhitelist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -866,6 +1046,12 @@ class OptionsQueryParamsWhitelist(TypedDict, total=False): class OptionsQueryStringForwarding(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -915,6 +1101,11 @@ class OptionsQueryStringForwarding(TypedDict, total=False): class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -933,6 +1124,11 @@ class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -951,6 +1147,8 @@ class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): class OptionsReferrerACL(TypedDict, total=False): + """Controls access to the CDN resource content for specified domain names.""" + enabled: Required[bool] """Controls the option state. @@ -989,6 +1187,8 @@ class OptionsReferrerACL(TypedDict, total=False): class OptionsRequestLimiter(TypedDict, total=False): + """Option allows to limit the amount of HTTP requests.""" + enabled: Required[bool] """Controls the option state. @@ -1015,6 +1215,8 @@ class OptionsRequestLimiter(TypedDict, total=False): class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + """Hides HTTP headers from an origin server in the CDN response.""" + enabled: Required[bool] """Controls the option state. @@ -1054,6 +1256,11 @@ class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): class OptionsRewrite(TypedDict, total=False): + """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. + """ + body: Required[str] """Path for the Rewrite option. @@ -1086,6 +1293,11 @@ class OptionsRewrite(TypedDict, total=False): class OptionsSecureKey(TypedDict, total=False): + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + enabled: Required[bool] """Controls the option state. @@ -1109,6 +1321,17 @@ class OptionsSecureKey(TypedDict, total=False): class OptionsSlice(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -1127,6 +1350,15 @@ class OptionsSlice(TypedDict, total=False): class OptionsSni(TypedDict, total=False): + """ + 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`. + """ + custom_hostname: Required[str] """Custom SNI hostname. @@ -1160,6 +1392,8 @@ class OptionsSni(TypedDict, total=False): class OptionsStale(TypedDict, total=False): + """Serves stale cached content in case of origin unavailability.""" + enabled: Required[bool] """Controls the option state. @@ -1226,6 +1460,8 @@ class OptionsStaticResponseHeadersValue(TypedDict, total=False): class OptionsStaticResponseHeaders(TypedDict, total=False): + """Custom HTTP Headers that a CDN server adds to a response.""" + enabled: Required[bool] """Controls the option state. @@ -1239,6 +1475,11 @@ class OptionsStaticResponseHeaders(TypedDict, total=False): class OptionsStaticHeaders(TypedDict, total=False): + """**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. + """ + enabled: Required[bool] """Controls the option state. @@ -1262,6 +1503,11 @@ class OptionsStaticHeaders(TypedDict, total=False): class OptionsStaticRequestHeaders(TypedDict, total=False): + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + enabled: Required[bool] """Controls the option state. @@ -1285,6 +1531,8 @@ class OptionsStaticRequestHeaders(TypedDict, total=False): class OptionsUserAgentACL(TypedDict, total=False): + """Controls access to the content for specified User-Agents.""" + enabled: Required[bool] """Controls the option state. @@ -1319,6 +1567,8 @@ class OptionsUserAgentACL(TypedDict, total=False): class OptionsWaap(TypedDict, total=False): + """Allows to enable WAAP (Web Application and API Protection).""" + enabled: Required[bool] """Controls the option state. @@ -1337,6 +1587,8 @@ class OptionsWaap(TypedDict, total=False): class OptionsWebsockets(TypedDict, total=False): + """Enables or disables WebSockets connections to an origin server.""" + enabled: Required[bool] """Controls the option state. @@ -1355,6 +1607,12 @@ class OptionsWebsockets(TypedDict, total=False): class Options(TypedDict, total=False): + """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. + """ + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] """HTTP methods allowed for content requests from the CDN.""" diff --git a/src/gcore/types/cdn/rule_template.py b/src/gcore/types/cdn/rule_template.py index d42b39f1..17d5656b 100644 --- a/src/gcore/types/cdn/rule_template.py +++ b/src/gcore/types/cdn/rule_template.py @@ -66,6 +66,8 @@ class OptionsAllowedHTTPMethods(BaseModel): + """HTTP methods allowed for content requests from the CDN.""" + enabled: bool """Controls the option state. @@ -79,6 +81,8 @@ class OptionsAllowedHTTPMethods(BaseModel): class OptionsBotProtectionBotChallenge(BaseModel): + """Controls the bot challenge module state.""" + enabled: Optional[bool] = None """Possible values: @@ -88,6 +92,10 @@ class OptionsBotProtectionBotChallenge(BaseModel): class OptionsBotProtection(BaseModel): + """ + Allows to prevent online services from overloading and ensure your business workflow running smoothly. + """ + bot_challenge: OptionsBotProtectionBotChallenge """Controls the bot challenge module state.""" @@ -102,6 +110,18 @@ class OptionsBotProtection(BaseModel): class OptionsBrotliCompression(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -137,6 +157,13 @@ class OptionsBrotliCompression(BaseModel): class OptionsBrowserCacheSettings(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -154,6 +181,11 @@ class OptionsBrowserCacheSettings(BaseModel): class OptionsCacheHTTPHeaders(BaseModel): + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + enabled: bool """Controls the option state. @@ -167,6 +199,11 @@ class OptionsCacheHTTPHeaders(BaseModel): class OptionsCors(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -207,6 +244,8 @@ class OptionsCors(BaseModel): class OptionsCountryACL(BaseModel): + """Enables control access to content for specified countries.""" + enabled: bool """Controls the option state. @@ -238,6 +277,11 @@ class OptionsCountryACL(BaseModel): class OptionsDisableCache(BaseModel): + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + enabled: bool """Controls the option state. @@ -256,6 +300,8 @@ class OptionsDisableCache(BaseModel): class OptionsDisableProxyForceRanges(BaseModel): + """Allows 206 responses regardless of the settings of an origin source.""" + enabled: bool """Controls the option state. @@ -274,6 +320,11 @@ class OptionsDisableProxyForceRanges(BaseModel): class OptionsEdgeCacheSettings(BaseModel): + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + enabled: bool """Controls the option state. @@ -318,6 +369,10 @@ class OptionsEdgeCacheSettings(BaseModel): class OptionsFastedgeOnRequestBody(BaseModel): + """ + Allows to configure FastEdge application that will be called to handle request body as soon as CDN receives incoming HTTP request. + """ + app_id: str """The ID of the application in FastEdge.""" @@ -338,6 +393,10 @@ class OptionsFastedgeOnRequestBody(BaseModel): class OptionsFastedgeOnRequestHeaders(BaseModel): + """ + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request. + """ + app_id: str """The ID of the application in FastEdge.""" @@ -358,6 +417,10 @@ class OptionsFastedgeOnRequestHeaders(BaseModel): class OptionsFastedgeOnResponseBody(BaseModel): + """ + Allows to configure FastEdge application that will be called to handle response body before CDN sends the HTTP response. + """ + app_id: str """The ID of the application in FastEdge.""" @@ -378,6 +441,10 @@ class OptionsFastedgeOnResponseBody(BaseModel): class OptionsFastedgeOnResponseHeaders(BaseModel): + """ + Allows to configure FastEdge application that will be called to handle response headers before CDN sends the HTTP response. + """ + app_id: str """The ID of the application in FastEdge.""" @@ -398,6 +465,12 @@ class OptionsFastedgeOnResponseHeaders(BaseModel): class OptionsFastedge(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -433,6 +506,16 @@ class OptionsFastedge(BaseModel): class OptionsFetchCompressed(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -451,6 +534,11 @@ class OptionsFetchCompressed(BaseModel): class OptionsFollowOriginRedirect(BaseModel): + """ + 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. + """ + codes: List[Literal[301, 302, 303, 307, 308]] """Redirect status code that the origin server returns. @@ -469,6 +557,11 @@ class OptionsFollowOriginRedirect(BaseModel): class OptionsForceReturnTimeInterval(BaseModel): + """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. + """ + end_time: str """Time until which a custom HTTP response code should be applied. @@ -486,6 +579,11 @@ class OptionsForceReturnTimeInterval(BaseModel): class OptionsForceReturn(BaseModel): + """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. + """ + body: str """URL for redirection or text.""" @@ -509,6 +607,11 @@ class OptionsForceReturn(BaseModel): class OptionsForwardHostHeader(BaseModel): + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + enabled: bool """Controls the option state. @@ -527,6 +630,16 @@ class OptionsForwardHostHeader(BaseModel): class OptionsGzipOn(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -545,6 +658,15 @@ class OptionsGzipOn(BaseModel): class OptionsHostHeader(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -559,6 +681,10 @@ class OptionsHostHeader(BaseModel): class OptionsIgnoreCookie(BaseModel): + """ + Defines whether the files with the Set-Cookies header are cached as one file or as different ones. + """ + enabled: bool """Controls the option state. @@ -578,6 +704,12 @@ class OptionsIgnoreCookie(BaseModel): class OptionsIgnoreQueryString(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -596,6 +728,10 @@ class OptionsIgnoreQueryString(BaseModel): class OptionsImageStack(BaseModel): + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically converts them to WebP or AVIF format. + """ + enabled: bool """Controls the option state. @@ -623,6 +759,12 @@ class OptionsImageStack(BaseModel): class OptionsIPAddressACL(BaseModel): + """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) + """ + enabled: bool """Controls the option state. @@ -659,6 +801,8 @@ class OptionsIPAddressACL(BaseModel): class OptionsLimitBandwidth(BaseModel): + """Allows to control the download speed per connection.""" + enabled: bool """Controls the option state. @@ -694,6 +838,18 @@ class OptionsLimitBandwidth(BaseModel): class OptionsProxyCacheKey(BaseModel): + """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. + """ + enabled: bool """Controls the option state. @@ -708,6 +864,8 @@ class OptionsProxyCacheKey(BaseModel): class OptionsProxyCacheMethodsSet(BaseModel): + """Caching for POST requests along with default GET and HEAD.""" + enabled: bool """Controls the option state. @@ -726,6 +884,8 @@ class OptionsProxyCacheMethodsSet(BaseModel): class OptionsProxyConnectTimeout(BaseModel): + """The time limit for establishing a connection with the origin.""" + enabled: bool """Controls the option state. @@ -743,6 +903,14 @@ class OptionsProxyConnectTimeout(BaseModel): class OptionsProxyReadTimeout(BaseModel): + """ + 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). + """ + enabled: bool """Controls the option state. @@ -760,6 +928,12 @@ class OptionsProxyReadTimeout(BaseModel): class OptionsQueryParamsBlacklist(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -774,6 +948,12 @@ class OptionsQueryParamsBlacklist(BaseModel): class OptionsQueryParamsWhitelist(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -788,6 +968,12 @@ class OptionsQueryParamsWhitelist(BaseModel): class OptionsQueryStringForwarding(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -837,6 +1023,11 @@ class OptionsQueryStringForwarding(BaseModel): class OptionsRedirectHTTPToHTTPS(BaseModel): + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: bool """Controls the option state. @@ -855,6 +1046,11 @@ class OptionsRedirectHTTPToHTTPS(BaseModel): class OptionsRedirectHTTPSToHTTP(BaseModel): + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: bool """Controls the option state. @@ -873,6 +1069,8 @@ class OptionsRedirectHTTPSToHTTP(BaseModel): class OptionsReferrerACL(BaseModel): + """Controls access to the CDN resource content for specified domain names.""" + enabled: bool """Controls the option state. @@ -911,6 +1109,8 @@ class OptionsReferrerACL(BaseModel): class OptionsRequestLimiter(BaseModel): + """Option allows to limit the amount of HTTP requests.""" + enabled: bool """Controls the option state. @@ -941,6 +1141,8 @@ class OptionsRequestLimiter(BaseModel): class OptionsResponseHeadersHidingPolicy(BaseModel): + """Hides HTTP headers from an origin server in the CDN response.""" + enabled: bool """Controls the option state. @@ -980,6 +1182,11 @@ class OptionsResponseHeadersHidingPolicy(BaseModel): class OptionsRewrite(BaseModel): + """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. + """ + body: str """Path for the Rewrite option. @@ -1012,6 +1219,11 @@ class OptionsRewrite(BaseModel): class OptionsSecureKey(BaseModel): + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + enabled: bool """Controls the option state. @@ -1035,6 +1247,17 @@ class OptionsSecureKey(BaseModel): class OptionsSlice(BaseModel): + """ + 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. + """ + enabled: bool """Controls the option state. @@ -1053,6 +1276,15 @@ class OptionsSlice(BaseModel): class OptionsSni(BaseModel): + """ + 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`. + """ + custom_hostname: str """Custom SNI hostname. @@ -1086,6 +1318,8 @@ class OptionsSni(BaseModel): class OptionsStale(BaseModel): + """Serves stale cached content in case of origin unavailability.""" + enabled: bool """Controls the option state. @@ -1150,6 +1384,8 @@ class OptionsStaticResponseHeadersValue(BaseModel): class OptionsStaticResponseHeaders(BaseModel): + """Custom HTTP Headers that a CDN server adds to a response.""" + enabled: bool """Controls the option state. @@ -1163,6 +1399,11 @@ class OptionsStaticResponseHeaders(BaseModel): class OptionsStaticHeaders(BaseModel): + """**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. + """ + enabled: bool """Controls the option state. @@ -1186,6 +1427,11 @@ class OptionsStaticHeaders(BaseModel): class OptionsStaticRequestHeaders(BaseModel): + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + enabled: bool """Controls the option state. @@ -1209,6 +1455,8 @@ class OptionsStaticRequestHeaders(BaseModel): class OptionsUserAgentACL(BaseModel): + """Controls access to the content for specified User-Agents.""" + enabled: bool """Controls the option state. @@ -1243,6 +1491,8 @@ class OptionsUserAgentACL(BaseModel): class OptionsWaap(BaseModel): + """Allows to enable WAAP (Web Application and API Protection).""" + enabled: bool """Controls the option state. @@ -1261,6 +1511,8 @@ class OptionsWaap(BaseModel): class OptionsWebsockets(BaseModel): + """Enables or disables WebSockets connections to an origin server.""" + enabled: bool """Controls the option state. @@ -1279,6 +1531,12 @@ class OptionsWebsockets(BaseModel): class Options(BaseModel): + """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. + """ + allowed_http_methods: Optional[OptionsAllowedHTTPMethods] = FieldInfo(alias="allowedHttpMethods", default=None) """HTTP methods allowed for content requests from the CDN.""" diff --git a/src/gcore/types/cdn/rule_template_create_params.py b/src/gcore/types/cdn/rule_template_create_params.py index 7c9c0fbb..4ed1a187 100644 --- a/src/gcore/types/cdn/rule_template_create_params.py +++ b/src/gcore/types/cdn/rule_template_create_params.py @@ -124,6 +124,8 @@ class RuleTemplateCreateParams(TypedDict, total=False): class OptionsAllowedHTTPMethods(TypedDict, total=False): + """HTTP methods allowed for content requests from the CDN.""" + enabled: Required[bool] """Controls the option state. @@ -137,6 +139,8 @@ class OptionsAllowedHTTPMethods(TypedDict, total=False): class OptionsBotProtectionBotChallenge(TypedDict, total=False): + """Controls the bot challenge module state.""" + enabled: bool """Possible values: @@ -146,6 +150,10 @@ class OptionsBotProtectionBotChallenge(TypedDict, total=False): class OptionsBotProtection(TypedDict, total=False): + """ + Allows to prevent online services from overloading and ensure your business workflow running smoothly. + """ + bot_challenge: Required[OptionsBotProtectionBotChallenge] """Controls the bot challenge module state.""" @@ -160,6 +168,18 @@ class OptionsBotProtection(TypedDict, total=False): class OptionsBrotliCompression(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -197,6 +217,13 @@ class OptionsBrotliCompression(TypedDict, total=False): class OptionsBrowserCacheSettings(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -214,6 +241,11 @@ class OptionsBrowserCacheSettings(TypedDict, total=False): class OptionsCacheHTTPHeaders(TypedDict, total=False): + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + enabled: Required[bool] """Controls the option state. @@ -227,6 +259,11 @@ class OptionsCacheHTTPHeaders(TypedDict, total=False): class OptionsCors(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -267,6 +304,8 @@ class OptionsCors(TypedDict, total=False): class OptionsCountryACL(TypedDict, total=False): + """Enables control access to content for specified countries.""" + enabled: Required[bool] """Controls the option state. @@ -298,6 +337,11 @@ class OptionsCountryACL(TypedDict, total=False): class OptionsDisableCache(TypedDict, total=False): + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + enabled: Required[bool] """Controls the option state. @@ -316,6 +360,8 @@ class OptionsDisableCache(TypedDict, total=False): class OptionsDisableProxyForceRanges(TypedDict, total=False): + """Allows 206 responses regardless of the settings of an origin source.""" + enabled: Required[bool] """Controls the option state. @@ -334,6 +380,11 @@ class OptionsDisableProxyForceRanges(TypedDict, total=False): class OptionsEdgeCacheSettings(TypedDict, total=False): + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -378,6 +429,10 @@ class OptionsEdgeCacheSettings(TypedDict, total=False): class OptionsFastedgeOnRequestBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request body as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -398,6 +453,10 @@ class OptionsFastedgeOnRequestBody(TypedDict, total=False): class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -418,6 +477,10 @@ class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): class OptionsFastedgeOnResponseBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response body before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -438,6 +501,10 @@ class OptionsFastedgeOnResponseBody(TypedDict, total=False): class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response headers before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -458,6 +525,12 @@ class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): class OptionsFastedge(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -493,6 +566,16 @@ class OptionsFastedge(TypedDict, total=False): class OptionsFetchCompressed(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -511,6 +594,11 @@ class OptionsFetchCompressed(TypedDict, total=False): class OptionsFollowOriginRedirect(TypedDict, total=False): + """ + 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. + """ + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] """Redirect status code that the origin server returns. @@ -529,6 +617,11 @@ class OptionsFollowOriginRedirect(TypedDict, total=False): class OptionsForceReturnTimeInterval(TypedDict, total=False): + """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. + """ + end_time: Required[str] """Time until which a custom HTTP response code should be applied. @@ -546,6 +639,11 @@ class OptionsForceReturnTimeInterval(TypedDict, total=False): class OptionsForceReturn(TypedDict, total=False): + """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. + """ + body: Required[str] """URL for redirection or text.""" @@ -569,6 +667,11 @@ class OptionsForceReturn(TypedDict, total=False): class OptionsForwardHostHeader(TypedDict, total=False): + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -587,6 +690,16 @@ class OptionsForwardHostHeader(TypedDict, total=False): class OptionsGzipOn(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -605,6 +718,15 @@ class OptionsGzipOn(TypedDict, total=False): class OptionsHostHeader(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -619,6 +741,10 @@ class OptionsHostHeader(TypedDict, total=False): class OptionsIgnoreCookie(TypedDict, total=False): + """ + Defines whether the files with the Set-Cookies header are cached as one file or as different ones. + """ + enabled: Required[bool] """Controls the option state. @@ -638,6 +764,12 @@ class OptionsIgnoreCookie(TypedDict, total=False): class OptionsIgnoreQueryString(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -656,6 +788,10 @@ class OptionsIgnoreQueryString(TypedDict, total=False): class OptionsImageStack(TypedDict, total=False): + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically converts them to WebP or AVIF format. + """ + enabled: Required[bool] """Controls the option state. @@ -683,6 +819,12 @@ class OptionsImageStack(TypedDict, total=False): class OptionsIPAddressACL(TypedDict, total=False): + """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) + """ + enabled: Required[bool] """Controls the option state. @@ -719,6 +861,8 @@ class OptionsIPAddressACL(TypedDict, total=False): class OptionsLimitBandwidth(TypedDict, total=False): + """Allows to control the download speed per connection.""" + enabled: Required[bool] """Controls the option state. @@ -754,6 +898,18 @@ class OptionsLimitBandwidth(TypedDict, total=False): class OptionsProxyCacheKey(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -768,6 +924,8 @@ class OptionsProxyCacheKey(TypedDict, total=False): class OptionsProxyCacheMethodsSet(TypedDict, total=False): + """Caching for POST requests along with default GET and HEAD.""" + enabled: Required[bool] """Controls the option state. @@ -786,6 +944,8 @@ class OptionsProxyCacheMethodsSet(TypedDict, total=False): class OptionsProxyConnectTimeout(TypedDict, total=False): + """The time limit for establishing a connection with the origin.""" + enabled: Required[bool] """Controls the option state. @@ -803,6 +963,14 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): class OptionsProxyReadTimeout(TypedDict, total=False): + """ + 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). + """ + enabled: Required[bool] """Controls the option state. @@ -820,6 +988,12 @@ class OptionsProxyReadTimeout(TypedDict, total=False): class OptionsQueryParamsBlacklist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -834,6 +1008,12 @@ class OptionsQueryParamsBlacklist(TypedDict, total=False): class OptionsQueryParamsWhitelist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -848,6 +1028,12 @@ class OptionsQueryParamsWhitelist(TypedDict, total=False): class OptionsQueryStringForwarding(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -897,6 +1083,11 @@ class OptionsQueryStringForwarding(TypedDict, total=False): class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -915,6 +1106,11 @@ class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -933,6 +1129,8 @@ class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): class OptionsReferrerACL(TypedDict, total=False): + """Controls access to the CDN resource content for specified domain names.""" + enabled: Required[bool] """Controls the option state. @@ -971,6 +1169,8 @@ class OptionsReferrerACL(TypedDict, total=False): class OptionsRequestLimiter(TypedDict, total=False): + """Option allows to limit the amount of HTTP requests.""" + enabled: Required[bool] """Controls the option state. @@ -997,6 +1197,8 @@ class OptionsRequestLimiter(TypedDict, total=False): class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + """Hides HTTP headers from an origin server in the CDN response.""" + enabled: Required[bool] """Controls the option state. @@ -1036,6 +1238,11 @@ class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): class OptionsRewrite(TypedDict, total=False): + """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. + """ + body: Required[str] """Path for the Rewrite option. @@ -1068,6 +1275,11 @@ class OptionsRewrite(TypedDict, total=False): class OptionsSecureKey(TypedDict, total=False): + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + enabled: Required[bool] """Controls the option state. @@ -1091,6 +1303,17 @@ class OptionsSecureKey(TypedDict, total=False): class OptionsSlice(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -1109,6 +1332,15 @@ class OptionsSlice(TypedDict, total=False): class OptionsSni(TypedDict, total=False): + """ + 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`. + """ + custom_hostname: Required[str] """Custom SNI hostname. @@ -1142,6 +1374,8 @@ class OptionsSni(TypedDict, total=False): class OptionsStale(TypedDict, total=False): + """Serves stale cached content in case of origin unavailability.""" + enabled: Required[bool] """Controls the option state. @@ -1208,6 +1442,8 @@ class OptionsStaticResponseHeadersValue(TypedDict, total=False): class OptionsStaticResponseHeaders(TypedDict, total=False): + """Custom HTTP Headers that a CDN server adds to a response.""" + enabled: Required[bool] """Controls the option state. @@ -1221,6 +1457,11 @@ class OptionsStaticResponseHeaders(TypedDict, total=False): class OptionsStaticHeaders(TypedDict, total=False): + """**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. + """ + enabled: Required[bool] """Controls the option state. @@ -1244,6 +1485,11 @@ class OptionsStaticHeaders(TypedDict, total=False): class OptionsStaticRequestHeaders(TypedDict, total=False): + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + enabled: Required[bool] """Controls the option state. @@ -1267,6 +1513,8 @@ class OptionsStaticRequestHeaders(TypedDict, total=False): class OptionsUserAgentACL(TypedDict, total=False): + """Controls access to the content for specified User-Agents.""" + enabled: Required[bool] """Controls the option state. @@ -1301,6 +1549,8 @@ class OptionsUserAgentACL(TypedDict, total=False): class OptionsWaap(TypedDict, total=False): + """Allows to enable WAAP (Web Application and API Protection).""" + enabled: Required[bool] """Controls the option state. @@ -1319,6 +1569,8 @@ class OptionsWaap(TypedDict, total=False): class OptionsWebsockets(TypedDict, total=False): + """Enables or disables WebSockets connections to an origin server.""" + enabled: Required[bool] """Controls the option state. @@ -1337,6 +1589,12 @@ class OptionsWebsockets(TypedDict, total=False): class Options(TypedDict, total=False): + """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. + """ + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] """HTTP methods allowed for content requests from the CDN.""" diff --git a/src/gcore/types/cdn/rule_template_replace_params.py b/src/gcore/types/cdn/rule_template_replace_params.py index d0790a32..d2904e0a 100644 --- a/src/gcore/types/cdn/rule_template_replace_params.py +++ b/src/gcore/types/cdn/rule_template_replace_params.py @@ -124,6 +124,8 @@ class RuleTemplateReplaceParams(TypedDict, total=False): class OptionsAllowedHTTPMethods(TypedDict, total=False): + """HTTP methods allowed for content requests from the CDN.""" + enabled: Required[bool] """Controls the option state. @@ -137,6 +139,8 @@ class OptionsAllowedHTTPMethods(TypedDict, total=False): class OptionsBotProtectionBotChallenge(TypedDict, total=False): + """Controls the bot challenge module state.""" + enabled: bool """Possible values: @@ -146,6 +150,10 @@ class OptionsBotProtectionBotChallenge(TypedDict, total=False): class OptionsBotProtection(TypedDict, total=False): + """ + Allows to prevent online services from overloading and ensure your business workflow running smoothly. + """ + bot_challenge: Required[OptionsBotProtectionBotChallenge] """Controls the bot challenge module state.""" @@ -160,6 +168,18 @@ class OptionsBotProtection(TypedDict, total=False): class OptionsBrotliCompression(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -197,6 +217,13 @@ class OptionsBrotliCompression(TypedDict, total=False): class OptionsBrowserCacheSettings(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -214,6 +241,11 @@ class OptionsBrowserCacheSettings(TypedDict, total=False): class OptionsCacheHTTPHeaders(TypedDict, total=False): + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + enabled: Required[bool] """Controls the option state. @@ -227,6 +259,11 @@ class OptionsCacheHTTPHeaders(TypedDict, total=False): class OptionsCors(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -267,6 +304,8 @@ class OptionsCors(TypedDict, total=False): class OptionsCountryACL(TypedDict, total=False): + """Enables control access to content for specified countries.""" + enabled: Required[bool] """Controls the option state. @@ -298,6 +337,11 @@ class OptionsCountryACL(TypedDict, total=False): class OptionsDisableCache(TypedDict, total=False): + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + enabled: Required[bool] """Controls the option state. @@ -316,6 +360,8 @@ class OptionsDisableCache(TypedDict, total=False): class OptionsDisableProxyForceRanges(TypedDict, total=False): + """Allows 206 responses regardless of the settings of an origin source.""" + enabled: Required[bool] """Controls the option state. @@ -334,6 +380,11 @@ class OptionsDisableProxyForceRanges(TypedDict, total=False): class OptionsEdgeCacheSettings(TypedDict, total=False): + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -378,6 +429,10 @@ class OptionsEdgeCacheSettings(TypedDict, total=False): class OptionsFastedgeOnRequestBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request body as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -398,6 +453,10 @@ class OptionsFastedgeOnRequestBody(TypedDict, total=False): class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -418,6 +477,10 @@ class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): class OptionsFastedgeOnResponseBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response body before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -438,6 +501,10 @@ class OptionsFastedgeOnResponseBody(TypedDict, total=False): class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response headers before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -458,6 +525,12 @@ class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): class OptionsFastedge(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -493,6 +566,16 @@ class OptionsFastedge(TypedDict, total=False): class OptionsFetchCompressed(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -511,6 +594,11 @@ class OptionsFetchCompressed(TypedDict, total=False): class OptionsFollowOriginRedirect(TypedDict, total=False): + """ + 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. + """ + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] """Redirect status code that the origin server returns. @@ -529,6 +617,11 @@ class OptionsFollowOriginRedirect(TypedDict, total=False): class OptionsForceReturnTimeInterval(TypedDict, total=False): + """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. + """ + end_time: Required[str] """Time until which a custom HTTP response code should be applied. @@ -546,6 +639,11 @@ class OptionsForceReturnTimeInterval(TypedDict, total=False): class OptionsForceReturn(TypedDict, total=False): + """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. + """ + body: Required[str] """URL for redirection or text.""" @@ -569,6 +667,11 @@ class OptionsForceReturn(TypedDict, total=False): class OptionsForwardHostHeader(TypedDict, total=False): + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -587,6 +690,16 @@ class OptionsForwardHostHeader(TypedDict, total=False): class OptionsGzipOn(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -605,6 +718,15 @@ class OptionsGzipOn(TypedDict, total=False): class OptionsHostHeader(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -619,6 +741,10 @@ class OptionsHostHeader(TypedDict, total=False): class OptionsIgnoreCookie(TypedDict, total=False): + """ + Defines whether the files with the Set-Cookies header are cached as one file or as different ones. + """ + enabled: Required[bool] """Controls the option state. @@ -638,6 +764,12 @@ class OptionsIgnoreCookie(TypedDict, total=False): class OptionsIgnoreQueryString(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -656,6 +788,10 @@ class OptionsIgnoreQueryString(TypedDict, total=False): class OptionsImageStack(TypedDict, total=False): + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically converts them to WebP or AVIF format. + """ + enabled: Required[bool] """Controls the option state. @@ -683,6 +819,12 @@ class OptionsImageStack(TypedDict, total=False): class OptionsIPAddressACL(TypedDict, total=False): + """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) + """ + enabled: Required[bool] """Controls the option state. @@ -719,6 +861,8 @@ class OptionsIPAddressACL(TypedDict, total=False): class OptionsLimitBandwidth(TypedDict, total=False): + """Allows to control the download speed per connection.""" + enabled: Required[bool] """Controls the option state. @@ -754,6 +898,18 @@ class OptionsLimitBandwidth(TypedDict, total=False): class OptionsProxyCacheKey(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -768,6 +924,8 @@ class OptionsProxyCacheKey(TypedDict, total=False): class OptionsProxyCacheMethodsSet(TypedDict, total=False): + """Caching for POST requests along with default GET and HEAD.""" + enabled: Required[bool] """Controls the option state. @@ -786,6 +944,8 @@ class OptionsProxyCacheMethodsSet(TypedDict, total=False): class OptionsProxyConnectTimeout(TypedDict, total=False): + """The time limit for establishing a connection with the origin.""" + enabled: Required[bool] """Controls the option state. @@ -803,6 +963,14 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): class OptionsProxyReadTimeout(TypedDict, total=False): + """ + 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). + """ + enabled: Required[bool] """Controls the option state. @@ -820,6 +988,12 @@ class OptionsProxyReadTimeout(TypedDict, total=False): class OptionsQueryParamsBlacklist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -834,6 +1008,12 @@ class OptionsQueryParamsBlacklist(TypedDict, total=False): class OptionsQueryParamsWhitelist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -848,6 +1028,12 @@ class OptionsQueryParamsWhitelist(TypedDict, total=False): class OptionsQueryStringForwarding(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -897,6 +1083,11 @@ class OptionsQueryStringForwarding(TypedDict, total=False): class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -915,6 +1106,11 @@ class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -933,6 +1129,8 @@ class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): class OptionsReferrerACL(TypedDict, total=False): + """Controls access to the CDN resource content for specified domain names.""" + enabled: Required[bool] """Controls the option state. @@ -971,6 +1169,8 @@ class OptionsReferrerACL(TypedDict, total=False): class OptionsRequestLimiter(TypedDict, total=False): + """Option allows to limit the amount of HTTP requests.""" + enabled: Required[bool] """Controls the option state. @@ -997,6 +1197,8 @@ class OptionsRequestLimiter(TypedDict, total=False): class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + """Hides HTTP headers from an origin server in the CDN response.""" + enabled: Required[bool] """Controls the option state. @@ -1036,6 +1238,11 @@ class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): class OptionsRewrite(TypedDict, total=False): + """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. + """ + body: Required[str] """Path for the Rewrite option. @@ -1068,6 +1275,11 @@ class OptionsRewrite(TypedDict, total=False): class OptionsSecureKey(TypedDict, total=False): + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + enabled: Required[bool] """Controls the option state. @@ -1091,6 +1303,17 @@ class OptionsSecureKey(TypedDict, total=False): class OptionsSlice(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -1109,6 +1332,15 @@ class OptionsSlice(TypedDict, total=False): class OptionsSni(TypedDict, total=False): + """ + 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`. + """ + custom_hostname: Required[str] """Custom SNI hostname. @@ -1142,6 +1374,8 @@ class OptionsSni(TypedDict, total=False): class OptionsStale(TypedDict, total=False): + """Serves stale cached content in case of origin unavailability.""" + enabled: Required[bool] """Controls the option state. @@ -1208,6 +1442,8 @@ class OptionsStaticResponseHeadersValue(TypedDict, total=False): class OptionsStaticResponseHeaders(TypedDict, total=False): + """Custom HTTP Headers that a CDN server adds to a response.""" + enabled: Required[bool] """Controls the option state. @@ -1221,6 +1457,11 @@ class OptionsStaticResponseHeaders(TypedDict, total=False): class OptionsStaticHeaders(TypedDict, total=False): + """**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. + """ + enabled: Required[bool] """Controls the option state. @@ -1244,6 +1485,11 @@ class OptionsStaticHeaders(TypedDict, total=False): class OptionsStaticRequestHeaders(TypedDict, total=False): + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + enabled: Required[bool] """Controls the option state. @@ -1267,6 +1513,8 @@ class OptionsStaticRequestHeaders(TypedDict, total=False): class OptionsUserAgentACL(TypedDict, total=False): + """Controls access to the content for specified User-Agents.""" + enabled: Required[bool] """Controls the option state. @@ -1301,6 +1549,8 @@ class OptionsUserAgentACL(TypedDict, total=False): class OptionsWaap(TypedDict, total=False): + """Allows to enable WAAP (Web Application and API Protection).""" + enabled: Required[bool] """Controls the option state. @@ -1319,6 +1569,8 @@ class OptionsWaap(TypedDict, total=False): class OptionsWebsockets(TypedDict, total=False): + """Enables or disables WebSockets connections to an origin server.""" + enabled: Required[bool] """Controls the option state. @@ -1337,6 +1589,12 @@ class OptionsWebsockets(TypedDict, total=False): class Options(TypedDict, total=False): + """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. + """ + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] """HTTP methods allowed for content requests from the CDN.""" diff --git a/src/gcore/types/cdn/rule_template_update_params.py b/src/gcore/types/cdn/rule_template_update_params.py index eb5be71b..d5034281 100644 --- a/src/gcore/types/cdn/rule_template_update_params.py +++ b/src/gcore/types/cdn/rule_template_update_params.py @@ -124,6 +124,8 @@ class RuleTemplateUpdateParams(TypedDict, total=False): class OptionsAllowedHTTPMethods(TypedDict, total=False): + """HTTP methods allowed for content requests from the CDN.""" + enabled: Required[bool] """Controls the option state. @@ -137,6 +139,8 @@ class OptionsAllowedHTTPMethods(TypedDict, total=False): class OptionsBotProtectionBotChallenge(TypedDict, total=False): + """Controls the bot challenge module state.""" + enabled: bool """Possible values: @@ -146,6 +150,10 @@ class OptionsBotProtectionBotChallenge(TypedDict, total=False): class OptionsBotProtection(TypedDict, total=False): + """ + Allows to prevent online services from overloading and ensure your business workflow running smoothly. + """ + bot_challenge: Required[OptionsBotProtectionBotChallenge] """Controls the bot challenge module state.""" @@ -160,6 +168,18 @@ class OptionsBotProtection(TypedDict, total=False): class OptionsBrotliCompression(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -197,6 +217,13 @@ class OptionsBrotliCompression(TypedDict, total=False): class OptionsBrowserCacheSettings(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -214,6 +241,11 @@ class OptionsBrowserCacheSettings(TypedDict, total=False): class OptionsCacheHTTPHeaders(TypedDict, total=False): + """**Legacy option**. Use the `response_headers_hiding_policy` option instead. + + HTTP Headers that must be included in the response. + """ + enabled: Required[bool] """Controls the option state. @@ -227,6 +259,11 @@ class OptionsCacheHTTPHeaders(TypedDict, total=False): class OptionsCors(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -267,6 +304,8 @@ class OptionsCors(TypedDict, total=False): class OptionsCountryACL(TypedDict, total=False): + """Enables control access to content for specified countries.""" + enabled: Required[bool] """Controls the option state. @@ -298,6 +337,11 @@ class OptionsCountryACL(TypedDict, total=False): class OptionsDisableCache(TypedDict, total=False): + """**Legacy option**. Use the `edge_cache_settings` option instead. + + Allows the complete disabling of content caching. + """ + enabled: Required[bool] """Controls the option state. @@ -316,6 +360,8 @@ class OptionsDisableCache(TypedDict, total=False): class OptionsDisableProxyForceRanges(TypedDict, total=False): + """Allows 206 responses regardless of the settings of an origin source.""" + enabled: Required[bool] """Controls the option state. @@ -334,6 +380,11 @@ class OptionsDisableProxyForceRanges(TypedDict, total=False): class OptionsEdgeCacheSettings(TypedDict, total=False): + """Cache expiration time for CDN servers. + + `value` and `default` fields cannot be used simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -378,6 +429,10 @@ class OptionsEdgeCacheSettings(TypedDict, total=False): class OptionsFastedgeOnRequestBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request body as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -398,6 +453,10 @@ class OptionsFastedgeOnRequestBody(TypedDict, total=False): class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle request headers as soon as CDN receives incoming HTTP request. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -418,6 +477,10 @@ class OptionsFastedgeOnRequestHeaders(TypedDict, total=False): class OptionsFastedgeOnResponseBody(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response body before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -438,6 +501,10 @@ class OptionsFastedgeOnResponseBody(TypedDict, total=False): class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): + """ + Allows to configure FastEdge application that will be called to handle response headers before CDN sends the HTTP response. + """ + app_id: Required[str] """The ID of the application in FastEdge.""" @@ -458,6 +525,12 @@ class OptionsFastedgeOnResponseHeaders(TypedDict, total=False): class OptionsFastedge(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -493,6 +566,16 @@ class OptionsFastedge(TypedDict, total=False): class OptionsFetchCompressed(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -511,6 +594,11 @@ class OptionsFetchCompressed(TypedDict, total=False): class OptionsFollowOriginRedirect(TypedDict, total=False): + """ + 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. + """ + codes: Required[Iterable[Literal[301, 302, 303, 307, 308]]] """Redirect status code that the origin server returns. @@ -529,6 +617,11 @@ class OptionsFollowOriginRedirect(TypedDict, total=False): class OptionsForceReturnTimeInterval(TypedDict, total=False): + """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. + """ + end_time: Required[str] """Time until which a custom HTTP response code should be applied. @@ -546,6 +639,11 @@ class OptionsForceReturnTimeInterval(TypedDict, total=False): class OptionsForceReturn(TypedDict, total=False): + """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. + """ + body: Required[str] """URL for redirection or text.""" @@ -569,6 +667,11 @@ class OptionsForceReturn(TypedDict, total=False): class OptionsForwardHostHeader(TypedDict, total=False): + """Forwards the Host header from a end-user request to an origin server. + + `hostHeader` and `forward_host_header` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -587,6 +690,16 @@ class OptionsForwardHostHeader(TypedDict, total=False): class OptionsGzipOn(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -605,6 +718,15 @@ class OptionsGzipOn(TypedDict, total=False): class OptionsHostHeader(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -619,6 +741,10 @@ class OptionsHostHeader(TypedDict, total=False): class OptionsIgnoreCookie(TypedDict, total=False): + """ + Defines whether the files with the Set-Cookies header are cached as one file or as different ones. + """ + enabled: Required[bool] """Controls the option state. @@ -638,6 +764,12 @@ class OptionsIgnoreCookie(TypedDict, total=False): class OptionsIgnoreQueryString(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -656,6 +788,10 @@ class OptionsIgnoreQueryString(TypedDict, total=False): class OptionsImageStack(TypedDict, total=False): + """ + Transforms JPG and PNG images (for example, resize or crop) and automatically converts them to WebP or AVIF format. + """ + enabled: Required[bool] """Controls the option state. @@ -683,6 +819,12 @@ class OptionsImageStack(TypedDict, total=False): class OptionsIPAddressACL(TypedDict, total=False): + """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) + """ + enabled: Required[bool] """Controls the option state. @@ -719,6 +861,8 @@ class OptionsIPAddressACL(TypedDict, total=False): class OptionsLimitBandwidth(TypedDict, total=False): + """Allows to control the download speed per connection.""" + enabled: Required[bool] """Controls the option state. @@ -754,6 +898,18 @@ class OptionsLimitBandwidth(TypedDict, total=False): class OptionsProxyCacheKey(TypedDict, total=False): + """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. + """ + enabled: Required[bool] """Controls the option state. @@ -768,6 +924,8 @@ class OptionsProxyCacheKey(TypedDict, total=False): class OptionsProxyCacheMethodsSet(TypedDict, total=False): + """Caching for POST requests along with default GET and HEAD.""" + enabled: Required[bool] """Controls the option state. @@ -786,6 +944,8 @@ class OptionsProxyCacheMethodsSet(TypedDict, total=False): class OptionsProxyConnectTimeout(TypedDict, total=False): + """The time limit for establishing a connection with the origin.""" + enabled: Required[bool] """Controls the option state. @@ -803,6 +963,14 @@ class OptionsProxyConnectTimeout(TypedDict, total=False): class OptionsProxyReadTimeout(TypedDict, total=False): + """ + 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). + """ + enabled: Required[bool] """Controls the option state. @@ -820,6 +988,12 @@ class OptionsProxyReadTimeout(TypedDict, total=False): class OptionsQueryParamsBlacklist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -834,6 +1008,12 @@ class OptionsQueryParamsBlacklist(TypedDict, total=False): class OptionsQueryParamsWhitelist(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -848,6 +1028,12 @@ class OptionsQueryParamsWhitelist(TypedDict, total=False): class OptionsQueryStringForwarding(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -897,6 +1083,11 @@ class OptionsQueryStringForwarding(TypedDict, total=False): class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): + """Enables redirect from HTTP to HTTPS. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -915,6 +1106,11 @@ class OptionsRedirectHTTPToHTTPS(TypedDict, total=False): class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): + """Enables redirect from HTTPS to HTTP. + + `redirect_http_to_https` and `redirect_https_to_http` options cannot be enabled simultaneously. + """ + enabled: Required[bool] """Controls the option state. @@ -933,6 +1129,8 @@ class OptionsRedirectHTTPSToHTTP(TypedDict, total=False): class OptionsReferrerACL(TypedDict, total=False): + """Controls access to the CDN resource content for specified domain names.""" + enabled: Required[bool] """Controls the option state. @@ -971,6 +1169,8 @@ class OptionsReferrerACL(TypedDict, total=False): class OptionsRequestLimiter(TypedDict, total=False): + """Option allows to limit the amount of HTTP requests.""" + enabled: Required[bool] """Controls the option state. @@ -997,6 +1197,8 @@ class OptionsRequestLimiter(TypedDict, total=False): class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): + """Hides HTTP headers from an origin server in the CDN response.""" + enabled: Required[bool] """Controls the option state. @@ -1036,6 +1238,11 @@ class OptionsResponseHeadersHidingPolicy(TypedDict, total=False): class OptionsRewrite(TypedDict, total=False): + """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. + """ + body: Required[str] """Path for the Rewrite option. @@ -1068,6 +1275,11 @@ class OptionsRewrite(TypedDict, total=False): class OptionsSecureKey(TypedDict, total=False): + """Configures access with tokenized URLs. + + This makes impossible to access content without a valid (unexpired) token. + """ + enabled: Required[bool] """Controls the option state. @@ -1091,6 +1303,17 @@ class OptionsSecureKey(TypedDict, total=False): class OptionsSlice(TypedDict, total=False): + """ + 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. + """ + enabled: Required[bool] """Controls the option state. @@ -1109,6 +1332,15 @@ class OptionsSlice(TypedDict, total=False): class OptionsSni(TypedDict, total=False): + """ + 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`. + """ + custom_hostname: Required[str] """Custom SNI hostname. @@ -1142,6 +1374,8 @@ class OptionsSni(TypedDict, total=False): class OptionsStale(TypedDict, total=False): + """Serves stale cached content in case of origin unavailability.""" + enabled: Required[bool] """Controls the option state. @@ -1208,6 +1442,8 @@ class OptionsStaticResponseHeadersValue(TypedDict, total=False): class OptionsStaticResponseHeaders(TypedDict, total=False): + """Custom HTTP Headers that a CDN server adds to a response.""" + enabled: Required[bool] """Controls the option state. @@ -1221,6 +1457,11 @@ class OptionsStaticResponseHeaders(TypedDict, total=False): class OptionsStaticHeaders(TypedDict, total=False): + """**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. + """ + enabled: Required[bool] """Controls the option state. @@ -1244,6 +1485,11 @@ class OptionsStaticHeaders(TypedDict, total=False): class OptionsStaticRequestHeaders(TypedDict, total=False): + """Custom HTTP Headers for a CDN server to add to request. + + Up to fifty custom HTTP Headers can be specified. + """ + enabled: Required[bool] """Controls the option state. @@ -1267,6 +1513,8 @@ class OptionsStaticRequestHeaders(TypedDict, total=False): class OptionsUserAgentACL(TypedDict, total=False): + """Controls access to the content for specified User-Agents.""" + enabled: Required[bool] """Controls the option state. @@ -1301,6 +1549,8 @@ class OptionsUserAgentACL(TypedDict, total=False): class OptionsWaap(TypedDict, total=False): + """Allows to enable WAAP (Web Application and API Protection).""" + enabled: Required[bool] """Controls the option state. @@ -1319,6 +1569,8 @@ class OptionsWaap(TypedDict, total=False): class OptionsWebsockets(TypedDict, total=False): + """Enables or disables WebSockets connections to an origin server.""" + enabled: Required[bool] """Controls the option state. @@ -1337,6 +1589,12 @@ class OptionsWebsockets(TypedDict, total=False): class Options(TypedDict, total=False): + """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. + """ + allowed_http_methods: Annotated[Optional[OptionsAllowedHTTPMethods], PropertyInfo(alias="allowedHttpMethods")] """HTTP methods allowed for content requests from the CDN.""" diff --git a/src/gcore/types/cdn/ssl_request_status.py b/src/gcore/types/cdn/ssl_request_status.py index b1738272..e0577790 100644 --- a/src/gcore/types/cdn/ssl_request_status.py +++ b/src/gcore/types/cdn/ssl_request_status.py @@ -8,6 +8,8 @@ class LatestStatus(BaseModel): + """Detailed information about last attempt to issue a Let's Encrypt certificate.""" + id: Optional[int] = None """ID of the attempt to issue the Let's Encrypt certificate.""" diff --git a/src/gcore/types/cloud/audit_log_entry.py b/src/gcore/types/cloud/audit_log_entry.py index 56dcac38..f73e831e 100644 --- a/src/gcore/types/cloud/audit_log_entry.py +++ b/src/gcore/types/cloud/audit_log_entry.py @@ -93,6 +93,8 @@ class Resource(BaseModel): class TotalPrice(BaseModel): + """Total resource price VAT inclusive""" + currency_code: Optional[str] = None """Currency code (3 letter code per ISO 4217)""" diff --git a/src/gcore/types/cloud/baremetal/baremetal_fixed_address.py b/src/gcore/types/cloud/baremetal/baremetal_fixed_address.py index 93d72394..1a62ab5a 100644 --- a/src/gcore/types/cloud/baremetal/baremetal_fixed_address.py +++ b/src/gcore/types/cloud/baremetal/baremetal_fixed_address.py @@ -9,6 +9,8 @@ class BaremetalFixedAddress(BaseModel): + """IP addresses of the trunk port and its subports.""" + addr: str """Address""" diff --git a/src/gcore/types/cloud/baremetal/baremetal_server.py b/src/gcore/types/cloud/baremetal/baremetal_server.py index 1d491ca7..1c3e9a8f 100644 --- a/src/gcore/types/cloud/baremetal/baremetal_server.py +++ b/src/gcore/types/cloud/baremetal/baremetal_server.py @@ -29,6 +29,8 @@ class FixedIPAssignment(BaseModel): class FlavorHardwareDescription(BaseModel): + """Additional hardware description""" + cpu: str """Human-readable CPU description""" @@ -46,6 +48,8 @@ class FlavorHardwareDescription(BaseModel): class Flavor(BaseModel): + """Flavor details""" + architecture: str """CPU architecture""" diff --git a/src/gcore/types/cloud/baremetal/server_create_params.py b/src/gcore/types/cloud/baremetal/server_create_params.py index 79ba71d7..5d889df8 100644 --- a/src/gcore/types/cloud/baremetal/server_create_params.py +++ b/src/gcore/types/cloud/baremetal/server_create_params.py @@ -115,6 +115,8 @@ class ServerCreateParams(TypedDict, total=False): class InterfaceCreateBareMetalExternalInterfaceSerializer(TypedDict, total=False): + """Instance will be attached to default external network""" + type: Required[Literal["external"]] """A public IP address will be assigned to the instance.""" @@ -173,6 +175,12 @@ class InterfaceCreateBareMetalSubnetInterfaceSerializerFloatingIPExistingInstanc class InterfaceCreateBareMetalSubnetInterfaceSerializer(TypedDict, total=False): + """ + The instance will get an IP address from the selected network. + If you choose to add a floating IP, the instance will be reachable from the internet. + Otherwise, it will only have a private IP within the network. + """ + network_id: Required[str] """The network where the instance will be connected.""" @@ -358,6 +366,8 @@ class DDOSProfileField(TypedDict, total=False): class DDOSProfile(TypedDict, total=False): + """Enable advanced DDoS protection for the server""" + profile_template: Required[int] """Unique identifier of the DDoS protection template to use for this profile""" diff --git a/src/gcore/types/cloud/baremetal_flavor.py b/src/gcore/types/cloud/baremetal_flavor.py index 5bc0b974..5cd8867f 100644 --- a/src/gcore/types/cloud/baremetal_flavor.py +++ b/src/gcore/types/cloud/baremetal_flavor.py @@ -9,6 +9,8 @@ class BaremetalFlavor(BaseModel): + """Bare metal flavor schema""" + architecture: str """Flavor architecture type""" diff --git a/src/gcore/types/cloud/billing_reservation.py b/src/gcore/types/cloud/billing_reservation.py index 5a1c1949..9800c029 100644 --- a/src/gcore/types/cloud/billing_reservation.py +++ b/src/gcore/types/cloud/billing_reservation.py @@ -9,6 +9,8 @@ class ActiveOvercommit(BaseModel): + """Overcommit pricing details""" + active_from: datetime """Billing subscription active from date""" @@ -29,6 +31,8 @@ class ActiveOvercommit(BaseModel): class Commit(BaseModel): + """Commit pricing details""" + active_from: datetime """Billing subscription active from date""" @@ -49,6 +53,8 @@ class Commit(BaseModel): class HardwareInfo(BaseModel): + """Hardware specifications""" + cpu: Optional[str] = None """CPU specification""" diff --git a/src/gcore/types/cloud/console.py b/src/gcore/types/cloud/console.py index 83456788..76eab309 100644 --- a/src/gcore/types/cloud/console.py +++ b/src/gcore/types/cloud/console.py @@ -6,6 +6,8 @@ class RemoteConsole(BaseModel): + """Remote console information""" + protocol: str type: str diff --git a/src/gcore/types/cloud/cost_report_get_aggregated_monthly_params.py b/src/gcore/types/cloud/cost_report_get_aggregated_monthly_params.py index 6b9a4389..caddf10c 100644 --- a/src/gcore/types/cloud/cost_report_get_aggregated_monthly_params.py +++ b/src/gcore/types/cloud/cost_report_get_aggregated_monthly_params.py @@ -394,6 +394,8 @@ class TagsCondition(TypedDict, total=False): class Tags(TypedDict, total=False): + """Filter by tags""" + conditions: Required[Iterable[TagsCondition]] """A list of tag filtering conditions defining how tags should match.""" diff --git a/src/gcore/types/cloud/cost_report_get_aggregated_params.py b/src/gcore/types/cloud/cost_report_get_aggregated_params.py index 6fa2ee1f..47cbebd5 100644 --- a/src/gcore/types/cloud/cost_report_get_aggregated_params.py +++ b/src/gcore/types/cloud/cost_report_get_aggregated_params.py @@ -406,6 +406,8 @@ class TagsCondition(TypedDict, total=False): class Tags(TypedDict, total=False): + """Filter by tags""" + conditions: Required[Iterable[TagsCondition]] """A list of tag filtering conditions defining how tags should match.""" diff --git a/src/gcore/types/cloud/cost_report_get_detailed_params.py b/src/gcore/types/cloud/cost_report_get_detailed_params.py index e7b8908e..7026096b 100644 --- a/src/gcore/types/cloud/cost_report_get_detailed_params.py +++ b/src/gcore/types/cloud/cost_report_get_detailed_params.py @@ -432,6 +432,8 @@ class TagsCondition(TypedDict, total=False): class Tags(TypedDict, total=False): + """Filter by tags""" + conditions: Required[Iterable[TagsCondition]] """A list of tag filtering conditions defining how tags should match.""" diff --git a/src/gcore/types/cloud/databases/postgres/cluster_create_params.py b/src/gcore/types/cloud/databases/postgres/cluster_create_params.py index 7b569828..f5a9e105 100644 --- a/src/gcore/types/cloud/databases/postgres/cluster_create_params.py +++ b/src/gcore/types/cloud/databases/postgres/cluster_create_params.py @@ -48,6 +48,8 @@ class ClusterCreateParams(TypedDict, total=False): class Flavor(TypedDict, total=False): + """Instance RAM and CPU""" + cpu: Required[int] """Maximum available cores for instance""" @@ -56,6 +58,8 @@ class Flavor(TypedDict, total=False): class HighAvailability(TypedDict, total=False): + """High Availability settings""" + replication_mode: Required[Literal["async", "sync"]] """Type of replication""" @@ -75,6 +79,8 @@ class PgServerConfigurationPooler(TypedDict, total=False): class PgServerConfiguration(TypedDict, total=False): + """PosgtreSQL cluster configuration""" + pg_conf: Required[str] """pg.conf settings""" @@ -85,6 +91,8 @@ class PgServerConfiguration(TypedDict, total=False): class Storage(TypedDict, total=False): + """Cluster's storage configuration""" + size_gib: Required[int] """Total available storage for database""" diff --git a/src/gcore/types/cloud/databases/postgres/cluster_update_params.py b/src/gcore/types/cloud/databases/postgres/cluster_update_params.py index 075ee4df..9ae130ff 100644 --- a/src/gcore/types/cloud/databases/postgres/cluster_update_params.py +++ b/src/gcore/types/cloud/databases/postgres/cluster_update_params.py @@ -53,6 +53,8 @@ class Database(TypedDict, total=False): class Flavor(TypedDict, total=False): + """New instance RAM and CPU""" + cpu: Required[int] """Maximum available cores for instance""" @@ -61,6 +63,8 @@ class Flavor(TypedDict, total=False): class HighAvailability(TypedDict, total=False): + """New High Availability settings""" + replication_mode: Required[Literal["async", "sync"]] """Type of replication""" @@ -80,6 +84,8 @@ class PgServerConfigurationPooler(TypedDict, total=False): class PgServerConfiguration(TypedDict, total=False): + """New PosgtreSQL cluster configuration""" + pg_conf: Optional[str] """New pg.conf file settings""" @@ -90,6 +96,8 @@ class PgServerConfiguration(TypedDict, total=False): class Storage(TypedDict, total=False): + """New storage configuration""" + size_gib: Required[int] """Total available storage for database""" diff --git a/src/gcore/types/cloud/databases/postgres/postgres_cluster.py b/src/gcore/types/cloud/databases/postgres/postgres_cluster.py index 445ba8e3..a5abc748 100644 --- a/src/gcore/types/cloud/databases/postgres/postgres_cluster.py +++ b/src/gcore/types/cloud/databases/postgres/postgres_cluster.py @@ -31,6 +31,8 @@ class Database(BaseModel): class Flavor(BaseModel): + """Instance RAM and CPU""" + cpu: int """Maximum available cores for instance""" @@ -64,6 +66,8 @@ class PgServerConfigurationPooler(BaseModel): class PgServerConfiguration(BaseModel): + """Main PG configuration""" + pg_conf: str """pg.conf settings""" @@ -74,6 +78,8 @@ class PgServerConfiguration(BaseModel): class Storage(BaseModel): + """PG's storage configuration""" + size_gib: int """Total available storage for database""" diff --git a/src/gcore/types/cloud/file_share_create_params.py b/src/gcore/types/cloud/file_share_create_params.py index 718f0055..dc69d0d0 100644 --- a/src/gcore/types/cloud/file_share_create_params.py +++ b/src/gcore/types/cloud/file_share_create_params.py @@ -55,6 +55,8 @@ class CreateStandardFileShareSerializer(TypedDict, total=False): class CreateStandardFileShareSerializerNetwork(TypedDict, total=False): + """File share network configuration""" + network_id: Required[str] """Network ID.""" @@ -110,6 +112,8 @@ class CreateVastFileShareSerializer(TypedDict, total=False): class CreateVastFileShareSerializerShareSettings(TypedDict, total=False): + """Configuration settings for the share""" + allowed_characters: Literal["LCD", "NPL"] """Determines which characters are allowed in file names. Choose between: diff --git a/src/gcore/types/cloud/file_share_update_params.py b/src/gcore/types/cloud/file_share_update_params.py index ca8df7d9..2df15e25 100644 --- a/src/gcore/types/cloud/file_share_update_params.py +++ b/src/gcore/types/cloud/file_share_update_params.py @@ -55,6 +55,8 @@ class FileShareUpdateParams(TypedDict, total=False): class ShareSettings(TypedDict, total=False): + """Configuration settings for the share""" + allowed_characters: Literal["LCD", "NPL"] """Determines which characters are allowed in file names. Choose between: diff --git a/src/gcore/types/cloud/fixed_address.py b/src/gcore/types/cloud/fixed_address.py index 995d2c83..4a4a1e06 100644 --- a/src/gcore/types/cloud/fixed_address.py +++ b/src/gcore/types/cloud/fixed_address.py @@ -9,6 +9,11 @@ class FixedAddress(BaseModel): + """Schema for `fixed` addresses. + + This schema is used when fetching a single instance. + """ + addr: str """IP address""" diff --git a/src/gcore/types/cloud/fixed_address_short.py b/src/gcore/types/cloud/fixed_address_short.py index baf1dd75..58fbb4e6 100644 --- a/src/gcore/types/cloud/fixed_address_short.py +++ b/src/gcore/types/cloud/fixed_address_short.py @@ -9,6 +9,12 @@ class FixedAddressShort(BaseModel): + """Schema for `fixed` addresses. + + This schema is used when listing instances. + It omits the `subnet_name` and `subnet_id` fields. + """ + addr: str """IP address""" diff --git a/src/gcore/types/cloud/floating_address.py b/src/gcore/types/cloud/floating_address.py index d730f632..80c4876c 100644 --- a/src/gcore/types/cloud/floating_address.py +++ b/src/gcore/types/cloud/floating_address.py @@ -8,6 +8,8 @@ class FloatingAddress(BaseModel): + """Schema for `floating` addresses.""" + addr: str """Address""" diff --git a/src/gcore/types/cloud/floating_ip_detailed.py b/src/gcore/types/cloud/floating_ip_detailed.py index 41f9ad36..65d9bb30 100644 --- a/src/gcore/types/cloud/floating_ip_detailed.py +++ b/src/gcore/types/cloud/floating_ip_detailed.py @@ -25,6 +25,8 @@ class InstanceFlavor(BaseModel): + """Flavor""" + flavor_id: str """Flavor ID is the same as name""" @@ -52,6 +54,8 @@ class InstanceVolume(BaseModel): class Instance(BaseModel): + """Instance the floating IP is attached to""" + id: str """Instance ID""" diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster.py b/src/gcore/types/cloud/gpu_baremetal_cluster.py index d2d67eca..85bc978c 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster.py @@ -41,6 +41,8 @@ class ServersSettingsInterfaceExternalInterfaceOutputSerializer(BaseModel): class ServersSettingsInterfaceSubnetInterfaceOutputSerializerFloatingIP(BaseModel): + """Floating IP config for this subnet attachment""" + source: Literal["new"] @@ -61,6 +63,8 @@ class ServersSettingsInterfaceSubnetInterfaceOutputSerializer(BaseModel): class ServersSettingsInterfaceAnySubnetInterfaceOutputSerializerFloatingIP(BaseModel): + """Floating IP config for this subnet attachment""" + source: Literal["new"] diff --git a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py index faf830e3..4bc1ea85 100644 --- a/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_cluster_create_params.py @@ -64,6 +64,8 @@ class ServersSettingsInterfaceExternalInterfaceInputSerializer(TypedDict, total= class ServersSettingsInterfaceSubnetInterfaceInputSerializerFloatingIP(TypedDict, total=False): + """Floating IP config for this subnet attachment""" + source: Required[Literal["new"]] @@ -84,6 +86,8 @@ class ServersSettingsInterfaceSubnetInterfaceInputSerializer(TypedDict, total=Fa class ServersSettingsInterfaceAnySubnetInterfaceInputSerializerFloatingIP(TypedDict, total=False): + """Floating IP config for this subnet attachment""" + source: Required[Literal["new"]] @@ -111,6 +115,8 @@ class ServersSettingsInterfaceAnySubnetInterfaceInputSerializer(TypedDict, total class ServersSettingsCredentials(TypedDict, total=False): + """Optional server access credentials""" + password: str """Used to set the password for the specified 'username' on Linux instances. @@ -142,6 +148,8 @@ class ServersSettingsSecurityGroup(TypedDict, total=False): class ServersSettings(TypedDict, total=False): + """Configuration settings for the servers in the cluster""" + interfaces: Required[Iterable[ServersSettingsInterface]] """Subnet IPs and floating IPs""" diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1.py b/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1.py index 72debc0b..171a164a 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server_v1.py @@ -37,6 +37,8 @@ class FixedIPAssignment(BaseModel): class FlavorHardwareDescription(BaseModel): + """Additional hardware description""" + cpu: str """Human-readable CPU description""" @@ -57,6 +59,8 @@ class FlavorHardwareDescription(BaseModel): class Flavor(BaseModel): + """Flavor""" + architecture: str """CPU architecture""" diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_flavor.py b/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_flavor.py index 4664d48a..bca6570c 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_flavor.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_flavor.py @@ -20,6 +20,8 @@ class GPUBaremetalFlavorSerializerWithoutPriceHardwareDescription(BaseModel): + """Additional bare metal hardware description""" + cpu: str """Human-readable CPU description""" @@ -37,6 +39,8 @@ class GPUBaremetalFlavorSerializerWithoutPriceHardwareDescription(BaseModel): class GPUBaremetalFlavorSerializerWithoutPriceHardwareProperties(BaseModel): + """Additional bare metal hardware properties""" + gpu_count: Optional[int] = None """The total count of available GPUs.""" @@ -54,6 +58,8 @@ class GPUBaremetalFlavorSerializerWithoutPriceHardwareProperties(BaseModel): class GPUBaremetalFlavorSerializerWithoutPriceSupportedFeatures(BaseModel): + """Set of enabled features based on the flavor's type and configuration""" + security_groups: bool @@ -81,6 +87,8 @@ class GPUBaremetalFlavorSerializerWithoutPrice(BaseModel): class GPUBaremetalFlavorSerializerWithPricesHardwareDescription(BaseModel): + """Additional virtual hardware description""" + cpu: str """Human-readable CPU description""" @@ -98,6 +106,8 @@ class GPUBaremetalFlavorSerializerWithPricesHardwareDescription(BaseModel): class GPUBaremetalFlavorSerializerWithPricesHardwareProperties(BaseModel): + """Additional bare metal hardware properties""" + gpu_count: Optional[int] = None """The total count of available GPUs.""" @@ -115,6 +125,8 @@ class GPUBaremetalFlavorSerializerWithPricesHardwareProperties(BaseModel): class GPUBaremetalFlavorSerializerWithPricesPrice(BaseModel): + """Flavor price""" + currency_code: Optional[str] = None """Currency code. Shown if the `include_prices` query parameter if set to true""" @@ -129,6 +141,8 @@ class GPUBaremetalFlavorSerializerWithPricesPrice(BaseModel): class GPUBaremetalFlavorSerializerWithPricesSupportedFeatures(BaseModel): + """Set of enabled features based on the flavor's type and configuration""" + security_groups: bool diff --git a/src/gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py b/src/gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py index 094bd21e..98bf36af 100644 --- a/src/gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py +++ b/src/gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py @@ -65,6 +65,8 @@ class NewInterfaceExternalExtendSchemaWithDdosddosProfileField(TypedDict, total= class NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile(TypedDict, total=False): + """Advanced DDoS protection.""" + profile_template: Required[int] """DDoS profile template ID.""" @@ -76,6 +78,8 @@ class NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile(TypedDict, total=False class NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup(TypedDict, total=False): + """MandatoryIdSchema schema""" + id: Required[str] """Resource ID""" @@ -119,6 +123,8 @@ class NewInterfaceSpecificSubnetSchemaDDOSProfileField(TypedDict, total=False): class NewInterfaceSpecificSubnetSchemaDDOSProfile(TypedDict, total=False): + """Advanced DDoS protection.""" + profile_template: Required[int] """DDoS profile template ID.""" @@ -130,6 +136,8 @@ class NewInterfaceSpecificSubnetSchemaDDOSProfile(TypedDict, total=False): class NewInterfaceSpecificSubnetSchemaSecurityGroup(TypedDict, total=False): + """MandatoryIdSchema schema""" + id: Required[str] """Resource ID""" @@ -176,6 +184,8 @@ class NewInterfaceAnySubnetSchemaDDOSProfileField(TypedDict, total=False): class NewInterfaceAnySubnetSchemaDDOSProfile(TypedDict, total=False): + """Advanced DDoS protection.""" + profile_template: Required[int] """DDoS profile template ID.""" @@ -187,6 +197,8 @@ class NewInterfaceAnySubnetSchemaDDOSProfile(TypedDict, total=False): class NewInterfaceAnySubnetSchemaSecurityGroup(TypedDict, total=False): + """MandatoryIdSchema schema""" + id: Required[str] """Resource ID""" @@ -230,6 +242,8 @@ class NewInterfaceReservedFixedIPSchemaDDOSProfileField(TypedDict, total=False): class NewInterfaceReservedFixedIPSchemaDDOSProfile(TypedDict, total=False): + """Advanced DDoS protection.""" + profile_template: Required[int] """DDoS profile template ID.""" @@ -241,6 +255,8 @@ class NewInterfaceReservedFixedIPSchemaDDOSProfile(TypedDict, total=False): class NewInterfaceReservedFixedIPSchemaSecurityGroup(TypedDict, total=False): + """MandatoryIdSchema schema""" + id: Required[str] """Resource ID""" diff --git a/src/gcore/types/cloud/gpu_virtual_cluster.py b/src/gcore/types/cloud/gpu_virtual_cluster.py index 28d58c1e..72aaad4e 100644 --- a/src/gcore/types/cloud/gpu_virtual_cluster.py +++ b/src/gcore/types/cloud/gpu_virtual_cluster.py @@ -42,6 +42,8 @@ class ServersSettingsInterfaceExternalInterfaceOutputSerializer(BaseModel): class ServersSettingsInterfaceSubnetInterfaceOutputSerializerFloatingIP(BaseModel): + """Floating IP config for this subnet attachment""" + source: Literal["new"] @@ -62,6 +64,8 @@ class ServersSettingsInterfaceSubnetInterfaceOutputSerializer(BaseModel): class ServersSettingsInterfaceAnySubnetInterfaceOutputSerializerFloatingIP(BaseModel): + """Floating IP config for this subnet attachment""" + source: Literal["new"] diff --git a/src/gcore/types/cloud/gpu_virtual_cluster_create_params.py b/src/gcore/types/cloud/gpu_virtual_cluster_create_params.py index d0f2f050..b678cabf 100644 --- a/src/gcore/types/cloud/gpu_virtual_cluster_create_params.py +++ b/src/gcore/types/cloud/gpu_virtual_cluster_create_params.py @@ -64,6 +64,8 @@ class ServersSettingsInterfaceExternalInterfaceInputSerializer(TypedDict, total= class ServersSettingsInterfaceSubnetInterfaceInputSerializerFloatingIP(TypedDict, total=False): + """Floating IP config for this subnet attachment""" + source: Required[Literal["new"]] @@ -84,6 +86,8 @@ class ServersSettingsInterfaceSubnetInterfaceInputSerializer(TypedDict, total=Fa class ServersSettingsInterfaceAnySubnetInterfaceInputSerializerFloatingIP(TypedDict, total=False): + """Floating IP config for this subnet attachment""" + source: Required[Literal["new"]] @@ -163,6 +167,8 @@ class ServersSettingsVolumeImageVolumeInputSerializer(TypedDict, total=False): class ServersSettingsCredentials(TypedDict, total=False): + """Optional server access credentials""" + password: str """Used to set the password for the specified 'username' on Linux instances. @@ -194,6 +200,8 @@ class ServersSettingsSecurityGroup(TypedDict, total=False): class ServersSettings(TypedDict, total=False): + """Configuration settings for the servers in the cluster""" + interfaces: Required[Iterable[ServersSettingsInterface]] """Subnet IPs and floating IPs""" diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor.py b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor.py index cd90cda1..5b94d243 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor.py +++ b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor.py @@ -20,6 +20,8 @@ class GPUVirtualFlavorSerializerWithoutPriceHardwareDescription(BaseModel): + """Additional virtual hardware description""" + gpu: Optional[str] = None """Human-readable GPU description""" @@ -34,6 +36,8 @@ class GPUVirtualFlavorSerializerWithoutPriceHardwareDescription(BaseModel): class GPUVirtualFlavorSerializerWithoutPriceHardwareProperties(BaseModel): + """Additional virtual hardware properties""" + gpu_count: Optional[int] = None """The total count of available GPUs.""" @@ -51,6 +55,8 @@ class GPUVirtualFlavorSerializerWithoutPriceHardwareProperties(BaseModel): class GPUVirtualFlavorSerializerWithoutPriceSupportedFeatures(BaseModel): + """Set of enabled features based on the flavor's type and configuration""" + security_groups: bool @@ -78,6 +84,8 @@ class GPUVirtualFlavorSerializerWithoutPrice(BaseModel): class GPUVirtualFlavorSerializerWithPricesHardwareDescription(BaseModel): + """Additional virtual hardware description""" + gpu: Optional[str] = None """Human-readable GPU description""" @@ -92,6 +100,8 @@ class GPUVirtualFlavorSerializerWithPricesHardwareDescription(BaseModel): class GPUVirtualFlavorSerializerWithPricesHardwareProperties(BaseModel): + """Additional virtual hardware properties""" + gpu_count: Optional[int] = None """The total count of available GPUs.""" @@ -109,6 +119,8 @@ class GPUVirtualFlavorSerializerWithPricesHardwareProperties(BaseModel): class GPUVirtualFlavorSerializerWithPricesPrice(BaseModel): + """Flavor price.""" + currency_code: Optional[str] = None """Currency code. Shown if the `include_prices` query parameter if set to true""" @@ -123,6 +135,8 @@ class GPUVirtualFlavorSerializerWithPricesPrice(BaseModel): class GPUVirtualFlavorSerializerWithPricesSupportedFeatures(BaseModel): + """Set of enabled features based on the flavor's type and configuration""" + security_groups: bool diff --git a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface.py b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface.py index fbac34d7..22892dca 100644 --- a/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface.py +++ b/src/gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface.py @@ -120,6 +120,8 @@ class NetworkSubnet(BaseModel): class Network(BaseModel): + """Body of the network this port is attached to""" + id: str """Network ID""" diff --git a/src/gcore/types/cloud/inference/applications/deployment_create_params.py b/src/gcore/types/cloud/inference/applications/deployment_create_params.py index 537480cf..fbcfdf5a 100644 --- a/src/gcore/types/cloud/inference/applications/deployment_create_params.py +++ b/src/gcore/types/cloud/inference/applications/deployment_create_params.py @@ -36,6 +36,8 @@ class DeploymentCreateParams(TypedDict, total=False): class ComponentsConfigurationScale(TypedDict, total=False): + """Scaling parameters of the component""" + max: Required[int] """Maximum number of replicas the container can be scaled up to""" diff --git a/src/gcore/types/cloud/inference/applications/deployment_update_params.py b/src/gcore/types/cloud/inference/applications/deployment_update_params.py index 8a8c6a1a..d5055d72 100644 --- a/src/gcore/types/cloud/inference/applications/deployment_update_params.py +++ b/src/gcore/types/cloud/inference/applications/deployment_update_params.py @@ -35,6 +35,8 @@ class ComponentsConfigurationParameterOverrides(TypedDict, total=False): class ComponentsConfigurationScale(TypedDict, total=False): + """Scaling parameters of the component""" + max: int """Maximum number of replicas the container can be scaled up to""" diff --git a/src/gcore/types/cloud/inference/applications/inference_application_deployment.py b/src/gcore/types/cloud/inference/applications/inference_application_deployment.py index b6333e6b..d864dc33 100644 --- a/src/gcore/types/cloud/inference/applications/inference_application_deployment.py +++ b/src/gcore/types/cloud/inference/applications/inference_application_deployment.py @@ -24,6 +24,8 @@ class ComponentsConfigurationParameterOverrides(BaseModel): class ComponentsConfigurationScale(BaseModel): + """Scaling parameters of the component""" + max: int """Maximum number of replicas the container can be scaled up to""" @@ -78,6 +80,8 @@ class StatusRegion(BaseModel): class Status(BaseModel): + """Current state of the deployment across regions""" + component_inferences: Dict[str, StatusComponentInferences] """Map of components and their inferences""" diff --git a/src/gcore/types/cloud/inference/deployment_create_params.py b/src/gcore/types/cloud/inference/deployment_create_params.py index ace2531f..98f624cf 100644 --- a/src/gcore/types/cloud/inference/deployment_create_params.py +++ b/src/gcore/types/cloud/inference/deployment_create_params.py @@ -117,21 +117,35 @@ class DeploymentCreateParams(TypedDict, total=False): class ContainerScaleTriggersCPU(TypedDict, total=False): + """CPU trigger configuration""" + threshold: Required[int] """Threshold value for the trigger in percentage""" class ContainerScaleTriggersGPUMemory(TypedDict, total=False): + """GPU memory trigger configuration. + + Calculated by `DCGM_FI_DEV_MEM_COPY_UTIL` metric + """ + threshold: Required[int] """Threshold value for the trigger in percentage""" class ContainerScaleTriggersGPUUtilization(TypedDict, total=False): + """GPU utilization trigger configuration. + + Calculated by `DCGM_FI_DEV_GPU_UTIL` metric + """ + threshold: Required[int] """Threshold value for the trigger in percentage""" class ContainerScaleTriggersHTTP(TypedDict, total=False): + """HTTP trigger configuration""" + rate: Required[int] """Request count per 'window' seconds for the http trigger""" @@ -140,11 +154,15 @@ class ContainerScaleTriggersHTTP(TypedDict, total=False): class ContainerScaleTriggersMemory(TypedDict, total=False): + """Memory trigger configuration""" + threshold: Required[int] """Threshold value for the trigger in percentage""" class ContainerScaleTriggersSqs(TypedDict, total=False): + """SQS trigger configuration""" + activation_queue_length: Required[int] """Number of messages for activation""" @@ -171,6 +189,8 @@ class ContainerScaleTriggersSqs(TypedDict, total=False): class ContainerScaleTriggers(TypedDict, total=False): + """Triggers for scaling actions""" + cpu: Optional[ContainerScaleTriggersCPU] """CPU trigger configuration""" @@ -197,6 +217,8 @@ class ContainerScaleTriggers(TypedDict, total=False): class ContainerScale(TypedDict, total=False): + """Scale for the container""" + max: Required[int] """Maximum scale for the container""" @@ -222,6 +244,8 @@ class Container(TypedDict, total=False): class IngressOpts(TypedDict, total=False): + """Ingress options for the inference instance""" + disable_response_buffering: bool """Disable response buffering if true. @@ -233,6 +257,8 @@ class IngressOpts(TypedDict, total=False): class Logging(TypedDict, total=False): + """Logging configuration for the inference instance""" + destination_region_id: Optional[int] """ID of the region in which the logs will be stored""" @@ -247,11 +273,15 @@ class Logging(TypedDict, total=False): class ProbesLivenessProbeProbeExec(TypedDict, total=False): + """Exec probe configuration""" + command: Required[SequenceNotStr[str]] """Command to be executed inside the running container.""" class ProbesLivenessProbeProbeHTTPGet(TypedDict, total=False): + """HTTP GET probe configuration""" + port: Required[int] """Port number the probe should connect to.""" @@ -269,11 +299,15 @@ class ProbesLivenessProbeProbeHTTPGet(TypedDict, total=False): class ProbesLivenessProbeProbeTcpSocket(TypedDict, total=False): + """TCP socket probe configuration""" + port: Required[int] """Port number to check if it's open.""" class ProbesLivenessProbeProbe(TypedDict, total=False): + """Probe configuration (exec, `http_get` or `tcp_socket`)""" + exec: Optional[ProbesLivenessProbeProbeExec] """Exec probe configuration""" @@ -300,6 +334,8 @@ class ProbesLivenessProbeProbe(TypedDict, total=False): class ProbesLivenessProbe(TypedDict, total=False): + """Liveness probe configuration""" + enabled: Required[bool] """Whether the probe is enabled or not.""" @@ -308,11 +344,15 @@ class ProbesLivenessProbe(TypedDict, total=False): class ProbesReadinessProbeProbeExec(TypedDict, total=False): + """Exec probe configuration""" + command: Required[SequenceNotStr[str]] """Command to be executed inside the running container.""" class ProbesReadinessProbeProbeHTTPGet(TypedDict, total=False): + """HTTP GET probe configuration""" + port: Required[int] """Port number the probe should connect to.""" @@ -330,11 +370,15 @@ class ProbesReadinessProbeProbeHTTPGet(TypedDict, total=False): class ProbesReadinessProbeProbeTcpSocket(TypedDict, total=False): + """TCP socket probe configuration""" + port: Required[int] """Port number to check if it's open.""" class ProbesReadinessProbeProbe(TypedDict, total=False): + """Probe configuration (exec, `http_get` or `tcp_socket`)""" + exec: Optional[ProbesReadinessProbeProbeExec] """Exec probe configuration""" @@ -361,6 +405,8 @@ class ProbesReadinessProbeProbe(TypedDict, total=False): class ProbesReadinessProbe(TypedDict, total=False): + """Readiness probe configuration""" + enabled: Required[bool] """Whether the probe is enabled or not.""" @@ -369,11 +415,15 @@ class ProbesReadinessProbe(TypedDict, total=False): class ProbesStartupProbeProbeExec(TypedDict, total=False): + """Exec probe configuration""" + command: Required[SequenceNotStr[str]] """Command to be executed inside the running container.""" class ProbesStartupProbeProbeHTTPGet(TypedDict, total=False): + """HTTP GET probe configuration""" + port: Required[int] """Port number the probe should connect to.""" @@ -391,11 +441,15 @@ class ProbesStartupProbeProbeHTTPGet(TypedDict, total=False): class ProbesStartupProbeProbeTcpSocket(TypedDict, total=False): + """TCP socket probe configuration""" + port: Required[int] """Port number to check if it's open.""" class ProbesStartupProbeProbe(TypedDict, total=False): + """Probe configuration (exec, `http_get` or `tcp_socket`)""" + exec: Optional[ProbesStartupProbeProbeExec] """Exec probe configuration""" @@ -422,6 +476,8 @@ class ProbesStartupProbeProbe(TypedDict, total=False): class ProbesStartupProbe(TypedDict, total=False): + """Startup probe configuration""" + enabled: Required[bool] """Whether the probe is enabled or not.""" @@ -430,6 +486,11 @@ class ProbesStartupProbe(TypedDict, total=False): class Probes(TypedDict, total=False): + """Probes configured for all containers of the inference instance. + + If probes are not provided, and the `image_name` is from a the Model Catalog registry, the default probes will be used. + """ + liveness_probe: Optional[ProbesLivenessProbe] """Liveness probe configuration""" diff --git a/src/gcore/types/cloud/inference/deployment_update_params.py b/src/gcore/types/cloud/inference/deployment_update_params.py index 26b2042d..85037b7b 100644 --- a/src/gcore/types/cloud/inference/deployment_update_params.py +++ b/src/gcore/types/cloud/inference/deployment_update_params.py @@ -111,21 +111,35 @@ class DeploymentUpdateParams(TypedDict, total=False): class ContainerScaleTriggersCPU(TypedDict, total=False): + """CPU trigger configuration""" + threshold: Required[int] """Threshold value for the trigger in percentage""" class ContainerScaleTriggersGPUMemory(TypedDict, total=False): + """GPU memory trigger configuration. + + Calculated by `DCGM_FI_DEV_MEM_COPY_UTIL` metric + """ + threshold: Required[int] """Threshold value for the trigger in percentage""" class ContainerScaleTriggersGPUUtilization(TypedDict, total=False): + """GPU utilization trigger configuration. + + Calculated by `DCGM_FI_DEV_GPU_UTIL` metric + """ + threshold: Required[int] """Threshold value for the trigger in percentage""" class ContainerScaleTriggersHTTP(TypedDict, total=False): + """HTTP trigger configuration""" + rate: Required[int] """Request count per 'window' seconds for the http trigger""" @@ -134,11 +148,15 @@ class ContainerScaleTriggersHTTP(TypedDict, total=False): class ContainerScaleTriggersMemory(TypedDict, total=False): + """Memory trigger configuration""" + threshold: Required[int] """Threshold value for the trigger in percentage""" class ContainerScaleTriggersSqs(TypedDict, total=False): + """SQS trigger configuration""" + activation_queue_length: Required[int] """Number of messages for activation""" @@ -165,6 +183,8 @@ class ContainerScaleTriggersSqs(TypedDict, total=False): class ContainerScaleTriggers(TypedDict, total=False): + """Triggers for scaling actions""" + cpu: Optional[ContainerScaleTriggersCPU] """CPU trigger configuration""" @@ -191,6 +211,8 @@ class ContainerScaleTriggers(TypedDict, total=False): class ContainerScale(TypedDict, total=False): + """Scale for the container""" + max: Required[int] """Maximum scale for the container""" @@ -216,6 +238,8 @@ class Container(TypedDict, total=False): class IngressOpts(TypedDict, total=False): + """Ingress options for the inference instance""" + disable_response_buffering: bool """Disable response buffering if true. @@ -227,6 +251,8 @@ class IngressOpts(TypedDict, total=False): class Logging(TypedDict, total=False): + """Logging configuration for the inference instance""" + destination_region_id: Optional[int] """ID of the region in which the logs will be stored""" @@ -241,11 +267,15 @@ class Logging(TypedDict, total=False): class ProbesLivenessProbeProbeExec(TypedDict, total=False): + """Exec probe configuration""" + command: SequenceNotStr[str] """Command to be executed inside the running container.""" class ProbesLivenessProbeProbeHTTPGet(TypedDict, total=False): + """HTTP GET probe configuration""" + headers: Dict[str, str] """HTTP headers to be sent with the request.""" @@ -263,11 +293,15 @@ class ProbesLivenessProbeProbeHTTPGet(TypedDict, total=False): class ProbesLivenessProbeProbeTcpSocket(TypedDict, total=False): + """TCP socket probe configuration""" + port: int """Port number to check if it's open.""" class ProbesLivenessProbeProbe(TypedDict, total=False): + """Probe configuration (exec, `http_get` or `tcp_socket`)""" + exec: Optional[ProbesLivenessProbeProbeExec] """Exec probe configuration""" @@ -294,6 +328,8 @@ class ProbesLivenessProbeProbe(TypedDict, total=False): class ProbesLivenessProbe(TypedDict, total=False): + """Liveness probe configuration""" + enabled: bool """Whether the probe is enabled or not.""" @@ -302,11 +338,15 @@ class ProbesLivenessProbe(TypedDict, total=False): class ProbesReadinessProbeProbeExec(TypedDict, total=False): + """Exec probe configuration""" + command: SequenceNotStr[str] """Command to be executed inside the running container.""" class ProbesReadinessProbeProbeHTTPGet(TypedDict, total=False): + """HTTP GET probe configuration""" + headers: Dict[str, str] """HTTP headers to be sent with the request.""" @@ -324,11 +364,15 @@ class ProbesReadinessProbeProbeHTTPGet(TypedDict, total=False): class ProbesReadinessProbeProbeTcpSocket(TypedDict, total=False): + """TCP socket probe configuration""" + port: int """Port number to check if it's open.""" class ProbesReadinessProbeProbe(TypedDict, total=False): + """Probe configuration (exec, `http_get` or `tcp_socket`)""" + exec: Optional[ProbesReadinessProbeProbeExec] """Exec probe configuration""" @@ -355,6 +399,8 @@ class ProbesReadinessProbeProbe(TypedDict, total=False): class ProbesReadinessProbe(TypedDict, total=False): + """Readiness probe configuration""" + enabled: bool """Whether the probe is enabled or not.""" @@ -363,11 +409,15 @@ class ProbesReadinessProbe(TypedDict, total=False): class ProbesStartupProbeProbeExec(TypedDict, total=False): + """Exec probe configuration""" + command: SequenceNotStr[str] """Command to be executed inside the running container.""" class ProbesStartupProbeProbeHTTPGet(TypedDict, total=False): + """HTTP GET probe configuration""" + headers: Dict[str, str] """HTTP headers to be sent with the request.""" @@ -385,11 +435,15 @@ class ProbesStartupProbeProbeHTTPGet(TypedDict, total=False): class ProbesStartupProbeProbeTcpSocket(TypedDict, total=False): + """TCP socket probe configuration""" + port: int """Port number to check if it's open.""" class ProbesStartupProbeProbe(TypedDict, total=False): + """Probe configuration (exec, `http_get` or `tcp_socket`)""" + exec: Optional[ProbesStartupProbeProbeExec] """Exec probe configuration""" @@ -416,6 +470,8 @@ class ProbesStartupProbeProbe(TypedDict, total=False): class ProbesStartupProbe(TypedDict, total=False): + """Startup probe configuration""" + enabled: bool """Whether the probe is enabled or not.""" @@ -424,6 +480,8 @@ class ProbesStartupProbe(TypedDict, total=False): class Probes(TypedDict, total=False): + """Probes configured for all containers of the inference instance.""" + liveness_probe: Optional[ProbesLivenessProbe] """Liveness probe configuration""" diff --git a/src/gcore/types/cloud/inference/inference_deployment.py b/src/gcore/types/cloud/inference/inference_deployment.py index bc24f8d1..df5fe742 100644 --- a/src/gcore/types/cloud/inference/inference_deployment.py +++ b/src/gcore/types/cloud/inference/inference_deployment.py @@ -26,6 +26,8 @@ class ContainerDeployStatus(BaseModel): + """Status of the containers deployment""" + ready: int """Number of ready instances""" @@ -34,21 +36,35 @@ class ContainerDeployStatus(BaseModel): class ContainerScaleTriggersCPU(BaseModel): + """CPU trigger configuration""" + threshold: int """Threshold value for the trigger in percentage""" class ContainerScaleTriggersGPUMemory(BaseModel): + """GPU memory trigger configuration. + + Calculated by `DCGM_FI_DEV_MEM_COPY_UTIL` metric + """ + threshold: int """Threshold value for the trigger in percentage""" class ContainerScaleTriggersGPUUtilization(BaseModel): + """GPU utilization trigger configuration. + + Calculated by `DCGM_FI_DEV_GPU_UTIL` metric + """ + threshold: int """Threshold value for the trigger in percentage""" class ContainerScaleTriggersHTTP(BaseModel): + """HTTP trigger configuration""" + rate: int """Request count per 'window' seconds for the http trigger""" @@ -57,11 +73,15 @@ class ContainerScaleTriggersHTTP(BaseModel): class ContainerScaleTriggersMemory(BaseModel): + """Memory trigger configuration""" + threshold: int """Threshold value for the trigger in percentage""" class ContainerScaleTriggersSqs(BaseModel): + """SQS trigger configuration""" + activation_queue_length: int """Number of messages for activation""" @@ -88,6 +108,8 @@ class ContainerScaleTriggersSqs(BaseModel): class ContainerScaleTriggers(BaseModel): + """Triggers for scaling actions""" + cpu: Optional[ContainerScaleTriggersCPU] = None """CPU trigger configuration""" @@ -114,6 +136,8 @@ class ContainerScaleTriggers(BaseModel): class ContainerScale(BaseModel): + """Scale for the container""" + cooldown_period: Optional[int] = None """Cooldown period between scaling actions in seconds""" @@ -148,6 +172,8 @@ class Container(BaseModel): class IngressOpts(BaseModel): + """Ingress options for the inference instance""" + disable_response_buffering: bool """Disable response buffering if true. @@ -167,6 +193,8 @@ class ObjectReference(BaseModel): class Probes(BaseModel): + """Probes configured for all containers of the inference instance.""" + liveness_probe: Optional[ProbeConfig] = None """Liveness probe configuration""" diff --git a/src/gcore/types/cloud/inference/inference_secret.py b/src/gcore/types/cloud/inference/inference_secret.py index 17ca610a..0d6600db 100644 --- a/src/gcore/types/cloud/inference/inference_secret.py +++ b/src/gcore/types/cloud/inference/inference_secret.py @@ -6,6 +6,8 @@ class Data(BaseModel): + """Secret data.""" + aws_access_key_id: str """AWS IAM key ID.""" diff --git a/src/gcore/types/cloud/inference/secret_create_params.py b/src/gcore/types/cloud/inference/secret_create_params.py index b4bc1a92..74817f1a 100644 --- a/src/gcore/types/cloud/inference/secret_create_params.py +++ b/src/gcore/types/cloud/inference/secret_create_params.py @@ -22,6 +22,8 @@ class SecretCreateParams(TypedDict, total=False): class Data(TypedDict, total=False): + """Secret data.""" + aws_access_key_id: Required[str] """AWS IAM key ID.""" diff --git a/src/gcore/types/cloud/inference/secret_replace_params.py b/src/gcore/types/cloud/inference/secret_replace_params.py index cc4fc67f..be81a56e 100644 --- a/src/gcore/types/cloud/inference/secret_replace_params.py +++ b/src/gcore/types/cloud/inference/secret_replace_params.py @@ -19,6 +19,8 @@ class SecretReplaceParams(TypedDict, total=False): class Data(TypedDict, total=False): + """Secret data.""" + aws_access_key_id: Required[str] """AWS IAM key ID.""" diff --git a/src/gcore/types/cloud/instance.py b/src/gcore/types/cloud/instance.py index 6f049f2d..14bac8b3 100644 --- a/src/gcore/types/cloud/instance.py +++ b/src/gcore/types/cloud/instance.py @@ -43,6 +43,8 @@ class FixedIPAssignment(BaseModel): class FlavorInstanceFlavorSerializerHardwareDescription(BaseModel): + """Additional hardware description""" + ram: str """RAM description""" @@ -51,6 +53,8 @@ class FlavorInstanceFlavorSerializerHardwareDescription(BaseModel): class FlavorInstanceFlavorSerializer(BaseModel): + """Instances flavor schema embedded into instance schema""" + architecture: str """CPU architecture""" @@ -74,6 +78,8 @@ class FlavorInstanceFlavorSerializer(BaseModel): class FlavorBareMetalFlavorSerializerHardwareDescription(BaseModel): + """Additional hardware description""" + cpu: str """Human-readable CPU description""" @@ -91,6 +97,8 @@ class FlavorBareMetalFlavorSerializerHardwareDescription(BaseModel): class FlavorBareMetalFlavorSerializer(BaseModel): + """Bare metal flavor schema embedded into instance schema""" + architecture: str """CPU architecture""" @@ -117,6 +125,8 @@ class FlavorBareMetalFlavorSerializer(BaseModel): class FlavorDeprecatedGPUClusterFlavorSerializerHardwareDescription(BaseModel): + """Additional hardware description""" + cpu: str """Human-readable CPU description""" @@ -137,6 +147,8 @@ class FlavorDeprecatedGPUClusterFlavorSerializerHardwareDescription(BaseModel): class FlavorDeprecatedGPUClusterFlavorSerializer(BaseModel): + """GPU cluster flavor schema embedded into instance schema""" + architecture: str """CPU architecture""" diff --git a/src/gcore/types/cloud/instance_assign_security_group_params.py b/src/gcore/types/cloud/instance_assign_security_group_params.py index a9af1025..a963ae34 100644 --- a/src/gcore/types/cloud/instance_assign_security_group_params.py +++ b/src/gcore/types/cloud/instance_assign_security_group_params.py @@ -23,6 +23,8 @@ class InstanceAssignSecurityGroupParams(TypedDict, total=False): class PortsSecurityGroupName(TypedDict, total=False): + """Port security group names""" + port_id: Required[Optional[str]] """Port ID. If None, security groups will be applied to all ports""" diff --git a/src/gcore/types/cloud/instance_create_params.py b/src/gcore/types/cloud/instance_create_params.py index 93b160be..e25ccdb9 100644 --- a/src/gcore/types/cloud/instance_create_params.py +++ b/src/gcore/types/cloud/instance_create_params.py @@ -147,6 +147,8 @@ class InterfaceNewInterfaceExternalSerializerPydanticSecurityGroup(TypedDict, to class InterfaceNewInterfaceExternalSerializerPydantic(TypedDict, total=False): + """Instance will be attached to default external network""" + type: Required[Literal["external"]] """A public IP address will be assigned to the instance.""" @@ -205,6 +207,12 @@ class InterfaceNewInterfaceSpecificSubnetFipSerializerPydanticSecurityGroup(Type class InterfaceNewInterfaceSpecificSubnetFipSerializerPydantic(TypedDict, total=False): + """ + The instance will get an IP address from the selected network. + If you choose to add a floating IP, the instance will be reachable from the internet. + Otherwise, it will only have a private IP within the network. + """ + network_id: Required[str] """The network where the instance will be connected.""" diff --git a/src/gcore/types/cloud/instance_unassign_security_group_params.py b/src/gcore/types/cloud/instance_unassign_security_group_params.py index 17e978a7..030a2b6b 100644 --- a/src/gcore/types/cloud/instance_unassign_security_group_params.py +++ b/src/gcore/types/cloud/instance_unassign_security_group_params.py @@ -23,6 +23,8 @@ class InstanceUnassignSecurityGroupParams(TypedDict, total=False): class PortsSecurityGroupName(TypedDict, total=False): + """Port security group names""" + port_id: Required[Optional[str]] """Port ID. If None, security groups will be applied to all ports""" diff --git a/src/gcore/types/cloud/instances/instance_flavor.py b/src/gcore/types/cloud/instances/instance_flavor.py index 3c6b84ef..07fbe85f 100644 --- a/src/gcore/types/cloud/instances/instance_flavor.py +++ b/src/gcore/types/cloud/instances/instance_flavor.py @@ -9,6 +9,8 @@ class InstanceFlavor(BaseModel): + """Instances flavor schema""" + architecture: str """Flavor architecture type""" diff --git a/src/gcore/types/cloud/instances/interface_attach_params.py b/src/gcore/types/cloud/instances/interface_attach_params.py index 42ad62d6..43ff9ee3 100644 --- a/src/gcore/types/cloud/instances/interface_attach_params.py +++ b/src/gcore/types/cloud/instances/interface_attach_params.py @@ -65,6 +65,8 @@ class NewInterfaceExternalExtendSchemaWithDdosddosProfileField(TypedDict, total= class NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile(TypedDict, total=False): + """Advanced DDoS protection.""" + profile_template: Required[int] """DDoS profile template ID.""" @@ -76,6 +78,8 @@ class NewInterfaceExternalExtendSchemaWithDDOSDDOSProfile(TypedDict, total=False class NewInterfaceExternalExtendSchemaWithDDOSSecurityGroup(TypedDict, total=False): + """MandatoryIdSchema schema""" + id: Required[str] """Resource ID""" @@ -119,6 +123,8 @@ class NewInterfaceSpecificSubnetSchemaDDOSProfileField(TypedDict, total=False): class NewInterfaceSpecificSubnetSchemaDDOSProfile(TypedDict, total=False): + """Advanced DDoS protection.""" + profile_template: Required[int] """DDoS profile template ID.""" @@ -130,6 +136,8 @@ class NewInterfaceSpecificSubnetSchemaDDOSProfile(TypedDict, total=False): class NewInterfaceSpecificSubnetSchemaSecurityGroup(TypedDict, total=False): + """MandatoryIdSchema schema""" + id: Required[str] """Resource ID""" @@ -176,6 +184,8 @@ class NewInterfaceAnySubnetSchemaDDOSProfileField(TypedDict, total=False): class NewInterfaceAnySubnetSchemaDDOSProfile(TypedDict, total=False): + """Advanced DDoS protection.""" + profile_template: Required[int] """DDoS profile template ID.""" @@ -187,6 +197,8 @@ class NewInterfaceAnySubnetSchemaDDOSProfile(TypedDict, total=False): class NewInterfaceAnySubnetSchemaSecurityGroup(TypedDict, total=False): + """MandatoryIdSchema schema""" + id: Required[str] """Resource ID""" @@ -230,6 +242,8 @@ class NewInterfaceReservedFixedIPSchemaDDOSProfileField(TypedDict, total=False): class NewInterfaceReservedFixedIPSchemaDDOSProfile(TypedDict, total=False): + """Advanced DDoS protection.""" + profile_template: Required[int] """DDoS profile template ID.""" @@ -241,6 +255,8 @@ class NewInterfaceReservedFixedIPSchemaDDOSProfile(TypedDict, total=False): class NewInterfaceReservedFixedIPSchemaSecurityGroup(TypedDict, total=False): + """MandatoryIdSchema schema""" + id: Required[str] """Resource ID""" diff --git a/src/gcore/types/cloud/instances/metrics.py b/src/gcore/types/cloud/instances/metrics.py index 2bf65b7d..f457b606 100644 --- a/src/gcore/types/cloud/instances/metrics.py +++ b/src/gcore/types/cloud/instances/metrics.py @@ -10,6 +10,8 @@ class Disk(BaseModel): + """Disk metrics item""" + disk_bps_read: Optional[float] = FieldInfo(alias="disk_Bps_read", default=None) """Disk read, Bytes per second""" @@ -27,6 +29,8 @@ class Disk(BaseModel): class Metrics(BaseModel): + """Instance metrics item""" + time: str """Timestamp""" diff --git a/src/gcore/types/cloud/k8s/cluster_create_params.py b/src/gcore/types/cloud/k8s/cluster_create_params.py index c49852c6..bda1ddee 100644 --- a/src/gcore/types/cloud/k8s/cluster_create_params.py +++ b/src/gcore/types/cloud/k8s/cluster_create_params.py @@ -184,6 +184,8 @@ class Pool(TypedDict, total=False): class AddOnsSlurm(TypedDict, total=False): + """Slurm add-on configuration""" + enabled: Required[Literal[True]] """The Slurm add-on will be enabled in the cluster. @@ -213,11 +215,15 @@ class AddOnsSlurm(TypedDict, total=False): class AddOns(TypedDict, total=False): + """Cluster add-ons configuration""" + slurm: AddOnsSlurm """Slurm add-on configuration""" class AuthenticationOidc(TypedDict, total=False): + """OIDC authentication settings""" + client_id: Optional[str] """Client ID""" @@ -246,11 +252,15 @@ class AuthenticationOidc(TypedDict, total=False): class Authentication(TypedDict, total=False): + """Authentication settings""" + oidc: Optional[AuthenticationOidc] """OIDC authentication settings""" class CniCilium(TypedDict, total=False): + """Cilium settings""" + encryption: bool """Wireguard encryption""" @@ -280,6 +290,8 @@ class CniCilium(TypedDict, total=False): class Cni(TypedDict, total=False): + """Cluster CNI settings""" + cilium: Optional[CniCilium] """Cilium settings""" @@ -288,6 +300,8 @@ class Cni(TypedDict, total=False): class CsiNfs(TypedDict, total=False): + """NFS CSI driver settings""" + vast_enabled: bool """Enable or disable VAST NFS integration. @@ -299,6 +313,8 @@ class CsiNfs(TypedDict, total=False): class Csi(TypedDict, total=False): + """Container Storage Interface (CSI) driver settings""" + nfs: CsiNfs """NFS CSI driver settings""" @@ -314,6 +330,8 @@ class DDOSProfileField(TypedDict, total=False): class DDOSProfile(TypedDict, total=False): + """Advanced DDoS Protection profile""" + enabled: Required[bool] """Enable advanced DDoS protection""" @@ -328,6 +346,8 @@ class DDOSProfile(TypedDict, total=False): class Logging(TypedDict, total=False): + """Logging configuration""" + destination_region_id: Optional[int] """Destination region id to which the logs will be written""" diff --git a/src/gcore/types/cloud/k8s/cluster_update_params.py b/src/gcore/types/cloud/k8s/cluster_update_params.py index d6b1dd55..137cff46 100644 --- a/src/gcore/types/cloud/k8s/cluster_update_params.py +++ b/src/gcore/types/cloud/k8s/cluster_update_params.py @@ -145,11 +145,15 @@ class AddOnsSlurmK8SClusterSlurmAddonDisableV2Serializer(TypedDict, total=False) class AddOns(TypedDict, total=False): + """Cluster add-ons configuration""" + slurm: AddOnsSlurm """Slurm add-on configuration""" class AuthenticationOidc(TypedDict, total=False): + """OIDC authentication settings""" + client_id: Optional[str] """Client ID""" @@ -178,11 +182,15 @@ class AuthenticationOidc(TypedDict, total=False): class Authentication(TypedDict, total=False): + """Authentication settings""" + oidc: Optional[AuthenticationOidc] """OIDC authentication settings""" class CniCilium(TypedDict, total=False): + """Cilium settings""" + encryption: bool """Wireguard encryption""" @@ -212,6 +220,8 @@ class CniCilium(TypedDict, total=False): class Cni(TypedDict, total=False): + """Cluster CNI settings""" + cilium: Optional[CniCilium] """Cilium settings""" @@ -230,6 +240,8 @@ class DDOSProfileField(TypedDict, total=False): class DDOSProfile(TypedDict, total=False): + """Advanced DDoS Protection profile""" + enabled: Required[bool] """Enable advanced DDoS protection""" @@ -244,6 +256,8 @@ class DDOSProfile(TypedDict, total=False): class Logging(TypedDict, total=False): + """Logging configuration""" + destination_region_id: Optional[int] """Destination region id to which the logs will be written""" diff --git a/src/gcore/types/cloud/k8s/k8s_cluster.py b/src/gcore/types/cloud/k8s/k8s_cluster.py index 8d4e6c21..6296a09b 100644 --- a/src/gcore/types/cloud/k8s/k8s_cluster.py +++ b/src/gcore/types/cloud/k8s/k8s_cluster.py @@ -24,6 +24,8 @@ class AddOnsSlurm(BaseModel): + """Slurm add-on configuration""" + enabled: bool """Indicates whether Slurm add-on is deployed in the cluster. @@ -50,21 +52,29 @@ class AddOnsSlurm(BaseModel): class AddOns(BaseModel): + """Cluster add-ons configuration""" + slurm: AddOnsSlurm """Slurm add-on configuration""" class CsiNfs(BaseModel): + """NFS settings""" + vast_enabled: bool """Indicates the status of VAST NFS integration""" class Csi(BaseModel): + """Cluster CSI settings""" + nfs: CsiNfs """NFS settings""" class AuthenticationOidc(BaseModel): + """OIDC authentication settings""" + client_id: Optional[str] = None """Client ID""" @@ -93,6 +103,8 @@ class AuthenticationOidc(BaseModel): class Authentication(BaseModel): + """Cluster authentication settings""" + kubeconfig_created_at: Optional[datetime] = None """Kubeconfig creation date""" @@ -104,6 +116,8 @@ class Authentication(BaseModel): class CniCilium(BaseModel): + """Cilium settings""" + encryption: Optional[bool] = None """Wireguard encryption""" @@ -133,6 +147,8 @@ class CniCilium(BaseModel): class Cni(BaseModel): + """Cluster CNI settings""" + cilium: Optional[CniCilium] = None """Cilium settings""" @@ -151,6 +167,8 @@ class DDOSProfileField(BaseModel): class DDOSProfile(BaseModel): + """Advanced DDoS Protection profile""" + enabled: bool """Enable advanced DDoS protection""" diff --git a/src/gcore/types/cloud/load_balancer.py b/src/gcore/types/cloud/load_balancer.py index 75e5387a..1763aa95 100644 --- a/src/gcore/types/cloud/load_balancer.py +++ b/src/gcore/types/cloud/load_balancer.py @@ -27,6 +27,8 @@ class AdditionalVip(BaseModel): class Flavor(BaseModel): + """Load balancer flavor (if not default)""" + flavor_id: str """Flavor ID is the same as name""" diff --git a/src/gcore/types/cloud/load_balancer_create_params.py b/src/gcore/types/cloud/load_balancer_create_params.py index e75028f8..16e66ced 100644 --- a/src/gcore/types/cloud/load_balancer_create_params.py +++ b/src/gcore/types/cloud/load_balancer_create_params.py @@ -138,6 +138,8 @@ class FloatingIPExistingInstanceFloatingIPInterfaceSerializer(TypedDict, total=F class ListenerPoolHealthmonitor(TypedDict, total=False): + """Health monitor details""" + delay: Required[int] """The time, in seconds, between sending probes to members""" @@ -242,6 +244,8 @@ class ListenerPoolMember(TypedDict, total=False): class ListenerPoolSessionPersistence(TypedDict, total=False): + """Session persistence details""" + type: Required[LbSessionPersistenceType] """Session persistence type""" @@ -361,6 +365,8 @@ class Listener(TypedDict, total=False): class Logging(TypedDict, total=False): + """Logging configuration""" + destination_region_id: Optional[int] """Destination region id to which the logs will be written""" diff --git a/src/gcore/types/cloud/load_balancer_update_params.py b/src/gcore/types/cloud/load_balancer_update_params.py index 28fa42f9..94770401 100644 --- a/src/gcore/types/cloud/load_balancer_update_params.py +++ b/src/gcore/types/cloud/load_balancer_update_params.py @@ -61,6 +61,8 @@ class LoadBalancerUpdateParams(TypedDict, total=False): class Logging(TypedDict, total=False): + """Logging configuration""" + destination_region_id: Optional[int] """Destination region id to which the logs will be written""" diff --git a/src/gcore/types/cloud/load_balancers/pool_create_params.py b/src/gcore/types/cloud/load_balancers/pool_create_params.py index c8e503a5..079e78ed 100644 --- a/src/gcore/types/cloud/load_balancers/pool_create_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_create_params.py @@ -65,6 +65,8 @@ class PoolCreateParams(TypedDict, total=False): class Healthmonitor(TypedDict, total=False): + """Health monitor details""" + delay: Required[int] """The time, in seconds, between sending probes to members""" @@ -169,6 +171,8 @@ class Member(TypedDict, total=False): class SessionPersistence(TypedDict, total=False): + """Session persistence details""" + type: Required[LbSessionPersistenceType] """Session persistence type""" diff --git a/src/gcore/types/cloud/load_balancers/pool_update_params.py b/src/gcore/types/cloud/load_balancers/pool_update_params.py index 088d3cec..381e4247 100644 --- a/src/gcore/types/cloud/load_balancers/pool_update_params.py +++ b/src/gcore/types/cloud/load_balancers/pool_update_params.py @@ -63,6 +63,8 @@ class PoolUpdateParams(TypedDict, total=False): class Healthmonitor(TypedDict, total=False): + """New pool health monitor settings""" + delay: Required[int] """The time, in seconds, between sending probes to members""" @@ -167,6 +169,8 @@ class Member(TypedDict, total=False): class SessionPersistence(TypedDict, total=False): + """New session persistence settings""" + type: Required[LbSessionPersistenceType] """Session persistence type""" diff --git a/src/gcore/types/cloud/networks/router.py b/src/gcore/types/cloud/networks/router.py index c5d1d5a3..5f7cac6b 100644 --- a/src/gcore/types/cloud/networks/router.py +++ b/src/gcore/types/cloud/networks/router.py @@ -25,6 +25,8 @@ class Interface(BaseModel): class ExternalGatewayInfo(BaseModel): + """State of this router's external gateway.""" + enable_snat: bool """Is SNAT enabled.""" diff --git a/src/gcore/types/cloud/networks/router_update_params.py b/src/gcore/types/cloud/networks/router_update_params.py index b48253b7..44e4f142 100644 --- a/src/gcore/types/cloud/networks/router_update_params.py +++ b/src/gcore/types/cloud/networks/router_update_params.py @@ -24,6 +24,8 @@ class RouterUpdateParams(TypedDict, total=False): class ExternalGatewayInfo(TypedDict, total=False): + """New external gateway.""" + network_id: Required[str] """id of the external network.""" diff --git a/src/gcore/types/cloud/quota_get_all_response.py b/src/gcore/types/cloud/quota_get_all_response.py index 1778f75c..019ceacf 100644 --- a/src/gcore/types/cloud/quota_get_all_response.py +++ b/src/gcore/types/cloud/quota_get_all_response.py @@ -8,6 +8,8 @@ class GlobalQuotas(BaseModel): + """Global entity quotas""" + inference_cpu_millicore_count_limit: Optional[int] = None """Inference CPU millicore count limit""" diff --git a/src/gcore/types/cloud/quotas/request_create_params.py b/src/gcore/types/cloud/quotas/request_create_params.py index 8732cde2..c6afc586 100644 --- a/src/gcore/types/cloud/quotas/request_create_params.py +++ b/src/gcore/types/cloud/quotas/request_create_params.py @@ -17,6 +17,8 @@ class RequestCreateParams(TypedDict, total=False): class RequestedLimitsGlobalLimits(TypedDict, total=False): + """Global entity quota limits""" + inference_cpu_millicore_count_limit: int """Inference CPU millicore count limit""" @@ -203,6 +205,8 @@ class RequestedLimitsRegionalLimit(TypedDict, total=False): class RequestedLimits(TypedDict, total=False): + """Limits you want to increase.""" + global_limits: RequestedLimitsGlobalLimits """Global entity quota limits""" diff --git a/src/gcore/types/cloud/quotas/request_get_response.py b/src/gcore/types/cloud/quotas/request_get_response.py index 3ac8bc47..9ca76084 100644 --- a/src/gcore/types/cloud/quotas/request_get_response.py +++ b/src/gcore/types/cloud/quotas/request_get_response.py @@ -9,6 +9,8 @@ class RequestedLimitsGlobalLimits(BaseModel): + """Global entity quota limits""" + inference_cpu_millicore_count_limit: Optional[int] = None """Inference CPU millicore count limit""" @@ -195,6 +197,8 @@ class RequestedLimitsRegionalLimit(BaseModel): class RequestedLimits(BaseModel): + """Requested limits.""" + global_limits: Optional[RequestedLimitsGlobalLimits] = None """Global entity quota limits""" diff --git a/src/gcore/types/cloud/quotas/request_list_response.py b/src/gcore/types/cloud/quotas/request_list_response.py index 971dce9b..63cdce04 100644 --- a/src/gcore/types/cloud/quotas/request_list_response.py +++ b/src/gcore/types/cloud/quotas/request_list_response.py @@ -9,6 +9,8 @@ class RequestedLimitsGlobalLimits(BaseModel): + """Global entity quota limits""" + inference_cpu_millicore_count_limit: Optional[int] = None """Inference CPU millicore count limit""" @@ -195,6 +197,8 @@ class RequestedLimitsRegionalLimit(BaseModel): class RequestedLimits(BaseModel): + """Requested limits.""" + global_limits: Optional[RequestedLimitsGlobalLimits] = None """Global entity quota limits""" diff --git a/src/gcore/types/cloud/region.py b/src/gcore/types/cloud/region.py index d44747af..ac2fa29b 100644 --- a/src/gcore/types/cloud/region.py +++ b/src/gcore/types/cloud/region.py @@ -10,6 +10,8 @@ class Coordinates(BaseModel): + """Coordinates of the region""" + latitude: Union[float, str] longitude: Union[float, str] diff --git a/src/gcore/types/cloud/reserved_fixed_ip.py b/src/gcore/types/cloud/reserved_fixed_ip.py index 89205ad5..f059bed8 100644 --- a/src/gcore/types/cloud/reserved_fixed_ip.py +++ b/src/gcore/types/cloud/reserved_fixed_ip.py @@ -19,6 +19,8 @@ class Attachment(BaseModel): class Reservation(BaseModel): + """Reserved fixed IP status with resource type and ID it is attached to""" + resource_id: Optional[str] = None """ID of the instance or load balancer the IP is attached to""" diff --git a/src/gcore/types/cloud/secret_upload_tls_certificate_params.py b/src/gcore/types/cloud/secret_upload_tls_certificate_params.py index 0ea75d24..524b58ad 100644 --- a/src/gcore/types/cloud/secret_upload_tls_certificate_params.py +++ b/src/gcore/types/cloud/secret_upload_tls_certificate_params.py @@ -29,6 +29,8 @@ class SecretUploadTlsCertificateParams(TypedDict, total=False): class Payload(TypedDict, total=False): + """Secret payload.""" + certificate: Required[str] """SSL certificate in PEM format.""" diff --git a/src/gcore/types/cloud/security_group_create_params.py b/src/gcore/types/cloud/security_group_create_params.py index 8847cbb1..7ae07e15 100644 --- a/src/gcore/types/cloud/security_group_create_params.py +++ b/src/gcore/types/cloud/security_group_create_params.py @@ -78,6 +78,8 @@ class SecurityGroupSecurityGroupRule(TypedDict, total=False): class SecurityGroup(TypedDict, total=False): + """Security group""" + name: Required[str] """Security group name""" diff --git a/src/gcore/types/cloud/tag.py b/src/gcore/types/cloud/tag.py index e53068dc..56ac9aa0 100644 --- a/src/gcore/types/cloud/tag.py +++ b/src/gcore/types/cloud/tag.py @@ -6,6 +6,13 @@ class Tag(BaseModel): + """ + A tag is a key-value pair that can be associated with a resource, + enabling efficient filtering and grouping for better organization and management. + Some tags are read-only and cannot be modified by the user. + Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values. + """ + key: str """Tag key. The maximum size for a key is 255 characters.""" diff --git a/src/gcore/types/cloud/task.py b/src/gcore/types/cloud/task.py index 80fe515c..aaa2f782 100644 --- a/src/gcore/types/cloud/task.py +++ b/src/gcore/types/cloud/task.py @@ -9,6 +9,8 @@ class CreatedResources(BaseModel): + """If the task creates resources, this field will contain their IDs""" + ai_clusters: Optional[List[str]] = None """IDs of created AI clusters""" diff --git a/src/gcore/types/cloud/usage_report.py b/src/gcore/types/cloud/usage_report.py index 5a95c09d..6649aebf 100644 --- a/src/gcore/types/cloud/usage_report.py +++ b/src/gcore/types/cloud/usage_report.py @@ -64,6 +64,11 @@ class ResourceResourceAIClusterSerializer(BaseModel): + """ + These properties are common for all individual AI clusters + in all cost and usage reports results (but not in totals) + """ + billing_metric_name: str """Name of the billing metric""" @@ -104,6 +109,11 @@ class ResourceResourceAIClusterSerializer(BaseModel): class ResourceResourceAIVirtualClusterSerializer(BaseModel): + """ + These properties are common for all individual AI Virtual clusters + in all cost and usage reports results (but not in totals) + """ + billing_metric_name: str """Name of the billing metric""" @@ -144,6 +154,11 @@ class ResourceResourceAIVirtualClusterSerializer(BaseModel): class ResourceResourceBaremetalSerializer(BaseModel): + """ + These properties are common for all individual bare metal servers + in all cost and usage reports results (but not in totals) + """ + billing_metric_name: str """Name of the billing metric""" @@ -184,6 +199,11 @@ class ResourceResourceBaremetalSerializer(BaseModel): class ResourceResourceBasicVmSerializer(BaseModel): + """ + These properties are common for all individual basic VMs + in all cost and usage reports results (but not in totals) + """ + billing_metric_name: str """Name of the billing metric""" @@ -224,6 +244,11 @@ class ResourceResourceBasicVmSerializer(BaseModel): class ResourceResourceBackupSerializer(BaseModel): + """ + These properties are common for all individual backups + in all cost and usage reports results (but not in totals) + """ + billing_metric_name: str """Name of the billing metric""" @@ -301,6 +326,11 @@ class ResourceResourceContainerSerializer(BaseModel): class ResourceResourceEgressTrafficSerializer(BaseModel): + """ + These properties are common for all individual egress traffic + in all cost and usage reports results (but not in totals) + """ + billing_metric_name: str """Name of the billing metric""" @@ -347,6 +377,11 @@ class ResourceResourceEgressTrafficSerializer(BaseModel): class ResourceResourceExternalIPSerializer(BaseModel): + """ + These properties are common for all individual external IPs + in all cost and usage reports results (but not in totals) + """ + attached_to_vm: Optional[str] = None """ID of the VM the IP is attached to""" @@ -390,6 +425,11 @@ class ResourceResourceExternalIPSerializer(BaseModel): class ResourceResourceFileShareSerializer(BaseModel): + """ + These properties are common for all individual file shares + in all cost and usage reports results (but not in totals) + """ + billing_metric_name: str """Name of the billing metric""" @@ -436,6 +476,11 @@ class ResourceResourceFileShareSerializer(BaseModel): class ResourceResourceFloatingIPSerializer(BaseModel): + """ + These properties are common for all individual floating IPs + in all cost and usage reports results (but not in totals) + """ + billing_metric_name: str """Name of the billing metric""" @@ -476,6 +521,11 @@ class ResourceResourceFloatingIPSerializer(BaseModel): class ResourceResourceFunctionsSerializer(BaseModel): + """ + These properties are common for all individual functions + in all cost and usage reports results (but not in totals) + """ + billing_metric_name: str """Name of the billing metric""" @@ -510,6 +560,11 @@ class ResourceResourceFunctionsSerializer(BaseModel): class ResourceResourceFunctionCallsSerializer(BaseModel): + """ + These properties are common for all individual function calls + in all cost and usage reports results (but not in totals) + """ + billing_metric_name: str """Name of the billing metric""" @@ -544,6 +599,11 @@ class ResourceResourceFunctionCallsSerializer(BaseModel): class ResourceResourceFunctionEgressTrafficSerializer(BaseModel): + """ + These properties are common for all individual function egress traffic + in all cost and usage reports results (but not in totals) + """ + billing_metric_name: str """Name of the billing metric""" @@ -578,6 +638,11 @@ class ResourceResourceFunctionEgressTrafficSerializer(BaseModel): class ResourceResourceImagesSerializer(BaseModel): + """ + These properties are common for all individual images + in all cost and usage reports results (but not in totals) + """ + billing_metric_name: str """Name of the billing metric""" @@ -658,6 +723,11 @@ class ResourceResourceInferenceSerializer(BaseModel): class ResourceResourceInstanceSerializer(BaseModel): + """ + These properties are common for all individual instances + in all cost and usage reports results (but not in totals) + """ + billing_metric_name: str """Name of the billing metric""" @@ -698,6 +768,11 @@ class ResourceResourceInstanceSerializer(BaseModel): class ResourceResourceLoadBalancerSerializer(BaseModel): + """ + These properties are common for all individual load balancers + in all cost and usage reports results (but not in totals) + """ + billing_metric_name: str """Name of the billing metric""" @@ -738,6 +813,11 @@ class ResourceResourceLoadBalancerSerializer(BaseModel): class ResourceResourceLogIndexSerializer(BaseModel): + """ + These properties are common for all individual log indexes + in all cost and usage reports results (but not in totals) + """ + billing_metric_name: str """Name of the billing metric""" @@ -778,6 +858,11 @@ class ResourceResourceLogIndexSerializer(BaseModel): class ResourceResourceSnapshotSerializer(BaseModel): + """ + These properties are common for all individual snapshots + in all cost and usage reports results (but not in totals) + """ + billing_metric_name: str """Name of the billing metric""" @@ -827,6 +912,11 @@ class ResourceResourceSnapshotSerializer(BaseModel): class ResourceResourceVolumeSerializer(BaseModel): + """ + These properties are common for all individual volumes + in all cost and usage reports results (but not in totals) + """ + billing_metric_name: str """Name of the billing metric""" diff --git a/src/gcore/types/cloud/usage_report_get_params.py b/src/gcore/types/cloud/usage_report_get_params.py index 176598dc..7af78190 100644 --- a/src/gcore/types/cloud/usage_report_get_params.py +++ b/src/gcore/types/cloud/usage_report_get_params.py @@ -426,6 +426,8 @@ class TagsCondition(TypedDict, total=False): class Tags(TypedDict, total=False): + """Filter by tags""" + conditions: Required[Iterable[TagsCondition]] """A list of tag filtering conditions defining how tags should match.""" diff --git a/src/gcore/types/cloud/volume.py b/src/gcore/types/cloud/volume.py index 68c9053f..1ea6ff59 100644 --- a/src/gcore/types/cloud/volume.py +++ b/src/gcore/types/cloud/volume.py @@ -36,6 +36,8 @@ class Attachment(BaseModel): class LimiterStats(BaseModel): + """Schema representing the Quality of Service (QoS) parameters for a volume.""" + iops_base_limit: int """The sustained IOPS (Input/Output Operations Per Second) limit.""" diff --git a/src/gcore/types/dns/dns_name_server.py b/src/gcore/types/dns/dns_name_server.py index 619c4943..e865a7ba 100644 --- a/src/gcore/types/dns/dns_name_server.py +++ b/src/gcore/types/dns/dns_name_server.py @@ -10,6 +10,8 @@ class DNSNameServer(BaseModel): + """NameServer""" + ipv4_addresses: Optional[List[str]] = FieldInfo(alias="ipv4Addresses", default=None) ipv6_addresses: Optional[List[str]] = FieldInfo(alias="ipv6Addresses", default=None) diff --git a/src/gcore/types/dns/zone_get_response.py b/src/gcore/types/dns/zone_get_response.py index 912d6f73..38422c5c 100644 --- a/src/gcore/types/dns/zone_get_response.py +++ b/src/gcore/types/dns/zone_get_response.py @@ -10,6 +10,8 @@ class ZoneRecord(BaseModel): + """Record - readonly short version of rrset""" + name: Optional[str] = None short_answers: Optional[List[str]] = None @@ -20,6 +22,8 @@ class ZoneRecord(BaseModel): class ZoneRrsetsAmountDynamic(BaseModel): + """Amount of dynamic RRsets in zone""" + healthcheck: Optional[int] = None """Amount of RRsets with enabled healthchecks""" @@ -39,6 +43,8 @@ class ZoneRrsetsAmount(BaseModel): class Zone(BaseModel): + """OutputZone""" + id: Optional[int] = None """ ID of zone. This field usually is omitted in response and available only in case @@ -102,5 +108,7 @@ class Zone(BaseModel): class ZoneGetResponse(BaseModel): + """Complete zone info with all records included""" + zone: Optional[Zone] = FieldInfo(alias="Zone", default=None) """OutputZone""" diff --git a/src/gcore/types/dns/zone_get_statistics_response.py b/src/gcore/types/dns/zone_get_statistics_response.py index 76dadd2e..9c992062 100644 --- a/src/gcore/types/dns/zone_get_statistics_response.py +++ b/src/gcore/types/dns/zone_get_statistics_response.py @@ -8,6 +8,8 @@ class ZoneGetStatisticsResponse(BaseModel): + """StatisticsZoneResponse""" + requests: Optional[object] = None """ Requests amount (values) for particular zone fractionated by time intervals diff --git a/src/gcore/types/dns/zone_import_response.py b/src/gcore/types/dns/zone_import_response.py index d3a365ed..75f07129 100644 --- a/src/gcore/types/dns/zone_import_response.py +++ b/src/gcore/types/dns/zone_import_response.py @@ -8,6 +8,8 @@ class Imported(BaseModel): + """ImportedRRSets - import statistics""" + qtype: Optional[int] = None resource_records: Optional[int] = None diff --git a/src/gcore/types/dns/zone_list_response.py b/src/gcore/types/dns/zone_list_response.py index 6a3826f3..16d0629b 100644 --- a/src/gcore/types/dns/zone_list_response.py +++ b/src/gcore/types/dns/zone_list_response.py @@ -8,6 +8,8 @@ class ZoneRecord(BaseModel): + """Record - readonly short version of rrset""" + name: Optional[str] = None short_answers: Optional[List[str]] = None @@ -18,6 +20,8 @@ class ZoneRecord(BaseModel): class ZoneRrsetsAmountDynamic(BaseModel): + """Amount of dynamic RRsets in zone""" + healthcheck: Optional[int] = None """Amount of RRsets with enabled healthchecks""" @@ -37,6 +41,8 @@ class ZoneRrsetsAmount(BaseModel): class Zone(BaseModel): + """OutputZone""" + id: Optional[int] = None """ ID of zone. This field usually is omitted in response and available only in case diff --git a/src/gcore/types/dns/zones/dns_failover_log.py b/src/gcore/types/dns/zones/dns_failover_log.py index a329325a..2c37f385 100644 --- a/src/gcore/types/dns/zones/dns_failover_log.py +++ b/src/gcore/types/dns/zones/dns_failover_log.py @@ -9,6 +9,8 @@ class DNSFailoverLogItem(BaseModel): + """FailoverLogEntry""" + action: Optional[str] = None address: Optional[str] = None diff --git a/src/gcore/types/dns/zones/rrset_create_params.py b/src/gcore/types/dns/zones/rrset_create_params.py index 16facb7e..e4b2f876 100644 --- a/src/gcore/types/dns/zones/rrset_create_params.py +++ b/src/gcore/types/dns/zones/rrset_create_params.py @@ -28,6 +28,8 @@ class RrsetCreateParams(TypedDict, total=False): class ResourceRecord(TypedDict, total=False): + """nolint: lll""" + content: Required[Iterable[object]] """ Content of resource record The exact length of the array depends on the type of diff --git a/src/gcore/types/dns/zones/rrset_replace_params.py b/src/gcore/types/dns/zones/rrset_replace_params.py index e258f9b9..46f6274c 100644 --- a/src/gcore/types/dns/zones/rrset_replace_params.py +++ b/src/gcore/types/dns/zones/rrset_replace_params.py @@ -28,6 +28,8 @@ class RrsetReplaceParams(TypedDict, total=False): class ResourceRecord(TypedDict, total=False): + """nolint: lll""" + content: Required[Iterable[object]] """ Content of resource record The exact length of the array depends on the type of diff --git a/src/gcore/types/fastedge/app.py b/src/gcore/types/fastedge/app.py index 506008e0..8229b330 100644 --- a/src/gcore/types/fastedge/app.py +++ b/src/gcore/types/fastedge/app.py @@ -10,6 +10,8 @@ class Secrets(BaseModel): + """Application secret short description""" + id: int """The unique identifier of the secret.""" diff --git a/src/gcore/types/fastedge/app_create_params.py b/src/gcore/types/fastedge/app_create_params.py index 3046b307..be6ef061 100644 --- a/src/gcore/types/fastedge/app_create_params.py +++ b/src/gcore/types/fastedge/app_create_params.py @@ -52,5 +52,7 @@ class AppCreateParams(TypedDict, total=False): class Secrets(TypedDict, total=False): + """Application secret short description""" + id: Required[int] """The unique identifier of the secret.""" diff --git a/src/gcore/types/fastedge/app_param.py b/src/gcore/types/fastedge/app_param.py index 15b1ee3d..21d6028f 100644 --- a/src/gcore/types/fastedge/app_param.py +++ b/src/gcore/types/fastedge/app_param.py @@ -9,6 +9,8 @@ class Secrets(TypedDict, total=False): + """Application secret short description""" + id: Required[int] """The unique identifier of the secret.""" diff --git a/src/gcore/types/fastedge/app_update_params.py b/src/gcore/types/fastedge/app_update_params.py index b1c7cce8..39d58a22 100644 --- a/src/gcore/types/fastedge/app_update_params.py +++ b/src/gcore/types/fastedge/app_update_params.py @@ -52,5 +52,7 @@ class AppUpdateParams(TypedDict, total=False): class Secrets(TypedDict, total=False): + """Application secret short description""" + id: Required[int] """The unique identifier of the secret.""" diff --git a/src/gcore/types/fastedge/call_status.py b/src/gcore/types/fastedge/call_status.py index c694c963..0059f97f 100644 --- a/src/gcore/types/fastedge/call_status.py +++ b/src/gcore/types/fastedge/call_status.py @@ -17,6 +17,8 @@ class CountByStatus(BaseModel): class CallStatus(BaseModel): + """Edge app call statistics""" + count_by_status: List[CountByStatus] """Count by status""" diff --git a/src/gcore/types/fastedge/duration_stats.py b/src/gcore/types/fastedge/duration_stats.py index fbb08c0c..61025235 100644 --- a/src/gcore/types/fastedge/duration_stats.py +++ b/src/gcore/types/fastedge/duration_stats.py @@ -8,6 +8,8 @@ class DurationStats(BaseModel): + """Edge app execution duration statistics""" + avg: int """Average duration in usec""" diff --git a/src/gcore/types/fastedge/kv_store.py b/src/gcore/types/fastedge/kv_store.py index f63f2a27..4f4975f4 100644 --- a/src/gcore/types/fastedge/kv_store.py +++ b/src/gcore/types/fastedge/kv_store.py @@ -9,6 +9,8 @@ class Byod(BaseModel): + """BYOD (Bring Your Own Data) settings""" + prefix: str """Key prefix""" diff --git a/src/gcore/types/fastedge/kv_store_create_params.py b/src/gcore/types/fastedge/kv_store_create_params.py index d0159585..82f25c63 100644 --- a/src/gcore/types/fastedge/kv_store_create_params.py +++ b/src/gcore/types/fastedge/kv_store_create_params.py @@ -16,6 +16,8 @@ class KvStoreCreateParams(TypedDict, total=False): class Byod(TypedDict, total=False): + """BYOD (Bring Your Own Data) settings""" + prefix: Required[str] """Key prefix""" diff --git a/src/gcore/types/fastedge/kv_store_replace_params.py b/src/gcore/types/fastedge/kv_store_replace_params.py index 7448380f..b58d2bae 100644 --- a/src/gcore/types/fastedge/kv_store_replace_params.py +++ b/src/gcore/types/fastedge/kv_store_replace_params.py @@ -16,6 +16,8 @@ class KvStoreReplaceParams(TypedDict, total=False): class Byod(TypedDict, total=False): + """BYOD (Bring Your Own Data) settings""" + prefix: Required[str] """Key prefix""" diff --git a/src/gcore/types/fastedge/kv_store_stats.py b/src/gcore/types/fastedge/kv_store_stats.py index 30d5f14e..4308d772 100644 --- a/src/gcore/types/fastedge/kv_store_stats.py +++ b/src/gcore/types/fastedge/kv_store_stats.py @@ -8,6 +8,8 @@ class Stats(BaseModel): + """Store statistics""" + cf_count: int """Total number of Cuckoo filter entries""" diff --git a/src/gcore/types/iam/account_overview.py b/src/gcore/types/iam/account_overview.py index e0907b58..ab1b57b6 100644 --- a/src/gcore/types/iam/account_overview.py +++ b/src/gcore/types/iam/account_overview.py @@ -36,6 +36,8 @@ class FreeFeaturesCdn(BaseModel): + """Feature object.""" + create_date: Optional[str] = None """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" @@ -53,6 +55,8 @@ class FreeFeaturesCdn(BaseModel): class FreeFeaturesCloud(BaseModel): + """Feature object.""" + create_date: Optional[str] = None """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" @@ -70,6 +74,8 @@ class FreeFeaturesCloud(BaseModel): class FreeFeaturesDDOS(BaseModel): + """Feature object.""" + create_date: Optional[str] = None """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" @@ -87,6 +93,8 @@ class FreeFeaturesDDOS(BaseModel): class FreeFeaturesDNS(BaseModel): + """Feature object.""" + create_date: Optional[str] = None """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" @@ -104,6 +112,8 @@ class FreeFeaturesDNS(BaseModel): class FreeFeaturesStorage(BaseModel): + """Feature object.""" + create_date: Optional[str] = None """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" @@ -121,6 +131,8 @@ class FreeFeaturesStorage(BaseModel): class FreeFeaturesStreaming(BaseModel): + """Feature object.""" + create_date: Optional[str] = None """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" @@ -138,6 +150,10 @@ class FreeFeaturesStreaming(BaseModel): class FreeFeatures(BaseModel): + """ + An object of arrays which contains information about free features available for the requested account. + """ + cdn: Optional[List[FreeFeaturesCdn]] = FieldInfo(alias="CDN", default=None) cloud: Optional[List[FreeFeaturesCloud]] = FieldInfo(alias="CLOUD", default=None) @@ -152,6 +168,8 @@ class FreeFeatures(BaseModel): class PaidFeaturesCdn(BaseModel): + """Feature object.""" + create_date: Optional[str] = None """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" @@ -169,6 +187,8 @@ class PaidFeaturesCdn(BaseModel): class PaidFeaturesCloud(BaseModel): + """Feature object.""" + create_date: Optional[str] = None """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" @@ -186,6 +206,8 @@ class PaidFeaturesCloud(BaseModel): class PaidFeaturesDDOS(BaseModel): + """Feature object.""" + create_date: Optional[str] = None """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" @@ -203,6 +225,8 @@ class PaidFeaturesDDOS(BaseModel): class PaidFeaturesDNS(BaseModel): + """Feature object.""" + create_date: Optional[str] = None """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" @@ -220,6 +244,8 @@ class PaidFeaturesDNS(BaseModel): class PaidFeaturesStorage(BaseModel): + """Feature object.""" + create_date: Optional[str] = None """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" @@ -237,6 +263,8 @@ class PaidFeaturesStorage(BaseModel): class PaidFeaturesStreaming(BaseModel): + """Feature object.""" + create_date: Optional[str] = None """Date and time when the feature was activated (ISO 8086/RFC 3339 format).""" @@ -254,6 +282,10 @@ class PaidFeaturesStreaming(BaseModel): class PaidFeatures(BaseModel): + """ + An object of arrays which contains information about paid features available for the requested account. + """ + cdn: Optional[List[PaidFeaturesCdn]] = FieldInfo(alias="CDN", default=None) cloud: Optional[List[PaidFeaturesCloud]] = FieldInfo(alias="CLOUD", default=None) @@ -316,6 +348,10 @@ class ServiceStatusesStreaming(BaseModel): class ServiceStatuses(BaseModel): + """ + An object of arrays which contains information about all services available for the requested account. + """ + cdn: Optional[ServiceStatusesCdn] = FieldInfo(alias="CDN", default=None) cloud: Optional[ServiceStatusesCloud] = FieldInfo(alias="CLOUD", default=None) diff --git a/src/gcore/types/iam/api_token_create_params.py b/src/gcore/types/iam/api_token_create_params.py index 50d23678..c8ba1f0e 100644 --- a/src/gcore/types/iam/api_token_create_params.py +++ b/src/gcore/types/iam/api_token_create_params.py @@ -40,4 +40,6 @@ class ClientUserRole(TypedDict, total=False): class ClientUser(TypedDict, total=False): + """API token role.""" + role: ClientUserRole diff --git a/src/gcore/types/storage/bucket.py b/src/gcore/types/storage/bucket.py index e2cc7ae4..f0426088 100644 --- a/src/gcore/types/storage/bucket.py +++ b/src/gcore/types/storage/bucket.py @@ -8,6 +8,8 @@ class Bucket(BaseModel): + """BucketDtoV2 for response""" + name: str """Name of the S3 bucket""" diff --git a/src/gcore/types/storage/buckets/bucket_cors.py b/src/gcore/types/storage/buckets/bucket_cors.py index 42a3e527..9e310915 100644 --- a/src/gcore/types/storage/buckets/bucket_cors.py +++ b/src/gcore/types/storage/buckets/bucket_cors.py @@ -10,6 +10,8 @@ class BucketCors(BaseModel): + """StorageGetBucketCorsEndpointRes output""" + allowed_origins: Optional[List[str]] = FieldInfo(alias="allowedOrigins", default=None) """ List of allowed origins for Cross-Origin Resource Sharing (CORS) requests. diff --git a/src/gcore/types/storage/location.py b/src/gcore/types/storage/location.py index 0dda2627..5fff1680 100644 --- a/src/gcore/types/storage/location.py +++ b/src/gcore/types/storage/location.py @@ -8,6 +8,8 @@ class Location(BaseModel): + """LocationV2 represents location data for v2 API where title is a string""" + address: str """Full hostname/address for accessing the storage endpoint in this location""" diff --git a/src/gcore/types/storage/usage_total.py b/src/gcore/types/storage/usage_total.py index ae2288f7..6ecfd2ec 100644 --- a/src/gcore/types/storage/usage_total.py +++ b/src/gcore/types/storage/usage_total.py @@ -46,6 +46,8 @@ class DataMetrics(BaseModel): class Data(BaseModel): + """StorageStatsTotalElement for response""" + metrics: Optional[DataMetrics] = None diff --git a/src/gcore/types/streaming/player.py b/src/gcore/types/streaming/player.py index 97b74532..37736297 100644 --- a/src/gcore/types/streaming/player.py +++ b/src/gcore/types/streaming/player.py @@ -8,6 +8,11 @@ class Player(BaseModel): + """Set of properties for displaying videos. + + All parameters may be blank to inherit their values from default Streaming player. + """ + name: str """Player name""" diff --git a/src/gcore/types/streaming/player_param.py b/src/gcore/types/streaming/player_param.py index 4920422f..accb0aa7 100644 --- a/src/gcore/types/streaming/player_param.py +++ b/src/gcore/types/streaming/player_param.py @@ -8,6 +8,11 @@ class PlayerParam(TypedDict, total=False): + """Set of properties for displaying videos. + + All parameters may be blank to inherit their values from default Streaming player. + """ + name: Required[str] """Player name""" diff --git a/src/gcore/types/streaming/stream_start_recording_response.py b/src/gcore/types/streaming/stream_start_recording_response.py index 3bf41ac0..ba3326b6 100644 --- a/src/gcore/types/streaming/stream_start_recording_response.py +++ b/src/gcore/types/streaming/stream_start_recording_response.py @@ -35,10 +35,14 @@ class DataStream(BaseModel): class Data(BaseModel): + """Stream data""" + stream: Optional[DataStream] = None class WarningMeta(BaseModel): + """storage usage state for client""" + storage_limit_mb: Optional[int] = None """Current storage limit for client by megabytes""" @@ -47,6 +51,8 @@ class WarningMeta(BaseModel): class WarningSourceObject(BaseModel): + """Warning source object""" + id: Optional[int] = None """Client ID""" 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 e761c89f..7eb0bf01 100644 --- a/src/gcore/types/waap/domains/advanced_rule_create_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_create_params.py @@ -51,6 +51,10 @@ class AdvancedRuleCreateParams(TypedDict, total=False): class ActionBlock(TypedDict, total=False): + """ + WAAP block action behavior could be configured with response status code and action duration. + """ + action_duration: str """How long a rule's block action will apply to subsequent requests. @@ -64,11 +68,18 @@ class ActionBlock(TypedDict, total=False): class ActionTag(TypedDict, total=False): + """WAAP tag action gets a list of tags to tag the request scope with""" + tags: Required[SequenceNotStr[str]] """The list of user defined tags to tag the request with""" class Action(TypedDict, total=False): + """The action that the rule takes when triggered. + + Only one action can be set per rule. + """ + allow: object """The WAAP allowed the request""" 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 d77ee76e..7c191c34 100644 --- a/src/gcore/types/waap/domains/advanced_rule_update_params.py +++ b/src/gcore/types/waap/domains/advanced_rule_update_params.py @@ -51,6 +51,10 @@ class AdvancedRuleUpdateParams(TypedDict, total=False): class ActionBlock(TypedDict, total=False): + """ + WAAP block action behavior could be configured with response status code and action duration. + """ + action_duration: str """How long a rule's block action will apply to subsequent requests. @@ -64,11 +68,15 @@ class ActionBlock(TypedDict, total=False): class ActionTag(TypedDict, total=False): + """WAAP tag action gets a list of tags to tag the request scope with""" + tags: Required[SequenceNotStr[str]] """The list of user defined tags to tag the request with""" class Action(TypedDict, total=False): + """The action that a WAAP rule takes when triggered.""" + allow: object """The WAAP allowed the request""" diff --git a/src/gcore/types/waap/domains/api_path_group_list.py b/src/gcore/types/waap/domains/api_path_group_list.py index 6ecc6b55..3990cfeb 100644 --- a/src/gcore/types/waap/domains/api_path_group_list.py +++ b/src/gcore/types/waap/domains/api_path_group_list.py @@ -8,5 +8,7 @@ class APIPathGroupList(BaseModel): + """Response model for the API path groups""" + api_path_groups: List[str] """An array of api groups 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 19c17b6d..85559fd3 100644 --- a/src/gcore/types/waap/domains/custom_rule_create_params.py +++ b/src/gcore/types/waap/domains/custom_rule_create_params.py @@ -59,6 +59,10 @@ class CustomRuleCreateParams(TypedDict, total=False): class ActionBlock(TypedDict, total=False): + """ + WAAP block action behavior could be configured with response status code and action duration. + """ + action_duration: str """How long a rule's block action will apply to subsequent requests. @@ -72,11 +76,18 @@ class ActionBlock(TypedDict, total=False): class ActionTag(TypedDict, total=False): + """WAAP tag action gets a list of tags to tag the request scope with""" + tags: Required[SequenceNotStr[str]] """The list of user defined tags to tag the request with""" class Action(TypedDict, total=False): + """The action that the rule takes when triggered. + + Only one action can be set per rule. + """ + allow: object """The WAAP allowed the request""" @@ -100,6 +111,8 @@ class Action(TypedDict, total=False): class ConditionContentType(TypedDict, total=False): + """Match the requested Content-Type""" + content_type: Required[SequenceNotStr[str]] """The list of content types to match against""" @@ -108,6 +121,8 @@ class ConditionContentType(TypedDict, total=False): class ConditionCountry(TypedDict, total=False): + """Match the country that the request originated from""" + country_code: Required[SequenceNotStr[str]] """ A list of ISO 3166-1 alpha-2 formatted strings representing the countries to @@ -119,6 +134,8 @@ class ConditionCountry(TypedDict, total=False): class ConditionFileExtension(TypedDict, total=False): + """Match the incoming file extension""" + file_extension: Required[SequenceNotStr[str]] """The list of file extensions to match against""" @@ -127,6 +144,8 @@ class ConditionFileExtension(TypedDict, total=False): class ConditionHeader(TypedDict, total=False): + """Match an incoming request header""" + header: Required[str] """The request header name""" @@ -141,6 +160,8 @@ class ConditionHeader(TypedDict, total=False): class ConditionHeaderExists(TypedDict, total=False): + """Match when an incoming request header is present""" + header: Required[str] """The request header name""" @@ -149,6 +170,8 @@ class ConditionHeaderExists(TypedDict, total=False): class ConditionHTTPMethod(TypedDict, total=False): + """Match the incoming HTTP method""" + http_method: Required[Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]] """HTTP methods of a request""" @@ -157,6 +180,8 @@ class ConditionHTTPMethod(TypedDict, total=False): class ConditionIP(TypedDict, total=False): + """Match the incoming request against a single IP address""" + ip_address: Required[str] """A single IPv4 or IPv6 address""" @@ -165,6 +190,8 @@ class ConditionIP(TypedDict, total=False): class ConditionIPRange(TypedDict, total=False): + """Match the incoming request against an IP range""" + lower_bound: Required[str] """The lower bound IPv4 or IPv6 address to match against""" @@ -176,6 +203,10 @@ class ConditionIPRange(TypedDict, total=False): class ConditionOrganization(TypedDict, total=False): + """ + Match the organization the request originated from, as determined by a WHOIS lookup of the requesting IP + """ + organization: Required[str] """The organization to match against""" @@ -184,6 +215,10 @@ class ConditionOrganization(TypedDict, total=False): class ConditionOwnerTypes(TypedDict, total=False): + """ + Match the type of organization that owns the IP address making an incoming request + """ + negation: bool """Whether or not to apply a boolean NOT operation to the rule's condition""" @@ -206,6 +241,8 @@ class ConditionOwnerTypes(TypedDict, total=False): class ConditionRequestRate(TypedDict, total=False): + """Match the rate at which requests come in that match certain conditions""" + path_pattern: Required[str] """A regular expression matching the URL path of the incoming request""" @@ -235,6 +272,8 @@ class ConditionRequestRate(TypedDict, total=False): class ConditionResponseHeader(TypedDict, total=False): + """Match a response header""" + header: Required[str] """The response header name""" @@ -249,6 +288,8 @@ class ConditionResponseHeader(TypedDict, total=False): class ConditionResponseHeaderExists(TypedDict, total=False): + """Match when a response header is present""" + header: Required[str] """The response header name""" @@ -257,6 +298,8 @@ class ConditionResponseHeaderExists(TypedDict, total=False): class ConditionSessionRequestCount(TypedDict, total=False): + """Match the number of dynamic page requests made in a WAAP session""" + request_count: Required[int] """The number of dynamic requests in the session""" @@ -265,6 +308,8 @@ class ConditionSessionRequestCount(TypedDict, total=False): class ConditionTags(TypedDict, total=False): + """Matches requests based on specified tags""" + tags: Required[SequenceNotStr[str]] """A list of tags to match against the request tags""" @@ -273,6 +318,8 @@ class ConditionTags(TypedDict, total=False): class ConditionURL(TypedDict, total=False): + """Match the incoming request URL""" + url: Required[str] """ The pattern to match against the request URL. Constraints depend on @@ -292,6 +339,8 @@ class ConditionURL(TypedDict, total=False): class ConditionUserAgent(TypedDict, total=False): + """Match the user agent making the request""" + user_agent: Required[str] """The user agent value to match""" @@ -303,6 +352,8 @@ class ConditionUserAgent(TypedDict, total=False): class ConditionUserDefinedTags(TypedDict, total=False): + """Matches requests based on user-defined tags""" + tags: Required[SequenceNotStr[str]] """A list of user-defined tags to match against the request tags""" @@ -311,6 +362,10 @@ class ConditionUserDefinedTags(TypedDict, total=False): class Condition(TypedDict, total=False): + """ + The criteria of an incoming web request and the models of the various values those criteria can take + """ + content_type: ConditionContentType """Match the requested Content-Type""" 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 7a1ec114..a5d74346 100644 --- a/src/gcore/types/waap/domains/custom_rule_update_params.py +++ b/src/gcore/types/waap/domains/custom_rule_update_params.py @@ -59,6 +59,10 @@ class CustomRuleUpdateParams(TypedDict, total=False): class ActionBlock(TypedDict, total=False): + """ + WAAP block action behavior could be configured with response status code and action duration. + """ + action_duration: str """How long a rule's block action will apply to subsequent requests. @@ -72,11 +76,15 @@ class ActionBlock(TypedDict, total=False): class ActionTag(TypedDict, total=False): + """WAAP tag action gets a list of tags to tag the request scope with""" + tags: Required[SequenceNotStr[str]] """The list of user defined tags to tag the request with""" class Action(TypedDict, total=False): + """The action that a WAAP rule takes when triggered.""" + allow: object """The WAAP allowed the request""" @@ -100,6 +108,8 @@ class Action(TypedDict, total=False): class ConditionContentType(TypedDict, total=False): + """Match the requested Content-Type""" + content_type: Required[SequenceNotStr[str]] """The list of content types to match against""" @@ -108,6 +118,8 @@ class ConditionContentType(TypedDict, total=False): class ConditionCountry(TypedDict, total=False): + """Match the country that the request originated from""" + country_code: Required[SequenceNotStr[str]] """ A list of ISO 3166-1 alpha-2 formatted strings representing the countries to @@ -119,6 +131,8 @@ class ConditionCountry(TypedDict, total=False): class ConditionFileExtension(TypedDict, total=False): + """Match the incoming file extension""" + file_extension: Required[SequenceNotStr[str]] """The list of file extensions to match against""" @@ -127,6 +141,8 @@ class ConditionFileExtension(TypedDict, total=False): class ConditionHeader(TypedDict, total=False): + """Match an incoming request header""" + header: Required[str] """The request header name""" @@ -141,6 +157,8 @@ class ConditionHeader(TypedDict, total=False): class ConditionHeaderExists(TypedDict, total=False): + """Match when an incoming request header is present""" + header: Required[str] """The request header name""" @@ -149,6 +167,8 @@ class ConditionHeaderExists(TypedDict, total=False): class ConditionHTTPMethod(TypedDict, total=False): + """Match the incoming HTTP method""" + http_method: Required[Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]] """HTTP methods of a request""" @@ -157,6 +177,8 @@ class ConditionHTTPMethod(TypedDict, total=False): class ConditionIP(TypedDict, total=False): + """Match the incoming request against a single IP address""" + ip_address: Required[str] """A single IPv4 or IPv6 address""" @@ -165,6 +187,8 @@ class ConditionIP(TypedDict, total=False): class ConditionIPRange(TypedDict, total=False): + """Match the incoming request against an IP range""" + lower_bound: Required[str] """The lower bound IPv4 or IPv6 address to match against""" @@ -176,6 +200,10 @@ class ConditionIPRange(TypedDict, total=False): class ConditionOrganization(TypedDict, total=False): + """ + Match the organization the request originated from, as determined by a WHOIS lookup of the requesting IP + """ + organization: Required[str] """The organization to match against""" @@ -184,6 +212,10 @@ class ConditionOrganization(TypedDict, total=False): class ConditionOwnerTypes(TypedDict, total=False): + """ + Match the type of organization that owns the IP address making an incoming request + """ + negation: bool """Whether or not to apply a boolean NOT operation to the rule's condition""" @@ -206,6 +238,8 @@ class ConditionOwnerTypes(TypedDict, total=False): class ConditionRequestRate(TypedDict, total=False): + """Match the rate at which requests come in that match certain conditions""" + path_pattern: Required[str] """A regular expression matching the URL path of the incoming request""" @@ -235,6 +269,8 @@ class ConditionRequestRate(TypedDict, total=False): class ConditionResponseHeader(TypedDict, total=False): + """Match a response header""" + header: Required[str] """The response header name""" @@ -249,6 +285,8 @@ class ConditionResponseHeader(TypedDict, total=False): class ConditionResponseHeaderExists(TypedDict, total=False): + """Match when a response header is present""" + header: Required[str] """The response header name""" @@ -257,6 +295,8 @@ class ConditionResponseHeaderExists(TypedDict, total=False): class ConditionSessionRequestCount(TypedDict, total=False): + """Match the number of dynamic page requests made in a WAAP session""" + request_count: Required[int] """The number of dynamic requests in the session""" @@ -265,6 +305,8 @@ class ConditionSessionRequestCount(TypedDict, total=False): class ConditionTags(TypedDict, total=False): + """Matches requests based on specified tags""" + tags: Required[SequenceNotStr[str]] """A list of tags to match against the request tags""" @@ -273,6 +315,8 @@ class ConditionTags(TypedDict, total=False): class ConditionURL(TypedDict, total=False): + """Match the incoming request URL""" + url: Required[str] """ The pattern to match against the request URL. Constraints depend on @@ -292,6 +336,8 @@ class ConditionURL(TypedDict, total=False): class ConditionUserAgent(TypedDict, total=False): + """Match the user agent making the request""" + user_agent: Required[str] """The user agent value to match""" @@ -303,6 +349,8 @@ class ConditionUserAgent(TypedDict, total=False): class ConditionUserDefinedTags(TypedDict, total=False): + """Matches requests based on user-defined tags""" + tags: Required[SequenceNotStr[str]] """A list of user-defined tags to match against the request tags""" @@ -311,6 +359,10 @@ class ConditionUserDefinedTags(TypedDict, total=False): class Condition(TypedDict, total=False): + """ + The criteria of an incoming web request and the models of the various values those criteria can take + """ + content_type: ConditionContentType """Match the requested Content-Type""" 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 fec010b2..00a84336 100644 --- a/src/gcore/types/waap/domains/firewall_rule_create_params.py +++ b/src/gcore/types/waap/domains/firewall_rule_create_params.py @@ -26,6 +26,10 @@ class FirewallRuleCreateParams(TypedDict, total=False): class ActionBlock(TypedDict, total=False): + """ + WAAP block action behavior could be configured with response status code and action duration. + """ + action_duration: str """How long a rule's block action will apply to subsequent requests. @@ -39,6 +43,8 @@ class ActionBlock(TypedDict, total=False): class Action(TypedDict, total=False): + """The action that the rule takes when triggered""" + allow: Optional[object] """The WAAP allowed the request""" @@ -50,6 +56,8 @@ class Action(TypedDict, total=False): class ConditionIP(TypedDict, total=False): + """Match the incoming request against a single IP address""" + ip_address: Required[str] """A single IPv4 or IPv6 address""" @@ -58,6 +66,8 @@ class ConditionIP(TypedDict, total=False): class ConditionIPRange(TypedDict, total=False): + """Match the incoming request against an IP range""" + lower_bound: Required[str] """The lower bound IPv4 or IPv6 address to match against""" @@ -69,6 +79,10 @@ class ConditionIPRange(TypedDict, total=False): class Condition(TypedDict, total=False): + """ + The criteria of an incoming web request and the models of the various values those criteria can take + """ + ip: ConditionIP """Match the incoming request against a single IP address""" 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 87b0cd7e..48a2addf 100644 --- a/src/gcore/types/waap/domains/firewall_rule_update_params.py +++ b/src/gcore/types/waap/domains/firewall_rule_update_params.py @@ -29,6 +29,10 @@ class FirewallRuleUpdateParams(TypedDict, total=False): class ActionBlock(TypedDict, total=False): + """ + WAAP block action behavior could be configured with response status code and action duration. + """ + action_duration: str """How long a rule's block action will apply to subsequent requests. @@ -42,6 +46,8 @@ class ActionBlock(TypedDict, total=False): class Action(TypedDict, total=False): + """The action that a firewall rule takes when triggered""" + allow: Optional[object] """The WAAP allowed the request""" @@ -53,6 +59,8 @@ class Action(TypedDict, total=False): class ConditionIP(TypedDict, total=False): + """Match the incoming request against a single IP address""" + ip_address: Required[str] """A single IPv4 or IPv6 address""" @@ -61,6 +69,8 @@ class ConditionIP(TypedDict, total=False): class ConditionIPRange(TypedDict, total=False): + """Match the incoming request against an IP range""" + lower_bound: Required[str] """The lower bound IPv4 or IPv6 address to match against""" @@ -72,6 +82,10 @@ class ConditionIPRange(TypedDict, total=False): class Condition(TypedDict, total=False): + """ + The criteria of an incoming web request and the models of the various values those criteria can take + """ + ip: ConditionIP """Match the incoming request against a single IP address""" diff --git a/src/gcore/types/waap/domains/setting_update_params.py b/src/gcore/types/waap/domains/setting_update_params.py index 2b3ea5de..8a7f804b 100644 --- a/src/gcore/types/waap/domains/setting_update_params.py +++ b/src/gcore/types/waap/domains/setting_update_params.py @@ -18,6 +18,8 @@ class SettingUpdateParams(TypedDict, total=False): class API(TypedDict, total=False): + """Editable API settings of a domain""" + api_urls: SequenceNotStr[str] """The API URLs for a domain. @@ -33,6 +35,8 @@ class API(TypedDict, total=False): class DDOS(TypedDict, total=False): + """Editable DDoS settings for a domain.""" + burst_threshold: int """The burst threshold detects sudden rises in traffic. diff --git a/src/gcore/types/waap/domains/waap_advanced_rule.py b/src/gcore/types/waap/domains/waap_advanced_rule.py index c9c4529a..22450b73 100644 --- a/src/gcore/types/waap/domains/waap_advanced_rule.py +++ b/src/gcore/types/waap/domains/waap_advanced_rule.py @@ -9,6 +9,10 @@ class ActionBlock(BaseModel): + """ + WAAP block action behavior could be configured with response status code and action duration. + """ + action_duration: Optional[str] = None """How long a rule's block action will apply to subsequent requests. @@ -22,11 +26,18 @@ class ActionBlock(BaseModel): class ActionTag(BaseModel): + """WAAP tag action gets a list of tags to tag the request scope with""" + tags: List[str] """The list of user defined tags to tag the request with""" class Action(BaseModel): + """The action that the rule takes when triggered. + + Only one action can be set per rule. + """ + allow: Optional[object] = None """The WAAP allowed the request""" @@ -50,6 +61,8 @@ class Action(BaseModel): class WaapAdvancedRule(BaseModel): + """An advanced WAAP rule applied to a domain""" + id: int """The unique identifier for the rule""" diff --git a/src/gcore/types/waap/domains/waap_api_discovery_settings.py b/src/gcore/types/waap/domains/waap_api_discovery_settings.py index efcf0a0d..3b6339d8 100644 --- a/src/gcore/types/waap/domains/waap_api_discovery_settings.py +++ b/src/gcore/types/waap/domains/waap_api_discovery_settings.py @@ -10,6 +10,8 @@ class WaapAPIDiscoverySettings(BaseModel): + """Response model for the API discovery settings""" + description_file_location: Optional[str] = FieldInfo(alias="descriptionFileLocation", default=None) """The URL of the API description file. diff --git a/src/gcore/types/waap/domains/waap_api_path.py b/src/gcore/types/waap/domains/waap_api_path.py index 23abac76..ad57e1c2 100644 --- a/src/gcore/types/waap/domains/waap_api_path.py +++ b/src/gcore/types/waap/domains/waap_api_path.py @@ -10,6 +10,8 @@ class WaapAPIPath(BaseModel): + """Response model for the API path""" + id: str """The path ID""" diff --git a/src/gcore/types/waap/domains/waap_api_scan_result.py b/src/gcore/types/waap/domains/waap_api_scan_result.py index 9e8b7efc..c2bb18fa 100644 --- a/src/gcore/types/waap/domains/waap_api_scan_result.py +++ b/src/gcore/types/waap/domains/waap_api_scan_result.py @@ -10,6 +10,8 @@ class WaapAPIScanResult(BaseModel): + """The result of a scan""" + id: str """The scan ID""" diff --git a/src/gcore/types/waap/domains/waap_blocked_statistics.py b/src/gcore/types/waap/domains/waap_blocked_statistics.py index ae06354b..43aacc6b 100644 --- a/src/gcore/types/waap/domains/waap_blocked_statistics.py +++ b/src/gcore/types/waap/domains/waap_blocked_statistics.py @@ -8,6 +8,8 @@ class WaapBlockedStatistics(BaseModel): + """A collection of total numbers of events with blocked results per criteria""" + action: List[List[Union[str, int]]] """A collection of event counts per action. diff --git a/src/gcore/types/waap/domains/waap_count_statistics.py b/src/gcore/types/waap/domains/waap_count_statistics.py index eea255ff..daa586f0 100644 --- a/src/gcore/types/waap/domains/waap_count_statistics.py +++ b/src/gcore/types/waap/domains/waap_count_statistics.py @@ -8,6 +8,8 @@ class WaapCountStatistics(BaseModel): + """A collection of total numbers of events per criteria""" + action: List[List[Union[str, int]]] """A collection of event counts per action. diff --git a/src/gcore/types/waap/domains/waap_custom_rule.py b/src/gcore/types/waap/domains/waap_custom_rule.py index 25bc3234..89408a30 100644 --- a/src/gcore/types/waap/domains/waap_custom_rule.py +++ b/src/gcore/types/waap/domains/waap_custom_rule.py @@ -33,6 +33,10 @@ class ActionBlock(BaseModel): + """ + WAAP block action behavior could be configured with response status code and action duration. + """ + action_duration: Optional[str] = None """How long a rule's block action will apply to subsequent requests. @@ -46,11 +50,18 @@ class ActionBlock(BaseModel): class ActionTag(BaseModel): + """WAAP tag action gets a list of tags to tag the request scope with""" + tags: List[str] """The list of user defined tags to tag the request with""" class Action(BaseModel): + """The action that the rule takes when triggered. + + Only one action can be set per rule. + """ + allow: Optional[object] = None """The WAAP allowed the request""" @@ -74,6 +85,8 @@ class Action(BaseModel): class ConditionContentType(BaseModel): + """Match the requested Content-Type""" + content_type: List[str] """The list of content types to match against""" @@ -82,6 +95,8 @@ class ConditionContentType(BaseModel): class ConditionCountry(BaseModel): + """Match the country that the request originated from""" + country_code: List[str] """ A list of ISO 3166-1 alpha-2 formatted strings representing the countries to @@ -93,6 +108,8 @@ class ConditionCountry(BaseModel): class ConditionFileExtension(BaseModel): + """Match the incoming file extension""" + file_extension: List[str] """The list of file extensions to match against""" @@ -101,6 +118,8 @@ class ConditionFileExtension(BaseModel): class ConditionHeader(BaseModel): + """Match an incoming request header""" + header: str """The request header name""" @@ -115,6 +134,8 @@ class ConditionHeader(BaseModel): class ConditionHeaderExists(BaseModel): + """Match when an incoming request header is present""" + header: str """The request header name""" @@ -123,6 +144,8 @@ class ConditionHeaderExists(BaseModel): class ConditionHTTPMethod(BaseModel): + """Match the incoming HTTP method""" + http_method: Literal["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"] """HTTP methods of a request""" @@ -131,6 +154,8 @@ class ConditionHTTPMethod(BaseModel): class ConditionIP(BaseModel): + """Match the incoming request against a single IP address""" + ip_address: str """A single IPv4 or IPv6 address""" @@ -139,6 +164,8 @@ class ConditionIP(BaseModel): class ConditionIPRange(BaseModel): + """Match the incoming request against an IP range""" + lower_bound: str """The lower bound IPv4 or IPv6 address to match against""" @@ -150,6 +177,10 @@ class ConditionIPRange(BaseModel): class ConditionOrganization(BaseModel): + """ + Match the organization the request originated from, as determined by a WHOIS lookup of the requesting IP + """ + organization: str """The organization to match against""" @@ -158,6 +189,10 @@ class ConditionOrganization(BaseModel): class ConditionOwnerTypes(BaseModel): + """ + Match the type of organization that owns the IP address making an incoming request + """ + negation: Optional[bool] = None """Whether or not to apply a boolean NOT operation to the rule's condition""" @@ -182,6 +217,8 @@ class ConditionOwnerTypes(BaseModel): class ConditionRequestRate(BaseModel): + """Match the rate at which requests come in that match certain conditions""" + path_pattern: str """A regular expression matching the URL path of the incoming request""" @@ -213,6 +250,8 @@ class ConditionRequestRate(BaseModel): class ConditionResponseHeader(BaseModel): + """Match a response header""" + header: str """The response header name""" @@ -227,6 +266,8 @@ class ConditionResponseHeader(BaseModel): class ConditionResponseHeaderExists(BaseModel): + """Match when a response header is present""" + header: str """The response header name""" @@ -235,6 +276,8 @@ class ConditionResponseHeaderExists(BaseModel): class ConditionSessionRequestCount(BaseModel): + """Match the number of dynamic page requests made in a WAAP session""" + request_count: int """The number of dynamic requests in the session""" @@ -243,6 +286,8 @@ class ConditionSessionRequestCount(BaseModel): class ConditionTags(BaseModel): + """Matches requests based on specified tags""" + tags: List[str] """A list of tags to match against the request tags""" @@ -251,6 +296,8 @@ class ConditionTags(BaseModel): class ConditionURL(BaseModel): + """Match the incoming request URL""" + url: str """ The pattern to match against the request URL. Constraints depend on @@ -270,6 +317,8 @@ class ConditionURL(BaseModel): class ConditionUserAgent(BaseModel): + """Match the user agent making the request""" + user_agent: str """The user agent value to match""" @@ -281,6 +330,8 @@ class ConditionUserAgent(BaseModel): class ConditionUserDefinedTags(BaseModel): + """Matches requests based on user-defined tags""" + tags: List[str] """A list of user-defined tags to match against the request tags""" @@ -289,6 +340,10 @@ class ConditionUserDefinedTags(BaseModel): class Condition(BaseModel): + """ + The criteria of an incoming web request and the models of the various values those criteria can take + """ + content_type: Optional[ConditionContentType] = None """Match the requested Content-Type""" @@ -351,6 +406,8 @@ class Condition(BaseModel): class WaapCustomRule(BaseModel): + """An WAAP rule applied to a domain""" + id: int """The unique identifier for the rule""" diff --git a/src/gcore/types/waap/domains/waap_event_statistics.py b/src/gcore/types/waap/domains/waap_event_statistics.py index 26f34fba..90f2b1d1 100644 --- a/src/gcore/types/waap/domains/waap_event_statistics.py +++ b/src/gcore/types/waap/domains/waap_event_statistics.py @@ -8,6 +8,8 @@ class WaapEventStatistics(BaseModel): + """A collection of event metrics over a time span""" + blocked: WaapBlockedStatistics """A collection of total numbers of events with blocked results per criteria""" diff --git a/src/gcore/types/waap/domains/waap_firewall_rule.py b/src/gcore/types/waap/domains/waap_firewall_rule.py index 1130a89a..2686de74 100644 --- a/src/gcore/types/waap/domains/waap_firewall_rule.py +++ b/src/gcore/types/waap/domains/waap_firewall_rule.py @@ -9,6 +9,10 @@ class ActionBlock(BaseModel): + """ + WAAP block action behavior could be configured with response status code and action duration. + """ + action_duration: Optional[str] = None """How long a rule's block action will apply to subsequent requests. @@ -22,6 +26,8 @@ class ActionBlock(BaseModel): class Action(BaseModel): + """The action that the rule takes when triggered""" + allow: Optional[object] = None """The WAAP allowed the request""" @@ -33,6 +39,8 @@ class Action(BaseModel): class ConditionIP(BaseModel): + """Match the incoming request against a single IP address""" + ip_address: str """A single IPv4 or IPv6 address""" @@ -41,6 +49,8 @@ class ConditionIP(BaseModel): class ConditionIPRange(BaseModel): + """Match the incoming request against an IP range""" + lower_bound: str """The lower bound IPv4 or IPv6 address to match against""" @@ -52,6 +62,10 @@ class ConditionIPRange(BaseModel): class Condition(BaseModel): + """ + The criteria of an incoming web request and the models of the various values those criteria can take + """ + ip: Optional[ConditionIP] = None """Match the incoming request against a single IP address""" diff --git a/src/gcore/types/waap/domains/waap_request_details.py b/src/gcore/types/waap/domains/waap_request_details.py index e3a1d9cd..d4a67bad 100644 --- a/src/gcore/types/waap/domains/waap_request_details.py +++ b/src/gcore/types/waap/domains/waap_request_details.py @@ -10,6 +10,8 @@ class CommonTag(BaseModel): + """Common tag details""" + description: str """Tag description information""" @@ -21,6 +23,8 @@ class CommonTag(BaseModel): class NetworkOrganization(BaseModel): + """Organization details""" + name: str """Organization name""" @@ -29,6 +33,8 @@ class NetworkOrganization(BaseModel): class Network(BaseModel): + """Network details""" + client_ip: str """Client IP""" @@ -40,6 +46,8 @@ class Network(BaseModel): class PatternMatchedTag(BaseModel): + """Pattern matched tag details""" + description: str """Tag description information""" @@ -72,6 +80,8 @@ class PatternMatchedTag(BaseModel): class UserAgent(BaseModel): + """User agent""" + base_browser: str """User agent browser""" @@ -107,6 +117,8 @@ class UserAgent(BaseModel): class WaapRequestDetails(BaseModel): + """Request's details used when displaying a single request.""" + id: str """Request ID""" diff --git a/src/gcore/types/waap/domains/waap_request_summary.py b/src/gcore/types/waap/domains/waap_request_summary.py index f82873b7..dd114b2b 100644 --- a/src/gcore/types/waap/domains/waap_request_summary.py +++ b/src/gcore/types/waap/domains/waap_request_summary.py @@ -8,6 +8,8 @@ class WaapRequestSummary(BaseModel): + """Request summary used when displaying a list of requests""" + id: str """Request's unique id""" diff --git a/src/gcore/types/waap/domains/waap_task_id.py b/src/gcore/types/waap/domains/waap_task_id.py index 97b9d44b..22f383c7 100644 --- a/src/gcore/types/waap/domains/waap_task_id.py +++ b/src/gcore/types/waap/domains/waap_task_id.py @@ -6,5 +6,7 @@ class WaapTaskID(BaseModel): + """Response model for the task result ID""" + id: str """The task ID""" diff --git a/src/gcore/types/waap/domains/waap_traffic_metrics.py b/src/gcore/types/waap/domains/waap_traffic_metrics.py index 072e1366..b87d6c4b 100644 --- a/src/gcore/types/waap/domains/waap_traffic_metrics.py +++ b/src/gcore/types/waap/domains/waap_traffic_metrics.py @@ -10,6 +10,8 @@ class WaapTrafficMetrics(BaseModel): + """Represents the traffic metrics for a domain at a given time window""" + timestamp: int """UNIX timestamp indicating when the traffic data was recorded""" diff --git a/src/gcore/types/waap/waap_advanced_rule_descriptor.py b/src/gcore/types/waap/waap_advanced_rule_descriptor.py index 45425e54..0aac47d5 100644 --- a/src/gcore/types/waap/waap_advanced_rule_descriptor.py +++ b/src/gcore/types/waap/waap_advanced_rule_descriptor.py @@ -8,6 +8,8 @@ class AttrArg(BaseModel): + """An argument of a descriptor's object""" + name: str """The argument's name""" @@ -19,6 +21,8 @@ class AttrArg(BaseModel): class Attr(BaseModel): + """An attribute of a descriptor's object""" + name: str """The attribute's name""" @@ -36,6 +40,8 @@ class Attr(BaseModel): class WaapAdvancedRuleDescriptor(BaseModel): + """Advanced rules descriptor object""" + name: str """The object's name""" diff --git a/src/gcore/types/waap/waap_advanced_rule_descriptor_list.py b/src/gcore/types/waap/waap_advanced_rule_descriptor_list.py index 1924fee2..5af6cb73 100644 --- a/src/gcore/types/waap/waap_advanced_rule_descriptor_list.py +++ b/src/gcore/types/waap/waap_advanced_rule_descriptor_list.py @@ -9,6 +9,8 @@ class WaapAdvancedRuleDescriptorList(BaseModel): + """A response from a request to retrieve an advanced rules descriptor""" + version: str """The descriptor's version""" diff --git a/src/gcore/types/waap/waap_detailed_domain.py b/src/gcore/types/waap/waap_detailed_domain.py index 9e12ccee..e76b62b1 100644 --- a/src/gcore/types/waap/waap_detailed_domain.py +++ b/src/gcore/types/waap/waap_detailed_domain.py @@ -18,6 +18,14 @@ class Quotas(BaseModel): class WaapDetailedDomain(BaseModel): + """Represents a WAAP domain, serving as a singular unit within the WAAP + service. + + Each domain functions autonomously, possessing its own set of rules and + configurations to manage web application firewall settings and + behaviors. + """ + id: int """The domain ID""" diff --git a/src/gcore/types/waap/waap_domain_api_settings.py b/src/gcore/types/waap/waap_domain_api_settings.py index 7a8b3077..0d6c6615 100644 --- a/src/gcore/types/waap/waap_domain_api_settings.py +++ b/src/gcore/types/waap/waap_domain_api_settings.py @@ -8,6 +8,8 @@ class WaapDomainAPISettings(BaseModel): + """API settings of a domain""" + api_urls: Optional[List[str]] = None """The API URLs for a domain. diff --git a/src/gcore/types/waap/waap_domain_ddos_settings.py b/src/gcore/types/waap/waap_domain_ddos_settings.py index 96970d0f..6111d794 100644 --- a/src/gcore/types/waap/waap_domain_ddos_settings.py +++ b/src/gcore/types/waap/waap_domain_ddos_settings.py @@ -8,6 +8,8 @@ class WaapDomainDDOSSettings(BaseModel): + """DDoS settings for a domain.""" + burst_threshold: Optional[int] = None """The burst threshold detects sudden rises in traffic. diff --git a/src/gcore/types/waap/waap_domain_settings_model.py b/src/gcore/types/waap/waap_domain_settings_model.py index b287c563..96ee2d3e 100644 --- a/src/gcore/types/waap/waap_domain_settings_model.py +++ b/src/gcore/types/waap/waap_domain_settings_model.py @@ -8,6 +8,8 @@ class WaapDomainSettingsModel(BaseModel): + """Settings for a domain.""" + api: WaapDomainAPISettings """API settings of a domain""" diff --git a/src/gcore/types/waap/waap_get_account_overview_response.py b/src/gcore/types/waap/waap_get_account_overview_response.py index 14a8808c..079eb6f0 100644 --- a/src/gcore/types/waap/waap_get_account_overview_response.py +++ b/src/gcore/types/waap/waap_get_account_overview_response.py @@ -16,11 +16,15 @@ class Quotas(BaseModel): class Service(BaseModel): + """Information about the WAAP service status""" + enabled: bool """Whether the service is enabled""" class WaapGetAccountOverviewResponse(BaseModel): + """Represents the WAAP service information for a client""" + id: Optional[int] = None """The client ID""" diff --git a/src/gcore/types/waap/waap_ip_info.py b/src/gcore/types/waap/waap_ip_info.py index 741e7e2f..e1ace869 100644 --- a/src/gcore/types/waap/waap_ip_info.py +++ b/src/gcore/types/waap/waap_ip_info.py @@ -9,6 +9,8 @@ class Whois(BaseModel): + """The WHOIS information for the IP address""" + abuse_mail: Optional[str] = None """The abuse mail""" diff --git a/src/gcore/types/waap/waap_organization.py b/src/gcore/types/waap/waap_organization.py index f5f580fe..aa851e76 100644 --- a/src/gcore/types/waap/waap_organization.py +++ b/src/gcore/types/waap/waap_organization.py @@ -6,6 +6,8 @@ class WaapOrganization(BaseModel): + """Represents an IP range owner organization""" + id: int """The ID of an organization""" diff --git a/src/gcore/types/waap/waap_policy_mode.py b/src/gcore/types/waap/waap_policy_mode.py index 1f9af3f7..14faca49 100644 --- a/src/gcore/types/waap/waap_policy_mode.py +++ b/src/gcore/types/waap/waap_policy_mode.py @@ -6,5 +6,7 @@ class WaapPolicyMode(BaseModel): + """Represents the mode of a security rule.""" + mode: bool """Indicates if the security rule is active""" diff --git a/src/gcore/types/waap/waap_rule_set.py b/src/gcore/types/waap/waap_rule_set.py index e5e33e10..99f01433 100644 --- a/src/gcore/types/waap/waap_rule_set.py +++ b/src/gcore/types/waap/waap_rule_set.py @@ -9,6 +9,8 @@ class Tag(BaseModel): + """A single tag associated with a rule set.""" + id: int """Identifier of the tag.""" @@ -20,6 +22,8 @@ class Tag(BaseModel): class Rule(BaseModel): + """Represents a configurable WAAP security rule, also known as a policy.""" + id: str """Unique identifier for the security rule""" @@ -43,6 +47,8 @@ class Rule(BaseModel): class WaapRuleSet(BaseModel): + """Represents a custom rule set.""" + id: int """Identifier of the rule set.""" diff --git a/src/gcore/types/waap/waap_statistic_item.py b/src/gcore/types/waap/waap_statistic_item.py index 9a081374..925cb6d3 100644 --- a/src/gcore/types/waap/waap_statistic_item.py +++ b/src/gcore/types/waap/waap_statistic_item.py @@ -8,6 +8,8 @@ class WaapStatisticItem(BaseModel): + """Response model for the statistics item""" + date_time: datetime """The date and time for the statistic in ISO 8601 format""" diff --git a/src/gcore/types/waap/waap_statistics_series.py b/src/gcore/types/waap/waap_statistics_series.py index b5d884bd..d645dc66 100644 --- a/src/gcore/types/waap/waap_statistics_series.py +++ b/src/gcore/types/waap/waap_statistics_series.py @@ -9,6 +9,8 @@ class WaapStatisticsSeries(BaseModel): + """Response model for the statistics series""" + total_bytes: Optional[List[WaapStatisticItem]] = None """Will be returned if `total_bytes` is requested in the metrics parameter""" diff --git a/src/gcore/types/waap/waap_summary_domain.py b/src/gcore/types/waap/waap_summary_domain.py index 78549e71..b5186b37 100644 --- a/src/gcore/types/waap/waap_summary_domain.py +++ b/src/gcore/types/waap/waap_summary_domain.py @@ -10,6 +10,8 @@ class WaapSummaryDomain(BaseModel): + """Represents a WAAP domain when getting a list of domains.""" + id: int """The domain ID""" diff --git a/src/gcore/types/waap/waap_tag.py b/src/gcore/types/waap/waap_tag.py index 5ccdeae7..fe934227 100644 --- a/src/gcore/types/waap/waap_tag.py +++ b/src/gcore/types/waap/waap_tag.py @@ -6,6 +6,10 @@ class WaapTag(BaseModel): + """ + Tags provide shortcuts for the rules used in WAAP policies for the creation of more complex WAAP rules. + """ + description: str """A tag's human readable description""" From 10d584610325625d44e09b345eb84596040e1cd0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 07:46:11 +0000 Subject: [PATCH 16/27] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index b1d886a8..b1719fc7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 632 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-af877f4bcacb08ddb1febe8cf82da30454f95a010d02d30720d4f6e79a42883f.yml openapi_spec_hash: 27676e14bc9581a1a395bb0f9514f883 -config_hash: b42b8cd553a836e3e80a9ddddd396a53 +config_hash: ae48a5111e684a03cb47a26eeda8bfbc From a6e8476ae8d87cd160174bbe6075804eee59e395 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 08:03:56 +0000 Subject: [PATCH 17/27] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index b1719fc7..1b2afaca 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 632 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-af877f4bcacb08ddb1febe8cf82da30454f95a010d02d30720d4f6e79a42883f.yml openapi_spec_hash: 27676e14bc9581a1a395bb0f9514f883 -config_hash: ae48a5111e684a03cb47a26eeda8bfbc +config_hash: b538b5efdff6ec96ee120407e226c19e From 7656563fc5dd17e35f6818812ca099251cdda258 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 08:14:07 +0000 Subject: [PATCH 18/27] feat(api): aggregated API specs update --- .stats.yml | 4 +- src/gcore/resources/cloud/projects.py | 57 ++++++-- .../types/cloud/project_update_params.py | 1 + tests/api_resources/cloud/test_projects.py | 122 ++++++++++-------- 4 files changed, 114 insertions(+), 70 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1b2afaca..61558656 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 632 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-af877f4bcacb08ddb1febe8cf82da30454f95a010d02d30720d4f6e79a42883f.yml -openapi_spec_hash: 27676e14bc9581a1a395bb0f9514f883 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-771d5912d13cfded02247290691560b16c332adb8b1283d6ba814b8e118d3694.yml +openapi_spec_hash: 8ca4e1564be0ee0057edcbb283c7680c config_hash: b538b5efdff6ec96ee120407e226c19e diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index ad5381ec..a921b88a 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Optional from typing_extensions import Literal @@ -91,6 +92,7 @@ def create( cast_to=Project, ) + @typing_extensions.deprecated("deprecated") def update( self, *, @@ -104,10 +106,14 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: - """ - Update project name and description. + """Update project. + + Depricated: Use PATCH /v1/projects/{project_id} instead Update + project name and description. Args: + project_id: Project ID + name: Name of the entity, following a specific format. description: Description of the project. @@ -220,6 +226,8 @@ def delete( deleted. Args: + project_id: Project ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -249,10 +257,13 @@ def get( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: - """ + """Get project. + Retrieve detailed information about a specific project. Args: + project_id: Project ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -337,6 +348,7 @@ async def create( cast_to=Project, ) + @typing_extensions.deprecated("deprecated") async def update( self, *, @@ -350,10 +362,14 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: - """ - Update project name and description. + """Update project. + + Depricated: Use PATCH /v1/projects/{project_id} instead Update + project name and description. Args: + project_id: Project ID + name: Name of the entity, following a specific format. description: Description of the project. @@ -466,6 +482,8 @@ async def delete( deleted. Args: + project_id: Project ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -495,10 +513,13 @@ async def get( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: - """ + """Get project. + Retrieve detailed information about a specific project. Args: + project_id: Project ID + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -525,8 +546,10 @@ def __init__(self, projects: ProjectsResource) -> None: self.create = to_raw_response_wrapper( projects.create, ) - self.update = to_raw_response_wrapper( - projects.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + projects.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_raw_response_wrapper( projects.list, @@ -546,8 +569,10 @@ def __init__(self, projects: AsyncProjectsResource) -> None: self.create = async_to_raw_response_wrapper( projects.create, ) - self.update = async_to_raw_response_wrapper( - projects.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + projects.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_raw_response_wrapper( projects.list, @@ -567,8 +592,10 @@ def __init__(self, projects: ProjectsResource) -> None: self.create = to_streamed_response_wrapper( projects.create, ) - self.update = to_streamed_response_wrapper( - projects.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + projects.update, # pyright: ignore[reportDeprecated], + ) ) self.list = to_streamed_response_wrapper( projects.list, @@ -588,8 +615,10 @@ def __init__(self, projects: AsyncProjectsResource) -> None: self.create = async_to_streamed_response_wrapper( projects.create, ) - self.update = async_to_streamed_response_wrapper( - projects.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + projects.update, # pyright: ignore[reportDeprecated], + ) ) self.list = async_to_streamed_response_wrapper( projects.list, diff --git a/src/gcore/types/cloud/project_update_params.py b/src/gcore/types/cloud/project_update_params.py index 42489cb1..ea49bcf4 100644 --- a/src/gcore/types/cloud/project_update_params.py +++ b/src/gcore/types/cloud/project_update_params.py @@ -10,6 +10,7 @@ class ProjectUpdateParams(TypedDict, total=False): project_id: int + """Project ID""" name: Required[str] """Name of the entity, following a specific format.""" diff --git a/tests/api_resources/cloud/test_projects.py b/tests/api_resources/cloud/test_projects.py index 2a620652..455053fd 100644 --- a/tests/api_resources/cloud/test_projects.py +++ b/tests/api_resources/cloud/test_projects.py @@ -12,6 +12,8 @@ from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.cloud import Project, TaskIDList +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -59,27 +61,32 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: - project = client.cloud.projects.update( - project_id=0, - name="my-project", - ) + with pytest.warns(DeprecationWarning): + project = client.cloud.projects.update( + project_id=4, + name="my-project", + ) + assert_matches_type(Project, project, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: - project = client.cloud.projects.update( - project_id=0, - name="my-project", - description="Project description", - ) + with pytest.warns(DeprecationWarning): + project = client.cloud.projects.update( + project_id=4, + name="my-project", + description="Project description", + ) + assert_matches_type(Project, project, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: - response = client.cloud.projects.with_raw_response.update( - project_id=0, - name="my-project", - ) + with pytest.warns(DeprecationWarning): + response = client.cloud.projects.with_raw_response.update( + project_id=4, + name="my-project", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -88,15 +95,16 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with client.cloud.projects.with_streaming_response.update( - project_id=0, - name="my-project", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.cloud.projects.with_streaming_response.update( + project_id=4, + name="my-project", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = response.parse() - assert_matches_type(Project, project, path=["response"]) + project = response.parse() + assert_matches_type(Project, project, path=["response"]) assert cast(Any, response.is_closed) is True @@ -140,14 +148,14 @@ def test_streaming_response_list(self, client: Gcore) -> None: @parametrize def test_method_delete(self, client: Gcore) -> None: project = client.cloud.projects.delete( - project_id=0, + project_id=4, ) assert_matches_type(TaskIDList, project, path=["response"]) @parametrize def test_raw_response_delete(self, client: Gcore) -> None: response = client.cloud.projects.with_raw_response.delete( - project_id=0, + project_id=4, ) assert response.is_closed is True @@ -158,7 +166,7 @@ def test_raw_response_delete(self, client: Gcore) -> None: @parametrize def test_streaming_response_delete(self, client: Gcore) -> None: with client.cloud.projects.with_streaming_response.delete( - project_id=0, + project_id=4, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -171,14 +179,14 @@ def test_streaming_response_delete(self, client: Gcore) -> None: @parametrize def test_method_get(self, client: Gcore) -> None: project = client.cloud.projects.get( - project_id=0, + project_id=4, ) assert_matches_type(Project, project, path=["response"]) @parametrize def test_raw_response_get(self, client: Gcore) -> None: response = client.cloud.projects.with_raw_response.get( - project_id=0, + project_id=4, ) assert response.is_closed is True @@ -189,7 +197,7 @@ def test_raw_response_get(self, client: Gcore) -> None: @parametrize def test_streaming_response_get(self, client: Gcore) -> None: with client.cloud.projects.with_streaming_response.get( - project_id=0, + project_id=4, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -246,27 +254,32 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - project = await async_client.cloud.projects.update( - project_id=0, - name="my-project", - ) + with pytest.warns(DeprecationWarning): + project = await async_client.cloud.projects.update( + project_id=4, + name="my-project", + ) + assert_matches_type(Project, project, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - project = await async_client.cloud.projects.update( - project_id=0, - name="my-project", - description="Project description", - ) + with pytest.warns(DeprecationWarning): + project = await async_client.cloud.projects.update( + project_id=4, + name="my-project", + description="Project description", + ) + assert_matches_type(Project, project, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - response = await async_client.cloud.projects.with_raw_response.update( - project_id=0, - name="my-project", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.cloud.projects.with_raw_response.update( + project_id=4, + name="my-project", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -275,15 +288,16 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - async with async_client.cloud.projects.with_streaming_response.update( - project_id=0, - name="my-project", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.cloud.projects.with_streaming_response.update( + project_id=4, + name="my-project", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = await response.parse() - assert_matches_type(Project, project, path=["response"]) + project = await response.parse() + assert_matches_type(Project, project, path=["response"]) assert cast(Any, response.is_closed) is True @@ -327,14 +341,14 @@ async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: @parametrize async def test_method_delete(self, async_client: AsyncGcore) -> None: project = await async_client.cloud.projects.delete( - project_id=0, + project_id=4, ) assert_matches_type(TaskIDList, project, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.projects.with_raw_response.delete( - project_id=0, + project_id=4, ) assert response.is_closed is True @@ -345,7 +359,7 @@ async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: async with async_client.cloud.projects.with_streaming_response.delete( - project_id=0, + project_id=4, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -358,14 +372,14 @@ async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None @parametrize async def test_method_get(self, async_client: AsyncGcore) -> None: project = await async_client.cloud.projects.get( - project_id=0, + project_id=4, ) assert_matches_type(Project, project, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncGcore) -> None: response = await async_client.cloud.projects.with_raw_response.get( - project_id=0, + project_id=4, ) assert response.is_closed is True @@ -376,7 +390,7 @@ async def test_raw_response_get(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: async with async_client.cloud.projects.with_streaming_response.get( - project_id=0, + project_id=4, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From 67dc79fea2b041b24b212a02e927ccbd243e4522 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 12:16:21 +0000 Subject: [PATCH 19/27] feat(api): aggregated API specs update --- .stats.yml | 4 ++-- .../resources/cloud/security_groups/security_groups.py | 8 ++++---- src/gcore/types/cloud/security_group_list_params.py | 4 ++-- tests/api_resources/cloud/test_security_groups.py | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.stats.yml b/.stats.yml index 61558656..787707dd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 632 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-771d5912d13cfded02247290691560b16c332adb8b1283d6ba814b8e118d3694.yml -openapi_spec_hash: 8ca4e1564be0ee0057edcbb283c7680c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-4b7fbbd83aa47dd18d0cfe4f58c2e0394926d5d42c6d44253ffc2e37014da93a.yml +openapi_spec_hash: 7b964677a4d29ed874df07b3f14f74f6 config_hash: b538b5efdff6ec96ee120407e226c19e diff --git a/src/gcore/resources/cloud/security_groups/security_groups.py b/src/gcore/resources/cloud/security_groups/security_groups.py index 498e06b7..ca0d7b65 100644 --- a/src/gcore/resources/cloud/security_groups/security_groups.py +++ b/src/gcore/resources/cloud/security_groups/security_groups.py @@ -224,9 +224,9 @@ def list( offset: Offset in results list - tag_key: Optional. Filter by tag keys. + tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 - tag_key_value: Optional. Filter by tag key-value pairs. Must be a valid JSON string. + tag_key_value: Optional. Filter by tag key-value pairs. extra_headers: Send extra headers @@ -609,9 +609,9 @@ def list( offset: Offset in results list - tag_key: Optional. Filter by tag keys. + tag_key: Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2 - tag_key_value: Optional. Filter by tag key-value pairs. Must be a valid JSON string. + tag_key_value: Optional. Filter by tag key-value pairs. extra_headers: Send extra headers diff --git a/src/gcore/types/cloud/security_group_list_params.py b/src/gcore/types/cloud/security_group_list_params.py index c6bfc34d..22b3bd2c 100644 --- a/src/gcore/types/cloud/security_group_list_params.py +++ b/src/gcore/types/cloud/security_group_list_params.py @@ -23,7 +23,7 @@ class SecurityGroupListParams(TypedDict, total=False): """Offset in results list""" tag_key: SequenceNotStr[str] - """Optional. Filter by tag keys.""" + """Optional. Filter by tag keys. ?`tag_key`=key1&`tag_key`=key2""" tag_key_value: str - """Optional. Filter by tag key-value pairs. Must be a valid JSON string.""" + """Optional. Filter by tag key-value pairs.""" diff --git a/tests/api_resources/cloud/test_security_groups.py b/tests/api_resources/cloud/test_security_groups.py index 69777f00..41883f9e 100644 --- a/tests/api_resources/cloud/test_security_groups.py +++ b/tests/api_resources/cloud/test_security_groups.py @@ -169,7 +169,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: region_id=1, limit=10, offset=0, - tag_key=["my-tag"], + tag_key=["key1", "key2"], tag_key_value="tag_key_value", ) assert_matches_type(SyncOffsetPage[SecurityGroup], security_group, path=["response"]) @@ -543,7 +543,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No region_id=1, limit=10, offset=0, - tag_key=["my-tag"], + tag_key=["key1", "key2"], tag_key_value="tag_key_value", ) assert_matches_type(AsyncOffsetPage[SecurityGroup], security_group, path=["response"]) From 145f10ce4125be5a97ec6f092e4056ff78b2f3b1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 14:19:54 +0000 Subject: [PATCH 20/27] feat(dns): enable terraform code generation for gcore_dns_network_mapping --- .stats.yml | 4 +- api.md | 24 + src/gcore/resources/dns/__init__.py | 14 + src/gcore/resources/dns/dns.py | 32 + src/gcore/resources/dns/network_mappings.py | 1004 +++++++++++++++++ src/gcore/types/dns/__init__.py | 9 + src/gcore/types/dns/dns_mapping_entry.py | 15 + .../types/dns/dns_mapping_entry_param.py | 18 + src/gcore/types/dns/dns_network_mapping.py | 16 + .../dns/network_mapping_create_params.py | 18 + .../dns/network_mapping_create_response.py | 11 + .../dns/network_mapping_import_response.py | 11 + .../types/dns/network_mapping_list_params.py | 21 + .../dns/network_mapping_list_response.py | 14 + .../dns/network_mapping_replace_params.py | 19 + .../dns/test_network_mappings.py | 523 +++++++++ 16 files changed, 1751 insertions(+), 2 deletions(-) create mode 100644 src/gcore/resources/dns/network_mappings.py create mode 100644 src/gcore/types/dns/dns_mapping_entry.py create mode 100644 src/gcore/types/dns/dns_mapping_entry_param.py create mode 100644 src/gcore/types/dns/dns_network_mapping.py create mode 100644 src/gcore/types/dns/network_mapping_create_params.py create mode 100644 src/gcore/types/dns/network_mapping_create_response.py create mode 100644 src/gcore/types/dns/network_mapping_import_response.py create mode 100644 src/gcore/types/dns/network_mapping_list_params.py create mode 100644 src/gcore/types/dns/network_mapping_list_response.py create mode 100644 src/gcore/types/dns/network_mapping_replace_params.py create mode 100644 tests/api_resources/dns/test_network_mappings.py diff --git a/.stats.yml b/.stats.yml index 787707dd..4a6a6577 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 632 +configured_endpoints: 639 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-4b7fbbd83aa47dd18d0cfe4f58c2e0394926d5d42c6d44253ffc2e37014da93a.yml openapi_spec_hash: 7b964677a4d29ed874df07b3f14f74f6 -config_hash: b538b5efdff6ec96ee120407e226c19e +config_hash: 2c9c52a93526c053e52c10dd90c660a3 diff --git a/api.md b/api.md index 2981071e..9cdd5889 100644 --- a/api.md +++ b/api.md @@ -2116,6 +2116,30 @@ Methods: - client.dns.zones.rrsets.get_failover_logs(rrset_type, \*, zone_name, rrset_name, \*\*params) -> RrsetGetFailoverLogsResponse - client.dns.zones.rrsets.replace(rrset_type, \*, zone_name, rrset_name, \*\*params) -> DNSOutputRrset +## NetworkMappings + +Types: + +```python +from gcore.types.dns import ( + DNSMappingEntry, + DNSNetworkMapping, + NetworkMappingCreateResponse, + NetworkMappingListResponse, + NetworkMappingImportResponse, +) +``` + +Methods: + +- client.dns.network_mappings.create(\*\*params) -> NetworkMappingCreateResponse +- client.dns.network_mappings.list(\*\*params) -> NetworkMappingListResponse +- client.dns.network_mappings.delete(id) -> object +- client.dns.network_mappings.get(id) -> DNSNetworkMapping +- client.dns.network_mappings.get_by_name(name) -> DNSNetworkMapping +- client.dns.network*mappings.import*() -> NetworkMappingImportResponse +- client.dns.network_mappings.replace(path_id, \*\*params) -> object + # Storage Types: diff --git a/src/gcore/resources/dns/__init__.py b/src/gcore/resources/dns/__init__.py index 12d75f5f..878fd4ac 100644 --- a/src/gcore/resources/dns/__init__.py +++ b/src/gcore/resources/dns/__init__.py @@ -40,6 +40,14 @@ LocationsResourceWithStreamingResponse, AsyncLocationsResourceWithStreamingResponse, ) +from .network_mappings import ( + NetworkMappingsResource, + AsyncNetworkMappingsResource, + NetworkMappingsResourceWithRawResponse, + AsyncNetworkMappingsResourceWithRawResponse, + NetworkMappingsResourceWithStreamingResponse, + AsyncNetworkMappingsResourceWithStreamingResponse, +) __all__ = [ "LocationsResource", @@ -66,6 +74,12 @@ "AsyncZonesResourceWithRawResponse", "ZonesResourceWithStreamingResponse", "AsyncZonesResourceWithStreamingResponse", + "NetworkMappingsResource", + "AsyncNetworkMappingsResource", + "NetworkMappingsResourceWithRawResponse", + "AsyncNetworkMappingsResourceWithRawResponse", + "NetworkMappingsResourceWithStreamingResponse", + "AsyncNetworkMappingsResourceWithStreamingResponse", "DNSResource", "AsyncDNSResource", "DNSResourceWithRawResponse", diff --git a/src/gcore/resources/dns/dns.py b/src/gcore/resources/dns/dns.py index 099fe2fd..f942957c 100644 --- a/src/gcore/resources/dns/dns.py +++ b/src/gcore/resources/dns/dns.py @@ -50,6 +50,14 @@ PickersResourceWithStreamingResponse, AsyncPickersResourceWithStreamingResponse, ) +from .network_mappings import ( + NetworkMappingsResource, + AsyncNetworkMappingsResource, + NetworkMappingsResourceWithRawResponse, + AsyncNetworkMappingsResourceWithRawResponse, + NetworkMappingsResourceWithStreamingResponse, + AsyncNetworkMappingsResourceWithStreamingResponse, +) from ...types.dns.dns_lookup_response import DNSLookupResponse from ...types.dns.dns_get_account_overview_response import DNSGetAccountOverviewResponse @@ -73,6 +81,10 @@ def pickers(self) -> PickersResource: def zones(self) -> ZonesResource: return ZonesResource(self._client) + @cached_property + def network_mappings(self) -> NetworkMappingsResource: + return NetworkMappingsResource(self._client) + @cached_property def with_raw_response(self) -> DNSResourceWithRawResponse: """ @@ -176,6 +188,10 @@ def pickers(self) -> AsyncPickersResource: def zones(self) -> AsyncZonesResource: return AsyncZonesResource(self._client) + @cached_property + def network_mappings(self) -> AsyncNetworkMappingsResource: + return AsyncNetworkMappingsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncDNSResourceWithRawResponse: """ @@ -289,6 +305,10 @@ def pickers(self) -> PickersResourceWithRawResponse: def zones(self) -> ZonesResourceWithRawResponse: return ZonesResourceWithRawResponse(self._dns.zones) + @cached_property + def network_mappings(self) -> NetworkMappingsResourceWithRawResponse: + return NetworkMappingsResourceWithRawResponse(self._dns.network_mappings) + class AsyncDNSResourceWithRawResponse: def __init__(self, dns: AsyncDNSResource) -> None: @@ -317,6 +337,10 @@ def pickers(self) -> AsyncPickersResourceWithRawResponse: def zones(self) -> AsyncZonesResourceWithRawResponse: return AsyncZonesResourceWithRawResponse(self._dns.zones) + @cached_property + def network_mappings(self) -> AsyncNetworkMappingsResourceWithRawResponse: + return AsyncNetworkMappingsResourceWithRawResponse(self._dns.network_mappings) + class DNSResourceWithStreamingResponse: def __init__(self, dns: DNSResource) -> None: @@ -345,6 +369,10 @@ def pickers(self) -> PickersResourceWithStreamingResponse: def zones(self) -> ZonesResourceWithStreamingResponse: return ZonesResourceWithStreamingResponse(self._dns.zones) + @cached_property + def network_mappings(self) -> NetworkMappingsResourceWithStreamingResponse: + return NetworkMappingsResourceWithStreamingResponse(self._dns.network_mappings) + class AsyncDNSResourceWithStreamingResponse: def __init__(self, dns: AsyncDNSResource) -> None: @@ -372,3 +400,7 @@ def pickers(self) -> AsyncPickersResourceWithStreamingResponse: @cached_property def zones(self) -> AsyncZonesResourceWithStreamingResponse: return AsyncZonesResourceWithStreamingResponse(self._dns.zones) + + @cached_property + def network_mappings(self) -> AsyncNetworkMappingsResourceWithStreamingResponse: + return AsyncNetworkMappingsResourceWithStreamingResponse(self._dns.network_mappings) diff --git a/src/gcore/resources/dns/network_mappings.py b/src/gcore/resources/dns/network_mappings.py new file mode 100644 index 00000000..1292d320 --- /dev/null +++ b/src/gcore/resources/dns/network_mappings.py @@ -0,0 +1,1004 @@ +# 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, 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.dns import network_mapping_list_params, network_mapping_create_params, network_mapping_replace_params +from ..._base_client import make_request_options +from ...types.dns.dns_network_mapping import DNSNetworkMapping +from ...types.dns.dns_mapping_entry_param import DNSMappingEntryParam +from ...types.dns.network_mapping_list_response import NetworkMappingListResponse +from ...types.dns.network_mapping_create_response import NetworkMappingCreateResponse +from ...types.dns.network_mapping_import_response import NetworkMappingImportResponse + +__all__ = ["NetworkMappingsResource", "AsyncNetworkMappingsResource"] + + +class NetworkMappingsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> NetworkMappingsResourceWithRawResponse: + """ + 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 NetworkMappingsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> NetworkMappingsResourceWithStreamingResponse: + """ + 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 NetworkMappingsResourceWithStreamingResponse(self) + + def create( + self, + *, + id: int | Omit = omit, + mapping: Iterable[DNSMappingEntryParam] | Omit = omit, + name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> NetworkMappingCreateResponse: + """ + Create new network mapping. + + Example of request: + + ``` + curl --location --request POST 'https://api.gcore.com/dns/v2/network-mappings' \\ + --header 'Authorization: Bearer ...' \\ + --header 'Content-Type: application/json' \\ + --data-raw '{ + "name": "test", + "mapping": [ + { + "tags": [ + "tag1" + ], + "cidr4": [ + "192.0.2.0/24", + "198.0.100.0/24" + ] + }, + { + "tags": [ + "tag2", + "tag3" + ], + "cidr4": [ + "192.1.2.0/24", + "198.1.100.0/24" + ], + "cidr6": [ + "aa:10::/64" + ] + } + ] + }' + ``` + + 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( + "/dns/v2/network-mappings", + body=maybe_transform( + { + "id": id, + "mapping": mapping, + "name": name, + }, + network_mapping_create_params.NetworkMappingCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NetworkMappingCreateResponse, + ) + + def list( + self, + *, + 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, + ) -> NetworkMappingListResponse: + """ + List of network mappings. + + Example of request: + + ``` + curl --location --request GET 'https://api.gcore.com/dns/v2/network-mappings' \\ + --header 'Authorization: Bearer ...' + ``` + + Args: + limit: Max number of records in response + + offset: Amount of records to skip before beginning to write in response. + + order_by: Field name to sort by + + order_direction: Ascending or descending order + + 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( + "/dns/v2/network-mappings", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "limit": limit, + "offset": offset, + "order_by": order_by, + "order_direction": order_direction, + }, + network_mapping_list_params.NetworkMappingListParams, + ), + ), + cast_to=NetworkMappingListResponse, + ) + + 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, + ) -> object: + """ + Delete network mapping. + + Example of request: + + ``` + curl --location --request DELETE 'https://api.gcore.com/dns/v2/network-mappings/123' \\ + --header 'Authorization: Bearer ...' + ``` + + 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._delete( + f"/dns/v2/network-mappings/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + 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, + ) -> DNSNetworkMapping: + """ + Particular network mapping item info + + Example of request: + + ``` + curl --location --request GET 'https://api.gcore.com/dns/v2/network-mappings/123' \\ + --header 'Authorization: Bearer ...' + ``` + + 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"/dns/v2/network-mappings/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DNSNetworkMapping, + ) + + def get_by_name( + self, + 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, + ) -> DNSNetworkMapping: + """ + Get network mapping by name. + + Particular network mapping item info + + Example of request: + + ``` + curl --location --request GET 'https://api.gcore.com/dns/v2/network-mappings/test-mapping' \\ + --header 'Authorization: Bearer ...' + ``` + + 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 + """ + if not name: + raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") + return self._get( + f"/dns/v2/network-mappings/{name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DNSNetworkMapping, + ) + + def import_( + 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, + ) -> NetworkMappingImportResponse: + """ + Import network mapping from YAML file. + + Note: A YAML file use spaces as indentation, tabs are not allowed. Example of + input file: + + ``` + name: mapping_rule_1 + mapping: + - tags: + - tag_name_1 + cidr4: + - 127.0.2.0/24 + - tags: + - tag_name_2 + - tag_name_3 + cidr4: + - 128.0.1.0/24 + - 128.0.2.0/24 + - 128.0.3.0/24 + cidr6: + - ac:20::0/64 + --- + name: mapping_rule_2 + mapping: + - tags: + - my_network + cidr4: + - 129.0.2.0/24 + cidr6: + - ac:20::0/64 + ``` + + Example of request: + + ``` + curl --location --request POST 'https://api.gcore.com/dns/v2/network-mappings/import' \\ + --header 'Authorization: Bearer ...' \\ + --header 'Content-Type: text/plain' \\ + --data-raw 'name: mapping_rule_1 + mapping: + - tags: + - tag_name_1 + cidr4: + - 127.0.2.0/24 + - tags: + - tag_name_2 + - tag_name_3 + cidr4: + - 128.0.1.0/24 + - 128.0.2.0/24 + - 128.0.3.0/24 + cidr6: + - aa:10::/64 + --- + name: mapping_rule_2 + mapping: + - tags: + - my_network + cidr4: + - 129.0.2.0/24 + cidr6: + - ac:20::0/64' + ``` + """ + return self._post( + "/dns/v2/network-mappings/import", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NetworkMappingImportResponse, + ) + + def replace( + self, + path_id: int, + *, + body_id: int | Omit = omit, + mapping: Iterable[DNSMappingEntryParam] | Omit = omit, + name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + Update network mapping (Note: name of network mapping cannot be changed) + + Example of request: + + ``` + curl --location --request PUT 'https://api.gcore.com/dns/v2/network-mappings/123' \\ + --header 'Authorization: Bearer ...' \\ + --header 'Content-Type: application/json' \\ + --data-raw '{ + "name": "test-mapping", + "mapping": [ + { + "tags": [ + "tag1" + ], + "cidr4": [ + "192.0.2.0/24" + ] + }, + { + "tags": [ + "tag2", + "tag3" + ], + "cidr4": [ + "192.1.2.0/24" + ], + "cidr6": [ + "aa:10::/64" + ] + } + ] + }' + ``` + + 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._put( + f"/dns/v2/network-mappings/{path_id}", + body=maybe_transform( + { + "body_id": body_id, + "mapping": mapping, + "name": name, + }, + network_mapping_replace_params.NetworkMappingReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + +class AsyncNetworkMappingsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncNetworkMappingsResourceWithRawResponse: + """ + 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 AsyncNetworkMappingsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncNetworkMappingsResourceWithStreamingResponse: + """ + 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 AsyncNetworkMappingsResourceWithStreamingResponse(self) + + async def create( + self, + *, + id: int | Omit = omit, + mapping: Iterable[DNSMappingEntryParam] | Omit = omit, + name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> NetworkMappingCreateResponse: + """ + Create new network mapping. + + Example of request: + + ``` + curl --location --request POST 'https://api.gcore.com/dns/v2/network-mappings' \\ + --header 'Authorization: Bearer ...' \\ + --header 'Content-Type: application/json' \\ + --data-raw '{ + "name": "test", + "mapping": [ + { + "tags": [ + "tag1" + ], + "cidr4": [ + "192.0.2.0/24", + "198.0.100.0/24" + ] + }, + { + "tags": [ + "tag2", + "tag3" + ], + "cidr4": [ + "192.1.2.0/24", + "198.1.100.0/24" + ], + "cidr6": [ + "aa:10::/64" + ] + } + ] + }' + ``` + + 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( + "/dns/v2/network-mappings", + body=await async_maybe_transform( + { + "id": id, + "mapping": mapping, + "name": name, + }, + network_mapping_create_params.NetworkMappingCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NetworkMappingCreateResponse, + ) + + async def list( + self, + *, + 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, + ) -> NetworkMappingListResponse: + """ + List of network mappings. + + Example of request: + + ``` + curl --location --request GET 'https://api.gcore.com/dns/v2/network-mappings' \\ + --header 'Authorization: Bearer ...' + ``` + + Args: + limit: Max number of records in response + + offset: Amount of records to skip before beginning to write in response. + + order_by: Field name to sort by + + order_direction: Ascending or descending order + + 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( + "/dns/v2/network-mappings", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "limit": limit, + "offset": offset, + "order_by": order_by, + "order_direction": order_direction, + }, + network_mapping_list_params.NetworkMappingListParams, + ), + ), + cast_to=NetworkMappingListResponse, + ) + + 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, + ) -> object: + """ + Delete network mapping. + + Example of request: + + ``` + curl --location --request DELETE 'https://api.gcore.com/dns/v2/network-mappings/123' \\ + --header 'Authorization: Bearer ...' + ``` + + 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._delete( + f"/dns/v2/network-mappings/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + 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, + ) -> DNSNetworkMapping: + """ + Particular network mapping item info + + Example of request: + + ``` + curl --location --request GET 'https://api.gcore.com/dns/v2/network-mappings/123' \\ + --header 'Authorization: Bearer ...' + ``` + + 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"/dns/v2/network-mappings/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DNSNetworkMapping, + ) + + async def get_by_name( + self, + 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, + ) -> DNSNetworkMapping: + """ + Get network mapping by name. + + Particular network mapping item info + + Example of request: + + ``` + curl --location --request GET 'https://api.gcore.com/dns/v2/network-mappings/test-mapping' \\ + --header 'Authorization: Bearer ...' + ``` + + 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 + """ + if not name: + raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") + return await self._get( + f"/dns/v2/network-mappings/{name}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DNSNetworkMapping, + ) + + async def import_( + 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, + ) -> NetworkMappingImportResponse: + """ + Import network mapping from YAML file. + + Note: A YAML file use spaces as indentation, tabs are not allowed. Example of + input file: + + ``` + name: mapping_rule_1 + mapping: + - tags: + - tag_name_1 + cidr4: + - 127.0.2.0/24 + - tags: + - tag_name_2 + - tag_name_3 + cidr4: + - 128.0.1.0/24 + - 128.0.2.0/24 + - 128.0.3.0/24 + cidr6: + - ac:20::0/64 + --- + name: mapping_rule_2 + mapping: + - tags: + - my_network + cidr4: + - 129.0.2.0/24 + cidr6: + - ac:20::0/64 + ``` + + Example of request: + + ``` + curl --location --request POST 'https://api.gcore.com/dns/v2/network-mappings/import' \\ + --header 'Authorization: Bearer ...' \\ + --header 'Content-Type: text/plain' \\ + --data-raw 'name: mapping_rule_1 + mapping: + - tags: + - tag_name_1 + cidr4: + - 127.0.2.0/24 + - tags: + - tag_name_2 + - tag_name_3 + cidr4: + - 128.0.1.0/24 + - 128.0.2.0/24 + - 128.0.3.0/24 + cidr6: + - aa:10::/64 + --- + name: mapping_rule_2 + mapping: + - tags: + - my_network + cidr4: + - 129.0.2.0/24 + cidr6: + - ac:20::0/64' + ``` + """ + return await self._post( + "/dns/v2/network-mappings/import", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NetworkMappingImportResponse, + ) + + async def replace( + self, + path_id: int, + *, + body_id: int | Omit = omit, + mapping: Iterable[DNSMappingEntryParam] | Omit = omit, + name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + Update network mapping (Note: name of network mapping cannot be changed) + + Example of request: + + ``` + curl --location --request PUT 'https://api.gcore.com/dns/v2/network-mappings/123' \\ + --header 'Authorization: Bearer ...' \\ + --header 'Content-Type: application/json' \\ + --data-raw '{ + "name": "test-mapping", + "mapping": [ + { + "tags": [ + "tag1" + ], + "cidr4": [ + "192.0.2.0/24" + ] + }, + { + "tags": [ + "tag2", + "tag3" + ], + "cidr4": [ + "192.1.2.0/24" + ], + "cidr6": [ + "aa:10::/64" + ] + } + ] + }' + ``` + + 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._put( + f"/dns/v2/network-mappings/{path_id}", + body=await async_maybe_transform( + { + "body_id": body_id, + "mapping": mapping, + "name": name, + }, + network_mapping_replace_params.NetworkMappingReplaceParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=object, + ) + + +class NetworkMappingsResourceWithRawResponse: + def __init__(self, network_mappings: NetworkMappingsResource) -> None: + self._network_mappings = network_mappings + + self.create = to_raw_response_wrapper( + network_mappings.create, + ) + self.list = to_raw_response_wrapper( + network_mappings.list, + ) + self.delete = to_raw_response_wrapper( + network_mappings.delete, + ) + self.get = to_raw_response_wrapper( + network_mappings.get, + ) + self.get_by_name = to_raw_response_wrapper( + network_mappings.get_by_name, + ) + self.import_ = to_raw_response_wrapper( + network_mappings.import_, + ) + self.replace = to_raw_response_wrapper( + network_mappings.replace, + ) + + +class AsyncNetworkMappingsResourceWithRawResponse: + def __init__(self, network_mappings: AsyncNetworkMappingsResource) -> None: + self._network_mappings = network_mappings + + self.create = async_to_raw_response_wrapper( + network_mappings.create, + ) + self.list = async_to_raw_response_wrapper( + network_mappings.list, + ) + self.delete = async_to_raw_response_wrapper( + network_mappings.delete, + ) + self.get = async_to_raw_response_wrapper( + network_mappings.get, + ) + self.get_by_name = async_to_raw_response_wrapper( + network_mappings.get_by_name, + ) + self.import_ = async_to_raw_response_wrapper( + network_mappings.import_, + ) + self.replace = async_to_raw_response_wrapper( + network_mappings.replace, + ) + + +class NetworkMappingsResourceWithStreamingResponse: + def __init__(self, network_mappings: NetworkMappingsResource) -> None: + self._network_mappings = network_mappings + + self.create = to_streamed_response_wrapper( + network_mappings.create, + ) + self.list = to_streamed_response_wrapper( + network_mappings.list, + ) + self.delete = to_streamed_response_wrapper( + network_mappings.delete, + ) + self.get = to_streamed_response_wrapper( + network_mappings.get, + ) + self.get_by_name = to_streamed_response_wrapper( + network_mappings.get_by_name, + ) + self.import_ = to_streamed_response_wrapper( + network_mappings.import_, + ) + self.replace = to_streamed_response_wrapper( + network_mappings.replace, + ) + + +class AsyncNetworkMappingsResourceWithStreamingResponse: + def __init__(self, network_mappings: AsyncNetworkMappingsResource) -> None: + self._network_mappings = network_mappings + + self.create = async_to_streamed_response_wrapper( + network_mappings.create, + ) + self.list = async_to_streamed_response_wrapper( + network_mappings.list, + ) + self.delete = async_to_streamed_response_wrapper( + network_mappings.delete, + ) + self.get = async_to_streamed_response_wrapper( + network_mappings.get, + ) + self.get_by_name = async_to_streamed_response_wrapper( + network_mappings.get_by_name, + ) + self.import_ = async_to_streamed_response_wrapper( + network_mappings.import_, + ) + self.replace = async_to_streamed_response_wrapper( + network_mappings.replace, + ) diff --git a/src/gcore/types/dns/__init__.py b/src/gcore/types/dns/__init__.py index f72384a3..c42fa39f 100644 --- a/src/gcore/types/dns/__init__.py +++ b/src/gcore/types/dns/__init__.py @@ -6,12 +6,14 @@ from .dns_name_server import DNSNameServer as DNSNameServer from .zone_list_params import ZoneListParams as ZoneListParams from .dns_lookup_params import DNSLookupParams as DNSLookupParams +from .dns_mapping_entry import DNSMappingEntry as DNSMappingEntry from .zone_get_response import ZoneGetResponse as ZoneGetResponse from .metric_list_params import MetricListParams as MetricListParams from .zone_create_params import ZoneCreateParams as ZoneCreateParams from .zone_import_params import ZoneImportParams as ZoneImportParams from .zone_list_response import ZoneListResponse as ZoneListResponse from .dns_lookup_response import DNSLookupResponse as DNSLookupResponse +from .dns_network_mapping import DNSNetworkMapping as DNSNetworkMapping from .zone_replace_params import ZoneReplaceParams as ZoneReplaceParams from .metric_list_response import MetricListResponse as MetricListResponse from .picker_list_response import PickerListResponse as PickerListResponse @@ -19,10 +21,17 @@ from .zone_export_response import ZoneExportResponse as ZoneExportResponse from .zone_import_response import ZoneImportResponse as ZoneImportResponse from .location_list_response import LocationListResponse as LocationListResponse +from .dns_mapping_entry_param import DNSMappingEntryParam as DNSMappingEntryParam from .dns_location_translations import DNSLocationTranslations as DNSLocationTranslations from .zone_get_statistics_params import ZoneGetStatisticsParams as ZoneGetStatisticsParams +from .network_mapping_list_params import NetworkMappingListParams as NetworkMappingListParams from .zone_get_statistics_response import ZoneGetStatisticsResponse as ZoneGetStatisticsResponse +from .network_mapping_create_params import NetworkMappingCreateParams as NetworkMappingCreateParams +from .network_mapping_list_response import NetworkMappingListResponse as NetworkMappingListResponse from .location_list_regions_response import LocationListRegionsResponse as LocationListRegionsResponse +from .network_mapping_replace_params import NetworkMappingReplaceParams as NetworkMappingReplaceParams +from .network_mapping_create_response import NetworkMappingCreateResponse as NetworkMappingCreateResponse +from .network_mapping_import_response import NetworkMappingImportResponse as NetworkMappingImportResponse from .location_list_countries_response import LocationListCountriesResponse as LocationListCountriesResponse from .dns_get_account_overview_response import DNSGetAccountOverviewResponse as DNSGetAccountOverviewResponse from .location_list_continents_response import LocationListContinentsResponse as LocationListContinentsResponse diff --git a/src/gcore/types/dns/dns_mapping_entry.py b/src/gcore/types/dns/dns_mapping_entry.py new file mode 100644 index 00000000..8f96c644 --- /dev/null +++ b/src/gcore/types/dns/dns_mapping_entry.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__ = ["DNSMappingEntry"] + + +class DNSMappingEntry(BaseModel): + cidr4: Optional[List[object]] = None + + cidr6: Optional[List[object]] = None + + tags: Optional[List[str]] = None diff --git a/src/gcore/types/dns/dns_mapping_entry_param.py b/src/gcore/types/dns/dns_mapping_entry_param.py new file mode 100644 index 00000000..67942c37 --- /dev/null +++ b/src/gcore/types/dns/dns_mapping_entry_param.py @@ -0,0 +1,18 @@ +# 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 + +from ..._types import SequenceNotStr + +__all__ = ["DNSMappingEntryParam"] + + +class DNSMappingEntryParam(TypedDict, total=False): + cidr4: Iterable[object] + + cidr6: Iterable[object] + + tags: SequenceNotStr[str] diff --git a/src/gcore/types/dns/dns_network_mapping.py b/src/gcore/types/dns/dns_network_mapping.py new file mode 100644 index 00000000..d4daac0c --- /dev/null +++ b/src/gcore/types/dns/dns_network_mapping.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .dns_mapping_entry import DNSMappingEntry + +__all__ = ["DNSNetworkMapping"] + + +class DNSNetworkMapping(BaseModel): + id: Optional[int] = None + + mapping: Optional[List[DNSMappingEntry]] = None + + name: Optional[str] = None diff --git a/src/gcore/types/dns/network_mapping_create_params.py b/src/gcore/types/dns/network_mapping_create_params.py new file mode 100644 index 00000000..2b82ed34 --- /dev/null +++ b/src/gcore/types/dns/network_mapping_create_params.py @@ -0,0 +1,18 @@ +# 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 + +from .dns_mapping_entry_param import DNSMappingEntryParam + +__all__ = ["NetworkMappingCreateParams"] + + +class NetworkMappingCreateParams(TypedDict, total=False): + id: int + + mapping: Iterable[DNSMappingEntryParam] + + name: str diff --git a/src/gcore/types/dns/network_mapping_create_response.py b/src/gcore/types/dns/network_mapping_create_response.py new file mode 100644 index 00000000..7f2046aa --- /dev/null +++ b/src/gcore/types/dns/network_mapping_create_response.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["NetworkMappingCreateResponse"] + + +class NetworkMappingCreateResponse(BaseModel): + id: Optional[int] = None diff --git a/src/gcore/types/dns/network_mapping_import_response.py b/src/gcore/types/dns/network_mapping_import_response.py new file mode 100644 index 00000000..55e94e10 --- /dev/null +++ b/src/gcore/types/dns/network_mapping_import_response.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["NetworkMappingImportResponse"] + + +class NetworkMappingImportResponse(BaseModel): + success: Optional[bool] = None diff --git a/src/gcore/types/dns/network_mapping_list_params.py b/src/gcore/types/dns/network_mapping_list_params.py new file mode 100644 index 00000000..913e70fe --- /dev/null +++ b/src/gcore/types/dns/network_mapping_list_params.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["NetworkMappingListParams"] + + +class NetworkMappingListParams(TypedDict, total=False): + limit: int + """Max number of records in response""" + + offset: int + """Amount of records to skip before beginning to write in response.""" + + order_by: str + """Field name to sort by""" + + order_direction: Literal["asc", "desc"] + """Ascending or descending order""" diff --git a/src/gcore/types/dns/network_mapping_list_response.py b/src/gcore/types/dns/network_mapping_list_response.py new file mode 100644 index 00000000..fba55a5a --- /dev/null +++ b/src/gcore/types/dns/network_mapping_list_response.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel +from .dns_network_mapping import DNSNetworkMapping + +__all__ = ["NetworkMappingListResponse"] + + +class NetworkMappingListResponse(BaseModel): + network_mappings: Optional[List[DNSNetworkMapping]] = None + + total_amount: Optional[int] = None diff --git a/src/gcore/types/dns/network_mapping_replace_params.py b/src/gcore/types/dns/network_mapping_replace_params.py new file mode 100644 index 00000000..cb10d570 --- /dev/null +++ b/src/gcore/types/dns/network_mapping_replace_params.py @@ -0,0 +1,19 @@ +# 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 Annotated, TypedDict + +from ..._utils import PropertyInfo +from .dns_mapping_entry_param import DNSMappingEntryParam + +__all__ = ["NetworkMappingReplaceParams"] + + +class NetworkMappingReplaceParams(TypedDict, total=False): + body_id: Annotated[int, PropertyInfo(alias="id")] + + mapping: Iterable[DNSMappingEntryParam] + + name: str diff --git a/tests/api_resources/dns/test_network_mappings.py b/tests/api_resources/dns/test_network_mappings.py new file mode 100644 index 00000000..7f7e164a --- /dev/null +++ b/tests/api_resources/dns/test_network_mappings.py @@ -0,0 +1,523 @@ +# 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.dns import ( + DNSNetworkMapping, + NetworkMappingListResponse, + NetworkMappingCreateResponse, + NetworkMappingImportResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestNetworkMappings: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Gcore) -> None: + network_mapping = client.dns.network_mappings.create() + assert_matches_type(NetworkMappingCreateResponse, network_mapping, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Gcore) -> None: + network_mapping = client.dns.network_mappings.create( + id=0, + mapping=[ + { + "cidr4": [{}], + "cidr6": [{}], + "tags": ["string"], + } + ], + name="name", + ) + assert_matches_type(NetworkMappingCreateResponse, network_mapping, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Gcore) -> None: + response = client.dns.network_mappings.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_mapping = response.parse() + assert_matches_type(NetworkMappingCreateResponse, network_mapping, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Gcore) -> None: + with client.dns.network_mappings.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_mapping = response.parse() + assert_matches_type(NetworkMappingCreateResponse, network_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_list(self, client: Gcore) -> None: + network_mapping = client.dns.network_mappings.list() + assert_matches_type(NetworkMappingListResponse, network_mapping, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Gcore) -> None: + network_mapping = client.dns.network_mappings.list( + limit=0, + offset=0, + order_by="order_by", + order_direction="asc", + ) + assert_matches_type(NetworkMappingListResponse, network_mapping, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Gcore) -> None: + response = client.dns.network_mappings.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_mapping = response.parse() + assert_matches_type(NetworkMappingListResponse, network_mapping, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Gcore) -> None: + with client.dns.network_mappings.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_mapping = response.parse() + assert_matches_type(NetworkMappingListResponse, network_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Gcore) -> None: + network_mapping = client.dns.network_mappings.delete( + 0, + ) + assert_matches_type(object, network_mapping, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Gcore) -> None: + response = client.dns.network_mappings.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_mapping = response.parse() + assert_matches_type(object, network_mapping, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Gcore) -> None: + with client.dns.network_mappings.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_mapping = response.parse() + assert_matches_type(object, network_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get(self, client: Gcore) -> None: + network_mapping = client.dns.network_mappings.get( + 0, + ) + assert_matches_type(DNSNetworkMapping, network_mapping, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Gcore) -> None: + response = client.dns.network_mappings.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_mapping = response.parse() + assert_matches_type(DNSNetworkMapping, network_mapping, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Gcore) -> None: + with client.dns.network_mappings.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_mapping = response.parse() + assert_matches_type(DNSNetworkMapping, network_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_get_by_name(self, client: Gcore) -> None: + network_mapping = client.dns.network_mappings.get_by_name( + "name", + ) + assert_matches_type(DNSNetworkMapping, network_mapping, path=["response"]) + + @parametrize + def test_raw_response_get_by_name(self, client: Gcore) -> None: + response = client.dns.network_mappings.with_raw_response.get_by_name( + "name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_mapping = response.parse() + assert_matches_type(DNSNetworkMapping, network_mapping, path=["response"]) + + @parametrize + def test_streaming_response_get_by_name(self, client: Gcore) -> None: + with client.dns.network_mappings.with_streaming_response.get_by_name( + "name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_mapping = response.parse() + assert_matches_type(DNSNetworkMapping, network_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get_by_name(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + client.dns.network_mappings.with_raw_response.get_by_name( + "", + ) + + @parametrize + def test_method_import(self, client: Gcore) -> None: + network_mapping = client.dns.network_mappings.import_() + assert_matches_type(NetworkMappingImportResponse, network_mapping, path=["response"]) + + @parametrize + def test_raw_response_import(self, client: Gcore) -> None: + response = client.dns.network_mappings.with_raw_response.import_() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_mapping = response.parse() + assert_matches_type(NetworkMappingImportResponse, network_mapping, path=["response"]) + + @parametrize + def test_streaming_response_import(self, client: Gcore) -> None: + with client.dns.network_mappings.with_streaming_response.import_() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_mapping = response.parse() + assert_matches_type(NetworkMappingImportResponse, network_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_replace(self, client: Gcore) -> None: + network_mapping = client.dns.network_mappings.replace( + path_id=0, + ) + assert_matches_type(object, network_mapping, path=["response"]) + + @parametrize + def test_method_replace_with_all_params(self, client: Gcore) -> None: + network_mapping = client.dns.network_mappings.replace( + path_id=0, + body_id=0, + mapping=[ + { + "cidr4": [{}], + "cidr6": [{}], + "tags": ["string"], + } + ], + name="name", + ) + assert_matches_type(object, network_mapping, path=["response"]) + + @parametrize + def test_raw_response_replace(self, client: Gcore) -> None: + response = client.dns.network_mappings.with_raw_response.replace( + path_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_mapping = response.parse() + assert_matches_type(object, network_mapping, path=["response"]) + + @parametrize + def test_streaming_response_replace(self, client: Gcore) -> None: + with client.dns.network_mappings.with_streaming_response.replace( + path_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_mapping = response.parse() + assert_matches_type(object, network_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncNetworkMappings: + 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: + network_mapping = await async_client.dns.network_mappings.create() + assert_matches_type(NetworkMappingCreateResponse, network_mapping, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncGcore) -> None: + network_mapping = await async_client.dns.network_mappings.create( + id=0, + mapping=[ + { + "cidr4": [{}], + "cidr6": [{}], + "tags": ["string"], + } + ], + name="name", + ) + assert_matches_type(NetworkMappingCreateResponse, network_mapping, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.network_mappings.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_mapping = await response.parse() + assert_matches_type(NetworkMappingCreateResponse, network_mapping, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncGcore) -> None: + async with async_client.dns.network_mappings.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_mapping = await response.parse() + assert_matches_type(NetworkMappingCreateResponse, network_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_list(self, async_client: AsyncGcore) -> None: + network_mapping = await async_client.dns.network_mappings.list() + assert_matches_type(NetworkMappingListResponse, network_mapping, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: + network_mapping = await async_client.dns.network_mappings.list( + limit=0, + offset=0, + order_by="order_by", + order_direction="asc", + ) + assert_matches_type(NetworkMappingListResponse, network_mapping, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.network_mappings.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_mapping = await response.parse() + assert_matches_type(NetworkMappingListResponse, network_mapping, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: + async with async_client.dns.network_mappings.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_mapping = await response.parse() + assert_matches_type(NetworkMappingListResponse, network_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncGcore) -> None: + network_mapping = await async_client.dns.network_mappings.delete( + 0, + ) + assert_matches_type(object, network_mapping, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.network_mappings.with_raw_response.delete( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_mapping = await response.parse() + assert_matches_type(object, network_mapping, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncGcore) -> None: + async with async_client.dns.network_mappings.with_streaming_response.delete( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_mapping = await response.parse() + assert_matches_type(object, network_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get(self, async_client: AsyncGcore) -> None: + network_mapping = await async_client.dns.network_mappings.get( + 0, + ) + assert_matches_type(DNSNetworkMapping, network_mapping, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.network_mappings.with_raw_response.get( + 0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_mapping = await response.parse() + assert_matches_type(DNSNetworkMapping, network_mapping, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncGcore) -> None: + async with async_client.dns.network_mappings.with_streaming_response.get( + 0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_mapping = await response.parse() + assert_matches_type(DNSNetworkMapping, network_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_by_name(self, async_client: AsyncGcore) -> None: + network_mapping = await async_client.dns.network_mappings.get_by_name( + "name", + ) + assert_matches_type(DNSNetworkMapping, network_mapping, path=["response"]) + + @parametrize + async def test_raw_response_get_by_name(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.network_mappings.with_raw_response.get_by_name( + "name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_mapping = await response.parse() + assert_matches_type(DNSNetworkMapping, network_mapping, path=["response"]) + + @parametrize + async def test_streaming_response_get_by_name(self, async_client: AsyncGcore) -> None: + async with async_client.dns.network_mappings.with_streaming_response.get_by_name( + "name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_mapping = await response.parse() + assert_matches_type(DNSNetworkMapping, network_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get_by_name(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + await async_client.dns.network_mappings.with_raw_response.get_by_name( + "", + ) + + @parametrize + async def test_method_import(self, async_client: AsyncGcore) -> None: + network_mapping = await async_client.dns.network_mappings.import_() + assert_matches_type(NetworkMappingImportResponse, network_mapping, path=["response"]) + + @parametrize + async def test_raw_response_import(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.network_mappings.with_raw_response.import_() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_mapping = await response.parse() + assert_matches_type(NetworkMappingImportResponse, network_mapping, path=["response"]) + + @parametrize + async def test_streaming_response_import(self, async_client: AsyncGcore) -> None: + async with async_client.dns.network_mappings.with_streaming_response.import_() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_mapping = await response.parse() + assert_matches_type(NetworkMappingImportResponse, network_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_replace(self, async_client: AsyncGcore) -> None: + network_mapping = await async_client.dns.network_mappings.replace( + path_id=0, + ) + assert_matches_type(object, network_mapping, path=["response"]) + + @parametrize + async def test_method_replace_with_all_params(self, async_client: AsyncGcore) -> None: + network_mapping = await async_client.dns.network_mappings.replace( + path_id=0, + body_id=0, + mapping=[ + { + "cidr4": [{}], + "cidr6": [{}], + "tags": ["string"], + } + ], + name="name", + ) + assert_matches_type(object, network_mapping, path=["response"]) + + @parametrize + async def test_raw_response_replace(self, async_client: AsyncGcore) -> None: + response = await async_client.dns.network_mappings.with_raw_response.replace( + path_id=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + network_mapping = await response.parse() + assert_matches_type(object, network_mapping, path=["response"]) + + @parametrize + async def test_streaming_response_replace(self, async_client: AsyncGcore) -> None: + async with async_client.dns.network_mappings.with_streaming_response.replace( + path_id=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + network_mapping = await response.parse() + assert_matches_type(object, network_mapping, path=["response"]) + + assert cast(Any, response.is_closed) is True From 310c86dfebff83232844a7bed4b8c8094f0f38a6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 15:19:39 +0000 Subject: [PATCH 21/27] fix(cloud)!: replace PUT /cloud/v1/l7policies with PATCH --- .stats.yml | 4 +- api.md | 1 + .../load_balancers/l7_policies/l7_policies.py | 530 ++++++++++++++++- .../types/cloud/load_balancers/__init__.py | 1 + .../load_balancers/l7_policy_update_params.py | 130 +++++ .../cloud/load_balancers/test_l7_policies.py | 538 ++++++++++++++++++ 6 files changed, 1201 insertions(+), 3 deletions(-) create mode 100644 src/gcore/types/cloud/load_balancers/l7_policy_update_params.py diff --git a/.stats.yml b/.stats.yml index 4a6a6577..487418eb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 639 +configured_endpoints: 640 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-4b7fbbd83aa47dd18d0cfe4f58c2e0394926d5d42c6d44253ffc2e37014da93a.yml openapi_spec_hash: 7b964677a4d29ed874df07b3f14f74f6 -config_hash: 2c9c52a93526c053e52c10dd90c660a3 +config_hash: a32add008b466d9da19b63a5ea40626b diff --git a/api.md b/api.md index 9cdd5889..1cd1797c 100644 --- a/api.md +++ b/api.md @@ -222,6 +222,7 @@ Methods: Methods: - client.cloud.load_balancers.l7_policies.create(\*, project_id, region_id, \*\*params) -> TaskIDList +- client.cloud.load_balancers.l7_policies.update(l7policy_id, \*, project_id, region_id, \*\*params) -> TaskIDList - client.cloud.load_balancers.l7_policies.list(\*, project_id, region_id) -> LoadBalancerL7PolicyList - client.cloud.load_balancers.l7_policies.delete(l7policy_id, \*, project_id, region_id) -> TaskIDList - client.cloud.load_balancers.l7_policies.get(l7policy_id, \*, project_id, region_id) -> LoadBalancerL7Policy 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 037f3a2d..2fae78ea 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 @@ -26,7 +26,7 @@ ) from ....._base_client import make_request_options from .....types.cloud.task_id_list import TaskIDList -from .....types.cloud.load_balancers import l7_policy_create_params +from .....types.cloud.load_balancers import l7_policy_create_params, l7_policy_update_params from .....types.cloud.load_balancer_l7_policy import LoadBalancerL7Policy from .....types.cloud.load_balancer_l7_policy_list import LoadBalancerL7PolicyList @@ -316,6 +316,264 @@ def create( cast_to=TaskIDList, ) + @overload + def update( + self, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_TO_URL"], + redirect_url: str, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | 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, + ) -> TaskIDList: + """ + Updates only provided fields; omitted ones stay unchanged. + + Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + + action: Action + + redirect_url: Requests matching this policy will be redirected to this URL. Only valid if + action is `REDIRECT_TO_URL`. + + name: Human-readable name of the policy + + position: The position of this policy on the listener + + redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix + URL with the HTTP response code. Valid if action is `REDIRECT_TO_URL` or + `REDIRECT_PREFIX`. Valid options are 301, 302, 303, 307, or 308. Default is 302. + + tags: A list of simple strings assigned to the resource. + + 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, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_PREFIX"], + redirect_prefix: str, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | 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, + ) -> TaskIDList: + """ + Updates only provided fields; omitted ones stay unchanged. + + Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + + action: Action + + redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. + + name: Human-readable name of the policy + + position: The position of this policy on the listener + + redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix + URL with the HTTP response code. Valid options are 301, 302, 303, 307, or 308. + Default is 302. + + tags: A list of simple strings assigned to the resource. + + 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, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_TO_POOL"], + redirect_pool_id: str, + name: str | Omit = omit, + position: int | 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, + ) -> TaskIDList: + """ + Updates only provided fields; omitted ones stay unchanged. + + Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + + action: Action + + redirect_pool_id: Requests matching this policy will be redirected to the pool with this ID. + + name: Human-readable name of the policy + + position: The position of this policy on the listener + + tags: A list of simple strings assigned to the resource. + + 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, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REJECT"], + name: str | Omit = omit, + position: int | 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, + ) -> TaskIDList: + """ + Updates only provided fields; omitted ones stay unchanged. + + Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + + action: Action + + name: Human-readable name of the policy + + position: The position of this policy on the listener + + tags: A list of simple strings assigned to the resource. + + 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( + ["action", "redirect_url"], ["action", "redirect_prefix"], ["action", "redirect_pool_id"], ["action"] + ) + def update( + self, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_TO_URL"] + | Literal["REDIRECT_PREFIX"] + | Literal["REDIRECT_TO_POOL"] + | Literal["REJECT"], + redirect_url: str | Omit = omit, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, + redirect_prefix: str | Omit = omit, + redirect_pool_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not l7policy_id: + raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") + return self._patch( + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + body=maybe_transform( + { + "action": action, + "redirect_url": redirect_url, + "name": name, + "position": position, + "redirect_http_code": redirect_http_code, + "tags": tags, + "redirect_prefix": redirect_prefix, + "redirect_pool_id": redirect_pool_id, + }, + l7_policy_update_params.L7PolicyUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + def list( self, *, @@ -1072,6 +1330,264 @@ async def create( cast_to=TaskIDList, ) + @overload + async def update( + self, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_TO_URL"], + redirect_url: str, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | 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, + ) -> TaskIDList: + """ + Updates only provided fields; omitted ones stay unchanged. + + Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + + action: Action + + redirect_url: Requests matching this policy will be redirected to this URL. Only valid if + action is `REDIRECT_TO_URL`. + + name: Human-readable name of the policy + + position: The position of this policy on the listener + + redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix + URL with the HTTP response code. Valid if action is `REDIRECT_TO_URL` or + `REDIRECT_PREFIX`. Valid options are 301, 302, 303, 307, or 308. Default is 302. + + tags: A list of simple strings assigned to the resource. + + 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, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_PREFIX"], + redirect_prefix: str, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | 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, + ) -> TaskIDList: + """ + Updates only provided fields; omitted ones stay unchanged. + + Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + + action: Action + + redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. + + name: Human-readable name of the policy + + position: The position of this policy on the listener + + redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix + URL with the HTTP response code. Valid options are 301, 302, 303, 307, or 308. + Default is 302. + + tags: A list of simple strings assigned to the resource. + + 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, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_TO_POOL"], + redirect_pool_id: str, + name: str | Omit = omit, + position: int | 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, + ) -> TaskIDList: + """ + Updates only provided fields; omitted ones stay unchanged. + + Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + + action: Action + + redirect_pool_id: Requests matching this policy will be redirected to the pool with this ID. + + name: Human-readable name of the policy + + position: The position of this policy on the listener + + tags: A list of simple strings assigned to the resource. + + 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, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REJECT"], + name: str | Omit = omit, + position: int | 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, + ) -> TaskIDList: + """ + Updates only provided fields; omitted ones stay unchanged. + + Args: + project_id: Project ID + + region_id: Region ID + + l7policy_id: L7 policy ID + + action: Action + + name: Human-readable name of the policy + + position: The position of this policy on the listener + + tags: A list of simple strings assigned to the resource. + + 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( + ["action", "redirect_url"], ["action", "redirect_prefix"], ["action", "redirect_pool_id"], ["action"] + ) + async def update( + self, + l7policy_id: str, + *, + project_id: int | None = None, + region_id: int | None = None, + action: Literal["REDIRECT_TO_URL"] + | Literal["REDIRECT_PREFIX"] + | Literal["REDIRECT_TO_POOL"] + | Literal["REJECT"], + redirect_url: str | Omit = omit, + name: str | Omit = omit, + position: int | Omit = omit, + redirect_http_code: int | Omit = omit, + tags: SequenceNotStr[str] | Omit = omit, + redirect_prefix: str | Omit = omit, + redirect_pool_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> TaskIDList: + if project_id is None: + project_id = self._client._get_cloud_project_id_path_param() + if region_id is None: + region_id = self._client._get_cloud_region_id_path_param() + if not l7policy_id: + raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}") + return await self._patch( + f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}", + body=await async_maybe_transform( + { + "action": action, + "redirect_url": redirect_url, + "name": name, + "position": position, + "redirect_http_code": redirect_http_code, + "tags": tags, + "redirect_prefix": redirect_prefix, + "redirect_pool_id": redirect_pool_id, + }, + l7_policy_update_params.L7PolicyUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskIDList, + ) + async def list( self, *, @@ -1552,6 +2068,9 @@ def __init__(self, l7_policies: L7PoliciesResource) -> None: self.create = to_raw_response_wrapper( l7_policies.create, ) + self.update = to_raw_response_wrapper( + l7_policies.update, + ) self.list = to_raw_response_wrapper( l7_policies.list, ) @@ -1583,6 +2102,9 @@ def __init__(self, l7_policies: AsyncL7PoliciesResource) -> None: self.create = async_to_raw_response_wrapper( l7_policies.create, ) + self.update = async_to_raw_response_wrapper( + l7_policies.update, + ) self.list = async_to_raw_response_wrapper( l7_policies.list, ) @@ -1614,6 +2136,9 @@ def __init__(self, l7_policies: L7PoliciesResource) -> None: self.create = to_streamed_response_wrapper( l7_policies.create, ) + self.update = to_streamed_response_wrapper( + l7_policies.update, + ) self.list = to_streamed_response_wrapper( l7_policies.list, ) @@ -1645,6 +2170,9 @@ def __init__(self, l7_policies: AsyncL7PoliciesResource) -> None: self.create = async_to_streamed_response_wrapper( l7_policies.create, ) + self.update = async_to_streamed_response_wrapper( + l7_policies.update, + ) self.list = async_to_streamed_response_wrapper( l7_policies.list, ) diff --git a/src/gcore/types/cloud/load_balancers/__init__.py b/src/gcore/types/cloud/load_balancers/__init__.py index 7752f579..cfacdce7 100644 --- a/src/gcore/types/cloud/load_balancers/__init__.py +++ b/src/gcore/types/cloud/load_balancers/__init__.py @@ -13,3 +13,4 @@ from .listener_delete_params import ListenerDeleteParams as ListenerDeleteParams from .listener_update_params import ListenerUpdateParams as ListenerUpdateParams from .l7_policy_create_params import L7PolicyCreateParams as L7PolicyCreateParams +from .l7_policy_update_params import L7PolicyUpdateParams as L7PolicyUpdateParams diff --git a/src/gcore/types/cloud/load_balancers/l7_policy_update_params.py b/src/gcore/types/cloud/load_balancers/l7_policy_update_params.py new file mode 100644 index 00000000..f1888ed5 --- /dev/null +++ b/src/gcore/types/cloud/load_balancers/l7_policy_update_params.py @@ -0,0 +1,130 @@ +# 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 Literal, Required, TypeAlias, TypedDict + +from ...._types import SequenceNotStr + +__all__ = [ + "L7PolicyUpdateParams", + "UpdateL7PolicyRedirectToURLSerializer", + "UpdateL7PolicyRedirectPrefixSerializer", + "UpdateL7PolicyRedirectToPoolSerializer", + "UpdateL7PolicyRejectSerializer", +] + + +class UpdateL7PolicyRedirectToURLSerializer(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + action: Required[Literal["REDIRECT_TO_URL"]] + """Action""" + + redirect_url: Required[str] + """Requests matching this policy will be redirected to this URL. + + Only valid if action is `REDIRECT_TO_URL`. + """ + + name: str + """Human-readable name of the policy""" + + position: int + """The position of this policy on the listener""" + + redirect_http_code: int + """ + Requests matching this policy will be redirected to the specified URL or Prefix + URL with the HTTP response code. Valid if action is `REDIRECT_TO_URL` or + `REDIRECT_PREFIX`. Valid options are 301, 302, 303, 307, or 308. Default is 302. + """ + + tags: SequenceNotStr[str] + """A list of simple strings assigned to the resource.""" + + +class UpdateL7PolicyRedirectPrefixSerializer(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + action: Required[Literal["REDIRECT_PREFIX"]] + """Action""" + + redirect_prefix: Required[str] + """Requests matching this policy will be redirected to this Prefix URL.""" + + name: str + """Human-readable name of the policy""" + + position: int + """The position of this policy on the listener""" + + redirect_http_code: int + """ + Requests matching this policy will be redirected to the specified URL or Prefix + URL with the HTTP response code. Valid options are 301, 302, 303, 307, or 308. + Default is 302. + """ + + tags: SequenceNotStr[str] + """A list of simple strings assigned to the resource.""" + + +class UpdateL7PolicyRedirectToPoolSerializer(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + action: Required[Literal["REDIRECT_TO_POOL"]] + """Action""" + + redirect_pool_id: Required[str] + """Requests matching this policy will be redirected to the pool with this ID.""" + + name: str + """Human-readable name of the policy""" + + position: int + """The position of this policy on the listener""" + + tags: SequenceNotStr[str] + """A list of simple strings assigned to the resource.""" + + +class UpdateL7PolicyRejectSerializer(TypedDict, total=False): + project_id: int + """Project ID""" + + region_id: int + """Region ID""" + + action: Required[Literal["REJECT"]] + """Action""" + + name: str + """Human-readable name of the policy""" + + position: int + """The position of this policy on the listener""" + + tags: SequenceNotStr[str] + """A list of simple strings assigned to the resource.""" + + +L7PolicyUpdateParams: TypeAlias = Union[ + UpdateL7PolicyRedirectToURLSerializer, + UpdateL7PolicyRedirectPrefixSerializer, + UpdateL7PolicyRedirectToPoolSerializer, + UpdateL7PolicyRejectSerializer, +] diff --git a/tests/api_resources/cloud/load_balancers/test_l7_policies.py b/tests/api_resources/cloud/load_balancers/test_l7_policies.py index 585dda0a..aae51218 100644 --- a/tests/api_resources/cloud/load_balancers/test_l7_policies.py +++ b/tests/api_resources/cloud/load_balancers/test_l7_policies.py @@ -243,6 +243,275 @@ def test_streaming_response_create_overload_4(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_update_overload_1(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_TO_URL", + redirect_url="https://www.example.com", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_method_update_with_all_params_overload_1(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_TO_URL", + redirect_url="https://www.example.com", + name="redirect-example.com", + position=1, + redirect_http_code=301, + tags=["test_tag"], + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_raw_response_update_overload_1(self, client: Gcore) -> None: + response = client.cloud.load_balancers.l7_policies.with_raw_response.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_TO_URL", + redirect_url="https://www.example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + l7_policy = response.parse() + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_streaming_response_update_overload_1(self, client: Gcore) -> None: + with client.cloud.load_balancers.l7_policies.with_streaming_response.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_TO_URL", + redirect_url="https://www.example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + l7_policy = response.parse() + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update_overload_1(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): + client.cloud.load_balancers.l7_policies.with_raw_response.update( + l7policy_id="", + project_id=1, + region_id=1, + action="REDIRECT_TO_URL", + redirect_url="https://www.example.com", + ) + + @parametrize + def test_method_update_overload_2(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + redirect_prefix="/api/v1/policies", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_method_update_with_all_params_overload_2(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + redirect_prefix="/api/v1/policies", + name="redirect-example.com", + position=1, + redirect_http_code=301, + tags=["test_tag"], + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_raw_response_update_overload_2(self, client: Gcore) -> None: + response = client.cloud.load_balancers.l7_policies.with_raw_response.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + redirect_prefix="/api/v1/policies", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + l7_policy = response.parse() + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_streaming_response_update_overload_2(self, client: Gcore) -> None: + with client.cloud.load_balancers.l7_policies.with_streaming_response.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + redirect_prefix="/api/v1/policies", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + l7_policy = response.parse() + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update_overload_2(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): + client.cloud.load_balancers.l7_policies.with_raw_response.update( + l7policy_id="", + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + redirect_prefix="/api/v1/policies", + ) + + @parametrize + def test_method_update_overload_3(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + redirect_pool_id="00000000-0000-4000-8000-000000000000", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_method_update_with_all_params_overload_3(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + redirect_pool_id="00000000-0000-4000-8000-000000000000", + name="redirect-example.com", + position=1, + tags=["test_tag"], + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_raw_response_update_overload_3(self, client: Gcore) -> None: + response = client.cloud.load_balancers.l7_policies.with_raw_response.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + redirect_pool_id="00000000-0000-4000-8000-000000000000", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + l7_policy = response.parse() + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_streaming_response_update_overload_3(self, client: Gcore) -> None: + with client.cloud.load_balancers.l7_policies.with_streaming_response.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + redirect_pool_id="00000000-0000-4000-8000-000000000000", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + l7_policy = response.parse() + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update_overload_3(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): + client.cloud.load_balancers.l7_policies.with_raw_response.update( + l7policy_id="", + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + redirect_pool_id="00000000-0000-4000-8000-000000000000", + ) + + @parametrize + def test_method_update_overload_4(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REJECT", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_method_update_with_all_params_overload_4(self, client: Gcore) -> None: + l7_policy = client.cloud.load_balancers.l7_policies.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REJECT", + name="redirect-example.com", + position=1, + tags=["test_tag"], + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_raw_response_update_overload_4(self, client: Gcore) -> None: + response = client.cloud.load_balancers.l7_policies.with_raw_response.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REJECT", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + l7_policy = response.parse() + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + def test_streaming_response_update_overload_4(self, client: Gcore) -> None: + with client.cloud.load_balancers.l7_policies.with_streaming_response.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REJECT", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + l7_policy = response.parse() + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update_overload_4(self, client: Gcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): + client.cloud.load_balancers.l7_policies.with_raw_response.update( + l7policy_id="", + project_id=1, + region_id=1, + action="REJECT", + ) + @parametrize def test_method_list(self, client: Gcore) -> None: l7_policy = client.cloud.load_balancers.l7_policies.list( @@ -601,6 +870,275 @@ async def test_streaming_response_create_overload_4(self, async_client: AsyncGco assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_update_overload_1(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_TO_URL", + redirect_url="https://www.example.com", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_method_update_with_all_params_overload_1(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_TO_URL", + redirect_url="https://www.example.com", + name="redirect-example.com", + position=1, + redirect_http_code=301, + tags=["test_tag"], + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_raw_response_update_overload_1(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_TO_URL", + redirect_url="https://www.example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + l7_policy = await response.parse() + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_streaming_response_update_overload_1(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_TO_URL", + redirect_url="https://www.example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + l7_policy = await response.parse() + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update_overload_1(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): + await async_client.cloud.load_balancers.l7_policies.with_raw_response.update( + l7policy_id="", + project_id=1, + region_id=1, + action="REDIRECT_TO_URL", + redirect_url="https://www.example.com", + ) + + @parametrize + async def test_method_update_overload_2(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + redirect_prefix="/api/v1/policies", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_method_update_with_all_params_overload_2(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + redirect_prefix="/api/v1/policies", + name="redirect-example.com", + position=1, + redirect_http_code=301, + tags=["test_tag"], + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_raw_response_update_overload_2(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + redirect_prefix="/api/v1/policies", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + l7_policy = await response.parse() + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_streaming_response_update_overload_2(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + redirect_prefix="/api/v1/policies", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + l7_policy = await response.parse() + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update_overload_2(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): + await async_client.cloud.load_balancers.l7_policies.with_raw_response.update( + l7policy_id="", + project_id=1, + region_id=1, + action="REDIRECT_PREFIX", + redirect_prefix="/api/v1/policies", + ) + + @parametrize + async def test_method_update_overload_3(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + redirect_pool_id="00000000-0000-4000-8000-000000000000", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_method_update_with_all_params_overload_3(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + redirect_pool_id="00000000-0000-4000-8000-000000000000", + name="redirect-example.com", + position=1, + tags=["test_tag"], + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_raw_response_update_overload_3(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + redirect_pool_id="00000000-0000-4000-8000-000000000000", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + l7_policy = await response.parse() + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_streaming_response_update_overload_3(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + redirect_pool_id="00000000-0000-4000-8000-000000000000", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + l7_policy = await response.parse() + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update_overload_3(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): + await async_client.cloud.load_balancers.l7_policies.with_raw_response.update( + l7policy_id="", + project_id=1, + region_id=1, + action="REDIRECT_TO_POOL", + redirect_pool_id="00000000-0000-4000-8000-000000000000", + ) + + @parametrize + async def test_method_update_overload_4(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REJECT", + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_method_update_with_all_params_overload_4(self, async_client: AsyncGcore) -> None: + l7_policy = await async_client.cloud.load_balancers.l7_policies.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REJECT", + name="redirect-example.com", + position=1, + tags=["test_tag"], + ) + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_raw_response_update_overload_4(self, async_client: AsyncGcore) -> None: + response = await async_client.cloud.load_balancers.l7_policies.with_raw_response.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REJECT", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + l7_policy = await response.parse() + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + @parametrize + async def test_streaming_response_update_overload_4(self, async_client: AsyncGcore) -> None: + async with async_client.cloud.load_balancers.l7_policies.with_streaming_response.update( + l7policy_id="023f2e34-7806-443b-bfae-16c324569a3d", + project_id=1, + region_id=1, + action="REJECT", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + l7_policy = await response.parse() + assert_matches_type(TaskIDList, l7_policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update_overload_4(self, async_client: AsyncGcore) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `l7policy_id` but received ''"): + await async_client.cloud.load_balancers.l7_policies.with_raw_response.update( + l7policy_id="", + project_id=1, + region_id=1, + action="REJECT", + ) + @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: l7_policy = await async_client.cloud.load_balancers.l7_policies.list( From 27c74a20b35ddb13e360be75f9b66e470f43abc6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 18:52:38 +0000 Subject: [PATCH 22/27] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 487418eb..e62da168 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 640 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-4b7fbbd83aa47dd18d0cfe4f58c2e0394926d5d42c6d44253ffc2e37014da93a.yml openapi_spec_hash: 7b964677a4d29ed874df07b3f14f74f6 -config_hash: a32add008b466d9da19b63a5ea40626b +config_hash: ac70ccdbdb0bdc6b94d25b9d561d553f From de29040774e27e8fd6ea552d6f47ca60a1992976 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Dec 2025 12:15:26 +0000 Subject: [PATCH 23/27] fix(cloud): use PATCH /cloud/v1/projects --- .stats.yml | 2 +- api.md | 2 +- src/gcore/resources/cloud/projects.py | 67 ++++++------- .../types/cloud/project_update_params.py | 11 +-- tests/api_resources/cloud/test_projects.py | 94 ++++++++----------- tests/test_client.py | 8 +- 6 files changed, 76 insertions(+), 108 deletions(-) diff --git a/.stats.yml b/.stats.yml index e62da168..49e9ac61 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 640 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-4b7fbbd83aa47dd18d0cfe4f58c2e0394926d5d42c6d44253ffc2e37014da93a.yml openapi_spec_hash: 7b964677a4d29ed874df07b3f14f74f6 -config_hash: ac70ccdbdb0bdc6b94d25b9d561d553f +config_hash: ef6fa8ea607ea31853ae3f4ff506ac7e diff --git a/api.md b/api.md index 1cd1797c..8ae67ebb 100644 --- a/api.md +++ b/api.md @@ -67,7 +67,7 @@ from gcore.types.cloud import Project Methods: - client.cloud.projects.create(\*\*params) -> Project -- client.cloud.projects.update(\*, project_id, \*\*params) -> Project +- client.cloud.projects.update(\*, project_id, \*\*params) -> Project - client.cloud.projects.list(\*\*params) -> SyncOffsetPage[Project] - client.cloud.projects.delete(\*, project_id) -> TaskIDList - client.cloud.projects.get(\*, project_id) -> Project diff --git a/src/gcore/resources/cloud/projects.py b/src/gcore/resources/cloud/projects.py index a921b88a..721ad20b 100644 --- a/src/gcore/resources/cloud/projects.py +++ b/src/gcore/resources/cloud/projects.py @@ -2,7 +2,6 @@ from __future__ import annotations -import typing_extensions from typing import Optional from typing_extensions import Literal @@ -92,13 +91,12 @@ def create( cast_to=Project, ) - @typing_extensions.deprecated("deprecated") def update( self, *, project_id: int | None = None, - name: str, - description: Optional[str] | Omit = omit, + 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, @@ -106,18 +104,18 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: - """Update project. - - Depricated: Use PATCH /v1/projects/{project_id} instead Update - project name and description. + """ + This endpoint allows partial updates of a project (such as its name or + description). Only the fields explicitly provided in the request body will be + updated. Args: project_id: Project ID - name: Name of the entity, following a specific format. - description: Description of the project. + name: Name of the entity, following a specific format. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -128,12 +126,12 @@ def update( """ if project_id is None: project_id = self._client._get_cloud_project_id_path_param() - return self._put( + return self._patch( f"/cloud/v1/projects/{project_id}", body=maybe_transform( { - "name": name, "description": description, + "name": name, }, project_update_params.ProjectUpdateParams, ), @@ -348,13 +346,12 @@ async def create( cast_to=Project, ) - @typing_extensions.deprecated("deprecated") async def update( self, *, project_id: int | None = None, - name: str, - description: Optional[str] | Omit = omit, + 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, @@ -362,18 +359,18 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: - """Update project. - - Depricated: Use PATCH /v1/projects/{project_id} instead Update - project name and description. + """ + This endpoint allows partial updates of a project (such as its name or + description). Only the fields explicitly provided in the request body will be + updated. Args: project_id: Project ID - name: Name of the entity, following a specific format. - description: Description of the project. + name: Name of the entity, following a specific format. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -384,12 +381,12 @@ async def update( """ if project_id is None: project_id = self._client._get_cloud_project_id_path_param() - return await self._put( + return await self._patch( f"/cloud/v1/projects/{project_id}", body=await async_maybe_transform( { - "name": name, "description": description, + "name": name, }, project_update_params.ProjectUpdateParams, ), @@ -546,10 +543,8 @@ def __init__(self, projects: ProjectsResource) -> None: self.create = to_raw_response_wrapper( projects.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - projects.update, # pyright: ignore[reportDeprecated], - ) + self.update = to_raw_response_wrapper( + projects.update, ) self.list = to_raw_response_wrapper( projects.list, @@ -569,10 +564,8 @@ def __init__(self, projects: AsyncProjectsResource) -> None: self.create = async_to_raw_response_wrapper( projects.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - projects.update, # pyright: ignore[reportDeprecated], - ) + self.update = async_to_raw_response_wrapper( + projects.update, ) self.list = async_to_raw_response_wrapper( projects.list, @@ -592,10 +585,8 @@ def __init__(self, projects: ProjectsResource) -> None: self.create = to_streamed_response_wrapper( projects.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - projects.update, # pyright: ignore[reportDeprecated], - ) + self.update = to_streamed_response_wrapper( + projects.update, ) self.list = to_streamed_response_wrapper( projects.list, @@ -615,10 +606,8 @@ def __init__(self, projects: AsyncProjectsResource) -> None: self.create = async_to_streamed_response_wrapper( projects.create, ) - self.update = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - projects.update, # pyright: ignore[reportDeprecated], - ) + self.update = async_to_streamed_response_wrapper( + projects.update, ) self.list = async_to_streamed_response_wrapper( projects.list, diff --git a/src/gcore/types/cloud/project_update_params.py b/src/gcore/types/cloud/project_update_params.py index ea49bcf4..ee0861f6 100644 --- a/src/gcore/types/cloud/project_update_params.py +++ b/src/gcore/types/cloud/project_update_params.py @@ -2,8 +2,7 @@ from __future__ import annotations -from typing import Optional -from typing_extensions import Required, TypedDict +from typing_extensions import TypedDict __all__ = ["ProjectUpdateParams"] @@ -12,8 +11,8 @@ class ProjectUpdateParams(TypedDict, total=False): project_id: int """Project ID""" - name: Required[str] - """Name of the entity, following a specific format.""" - - description: Optional[str] + description: str """Description of the project.""" + + name: str + """Name of the entity, following a specific format.""" diff --git a/tests/api_resources/cloud/test_projects.py b/tests/api_resources/cloud/test_projects.py index 455053fd..3a4da5cc 100644 --- a/tests/api_resources/cloud/test_projects.py +++ b/tests/api_resources/cloud/test_projects.py @@ -12,8 +12,6 @@ from gcore.pagination import SyncOffsetPage, AsyncOffsetPage from gcore.types.cloud import Project, TaskIDList -# pyright: reportDeprecated=false - base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -61,32 +59,25 @@ def test_streaming_response_create(self, client: Gcore) -> None: @parametrize def test_method_update(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - project = client.cloud.projects.update( - project_id=4, - name="my-project", - ) - + project = client.cloud.projects.update( + project_id=4, + ) assert_matches_type(Project, project, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - project = client.cloud.projects.update( - project_id=4, - name="my-project", - description="Project description", - ) - + project = client.cloud.projects.update( + project_id=4, + description="Project description", + name="my-project", + ) assert_matches_type(Project, project, path=["response"]) @parametrize def test_raw_response_update(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - response = client.cloud.projects.with_raw_response.update( - project_id=4, - name="my-project", - ) + response = client.cloud.projects.with_raw_response.update( + project_id=4, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -95,16 +86,14 @@ def test_raw_response_update(self, client: Gcore) -> None: @parametrize def test_streaming_response_update(self, client: Gcore) -> None: - with pytest.warns(DeprecationWarning): - with client.cloud.projects.with_streaming_response.update( - project_id=4, - name="my-project", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with client.cloud.projects.with_streaming_response.update( + project_id=4, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = response.parse() - assert_matches_type(Project, project, path=["response"]) + project = response.parse() + assert_matches_type(Project, project, path=["response"]) assert cast(Any, response.is_closed) is True @@ -254,32 +243,25 @@ async def test_streaming_response_create(self, async_client: AsyncGcore) -> None @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - project = await async_client.cloud.projects.update( - project_id=4, - name="my-project", - ) - + project = await async_client.cloud.projects.update( + project_id=4, + ) assert_matches_type(Project, project, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - project = await async_client.cloud.projects.update( - project_id=4, - name="my-project", - description="Project description", - ) - + project = await async_client.cloud.projects.update( + project_id=4, + description="Project description", + name="my-project", + ) assert_matches_type(Project, project, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.cloud.projects.with_raw_response.update( - project_id=4, - name="my-project", - ) + response = await async_client.cloud.projects.with_raw_response.update( + project_id=4, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -288,16 +270,14 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.cloud.projects.with_streaming_response.update( - project_id=4, - name="my-project", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = await response.parse() - assert_matches_type(Project, project, path=["response"]) + async with async_client.cloud.projects.with_streaming_response.update( + project_id=4, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + project = await response.parse() + assert_matches_type(Project, project, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/test_client.py b/tests/test_client.py index 8f4855f7..65c6446b 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -377,11 +377,11 @@ def test_default_query_option(self) -> None: def test_cloud_project_id_client_params(self, client: Gcore) -> None: # Test with base client (no custom params) with pytest.raises(ValueError, match="Missing cloud_project_id argument;"): - client.cloud.projects.update(name="my-project") + client.cloud.projects.update() client = Gcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_project_id=0) with client as c2: - c2.cloud.projects.update(name="my-project") + c2.cloud.projects.update() def test_cloud_region_id_client_params(self, client: Gcore) -> None: # Test with base client (no custom params) @@ -1216,11 +1216,11 @@ async def test_default_query_option(self) -> None: async def test_cloud_project_id_client_params(self, async_client: AsyncGcore) -> None: # Test with base client (no custom params) with pytest.raises(ValueError, match="Missing cloud_project_id argument;"): - await async_client.cloud.projects.update(name="my-project") + await async_client.cloud.projects.update() client = AsyncGcore(base_url=base_url, api_key=api_key, _strict_response_validation=True, cloud_project_id=0) async with client as c2: - await c2.cloud.projects.update(name="my-project") + await c2.cloud.projects.update() async def test_cloud_region_id_client_params(self, async_client: AsyncGcore) -> None: # Test with base client (no custom params) From 766f5aa85a124789e11e77e5e238ef79e70289bd Mon Sep 17 00:00:00 2001 From: Danil Krox Date: Wed, 10 Dec 2025 13:16:22 +0100 Subject: [PATCH 24/27] fix(cloud)replace load balancer L7 policy replace_and_poll() with update_and_poll() --- .../load_balancers/l7_policies/l7_policies.py | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) 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 2fae78ea..22c257d4 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 @@ -897,7 +897,7 @@ def delete_and_poll( ) @overload - def replace_and_poll( + def update_and_poll( self, l7policy_id: str, *, @@ -916,11 +916,11 @@ def replace_and_poll( extra_query: Query | None = None, extra_body: Body | None = None, ) -> LoadBalancerL7Policy: - """Replace L7 policy and poll for completion.""" + """Update L7 policy and poll for completion.""" ... @overload - def replace_and_poll( + def update_and_poll( self, l7policy_id: str, *, @@ -939,11 +939,11 @@ def replace_and_poll( extra_query: Query | None = None, extra_body: Body | None = None, ) -> LoadBalancerL7Policy: - """Replace L7 policy and poll for completion.""" + """Update L7 policy and poll for completion.""" ... @overload - def replace_and_poll( + def update_and_poll( self, l7policy_id: str, *, @@ -961,11 +961,11 @@ def replace_and_poll( extra_query: Query | None = None, extra_body: Body | None = None, ) -> LoadBalancerL7Policy: - """Replace L7 policy and poll for completion.""" + """Update L7 policy and poll for completion.""" ... @overload - def replace_and_poll( + def update_and_poll( self, l7policy_id: str, *, @@ -982,13 +982,13 @@ def replace_and_poll( extra_query: Query | None = None, extra_body: Body | None = None, ) -> LoadBalancerL7Policy: - """Replace L7 policy and poll for completion.""" + """Update L7 policy and poll for completion.""" ... @required_args( ["action", "redirect_url"], ["action", "redirect_prefix"], ["action", "redirect_pool_id"], ["action"] ) - def replace_and_poll( + def update_and_poll( self, l7policy_id: str, *, @@ -1012,8 +1012,8 @@ def replace_and_poll( extra_query: Query | None = None, extra_body: Body | None = None, ) -> LoadBalancerL7Policy: - """Replace L7 policy and poll for completion.""" - response: TaskIDList = self.replace( # type: ignore + """Update L7 policy and poll for completion.""" + response: TaskIDList = self.update( # type: ignore l7policy_id=l7policy_id, project_id=project_id, region_id=region_id, @@ -1911,7 +1911,7 @@ async def delete_and_poll( ) @overload - async def replace_and_poll( + async def update_and_poll( self, l7policy_id: str, *, @@ -1930,11 +1930,11 @@ async def replace_and_poll( extra_query: Query | None = None, extra_body: Body | None = None, ) -> LoadBalancerL7Policy: - """Replace L7 policy and poll for completion.""" + """Update L7 policy and poll for completion.""" ... @overload - async def replace_and_poll( + async def update_and_poll( self, l7policy_id: str, *, @@ -1953,11 +1953,11 @@ async def replace_and_poll( extra_query: Query | None = None, extra_body: Body | None = None, ) -> LoadBalancerL7Policy: - """Replace L7 policy and poll for completion.""" + """Update L7 policy and poll for completion.""" ... @overload - async def replace_and_poll( + async def update_and_poll( self, l7policy_id: str, *, @@ -1975,11 +1975,11 @@ async def replace_and_poll( extra_query: Query | None = None, extra_body: Body | None = None, ) -> LoadBalancerL7Policy: - """Replace L7 policy and poll for completion.""" + """Update L7 policy and poll for completion.""" ... @overload - async def replace_and_poll( + async def update_and_poll( self, l7policy_id: str, *, @@ -1996,13 +1996,13 @@ async def replace_and_poll( extra_query: Query | None = None, extra_body: Body | None = None, ) -> LoadBalancerL7Policy: - """Replace L7 policy and poll for completion.""" + """Update L7 policy and poll for completion.""" ... @required_args( ["action", "redirect_url"], ["action", "redirect_prefix"], ["action", "redirect_pool_id"], ["action"] ) - async def replace_and_poll( + async def update_and_poll( self, l7policy_id: str, *, @@ -2026,8 +2026,8 @@ async def replace_and_poll( extra_query: Query | None = None, extra_body: Body | None = None, ) -> LoadBalancerL7Policy: - """Replace L7 policy and poll for completion.""" - response: TaskIDList = await self.replace( # type: ignore + """Update L7 policy and poll for completion.""" + response: TaskIDList = await self.update( # type: ignore l7policy_id=l7policy_id, project_id=project_id, region_id=region_id, @@ -2086,8 +2086,8 @@ def __init__(self, l7_policies: L7PoliciesResource) -> None: self.delete_and_poll = to_raw_response_wrapper( l7_policies.delete_and_poll, ) - self.replace_and_poll = to_raw_response_wrapper( - l7_policies.replace_and_poll, + self.update_and_poll = to_raw_response_wrapper( + l7_policies.update_and_poll, ) @cached_property @@ -2120,8 +2120,8 @@ def __init__(self, l7_policies: AsyncL7PoliciesResource) -> None: self.delete_and_poll = async_to_raw_response_wrapper( l7_policies.delete_and_poll, ) - self.replace_and_poll = async_to_raw_response_wrapper( - l7_policies.replace_and_poll, + self.update_and_poll = async_to_raw_response_wrapper( + l7_policies.update_and_poll, ) @cached_property @@ -2154,8 +2154,8 @@ def __init__(self, l7_policies: L7PoliciesResource) -> None: self.delete_and_poll = to_streamed_response_wrapper( l7_policies.delete_and_poll, ) - self.replace_and_poll = to_streamed_response_wrapper( - l7_policies.replace_and_poll, + self.update_and_poll = to_streamed_response_wrapper( + l7_policies.update_and_poll, ) @cached_property @@ -2188,8 +2188,8 @@ def __init__(self, l7_policies: AsyncL7PoliciesResource) -> None: self.delete_and_poll = async_to_streamed_response_wrapper( l7_policies.delete_and_poll, ) - self.replace_and_poll = async_to_streamed_response_wrapper( - l7_policies.replace_and_poll, + self.update_and_poll = async_to_streamed_response_wrapper( + l7_policies.update_and_poll, ) @cached_property From f2d5e272a02f8f8b9c2f9e163a5a82580fd2f4e2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Dec 2025 14:11:24 +0000 Subject: [PATCH 25/27] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 49e9ac61..78e324c5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 640 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-4b7fbbd83aa47dd18d0cfe4f58c2e0394926d5d42c6d44253ffc2e37014da93a.yml -openapi_spec_hash: 7b964677a4d29ed874df07b3f14f74f6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-4079df5b80ccb3ccbdfbfab9543db244c7e236675b3ef9fd4f9b9f21e77cbb19.yml +openapi_spec_hash: 2ab81d6ee1696810acf27cfbfd559700 config_hash: ef6fa8ea607ea31853ae3f4ff506ac7e From d25797ab245d8d9e5ea89ec1544ed49ef8587ccf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Dec 2025 14:39:58 +0000 Subject: [PATCH 26/27] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 78e324c5..1d92b3c5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 640 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-4079df5b80ccb3ccbdfbfab9543db244c7e236675b3ef9fd4f9b9f21e77cbb19.yml openapi_spec_hash: 2ab81d6ee1696810acf27cfbfd559700 -config_hash: ef6fa8ea607ea31853ae3f4ff506ac7e +config_hash: 12d04b6067da5a07e6f7f104987c0360 From 67fa8808f605f42d46750f93e776448bf57adc37 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Dec 2025 14:40:30 +0000 Subject: [PATCH 27/27] release: 0.24.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 39 +++++++++++++++++++++++++++++++++++ pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7f3f5c84..d2d60a3d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.23.0" + ".": "0.24.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 09e7067c..fb1287ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,44 @@ # Changelog +## 0.24.0 (2025-12-10) + +Full Changelog: [v0.23.0...v0.24.0](https://github.com/G-Core/gcore-python/compare/v0.23.0...v0.24.0) + +### ⚠ BREAKING CHANGES + +* **cloud:** replace PUT /cloud/v1/l7policies with PATCH +* **cdn:** streamline audit_logs naming +* **cloud:** rename load balancer pool member methods to create/delete +* streamline naming for create/replace models + +### Features + +* **api:** aggregated API specs update ([67dc79f](https://github.com/G-Core/gcore-python/commit/67dc79fea2b041b24b212a02e927ccbd243e4522)) +* **api:** aggregated API specs update ([7656563](https://github.com/G-Core/gcore-python/commit/7656563fc5dd17e35f6818812ca099251cdda258)) +* **api:** aggregated API specs update ([a1d51b8](https://github.com/G-Core/gcore-python/commit/a1d51b8ff11dc70e5f8f534cb45e87e1eba2cc14)) +* **api:** aggregated API specs update ([c5159ef](https://github.com/G-Core/gcore-python/commit/c5159efb03e551f71ed83f7efd3a9b73f5017d1d)) +* **api:** aggregated API specs update ([61299ed](https://github.com/G-Core/gcore-python/commit/61299edb52f077ab1cd4ac198b3ce59283fe779c)) +* **api:** aggregated API specs update ([b745f43](https://github.com/G-Core/gcore-python/commit/b745f43a066be1d41dd690c0e767d60e495c4a6c)) +* **dns:** enable terraform code generation for gcore_dns_network_mapping ([145f10c](https://github.com/G-Core/gcore-python/commit/145f10ce4125be5a97ec6f092e4056ff78b2f3b1)) + + +### Bug Fixes + +* **cdn:** streamline audit_logs naming ([cb075f5](https://github.com/G-Core/gcore-python/commit/cb075f51ee3bda135fbeb9eae1957ad0cda1c22a)) +* **cloud:** fix types in examples ([8b73b2a](https://github.com/G-Core/gcore-python/commit/8b73b2ae7a25cd187f5eeeb8e264c8ea6b22aaa1)) +* **cloud:** rename load balancer pool member methods to create/delete ([86346d4](https://github.com/G-Core/gcore-python/commit/86346d4fd0f464f120dd0ed6c1e7fb2b0107a625)) +* **cloud:** replace PUT /cloud/v1/l7policies with PATCH ([310c86d](https://github.com/G-Core/gcore-python/commit/310c86dfebff83232844a7bed4b8c8094f0f38a6)) +* **cloud:** use PATCH /cloud/v1/projects ([de29040](https://github.com/G-Core/gcore-python/commit/de29040774e27e8fd6ea552d6f47ca60a1992976)) +* streamline naming for create/replace models ([06e1dc3](https://github.com/G-Core/gcore-python/commit/06e1dc32499533ad16b88458164ec5a9ea385cc5)) +* **types:** allow pyright to infer TypedDict types within SequenceNotStr ([616698d](https://github.com/G-Core/gcore-python/commit/616698d4f75cd79685904b3ff5cf7a4057525332)) + + +### Chores + +* add missing docstrings ([91761cb](https://github.com/G-Core/gcore-python/commit/91761cb4af0ee9824166a9b4eb966f981547d9ec)) +* **docs:** use environment variables for authentication in code snippets ([2c2fa17](https://github.com/G-Core/gcore-python/commit/2c2fa1790799aab90409f65669bcb7f48659a7cb)) +* update lockfile ([ece4535](https://github.com/G-Core/gcore-python/commit/ece45355779bfa9a8d3c68783cd3512236f83f96)) + ## 0.23.0 (2025-12-01) Full Changelog: [v0.22.0...v0.23.0](https://github.com/G-Core/gcore-python/compare/v0.22.0...v0.23.0) diff --git a/pyproject.toml b/pyproject.toml index 2e7bb86e..f9e9af97 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.23.0" +version = "0.24.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 addbcdc6..08a76896 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.23.0" # x-release-please-version +__version__ = "0.24.0" # x-release-please-version